sqllogictest
Hex Artifact Content
Not logged in

Artifact fbbd6a8089fd0ba11c8edef48a1a3d5f889b19ea:


0000: 68 61 73 68 2d 74 68 72 65 73 68 6f 6c 64 20 38  hash-threshold 8
0010: 0d 0a 0d 0a 73 74 61 74 65 6d 65 6e 74 20 6f 6b  ....statement ok
0020: 0d 0a 43 52 45 41 54 45 20 54 41 42 4c 45 20 74  ..CREATE TABLE t
0030: 61 62 30 28 63 6f 6c 30 20 49 4e 54 45 47 45 52  ab0(col0 INTEGER
0040: 2c 20 63 6f 6c 31 20 49 4e 54 45 47 45 52 2c 20  , col1 INTEGER, 
0050: 63 6f 6c 32 20 49 4e 54 45 47 45 52 29 0d 0a 0d  col2 INTEGER)...
0060: 0a 73 74 61 74 65 6d 65 6e 74 20 6f 6b 0d 0a 43  .statement ok..C
0070: 52 45 41 54 45 20 54 41 42 4c 45 20 74 61 62 31  REATE TABLE tab1
0080: 28 63 6f 6c 30 20 49 4e 54 45 47 45 52 2c 20 63  (col0 INTEGER, c
0090: 6f 6c 31 20 49 4e 54 45 47 45 52 2c 20 63 6f 6c  ol1 INTEGER, col
00a0: 32 20 49 4e 54 45 47 45 52 29 0d 0a 0d 0a 73 74  2 INTEGER)....st
00b0: 61 74 65 6d 65 6e 74 20 6f 6b 0d 0a 43 52 45 41  atement ok..CREA
00c0: 54 45 20 54 41 42 4c 45 20 74 61 62 32 28 63 6f  TE TABLE tab2(co
00d0: 6c 30 20 49 4e 54 45 47 45 52 2c 20 63 6f 6c 31  l0 INTEGER, col1
00e0: 20 49 4e 54 45 47 45 52 2c 20 63 6f 6c 32 20 49   INTEGER, col2 I
00f0: 4e 54 45 47 45 52 29 0d 0a 0d 0a 73 74 61 74 65  NTEGER)....state
0100: 6d 65 6e 74 20 6f 6b 0d 0a 49 4e 53 45 52 54 20  ment ok..INSERT 
0110: 49 4e 54 4f 20 74 61 62 30 20 56 41 4c 55 45 53  INTO tab0 VALUES
0120: 28 38 39 2c 39 31 2c 38 32 29 0d 0a 0d 0a 73 74  (89,91,82)....st
0130: 61 74 65 6d 65 6e 74 20 6f 6b 0d 0a 49 4e 53 45  atement ok..INSE
0140: 52 54 20 49 4e 54 4f 20 74 61 62 30 20 56 41 4c  RT INTO tab0 VAL
0150: 55 45 53 28 33 35 2c 39 37 2c 31 29 0d 0a 0d 0a  UES(35,97,1)....
0160: 73 74 61 74 65 6d 65 6e 74 20 6f 6b 0d 0a 49 4e  statement ok..IN
0170: 53 45 52 54 20 49 4e 54 4f 20 74 61 62 30 20 56  SERT INTO tab0 V
0180: 41 4c 55 45 53 28 32 34 2c 38 36 2c 33 33 29 0d  ALUES(24,86,33).
0190: 0a 0d 0a 73 74 61 74 65 6d 65 6e 74 20 6f 6b 0d  ...statement ok.
01a0: 0a 49 4e 53 45 52 54 20 49 4e 54 4f 20 74 61 62  .INSERT INTO tab
01b0: 31 20 56 41 4c 55 45 53 28 36 34 2c 31 30 2c 35  1 VALUES(64,10,5
01c0: 37 29 0d 0a 0d 0a 73 74 61 74 65 6d 65 6e 74 20  7)....statement 
01d0: 6f 6b 0d 0a 49 4e 53 45 52 54 20 49 4e 54 4f 20  ok..INSERT INTO 
01e0: 74 61 62 31 20 56 41 4c 55 45 53 28 33 2c 32 36  tab1 VALUES(3,26
01f0: 2c 35 34 29 0d 0a 0d 0a 73 74 61 74 65 6d 65 6e  ,54)....statemen
0200: 74 20 6f 6b 0d 0a 49 4e 53 45 52 54 20 49 4e 54  t ok..INSERT INT
0210: 4f 20 74 61 62 31 20 56 41 4c 55 45 53 28 38 30  O tab1 VALUES(80
0220: 2c 31 33 2c 39 36 29 0d 0a 0d 0a 73 74 61 74 65  ,13,96)....state
0230: 6d 65 6e 74 20 6f 6b 0d 0a 49 4e 53 45 52 54 20  ment ok..INSERT 
0240: 49 4e 54 4f 20 74 61 62 32 20 56 41 4c 55 45 53  INTO tab2 VALUES
0250: 28 37 2c 33 31 2c 32 37 29 0d 0a 0d 0a 73 74 61  (7,31,27)....sta
0260: 74 65 6d 65 6e 74 20 6f 6b 0d 0a 49 4e 53 45 52  tement ok..INSER
0270: 54 20 49 4e 54 4f 20 74 61 62 32 20 56 41 4c 55  T INTO tab2 VALU
0280: 45 53 28 37 39 2c 31 37 2c 33 38 29 0d 0a 0d 0a  ES(79,17,38)....
0290: 73 74 61 74 65 6d 65 6e 74 20 6f 6b 0d 0a 49 4e  statement ok..IN
02a0: 53 45 52 54 20 49 4e 54 4f 20 74 61 62 32 20 56  SERT INTO tab2 V
02b0: 41 4c 55 45 53 28 37 38 2c 35 39 2c 32 36 29 0d  ALUES(78,59,26).
02c0: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
02d0: 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 72 30 2e  rt..SELECT cor0.
02e0: 63 6f 6c 31 20 2b 20 35 30 20 46 52 4f 4d 20 74  col1 + 50 FROM t
02f0: 61 62 30 2c 20 74 61 62 32 2c 20 74 61 62 32 20  ab0, tab2, tab2 
0300: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76  cor0..----..27 v
0310: 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f  alues hashing to
0320: 20 38 63 36 31 63 35 63 33 61 31 61 62 39 33 65   8c61c5c3a1ab93e
0330: 65 65 65 61 64 31 30 65 31 31 33 63 66 63 61 62  eeead10e113cfcab
0340: 65 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  e....onlyif mysq
0350: 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72  l # use DIV oper
0360: 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72  ator for integer
0370: 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79   division..query
0380: 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
0390: 2d 31 0d 0a 53 45 4c 45 43 54 20 2b 20 43 41 53  -1..SELECT + CAS
03a0: 54 28 20 63 6f 6c 30 20 41 53 20 53 49 47 4e 45  T( col0 AS SIGNE
03b0: 44 20 29 20 44 49 56 20 2d 20 63 6f 6c 32 20 2b  D ) DIV - col2 +
03c0: 20 28 20 2d 20 63 6f 6c 31 20 29 20 2d 20 2b 20   ( - col1 ) - + 
03d0: 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52 4f  col1 AS col0 FRO
03e0: 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
03f0: 2d 2d 2d 2d 0d 0a 2d 32 31 0d 0a 2d 32 36 0d 0a  ----..-21..-26..
0400: 2d 35 32 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  -52....skipif my
0410: 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
0420: 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
0430: 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 0d 0a 53  wsort label-1..S
0440: 45 4c 45 43 54 20 2b 20 43 41 53 54 20 28 20 63  ELECT + CAST ( c
0450: 6f 6c 30 20 41 53 20 49 4e 54 45 47 45 52 20 29  ol0 AS INTEGER )
0460: 20 2f 20 2d 20 63 6f 6c 32 20 2b 20 28 20 2d 20   / - col2 + ( - 
0470: 63 6f 6c 31 20 29 20 2d 20 2b 20 63 6f 6c 31 20  col1 ) - + col1 
0480: 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
0490: 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
04a0: 0a 2d 32 31 0d 0a 2d 32 36 0d 0a 2d 35 32 0d 0a  .-21..-26..-52..
04b0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
04c0: 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
04d0: 43 54 20 2d 20 63 6f 6c 31 20 2b 20 2d 20 74 61  CT - col1 + - ta
04e0: 62 32 2e 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c 32  b2.col2 * + col2
04f0: 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d   FROM tab2..----
0500: 0d 0a 2d 31 34 36 31 0d 0a 2d 37 33 35 0d 0a 2d  ..-1461..-735..-
0510: 37 36 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  760....query I r
0520: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
0530: 20 37 32 20 2a 20 2b 20 74 61 62 31 2e 63 6f 6c   72 * + tab1.col
0540: 31 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d  1 FROM tab1..---
0550: 2d 0d 0a 31 38 37 32 0d 0a 37 32 30 0d 0a 39 33  -..1872..720..93
0560: 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  6....query I row
0570: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2b  sort..SELECT + +
0580: 20 38 39 20 2a 20 2b 20 63 6f 6c 31 20 2b 20 63   89 * + col1 + c
0590: 6f 6c 31 20 2d 20 37 38 20 2a 20 63 6f 6c 32 20  ol1 - 78 * col2 
05a0: 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
05b0: 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 38 37 32 0d 0a  0..----..-1872..
05c0: 2d 33 35 34 36 0d 0a 2d 36 33 31 38 0d 0a 0d 0a  -3546..-6318....
05d0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
05e0: 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
05f0: 20 2b 20 28 20 28 20 2d 20 63 6f 6c 30 20 29 20   + ( ( - col0 ) 
0600: 29 20 2b 20 33 38 20 2a 20 33 37 20 2a 20 63 6f  ) + 38 * 37 * co
0610: 6c 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d  l1 FROM tab0..--
0620: 2d 2d 0d 0a 31 32 30 38 39 32 0d 0a 31 32 37 38  --..120892..1278
0630: 35 37 0d 0a 31 33 36 33 34 37 0d 0a 0d 0a 71 75  57..136347....qu
0640: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
0650: 45 4c 45 43 54 20 2d 20 36 35 20 2b 20 63 6f 6c  ELECT - 65 + col
0660: 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  2 FROM tab0 AS c
0670: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 32 0d 0a  or0..----..-32..
0680: 2d 36 34 0d 0a 31 37 0d 0a 0d 0a 71 75 65 72 79  -64..17....query
0690: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
06a0: 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 35 38  CT DISTINCT + 58
06b0: 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
06c0: 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
06d0: 0d 0a 35 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..58....query I 
06e0: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
06f0: 44 49 53 54 49 4e 43 54 20 35 30 20 2b 20 2d 20  DISTINCT 50 + - 
0700: 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41  col2 FROM tab2 A
0710: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32  S cor0..----..12
0720: 0d 0a 32 33 0d 0a 32 34 0d 0a 0d 0a 71 75 65 72  ..23..24....quer
0730: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
0740: 45 43 54 20 41 4c 4c 20 35 33 20 2a 20 2d 20 63  ECT ALL 53 * - c
0750: 6f 6c 32 20 2a 20 39 33 20 41 53 20 63 6f 6c 32  ol2 * 93 AS col2
0760: 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
0770: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 36 32 36 35  r0..----..-16265
0780: 37 0d 0a 2d 34 30 34 31 37 38 0d 0a 2d 34 39 32  7..-404178..-492
0790: 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  9....query I row
07a0: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 33 34 20  sort..SELECT 34 
07b0: 2a 20 2d 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61  * - col2 FROM ta
07c0: 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  b2 cor0..----..-
07d0: 31 32 39 32 0d 0a 2d 38 38 34 0d 0a 2d 39 31 38  1292..-884..-918
07e0: 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
07f0: 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d   # support for M
0800: 79 53 51 4c 20 73 70 65 63 69 66 69 63 20 73 79  ySQL specific sy
0810: 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73  stem types and s
0820: 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72  yntax..query I r
0830: 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 31 0d  owsort label-11.
0840: 0a 53 45 4c 45 43 54 20 2d 20 63 6f 72 30 2e 63  .SELECT - cor0.c
0850: 6f 6c 30 20 2a 20 2b 20 63 6f 6c 30 20 2b 20 43  ol0 * + col0 + C
0860: 41 53 54 28 20 4e 55 4c 4c 20 41 53 20 44 45 43  AST( NULL AS DEC
0870: 49 4d 41 4c 20 29 20 2a 20 63 6f 6c 30 20 2a 20  IMAL ) * col0 * 
0880: 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46  + col0 AS col0 F
0890: 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
08a0: 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55  ..----..NULL..NU
08b0: 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70  LL..NULL....skip
08c0: 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
08d0: 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
08e0: 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
08f0: 2d 31 31 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f  -11..SELECT - co
0900: 72 30 2e 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c 30  r0.col0 * + col0
0910: 20 2b 20 43 41 53 54 20 28 20 4e 55 4c 4c 20 41   + CAST ( NULL A
0920: 53 20 52 45 41 4c 20 29 20 2a 20 63 6f 6c 30 20  S REAL ) * col0 
0930: 2a 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30  * + col0 AS col0
0940: 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
0950: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a  r0..----..NULL..
0960: 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 6f 6e  NULL..NULL....on
0970: 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
0980: 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
0990: 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
09a0: 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
09b0: 6f 72 74 20 6c 61 62 65 6c 2d 31 32 0d 0a 53 45  ort label-12..SE
09c0: 4c 45 43 54 20 2d 20 63 6f 6c 31 20 2a 20 2b 20  LECT - col1 * + 
09d0: 63 6f 6c 32 20 2b 20 2d 20 63 6f 6c 31 20 44 49  col2 + - col1 DI
09e0: 56 20 38 30 20 41 53 20 63 6f 6c 32 20 46 52 4f  V 80 AS col2 FRO
09f0: 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
0a00: 2d 2d 2d 2d 0d 0a 2d 32 38 33 39 0d 0a 2d 37 34  ----..-2839..-74
0a10: 36 33 0d 0a 2d 39 38 0d 0a 0d 0a 73 6b 69 70 69  63..-98....skipi
0a20: 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
0a30: 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
0a40: 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
0a50: 31 32 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c  12..SELECT - col
0a60: 31 20 2a 20 2b 20 63 6f 6c 32 20 2b 20 2d 20 63  1 * + col2 + - c
0a70: 6f 6c 31 20 2f 20 38 30 20 41 53 20 63 6f 6c 32  ol1 / 80 AS col2
0a80: 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
0a90: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 38 33 39 0d  r0..----..-2839.
0aa0: 0a 2d 37 34 36 33 0d 0a 2d 39 38 0d 0a 0d 0a 71  .-7463..-98....q
0ab0: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
0ac0: 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
0ad0: 2b 20 63 6f 6c 32 20 2d 20 2d 20 63 6f 6c 30 20  + col2 - - col0 
0ae0: 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
0af0: 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 34 0d 0a 31 31  0..----..104..11
0b00: 37 0d 0a 33 34 0d 0a 0d 0a 73 6b 69 70 69 66 20  7..34....skipif 
0b10: 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73  postgresql # Pos
0b20: 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73  tgreSQL requires
0b30: 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e   AS when renamin
0b40: 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73  g output columns
0b50: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
0b60: 74 0d 0a 53 45 4c 45 43 54 20 39 31 20 2a 20 2b  t..SELECT 91 * +
0b70: 20 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c 30 20 63   col0 + - col0 c
0b80: 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol0 FROM tab1 AS
0b90: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 37 30   cor0..----..270
0ba0: 0d 0a 35 37 36 30 0d 0a 37 32 30 30 0d 0a 0d 0a  ..5760..7200....
0bb0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
0bc0: 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 2b 20  .SELECT ALL - + 
0bd0: 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c 30 20 2a 20  col0 + + col0 * 
0be0: 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46  + col0 AS col2 F
0bf0: 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
0c00: 0d 0a 2d 2d 2d 2d 0d 0a 34 30 33 32 0d 0a 36 0d  ..----..4032..6.
0c10: 0a 36 33 32 30 0d 0a 0d 0a 71 75 65 72 79 20 49  .6320....query I
0c20: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
0c30: 20 2b 20 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c 32   + col0 * + col2
0c40: 20 2a 20 2b 20 63 6f 6c 32 20 2b 20 2b 20 63 6f   * + col2 + + co
0c50: 6c 32 20 2a 20 63 6f 6c 32 20 2b 20 63 6f 6c 30  l2 * col2 + col0
0c60: 20 2a 20 2b 20 39 31 20 41 53 20 63 6f 6c 30 20   * + 91 AS col0 
0c70: 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
0c80: 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 32 37 30 39 0d  0..----..122709.
0c90: 0a 36 30 35 30 32 0d 0a 36 34 36 39 0d 0a 0d 0a  .60502..6469....
0ca0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
0cb0: 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 2d 20  .SELECT ALL - - 
0cc0: 39 31 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  91 AS col1 FROM 
0cd0: 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
0ce0: 2d 2d 0d 0a 39 31 0d 0a 39 31 0d 0a 39 31 0d 0a  --..91..91..91..
0cf0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
0d00: 74 0d 0a 53 45 4c 45 43 54 20 2d 20 37 37 20 2b  t..SELECT - 77 +
0d10: 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20   col2 FROM tab1 
0d20: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
0d30: 32 30 0d 0a 2d 32 33 0d 0a 31 39 0d 0a 0d 0a 71  20..-23..19....q
0d40: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
0d50: 53 45 4c 45 43 54 20 28 20 2b 20 63 6f 6c 31 20  SELECT ( + col1 
0d60: 2b 20 2b 20 63 6f 6c 31 20 29 20 2a 20 2d 20 74  + + col1 ) * - t
0d70: 61 62 31 2e 63 6f 6c 32 20 41 53 20 63 6f 6c 32  ab1.col2 AS col2
0d80: 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d   FROM tab1..----
0d90: 0d 0a 2d 31 31 34 30 0d 0a 2d 32 34 39 36 0d 0a  ..-1140..-2496..
0da0: 2d 32 38 30 38 0d 0a 0d 0a 73 6b 69 70 69 66 20  -2808....skipif 
0db0: 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73  postgresql # Pos
0dc0: 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73  tgreSQL requires
0dd0: 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e   AS when renamin
0de0: 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73  g output columns
0df0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
0e00: 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 72 30  t..SELECT + cor0
0e10: 2e 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c 31 20 2a  .col1 * + col1 *
0e20: 20 2d 20 63 6f 6c 31 20 63 6f 6c 31 20 46 52 4f   - col1 col1 FRO
0e30: 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
0e40: 2d 2d 2d 2d 0d 0a 2d 31 30 30 30 0d 0a 2d 31 37  ----..-1000..-17
0e50: 35 37 36 0d 0a 2d 32 31 39 37 0d 0a 0d 0a 71 75  576..-2197....qu
0e60: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
0e70: 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b  ELECT DISTINCT +
0e80: 20 2b 20 63 6f 6c 31 20 2b 20 63 6f 6c 30 20 2a   + col1 + col0 *
0e90: 20 2b 20 33 20 46 52 4f 4d 20 74 61 62 32 20 41   + 3 FROM tab2 A
0ea0: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 35  S cor0..----..25
0eb0: 34 0d 0a 32 39 33 0d 0a 35 32 0d 0a 0d 0a 71 75  4..293..52....qu
0ec0: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
0ed0: 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d  ELECT DISTINCT -
0ee0: 20 2b 20 39 30 20 2a 20 63 6f 6c 30 20 46 52 4f   + 90 * col0 FRO
0ef0: 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
0f00: 2d 2d 2d 2d 0d 0a 2d 32 37 30 0d 0a 2d 35 37 36  ----..-270..-576
0f10: 30 0d 0a 2d 37 32 30 30 0d 0a 0d 0a 71 75 65 72  0..-7200....quer
0f20: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
0f30: 45 43 54 20 2d 20 63 6f 6c 30 20 2a 20 2d 20 63  ECT - col0 * - c
0f40: 6f 6c 31 20 2b 20 2d 20 37 37 20 41 53 20 63 6f  ol1 + - 77 AS co
0f50: 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l1 FROM tab1 AS 
0f60: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 0d 0a 35  cor0..----..1..5
0f70: 36 33 0d 0a 39 36 33 0d 0a 0d 0a 6f 6e 6c 79 69  63..963....onlyi
0f80: 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49  f mysql # use DI
0f90: 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69  V operator for i
0fa0: 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d  nteger division.
0fb0: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
0fc0: 20 6c 61 62 65 6c 2d 32 34 0d 0a 53 45 4c 45 43   label-24..SELEC
0fd0: 54 20 2d 20 2b 20 63 6f 6c 32 20 2a 20 63 6f 6c  T - + col2 * col
0fe0: 31 20 44 49 56 20 28 20 2b 20 63 6f 6c 32 20 2a  1 DIV ( + col2 *
0ff0: 20 2b 20 63 6f 6c 31 20 29 20 41 53 20 63 6f 6c   + col1 ) AS col
1000: 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  0 FROM tab1 AS c
1010: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 2d  or0..----..-1..-
1020: 31 0d 0a 2d 31 0d 0a 0d 0a 73 6b 69 70 69 66 20  1..-1....skipif 
1030: 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
1040: 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
1050: 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 32 34  rowsort label-24
1060: 0d 0a 53 45 4c 45 43 54 20 2d 20 2b 20 63 6f 6c  ..SELECT - + col
1070: 32 20 2a 20 63 6f 6c 31 20 2f 20 28 20 2b 20 63  2 * col1 / ( + c
1080: 6f 6c 32 20 2a 20 2b 20 63 6f 6c 31 20 29 20 41  ol2 * + col1 ) A
1090: 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31  S col0 FROM tab1
10a0: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
10b0: 2d 31 0d 0a 2d 31 0d 0a 2d 31 0d 0a 0d 0a 71 75  -1..-1..-1....qu
10c0: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
10d0: 45 4c 45 43 54 20 2d 20 32 36 20 2a 20 63 6f 6c  ELECT - 26 * col
10e0: 32 20 2b 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61  2 + col2 FROM ta
10f0: 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
1100: 0d 0a 2d 32 30 35 30 0d 0a 2d 32 35 0d 0a 2d 38  ..-2050..-25..-8
1110: 32 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  25....query I ro
1120: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
1130: 4c 20 2d 20 63 6f 72 30 2e 63 6f 6c 30 20 2a 20  L - cor0.col0 * 
1140: 2d 20 33 39 20 41 53 20 63 6f 6c 30 20 46 52 4f  - 39 AS col0 FRO
1150: 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab1 cor0..---
1160: 2d 0d 0a 31 31 37 0d 0a 32 34 39 36 0d 0a 33 31  -..117..2496..31
1170: 32 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  20....query I ro
1180: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
1190: 4c 20 63 6f 72 30 2e 63 6f 6c 30 20 2b 20 39 31  L cor0.col0 + 91
11a0: 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
11b0: 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
11c0: 0d 0a 31 31 35 0d 0a 31 32 36 0d 0a 31 38 30 0d  ..115..126..180.
11d0: 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72  ...skipif postgr
11e0: 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51  esql # PostgreSQ
11f0: 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68  L requires AS wh
1200: 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70  en renaming outp
1210: 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72  ut columns..quer
1220: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
1230: 45 43 54 20 41 4c 4c 20 2d 20 28 20 2d 20 31 31  ECT ALL - ( - 11
1240: 20 29 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62   ) col1 FROM tab
1250: 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31  0 cor0..----..11
1260: 0d 0a 31 31 0d 0a 31 31 0d 0a 0d 0a 73 6b 69 70  ..11..11....skip
1270: 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20  if postgresql # 
1280: 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69  PostgreSQL requi
1290: 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61  res AS when rena
12a0: 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75  ming output colu
12b0: 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  mns..query I row
12c0: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
12d0: 20 37 38 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   78 col2 FROM ta
12e0: 62 31 0d 0a 2d 2d 2d 2d 0d 0a 37 38 0d 0a 37 38  b1..----..78..78
12f0: 0d 0a 37 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..78....query I 
1300: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
1310: 44 49 53 54 49 4e 43 54 20 63 6f 6c 31 20 2a 20  DISTINCT col1 * 
1320: 63 6f 6c 31 20 2a 20 63 6f 6c 30 20 46 52 4f 4d  col1 * col0 FROM
1330: 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
1340: 2d 2d 2d 0d 0a 31 37 37 35 30 34 0d 0a 33 32 39  ---..177504..329
1350: 33 31 35 0d 0a 37 33 37 30 30 39 0d 0a 0d 0a 71  315..737009....q
1360: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
1370: 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
1380: 2b 20 28 20 36 36 20 29 20 46 52 4f 4d 20 74 61  + ( 66 ) FROM ta
1390: 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
13a0: 0d 0a 36 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..66....query I 
13b0: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
13c0: 2d 20 2d 20 63 6f 6c 32 20 2a 20 2b 20 32 39 20  - - col2 * + 29 
13d0: 2b 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32  + col2 FROM tab2
13e0: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 34   cor0..----..114
13f0: 30 0d 0a 37 38 30 0d 0a 38 31 30 0d 0a 0d 0a 6f  0..780..810....o
1400: 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73  nlyif mysql # us
1410: 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66  e DIV operator f
1420: 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73  or integer divis
1430: 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ion..query I row
1440: 73 6f 72 74 20 6c 61 62 65 6c 2d 33 33 0d 0a 53  sort label-33..S
1450: 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 30  ELECT ALL + col0
1460: 20 44 49 56 20 63 6f 6c 32 20 46 52 4f 4d 20 74   DIV col2 FROM t
1470: 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 31 0d  ab0..----..0..1.
1480: 0a 33 35 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  .35....skipif my
1490: 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
14a0: 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
14b0: 77 73 6f 72 74 20 6c 61 62 65 6c 2d 33 33 0d 0a  wsort label-33..
14c0: 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c  SELECT ALL + col
14d0: 30 20 2f 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61  0 / col2 FROM ta
14e0: 62 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 31 0d 0a  b0..----..0..1..
14f0: 33 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  35....query I ro
1500: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
1510: 4c 20 34 39 20 41 53 20 63 6f 6c 31 20 46 52 4f  L 49 AS col1 FRO
1520: 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 34 39  M tab1..----..49
1530: 0d 0a 34 39 0d 0a 34 39 0d 0a 0d 0a 71 75 65 72  ..49..49....quer
1540: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
1550: 45 43 54 20 41 4c 4c 20 38 34 20 2a 20 2d 20 63  ECT ALL 84 * - c
1560: 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  ol2 AS col0 FROM
1570: 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 35   tab1..----..-45
1580: 33 36 0d 0a 2d 34 37 38 38 0d 0a 2d 38 30 36 34  36..-4788..-8064
1590: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
15a0: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 39 38  ort..SELECT - 98
15b0: 20 46 52 4f 4d 20 74 61 62 30 2c 20 74 61 62 32   FROM tab0, tab2
15c0: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
15d0: 39 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67  9 values hashing
15e0: 20 74 6f 20 66 31 37 62 37 30 30 38 61 37 64 65   to f17b7008a7de
15f0: 61 65 31 65 62 35 61 32 65 37 30 37 65 63 32 33  ae1eb5a2e707ec23
1600: 37 36 33 38 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  7638....onlyif m
1610: 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f  ysql # use DIV o
1620: 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65  perator for inte
1630: 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75  ger division..qu
1640: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
1650: 62 65 6c 2d 33 37 0d 0a 53 45 4c 45 43 54 20 63  bel-37..SELECT c
1660: 6f 6c 30 20 2b 20 2b 20 63 6f 72 30 2e 63 6f 6c  ol0 + + cor0.col
1670: 31 20 44 49 56 20 2b 20 63 6f 72 30 2e 63 6f 6c  1 DIV + cor0.col
1680: 31 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30  1 col2 FROM tab0
1690: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
16a0: 32 35 0d 0a 33 36 0d 0a 39 30 0d 0a 0d 0a 73 6b  25..36..90....sk
16b0: 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20  ipif postgresql 
16c0: 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71  # PostgreSQL req
16d0: 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65  uires AS when re
16e0: 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f  naming output co
16f0: 6c 75 6d 6e 73 0d 0a 73 6b 69 70 69 66 20 6d 79  lumns..skipif my
1700: 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
1710: 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
1720: 77 73 6f 72 74 20 6c 61 62 65 6c 2d 33 37 0d 0a  wsort label-37..
1730: 53 45 4c 45 43 54 20 63 6f 6c 30 20 2b 20 2b 20  SELECT col0 + + 
1740: 63 6f 72 30 2e 63 6f 6c 31 20 2f 20 2b 20 63 6f  cor0.col1 / + co
1750: 72 30 2e 63 6f 6c 31 20 63 6f 6c 32 20 46 52 4f  r0.col1 col2 FRO
1760: 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
1770: 2d 2d 2d 2d 0d 0a 32 35 0d 0a 33 36 0d 0a 39 30  ----..25..36..90
1780: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
1790: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
17a0: 2b 20 39 33 20 41 53 20 63 6f 6c 31 20 46 52 4f  + 93 AS col1 FRO
17b0: 4d 20 74 61 62 32 2c 20 74 61 62 31 20 41 53 20  M tab2, tab1 AS 
17c0: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61  cor0..----..9 va
17d0: 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20  lues hashing to 
17e0: 65 36 34 31 30 35 64 66 61 61 39 66 62 64 32 30  e64105dfaa9fbd20
17f0: 31 61 64 62 62 31 66 33 66 36 39 36 38 62 64 65  1adbb1f3f6968bde
1800: 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
1810: 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
1820: 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
1830: 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 43 41 53  rt..SELECT + CAS
1840: 54 20 28 20 2b 20 63 6f 6c 30 20 2b 20 2d 20 63  T ( + col0 + - c
1850: 6f 6c 31 20 41 53 20 52 45 41 4c 20 29 20 46 52  ol1 AS REAL ) FR
1860: 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d  OM tab2..----..-
1870: 32 34 0d 0a 31 39 0d 0a 36 32 0d 0a 0d 0a 71 75  24..19..62....qu
1880: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
1890: 45 4c 45 43 54 20 31 35 20 2a 20 63 6f 6c 30 20  ELECT 15 * col0 
18a0: 2a 20 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46  * col1 AS col1 F
18b0: 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab0..----..
18c0: 31 32 31 34 38 35 0d 0a 33 30 39 36 30 0d 0a 35  121485..30960..5
18d0: 30 39 32 35 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  0925....onlyif m
18e0: 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66  ysql # support f
18f0: 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69  or MySQL specifi
1900: 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61  c system types a
1910: 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79  nd syntax..query
1920: 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
1930: 2d 34 31 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f  -41..SELECT - co
1940: 6c 31 20 2d 20 43 41 53 54 28 20 2d 20 35 33 20  l1 - CAST( - 53 
1950: 41 53 20 53 49 47 4e 45 44 20 29 20 46 52 4f 4d  AS SIGNED ) FROM
1960: 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
1970: 2d 2d 2d 0d 0a 2d 36 0d 0a 32 32 0d 0a 33 36 0d  ---..-6..22..36.
1980: 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
1990: 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
19a0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
19b0: 74 20 6c 61 62 65 6c 2d 34 31 0d 0a 53 45 4c 45  t label-41..SELE
19c0: 43 54 20 2d 20 63 6f 6c 31 20 2d 20 43 41 53 54  CT - col1 - CAST
19d0: 20 28 20 2d 20 35 33 20 41 53 20 49 4e 54 45 47   ( - 53 AS INTEG
19e0: 45 52 20 29 20 46 52 4f 4d 20 74 61 62 32 20 41  ER ) FROM tab2 A
19f0: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 36  S cor0..----..-6
1a00: 0d 0a 32 32 0d 0a 33 36 0d 0a 0d 0a 71 75 65 72  ..22..36....quer
1a10: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
1a20: 45 43 54 20 28 20 2b 20 63 6f 6c 30 20 29 20 2a  ECT ( + col0 ) *
1a30: 20 2d 20 74 61 62 32 2e 63 6f 6c 32 20 2b 20 37   - tab2.col2 + 7
1a40: 35 20 2a 20 74 61 62 32 2e 63 6f 6c 31 20 2d 20  5 * tab2.col1 - 
1a50: 28 20 2b 20 63 6f 6c 32 20 29 20 2a 20 2b 20 74  ( + col2 ) * + t
1a60: 61 62 32 2e 63 6f 6c 30 20 46 52 4f 4d 20 74 61  ab2.col0 FROM ta
1a70: 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 37 32 39 0d  b2..----..-4729.
1a80: 0a 31 39 34 37 0d 0a 33 36 39 0d 0a 0d 0a 71 75  .1947..369....qu
1a90: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
1aa0: 45 4c 45 43 54 20 63 6f 6c 30 20 2a 20 63 6f 6c  ELECT col0 * col
1ab0: 31 20 2a 20 74 61 62 31 2e 63 6f 6c 32 20 41 53  1 * tab1.col2 AS
1ac0: 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 0d   col1 FROM tab1.
1ad0: 0a 2d 2d 2d 2d 0d 0a 33 36 34 38 30 0d 0a 34 32  .----..36480..42
1ae0: 31 32 0d 0a 39 39 38 34 30 0d 0a 0d 0a 73 6b 69  12..99840....ski
1af0: 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23  pif postgresql #
1b00: 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75   PostgreSQL requ
1b10: 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e  ires AS when ren
1b20: 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c  aming output col
1b30: 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f  umns..query I ro
1b40: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
1b50: 4c 20 63 6f 6c 30 20 2b 20 63 6f 6c 30 20 63 6f  L col0 + col0 co
1b60: 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l1 FROM tab1 AS 
1b70: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 38 0d  cor0..----..128.
1b80: 0a 31 36 30 0d 0a 36 0d 0a 0d 0a 6f 6e 6c 79 69  .160..6....onlyi
1b90: 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72  f mysql # suppor
1ba0: 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63  t for MySQL spec
1bb0: 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65  ific system type
1bc0: 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75  s and syntax..qu
1bd0: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
1be0: 62 65 6c 2d 34 35 0d 0a 53 45 4c 45 43 54 20 41  bel-45..SELECT A
1bf0: 4c 4c 20 2d 20 2b 20 63 6f 72 30 2e 63 6f 6c 30  LL - + cor0.col0
1c00: 20 2b 20 43 41 53 54 28 20 63 6f 6c 31 20 41 53   + CAST( col1 AS
1c10: 20 53 49 47 4e 45 44 20 29 20 46 52 4f 4d 20 74   SIGNED ) FROM t
1c20: 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
1c30: 2d 0d 0a 32 0d 0a 36 32 0d 0a 36 32 0d 0a 0d 0a  -..2..62..62....
1c40: 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
1c50: 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
1c60: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
1c70: 61 62 65 6c 2d 34 35 0d 0a 53 45 4c 45 43 54 20  abel-45..SELECT 
1c80: 41 4c 4c 20 2d 20 2b 20 63 6f 72 30 2e 63 6f 6c  ALL - + cor0.col
1c90: 30 20 2b 20 43 41 53 54 20 28 20 63 6f 6c 31 20  0 + CAST ( col1 
1ca0: 41 53 20 49 4e 54 45 47 45 52 20 29 20 46 52 4f  AS INTEGER ) FRO
1cb0: 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
1cc0: 2d 2d 2d 2d 0d 0a 32 0d 0a 36 32 0d 0a 36 32 0d  ----..2..62..62.
1cd0: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
1ce0: 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d  rt..SELECT ALL -
1cf0: 20 63 6f 6c 30 20 2b 20 63 6f 6c 30 20 41 53 20   col0 + col0 AS 
1d00: 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41  col0 FROM tab1 A
1d10: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d  S cor0..----..0.
1d20: 0a 30 0d 0a 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  .0..0....onlyif 
1d30: 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20  mysql # support 
1d40: 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66  for MySQL specif
1d50: 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20  ic system types 
1d60: 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72  and syntax..quer
1d70: 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
1d80: 6c 2d 34 37 0d 0a 53 45 4c 45 43 54 20 2b 20 63  l-47..SELECT + c
1d90: 6f 6c 31 20 2a 20 2d 20 43 41 53 54 28 20 28 20  ol1 * - CAST( ( 
1da0: 63 6f 72 30 2e 63 6f 6c 30 20 29 20 41 53 20 53  cor0.col0 ) AS S
1db0: 49 47 4e 45 44 20 29 20 41 53 20 63 6f 6c 31 20  IGNED ) AS col1 
1dc0: 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
1dd0: 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 34 30 0d 0a  0..----..-1040..
1de0: 2d 36 34 30 0d 0a 2d 37 38 0d 0a 0d 0a 73 6b 69  -640..-78....ski
1df0: 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
1e00: 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
1e10: 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
1e20: 6c 2d 34 37 0d 0a 53 45 4c 45 43 54 20 2b 20 63  l-47..SELECT + c
1e30: 6f 6c 31 20 2a 20 2d 20 43 41 53 54 20 28 20 28  ol1 * - CAST ( (
1e40: 20 63 6f 72 30 2e 63 6f 6c 30 20 29 20 41 53 20   cor0.col0 ) AS 
1e50: 49 4e 54 45 47 45 52 20 29 20 41 53 20 63 6f 6c  INTEGER ) AS col
1e60: 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  1 FROM tab1 AS c
1e70: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 34 30  or0..----..-1040
1e80: 0d 0a 2d 36 34 30 0d 0a 2d 37 38 0d 0a 0d 0a 73  ..-640..-78....s
1e90: 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c  kipif postgresql
1ea0: 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65   # PostgreSQL re
1eb0: 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72  quires AS when r
1ec0: 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63  enaming output c
1ed0: 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20  olumns..query I 
1ee0: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
1ef0: 63 6f 6c 30 20 2b 20 74 61 62 32 2e 63 6f 6c 30  col0 + tab2.col0
1f00: 20 2a 20 35 34 20 63 6f 6c 32 20 46 52 4f 4d 20   * 54 col2 FROM 
1f10: 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 33 38 35 0d  tab2..----..385.
1f20: 0a 34 32 39 30 0d 0a 34 33 34 35 0d 0a 0d 0a 71  .4290..4345....q
1f30: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
1f40: 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
1f50: 2b 20 63 6f 6c 32 20 2b 20 63 6f 6c 31 20 2a 20  + col2 + col1 * 
1f60: 28 20 63 6f 6c 32 20 2a 20 63 6f 6c 30 20 29 20  ( col2 * col0 ) 
1f70: 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d  FROM tab0..----.
1f80: 0a 33 33 39 36 0d 0a 36 36 34 32 30 30 0d 0a 36  .3396..664200..6
1f90: 38 31 34 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20  8145....query I 
1fa0: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
1fb0: 41 4c 4c 20 2b 20 33 20 2a 20 74 61 62 30 2e 63  ALL + 3 * tab0.c
1fc0: 6f 6c 31 20 2a 20 2d 20 28 20 2d 20 63 6f 6c 32  ol1 * - ( - col2
1fd0: 20 29 20 2d 20 2b 20 63 6f 6c 32 20 41 53 20 63   ) - + col2 AS c
1fe0: 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d  ol2 FROM tab0..-
1ff0: 2d 2d 2d 0d 0a 32 32 33 30 34 0d 0a 32 39 30 0d  ---..22304..290.
2000: 0a 38 34 38 31 0d 0a 0d 0a 71 75 65 72 79 20 49  .8481....query I
2010: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
2020: 20 44 49 53 54 49 4e 43 54 20 2b 20 36 31 20 46   DISTINCT + 61 F
2030: 52 4f 4d 20 74 61 62 30 2c 20 74 61 62 31 20 41  ROM tab0, tab1 A
2040: 53 20 63 6f 72 30 2c 20 74 61 62 30 20 41 53 20  S cor0, tab0 AS 
2050: 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 36 31 0d 0a  cor1..----..61..
2060: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2070: 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
2080: 43 54 20 2d 20 63 6f 6c 30 20 2b 20 2b 20 28 20  CT - col0 + + ( 
2090: 2d 20 32 38 20 29 20 41 53 20 63 6f 6c 31 20 46  - 28 ) AS col1 F
20a0: 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
20b0: 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 36 0d 0a 2d 31  ..----..-106..-1
20c0: 30 37 0d 0a 2d 33 35 0d 0a 0d 0a 6f 6e 6c 79 69  07..-35....onlyi
20d0: 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72  f mysql # suppor
20e0: 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63  t for MySQL spec
20f0: 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65  ific system type
2100: 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75  s and syntax..qu
2110: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
2120: 62 65 6c 2d 35 33 0d 0a 53 45 4c 45 43 54 20 44  bel-53..SELECT D
2130: 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c 30 20 2a  ISTINCT + col0 *
2140: 20 43 41 53 54 28 20 2b 20 63 6f 6c 30 20 41 53   CAST( + col0 AS
2150: 20 53 49 47 4e 45 44 20 29 20 2b 20 2d 20 63 6f   SIGNED ) + - co
2160: 6c 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  l2 AS col2 FROM 
2170: 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
2180: 2d 2d 0d 0a 2d 34 35 0d 0a 34 30 33 39 0d 0a 36  --..-45..4039..6
2190: 33 30 34 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  304....skipif my
21a0: 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
21b0: 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
21c0: 77 73 6f 72 74 20 6c 61 62 65 6c 2d 35 33 0d 0a  wsort label-53..
21d0: 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
21e0: 2b 20 63 6f 6c 30 20 2a 20 43 41 53 54 20 28 20  + col0 * CAST ( 
21f0: 2b 20 63 6f 6c 30 20 41 53 20 49 4e 54 45 47 45  + col0 AS INTEGE
2200: 52 20 29 20 2b 20 2d 20 63 6f 6c 32 20 41 53 20  R ) + - col2 AS 
2210: 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41  col2 FROM tab1 A
2220: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 34  S cor0..----..-4
2230: 35 0d 0a 34 30 33 39 0d 0a 36 33 30 34 0d 0a 0d  5..4039..6304...
2240: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2250: 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63  ..SELECT ALL + c
2260: 6f 72 30 2e 63 6f 6c 32 20 2d 20 63 6f 72 30 2e  or0.col2 - cor0.
2270: 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 63  col0 FROM tab0 c
2280: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 34 0d 0a  or0..----..-34..
2290: 2d 37 0d 0a 39 0d 0a 0d 0a 71 75 65 72 79 20 49  -7..9....query I
22a0: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
22b0: 20 2b 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 2a   + + cor0.col2 *
22c0: 20 63 6f 6c 32 20 2b 20 2d 20 63 6f 72 30 2e 63   col2 + - cor0.c
22d0: 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  ol1 AS col2 FROM
22e0: 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
22f0: 2d 2d 2d 0d 0a 31 34 32 37 0d 0a 36 31 37 0d 0a  ---..1427..617..
2300: 36 39 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  698....query I r
2310: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
2320: 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c 32 20 2a  ISTINCT - col2 *
2330: 20 32 36 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d   26 AS col1 FROM
2340: 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
2350: 2d 2d 2d 0d 0a 2d 36 37 36 0d 0a 2d 37 30 32 0d  ---..-676..-702.
2360: 0a 2d 39 38 38 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  .-988....onlyif 
2370: 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20  mysql # use DIV 
2380: 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74  operator for int
2390: 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71  eger division..q
23a0: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
23b0: 61 62 65 6c 2d 35 37 0d 0a 53 45 4c 45 43 54 20  abel-57..SELECT 
23c0: 44 49 53 54 49 4e 43 54 20 63 6f 6c 32 20 2a 20  DISTINCT col2 * 
23d0: 36 35 20 44 49 56 20 2b 20 63 6f 6c 31 20 2b 20  65 DIV + col1 + 
23e0: 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46 52 4f  col1 AS col2 FRO
23f0: 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
2400: 2d 2d 2d 2d 0d 0a 31 36 31 0d 0a 33 38 30 0d 0a  ----..161..380..
2410: 34 39 33 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  493....skipif my
2420: 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
2430: 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
2440: 77 73 6f 72 74 20 6c 61 62 65 6c 2d 35 37 0d 0a  wsort label-57..
2450: 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
2460: 63 6f 6c 32 20 2a 20 36 35 20 2f 20 2b 20 63 6f  col2 * 65 / + co
2470: 6c 31 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c  l1 + col1 AS col
2480: 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  2 FROM tab1 AS c
2490: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 36 31 0d 0a  or0..----..161..
24a0: 33 38 30 0d 0a 34 39 33 0d 0a 0d 0a 71 75 65 72  380..493....quer
24b0: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
24c0: 45 43 54 20 41 4c 4c 20 2d 20 63 6f 72 30 2e 63  ECT ALL - cor0.c
24d0: 6f 6c 31 20 2a 20 63 6f 72 30 2e 63 6f 6c 32 20  ol1 * cor0.col2 
24e0: 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
24f0: 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32 34 38 0d 0a  0..----..-1248..
2500: 2d 31 34 30 34 0d 0a 2d 35 37 30 0d 0a 0d 0a 71  -1404..-570....q
2510: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
2520: 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
2530: 2b 20 63 6f 6c 31 20 2a 20 63 6f 6c 31 20 2b 20  + col1 * col1 + 
2540: 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c 30 20 2b 20  col0 * + col0 + 
2550: 2d 20 33 38 20 41 53 20 63 6f 6c 30 20 46 52 4f  - 38 AS col0 FRO
2560: 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
2570: 2d 2d 2d 2d 0d 0a 31 30 35 39 36 0d 0a 31 36 31  ----..10596..161
2580: 36 34 0d 0a 37 39 33 34 0d 0a 0d 0a 71 75 65 72  64..7934....quer
2590: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
25a0: 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 30 20 2d  ECT ALL - col0 -
25b0: 20 63 6f 6c 30 20 2a 20 2b 20 35 32 20 46 52 4f   col0 * + 52 FRO
25c0: 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab0 cor0..---
25d0: 2d 0d 0a 2d 31 32 37 32 0d 0a 2d 31 38 35 35 0d  -..-1272..-1855.
25e0: 0a 2d 34 37 31 37 0d 0a 0d 0a 71 75 65 72 79 20  .-4717....query 
25f0: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
2600: 54 20 41 4c 4c 20 2b 20 2b 20 63 6f 6c 32 20 2a  T ALL + + col2 *
2610: 20 2b 20 30 20 46 52 4f 4d 20 74 61 62 30 20 41   + 0 FROM tab0 A
2620: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d  S cor0..----..0.
2630: 0a 30 0d 0a 30 0d 0a 0d 0a 71 75 65 72 79 20 49  .0..0....query I
2640: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
2650: 20 41 4c 4c 20 33 35 20 41 53 20 63 6f 6c 32 20   ALL 35 AS col2 
2660: 46 52 4f 4d 20 74 61 62 32 2c 20 74 61 62 31 20  FROM tab2, tab1 
2670: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39  AS cor0..----..9
2680: 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20   values hashing 
2690: 74 6f 20 64 39 62 31 30 33 66 37 39 63 34 65 38  to d9b103f79c4e8
26a0: 66 30 64 65 34 62 37 63 31 63 38 32 31 37 38 33  f0de4b7c1c821783
26b0: 61 32 39 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  a29....onlyif my
26c0: 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70  sql # use DIV op
26d0: 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67  erator for integ
26e0: 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65  er division..que
26f0: 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
2700: 65 6c 2d 36 33 0d 0a 53 45 4c 45 43 54 20 63 6f  el-63..SELECT co
2710: 6c 30 20 2a 20 36 36 20 44 49 56 20 63 6f 6c 30  l0 * 66 DIV col0
2720: 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
2730: 62 32 0d 0a 2d 2d 2d 2d 0d 0a 36 36 0d 0a 36 36  b2..----..66..66
2740: 0d 0a 36 36 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  ..66....skipif m
2750: 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
2760: 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
2770: 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 36 33 0d  owsort label-63.
2780: 0a 53 45 4c 45 43 54 20 63 6f 6c 30 20 2a 20 36  .SELECT col0 * 6
2790: 36 20 2f 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30  6 / col0 AS col0
27a0: 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d   FROM tab2..----
27b0: 0d 0a 36 36 0d 0a 36 36 0d 0a 36 36 0d 0a 0d 0a  ..66..66..66....
27c0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
27d0: 0a 53 45 4c 45 43 54 20 2b 20 32 34 20 2a 20 2d  .SELECT + 24 * -
27e0: 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20   col1 FROM tab0 
27f0: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
2800: 32 30 36 34 0d 0a 2d 32 31 38 34 0d 0a 2d 32 33  2064..-2184..-23
2810: 32 38 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  28....onlyif mys
2820: 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72  ql # support for
2830: 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63 20   MySQL specific 
2840: 73 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64  system types and
2850: 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49   syntax..query I
2860: 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 36   rowsort label-6
2870: 35 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  5..SELECT DISTIN
2880: 43 54 20 2d 20 43 41 53 54 28 20 4e 55 4c 4c 20  CT - CAST( NULL 
2890: 41 53 20 53 49 47 4e 45 44 20 29 20 2d 20 39 38  AS SIGNED ) - 98
28a0: 20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d   FROM tab1 cor0.
28b0: 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73  .----..NULL....s
28c0: 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
28d0: 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
28e0: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
28f0: 62 65 6c 2d 36 35 0d 0a 53 45 4c 45 43 54 20 44  bel-65..SELECT D
2900: 49 53 54 49 4e 43 54 20 2d 20 43 41 53 54 20 28  ISTINCT - CAST (
2910: 20 4e 55 4c 4c 20 41 53 20 49 4e 54 45 47 45 52   NULL AS INTEGER
2920: 20 29 20 2d 20 39 38 20 46 52 4f 4d 20 74 61 62   ) - 98 FROM tab
2930: 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55  1 cor0..----..NU
2940: 4c 4c 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  LL....query I ro
2950: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
2960: 34 31 20 2a 20 63 6f 6c 30 20 2b 20 63 6f 6c 32  41 * col0 + col2
2970: 20 2a 20 2b 20 63 6f 6c 32 20 41 53 20 63 6f 6c   * + col2 AS col
2980: 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  0 FROM tab2 AS c
2990: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 31 36 0d  or0..----..1016.
29a0: 0a 33 38 37 34 0d 0a 34 36 38 33 0d 0a 0d 0a 71  .3874..4683....q
29b0: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
29c0: 53 45 4c 45 43 54 20 41 4c 4c 20 32 37 20 41 53  SELECT ALL 27 AS
29d0: 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20   col2 FROM tab1 
29e0: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32  AS cor0..----..2
29f0: 37 0d 0a 32 37 0d 0a 32 37 0d 0a 0d 0a 6f 6e 6c  7..27..27....onl
2a00: 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20  yif mysql # use 
2a10: 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72  DIV operator for
2a20: 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f   integer divisio
2a30: 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  n..query I rowso
2a40: 72 74 20 6c 61 62 65 6c 2d 36 38 0d 0a 53 45 4c  rt label-68..SEL
2a50: 45 43 54 20 2d 20 2b 20 63 6f 72 30 2e 63 6f 6c  ECT - + cor0.col
2a60: 32 20 44 49 56 20 63 6f 6c 31 20 2b 20 2d 20 63  2 DIV col1 + - c
2a70: 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  ol0 AS col2 FROM
2a80: 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
2a90: 2d 2d 2d 0d 0a 2d 37 0d 0a 2d 37 38 0d 0a 2d 38  ---..-7..-78..-8
2aa0: 31 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  1....skipif mysq
2ab0: 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
2ac0: 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
2ad0: 6f 72 74 20 6c 61 62 65 6c 2d 36 38 0d 0a 53 45  ort label-68..SE
2ae0: 4c 45 43 54 20 2d 20 2b 20 63 6f 72 30 2e 63 6f  LECT - + cor0.co
2af0: 6c 32 20 2f 20 63 6f 6c 31 20 2b 20 2d 20 63 6f  l2 / col1 + - co
2b00: 6c 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  l0 AS col2 FROM 
2b10: 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
2b20: 2d 2d 0d 0a 2d 37 0d 0a 2d 37 38 0d 0a 2d 38 31  --..-7..-78..-81
2b30: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
2b40: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f  ort..SELECT - co
2b50: 6c 30 20 2a 20 2d 20 63 6f 6c 30 20 2a 20 2d 20  l0 * - col0 * - 
2b60: 35 37 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d  57 FROM tab2..--
2b70: 2d 2d 0d 0a 2d 32 37 39 33 0d 0a 2d 33 34 36 37  --..-2793..-3467
2b80: 38 38 0d 0a 2d 33 35 35 37 33 37 0d 0a 0d 0a 73  88..-355737....s
2b90: 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
2ba0: 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
2bb0: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
2bc0: 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b  ELECT DISTINCT +
2bd0: 20 63 6f 6c 30 20 2b 20 2d 20 43 41 53 54 20 28   col0 + - CAST (
2be0: 20 63 6f 6c 31 20 41 53 20 52 45 41 4c 20 29 20   col1 AS REAL ) 
2bf0: 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
2c00: 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 33 0d 0a 35 34  1..----..-23..54
2c10: 0d 0a 36 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..67....query I 
2c20: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
2c30: 44 49 53 54 49 4e 43 54 20 2d 20 37 32 20 2a 20  DISTINCT - 72 * 
2c40: 2b 20 37 34 20 41 53 20 63 6f 6c 30 20 46 52 4f  + 74 AS col0 FRO
2c50: 4d 20 74 61 62 30 2c 20 74 61 62 31 20 63 6f 72  M tab0, tab1 cor
2c60: 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 33 32 38 0d 0a  0..----..-5328..
2c70: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2c80: 74 0d 0a 53 45 4c 45 43 54 20 35 34 20 41 53 20  t..SELECT 54 AS 
2c90: 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 2c 20  col0 FROM tab0, 
2ca0: 74 61 62 30 20 41 53 20 63 6f 72 30 2c 20 74 61  tab0 AS cor0, ta
2cb0: 62 32 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d  b2 AS cor1..----
2cc0: 0d 0a 32 37 20 76 61 6c 75 65 73 20 68 61 73 68  ..27 values hash
2cd0: 69 6e 67 20 74 6f 20 38 31 31 35 30 64 35 39 64  ing to 81150d59d
2ce0: 36 63 33 66 63 34 38 62 34 65 66 35 61 34 61 35  6c3fc48b4ef5a4a5
2cf0: 34 39 35 62 63 37 61 0d 0a 0d 0a 71 75 65 72 79  495bc7a....query
2d00: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
2d10: 43 54 20 41 4c 4c 20 74 61 62 31 2e 63 6f 6c 31  CT ALL tab1.col1
2d20: 20 2a 20 63 6f 6c 30 20 2a 20 63 6f 6c 32 20 46   * col0 * col2 F
2d30: 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab1..----..
2d40: 33 36 34 38 30 0d 0a 34 32 31 32 0d 0a 39 39 38  36480..4212..998
2d50: 34 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  40....onlyif mys
2d60: 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72  ql # support for
2d70: 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63 20   MySQL specific 
2d80: 73 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64  system types and
2d90: 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49   syntax..query I
2da0: 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 37   rowsort label-7
2db0: 34 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 32  4..SELECT - col2
2dc0: 20 2a 20 63 6f 6c 31 20 2d 20 63 6f 6c 31 20 2a   * col1 - col1 *
2dd0: 20 2b 20 63 6f 6c 30 20 2a 20 2d 20 43 41 53 54   + col0 * - CAST
2de0: 28 20 4e 55 4c 4c 20 41 53 20 53 49 47 4e 45 44  ( NULL AS SIGNED
2df0: 20 29 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20   ) AS col0 FROM 
2e00: 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
2e10: 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a  --..NULL..NULL..
2e20: 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  NULL....skipif m
2e30: 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
2e40: 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
2e50: 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 37 34 0d  owsort label-74.
2e60: 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 32 20 2a  .SELECT - col2 *
2e70: 20 63 6f 6c 31 20 2d 20 63 6f 6c 31 20 2a 20 2b   col1 - col1 * +
2e80: 20 63 6f 6c 30 20 2a 20 2d 20 43 41 53 54 20 28   col0 * - CAST (
2e90: 20 4e 55 4c 4c 20 41 53 20 49 4e 54 45 47 45 52   NULL AS INTEGER
2ea0: 20 29 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20   ) AS col0 FROM 
2eb0: 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
2ec0: 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a  --..NULL..NULL..
2ed0: 4e 55 4c 4c 0d 0a 0d 0a 71 75 65 72 79 20 49 20  NULL....query I 
2ee0: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
2ef0: 41 4c 4c 20 2d 20 63 6f 72 30 2e 63 6f 6c 31 20  ALL - cor0.col1 
2f00: 2a 20 33 31 20 41 53 20 63 6f 6c 30 20 46 52 4f  * 31 AS col0 FRO
2f10: 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 20 43  M tab2 AS cor0 C
2f20: 52 4f 53 53 20 4a 4f 49 4e 20 74 61 62 31 20 41  ROSS JOIN tab1 A
2f30: 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 39 20  S cor1..----..9 
2f40: 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74  values hashing t
2f50: 6f 20 61 61 30 32 39 64 31 64 63 31 34 34 61 63  o aa029d1dc144ac
2f60: 37 61 64 33 39 36 35 65 32 61 66 34 65 35 61 36  7ad3965e2af4e5a6
2f70: 33 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  31....query I ro
2f80: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
2f90: 63 6f 6c 30 20 2b 20 2b 20 28 20 63 6f 6c 30 20  col0 + + ( col0 
2fa0: 29 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  ) AS col1 FROM t
2fb0: 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
2fc0: 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a 71 75  -..0..0..0....qu
2fd0: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
2fe0: 45 4c 45 43 54 20 63 6f 6c 31 20 2a 20 63 6f 6c  ELECT col1 * col
2ff0: 31 20 2a 20 2d 20 63 6f 6c 32 20 41 53 20 63 6f  1 * - col2 AS co
3000: 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l2 FROM tab1 AS 
3010: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 36 32  cor0..----..-162
3020: 32 34 0d 0a 2d 33 36 35 30 34 0d 0a 2d 35 37 30  24..-36504..-570
3030: 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  0....query I row
3040: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2d  sort..SELECT - -
3050: 20 35 39 20 2a 20 63 6f 72 30 2e 63 6f 6c 32 20   59 * cor0.col2 
3060: 2b 20 2d 20 63 6f 6c 30 20 41 53 20 63 6f 6c 32  + - col0 AS col2
3070: 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
3080: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 39 32 33 0d 0a  r0..----..1923..
3090: 32 34 0d 0a 34 37 34 39 0d 0a 0d 0a 71 75 65 72  24..4749....quer
30a0: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
30b0: 45 43 54 20 28 20 63 6f 6c 31 20 29 20 2a 20 63  ECT ( col1 ) * c
30c0: 6f 6c 32 20 2b 20 2d 20 34 34 20 46 52 4f 4d 20  ol2 + - 44 FROM 
30d0: 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
30e0: 2d 2d 0d 0a 31 32 30 34 0d 0a 31 33 36 30 0d 0a  --..1204..1360..
30f0: 35 32 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  526....query I r
3100: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
3110: 20 2d 20 63 6f 6c 31 20 2b 20 63 6f 72 30 2e 63   - col1 + cor0.c
3120: 6f 6c 30 20 2a 20 63 6f 6c 32 20 41 53 20 63 6f  ol0 * col2 AS co
3130: 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l0 FROM tab2 AS 
3140: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 35 38 0d  cor0..----..158.
3150: 0a 31 39 36 39 0d 0a 32 39 38 35 0d 0a 0d 0a 6f  .1969..2985....o
3160: 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73  nlyif mysql # us
3170: 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66  e DIV operator f
3180: 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73  or integer divis
3190: 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ion..query I row
31a0: 73 6f 72 74 20 6c 61 62 65 6c 2d 38 31 0d 0a 53  sort label-81..S
31b0: 45 4c 45 43 54 20 2d 20 34 31 20 44 49 56 20 63  ELECT - 41 DIV c
31c0: 6f 6c 30 20 2b 20 2b 20 63 6f 6c 32 20 41 53 20  ol0 + + col2 AS 
31d0: 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41  col0 FROM tab2 A
31e0: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 32  S cor0..----..22
31f0: 0d 0a 32 36 0d 0a 33 38 0d 0a 0d 0a 73 6b 69 70  ..26..38....skip
3200: 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
3210: 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
3220: 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
3230: 2d 38 31 0d 0a 53 45 4c 45 43 54 20 2d 20 34 31  -81..SELECT - 41
3240: 20 2f 20 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c 32   / col0 + + col2
3250: 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
3260: 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
3270: 0d 0a 32 32 0d 0a 32 36 0d 0a 33 38 0d 0a 0d 0a  ..22..26..38....
3280: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
3290: 0a 53 45 4c 45 43 54 20 33 35 20 2b 20 63 6f 6c  .SELECT 35 + col
32a0: 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  2 AS col2 FROM t
32b0: 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
32c0: 2d 0d 0a 31 31 37 0d 0a 33 36 0d 0a 36 38 0d 0a  -..117..36..68..
32d0: 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65  ..skipif postgre
32e0: 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c  sql # PostgreSQL
32f0: 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65   requires AS whe
3300: 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75  n renaming outpu
3310: 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79  t columns..query
3320: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
3330: 43 54 20 41 4c 4c 20 2d 20 31 39 20 63 6f 6c 30  CT ALL - 19 col0
3340: 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d   FROM tab1..----
3350: 0d 0a 2d 31 39 0d 0a 2d 31 39 0d 0a 2d 31 39 0d  ..-19..-19..-19.
3360: 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72  ...skipif postgr
3370: 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51  esql # PostgreSQ
3380: 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68  L requires AS wh
3390: 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70  en renaming outp
33a0: 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72  ut columns..quer
33b0: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
33c0: 45 43 54 20 2b 20 63 6f 6c 31 20 2a 20 2d 20 63  ECT + col1 * - c
33d0: 6f 6c 31 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61  ol1 col0 FROM ta
33e0: 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
33f0: 0d 0a 2d 37 33 39 36 0d 0a 2d 38 32 38 31 0d 0a  ..-7396..-8281..
3400: 2d 39 34 30 39 0d 0a 0d 0a 71 75 65 72 79 20 49  -9409....query I
3410: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
3420: 20 41 4c 4c 20 2b 20 31 37 20 41 53 20 63 6f 6c   ALL + 17 AS col
3430: 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  1 FROM tab1 AS c
3440: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 37 0d 0a 31  or0..----..17..1
3450: 37 0d 0a 31 37 0d 0a 0d 0a 71 75 65 72 79 20 49  7..17....query I
3460: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
3470: 20 44 49 53 54 49 4e 43 54 20 2b 20 2d 20 63 6f   DISTINCT + - co
3480: 6c 32 20 2b 20 2b 20 63 6f 6c 31 20 2a 20 2b 20  l2 + + col1 * + 
3490: 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41  col0 FROM tab0 A
34a0: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 30  S cor0..----..20
34b0: 33 31 0d 0a 33 33 39 34 0d 0a 38 30 31 37 0d 0a  31..3394..8017..
34c0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
34d0: 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20  t..SELECT ALL + 
34e0: 32 39 20 2a 20 2d 20 63 6f 6c 32 20 41 53 20 63  29 * - col2 AS c
34f0: 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol1 FROM tab0 AS
3500: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 33   cor0..----..-23
3510: 37 38 0d 0a 2d 32 39 0d 0a 2d 39 35 37 0d 0a 0d  78..-29..-957...
3520: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
3530: 0d 0a 53 45 4c 45 43 54 20 2d 20 38 34 20 2a 20  ..SELECT - 84 * 
3540: 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46  + col0 AS col2 F
3550: 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
3560: 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 30 31 36 0d 0a 2d  ..----..-2016..-
3570: 32 39 34 30 0d 0a 2d 37 34 37 36 0d 0a 0d 0a 71  2940..-7476....q
3580: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
3590: 53 45 4c 45 43 54 20 2d 20 63 6f 6c 32 20 2a 20  SELECT - col2 * 
35a0: 63 6f 6c 31 20 2a 20 34 31 20 46 52 4f 4d 20 74  col1 * 41 FROM t
35b0: 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
35c0: 2d 0d 0a 2d 32 36 34 38 36 0d 0a 2d 33 34 33 31  -..-26486..-3431
35d0: 37 0d 0a 2d 36 32 38 39 34 0d 0a 0d 0a 71 75 65  7..-62894....que
35e0: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
35f0: 4c 45 43 54 20 2d 20 2b 20 63 6f 6c 32 20 2b 20  LECT - + col2 + 
3600: 63 6f 6c 31 20 2a 20 2d 20 63 6f 72 30 2e 63 6f  col1 * - cor0.co
3610: 6c 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  l2 AS col2 FROM 
3620: 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
3630: 2d 2d 0d 0a 2d 31 35 36 30 0d 0a 2d 36 38 34 0d  --..-1560..-684.
3640: 0a 2d 38 36 34 0d 0a 0d 0a 71 75 65 72 79 20 49  .-864....query I
3650: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
3660: 20 41 4c 4c 20 35 31 20 46 52 4f 4d 20 74 61 62   ALL 51 FROM tab
3670: 32 2c 20 74 61 62 32 20 41 53 20 63 6f 72 30 2c  2, tab2 AS cor0,
3680: 20 74 61 62 30 20 63 6f 72 31 0d 0a 2d 2d 2d 2d   tab0 cor1..----
3690: 0d 0a 32 37 20 76 61 6c 75 65 73 20 68 61 73 68  ..27 values hash
36a0: 69 6e 67 20 74 6f 20 30 32 61 37 64 65 39 34 33  ing to 02a7de943
36b0: 36 35 62 38 63 62 35 62 35 63 62 39 32 63 34 62  65b8cb5b5cb92c4b
36c0: 31 64 31 65 37 63 35 0d 0a 0d 0a 71 75 65 72 79  1d1e7c5....query
36d0: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
36e0: 43 54 20 32 20 46 52 4f 4d 20 74 61 62 32 2c 20  CT 2 FROM tab2, 
36f0: 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab1 cor0..----.
3700: 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e  .9 values hashin
3710: 67 20 74 6f 20 38 34 64 62 66 61 66 39 62 63 31  g to 84dbfaf9bc1
3720: 37 64 64 30 39 37 66 31 35 62 63 33 36 62 34 31  7dd097f15bc36b41
3730: 38 36 32 36 31 0d 0a 0d 0a 71 75 65 72 79 20 49  86261....query I
3740: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
3750: 20 2d 20 2d 20 28 20 28 20 2b 20 63 6f 72 30 2e   - - ( ( + cor0.
3760: 63 6f 6c 32 20 29 20 29 20 46 52 4f 4d 20 74 61  col2 ) ) FROM ta
3770: 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
3780: 0d 0a 31 0d 0a 33 33 0d 0a 38 32 0d 0a 0d 0a 73  ..1..33..82....s
3790: 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c  kipif postgresql
37a0: 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65   # PostgreSQL re
37b0: 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72  quires AS when r
37c0: 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63  enaming output c
37d0: 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20  olumns..query I 
37e0: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
37f0: 2b 20 28 20 63 6f 6c 32 20 29 20 63 6f 6c 31 20  + ( col2 ) col1 
3800: 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
3810: 30 0d 0a 2d 2d 2d 2d 0d 0a 35 34 0d 0a 35 37 0d  0..----..54..57.
3820: 0a 39 36 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  .96....onlyif my
3830: 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f  sql # support fo
3840: 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63  r MySQL specific
3850: 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e   system types an
3860: 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20  d syntax..query 
3870: 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
3880: 39 35 0d 0a 53 45 4c 45 43 54 20 2b 20 43 41 53  95..SELECT + CAS
3890: 54 28 20 2d 20 63 6f 6c 30 20 41 53 20 53 49 47  T( - col0 AS SIG
38a0: 4e 45 44 20 29 20 2a 20 2d 20 63 6f 72 30 2e 63  NED ) * - cor0.c
38b0: 6f 6c 31 20 2b 20 63 6f 6c 30 20 2b 20 2b 20 28  ol1 + col0 + + (
38c0: 20 63 6f 6c 30 20 2a 20 43 41 53 54 28 20 2b 20   col0 * CAST( + 
38d0: 28 20 2b 20 63 6f 6c 30 20 29 20 41 53 20 53 49  ( + col0 ) AS SI
38e0: 47 4e 45 44 20 29 20 29 20 46 52 4f 4d 20 74 61  GNED ) ) FROM ta
38f0: 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
3900: 0d 0a 34 38 30 30 0d 0a 37 35 32 30 0d 0a 39 30  ..4800..7520..90
3910: 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
3920: 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
3930: 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
3940: 72 74 20 6c 61 62 65 6c 2d 39 35 0d 0a 53 45 4c  rt label-95..SEL
3950: 45 43 54 20 2b 20 43 41 53 54 20 28 20 2d 20 63  ECT + CAST ( - c
3960: 6f 6c 30 20 41 53 20 49 4e 54 45 47 45 52 20 29  ol0 AS INTEGER )
3970: 20 2a 20 2d 20 63 6f 72 30 2e 63 6f 6c 31 20 2b   * - cor0.col1 +
3980: 20 63 6f 6c 30 20 2b 20 2b 20 28 20 63 6f 6c 30   col0 + + ( col0
3990: 20 2a 20 43 41 53 54 20 28 20 2b 20 28 20 2b 20   * CAST ( + ( + 
39a0: 63 6f 6c 30 20 29 20 41 53 20 49 4e 54 45 47 45  col0 ) AS INTEGE
39b0: 52 20 29 20 29 20 46 52 4f 4d 20 74 61 62 31 20  R ) ) FROM tab1 
39c0: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 34  AS cor0..----..4
39d0: 38 30 30 0d 0a 37 35 32 30 0d 0a 39 30 0d 0a 0d  800..7520..90...
39e0: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
39f0: 0d 0a 53 45 4c 45 43 54 20 33 30 20 41 53 20 63  ..SELECT 30 AS c
3a00: 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol0 FROM tab2 AS
3a10: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 30 0d   cor0..----..30.
3a20: 0a 33 30 0d 0a 33 30 0d 0a 0d 0a 71 75 65 72 79  .30..30....query
3a30: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
3a40: 43 54 20 2d 20 2d 20 39 32 20 2b 20 63 6f 72 30  CT - - 92 + cor0
3a50: 2e 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46 52  .col1 AS col2 FR
3a60: 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
3a70: 0a 2d 2d 2d 2d 0d 0a 31 30 32 0d 0a 31 30 35 0d  .----..102..105.
3a80: 0a 31 31 38 0d 0a 0d 0a 73 6b 69 70 69 66 20 70  .118....skipif p
3a90: 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74  ostgresql # Post
3aa0: 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20  greSQL requires 
3ab0: 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67  AS when renaming
3ac0: 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d   output columns.
3ad0: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
3ae0: 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
3af0: 54 20 2b 20 63 6f 6c 32 20 2a 20 63 6f 72 30 2e  T + col2 * cor0.
3b00: 63 6f 6c 32 20 63 6f 6c 30 20 46 52 4f 4d 20 74  col2 col0 FROM t
3b10: 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
3b20: 2d 0d 0a 31 34 34 34 0d 0a 36 37 36 0d 0a 37 32  -..1444..676..72
3b30: 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  9....query I row
3b40: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 31  sort..SELECT + 1
3b50: 34 20 2a 20 2d 20 63 6f 6c 30 20 41 53 20 63 6f  4 * - col0 AS co
3b60: 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l2 FROM tab1 AS 
3b70: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 32  cor0..----..-112
3b80: 30 0d 0a 2d 34 32 0d 0a 2d 38 39 36 0d 0a 0d 0a  0..-42..-896....
3b90: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
3ba0: 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
3bb0: 20 2b 20 2d 20 63 6f 6c 32 20 2b 20 63 6f 6c 32   + - col2 + col2
3bc0: 20 2a 20 28 20 63 6f 72 30 2e 63 6f 6c 30 20 29   * ( cor0.col0 )
3bd0: 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
3be0: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 34 0d 0a 37 32  r0..----..34..72
3bf0: 31 36 0d 0a 37 35 39 0d 0a 0d 0a 71 75 65 72 79  16..759....query
3c00: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
3c10: 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 2d 20  CT DISTINCT + - 
3c20: 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c 31 20 2a 20  col1 * - col1 * 
3c30: 2d 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46  - col0 AS col0 F
3c40: 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
3c50: 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 35 32 30 0d 0a  ..----..-13520..
3c60: 2d 32 30 32 38 0d 0a 2d 36 34 30 30 0d 0a 0d 0a  -2028..-6400....
3c70: 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71  skipif postgresq
3c80: 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72  l # PostgreSQL r
3c90: 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20  equires AS when 
3ca0: 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20  renaming output 
3cb0: 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49  columns..query I
3cc0: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
3cd0: 20 2d 20 2b 20 63 6f 6c 32 20 2a 20 63 6f 6c 32   - + col2 * col2
3ce0: 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20   col0 FROM tab0 
3cf0: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
3d00: 31 0d 0a 2d 31 30 38 39 0d 0a 2d 36 37 32 34 0d  1..-1089..-6724.
3d10: 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72  ...skipif postgr
3d20: 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51  esql # PostgreSQ
3d30: 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68  L requires AS wh
3d40: 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70  en renaming outp
3d50: 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72  ut columns..quer
3d60: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
3d70: 45 43 54 20 2d 20 63 6f 6c 31 20 2a 20 63 6f 6c  ECT - col1 * col
3d80: 31 20 2a 20 2d 20 31 36 20 63 6f 6c 30 20 46 52  1 * - 16 col0 FR
3d90: 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
3da0: 0a 2d 2d 2d 2d 0d 0a 31 30 38 31 36 0d 0a 31 36  .----..10816..16
3db0: 30 30 0d 0a 32 37 30 34 0d 0a 0d 0a 71 75 65 72  00..2704....quer
3dc0: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
3dd0: 45 43 54 20 41 4c 4c 20 63 6f 6c 32 20 2a 20 2d  ECT ALL col2 * -
3de0: 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20   col2 FROM tab1 
3df0: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 39 31  cor0..----..-291
3e00: 36 0d 0a 2d 33 32 34 39 0d 0a 2d 39 32 31 36 0d  6..-3249..-9216.
3e10: 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
3e20: 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74  # use DIV operat
3e30: 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64  or for integer d
3e40: 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49  ivision..query I
3e50: 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
3e60: 30 35 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b  05..SELECT ALL +
3e70: 20 63 6f 6c 31 20 44 49 56 20 63 6f 6c 31 20 41   col1 DIV col1 A
3e80: 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30  S col1 FROM tab0
3e90: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
3ea0: 31 0d 0a 31 0d 0a 31 0d 0a 0d 0a 73 6b 69 70 69  1..1..1....skipi
3eb0: 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
3ec0: 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
3ed0: 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
3ee0: 31 30 35 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  105..SELECT ALL 
3ef0: 2b 20 63 6f 6c 31 20 2f 20 63 6f 6c 31 20 41 53  + col1 / col1 AS
3f00: 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20   col1 FROM tab0 
3f10: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
3f20: 0d 0a 31 0d 0a 31 0d 0a 0d 0a 71 75 65 72 79 20  ..1..1....query 
3f30: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
3f40: 54 20 41 4c 4c 20 2b 20 2b 20 63 6f 6c 32 20 2b  T ALL + + col2 +
3f50: 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 2a 20 63   + cor0.col0 * c
3f60: 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  ol1 AS col2 FROM
3f70: 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
3f80: 2d 2d 2d 0d 0a 31 33 38 31 0d 0a 32 34 34 0d 0a  ---..1381..244..
3f90: 34 36 32 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20  4628....query I 
3fa0: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
3fb0: 2d 20 2d 20 63 6f 6c 31 20 2b 20 2b 20 28 20 2d  - - col1 + + ( -
3fc0: 20 63 6f 6c 30 20 29 20 41 53 20 63 6f 6c 32 20   col0 ) AS col2 
3fd0: 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
3fe0: 30 0d 0a 2d 2d 2d 2d 0d 0a 32 0d 0a 36 32 0d 0a  0..----..2..62..
3ff0: 36 32 0d 0a 0d 0a 71 75 65 72 79 20 49 49 49 49  62....query IIII
4000: 49 49 49 49 49 49 49 49 49 49 49 20 72 6f 77 73  IIIIIIIIIII rows
4010: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2a 20 46 52  ort..SELECT * FR
4020: 4f 4d 20 74 61 62 30 2c 20 74 61 62 30 20 41 53  OM tab0, tab0 AS
4030: 20 63 6f 72 30 2c 20 74 61 62 30 20 63 6f 72 31   cor0, tab0 cor1
4040: 2c 20 74 61 62 31 2c 20 74 61 62 31 20 41 53 20  , tab1, tab1 AS 
4050: 63 6f 72 32 0d 0a 2d 2d 2d 2d 0d 0a 33 36 34 35  cor2..----..3645
4060: 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20   values hashing 
4070: 74 6f 20 62 63 65 35 63 62 66 34 38 66 34 61 34  to bce5cbf48f4a4
4080: 31 35 36 39 34 31 35 63 30 38 35 61 65 39 31 61  1569415c085ae91a
4090: 65 37 63 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  e7c....query I r
40a0: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63  owsort..SELECT c
40b0: 6f 6c 31 20 2a 20 2d 20 33 37 20 2b 20 2d 20 63  ol1 * - 37 + - c
40c0: 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol1 FROM tab0 AS
40d0: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 32   cor0..----..-32
40e0: 36 38 0d 0a 2d 33 34 35 38 0d 0a 2d 33 36 38 36  68..-3458..-3686
40f0: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
4100: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 72 30  ort..SELECT cor0
4110: 2e 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c 30 20 2b  .col1 * + col0 +
4120: 20 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46 52   col0 AS col1 FR
4130: 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d  OM tab2 cor0..--
4140: 2d 2d 0d 0a 31 34 32 32 0d 0a 32 32 34 0d 0a 34  --..1422..224..4
4150: 36 38 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f  680....skipif po
4160: 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67  stgresql # Postg
4170: 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41  reSQL requires A
4180: 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20  S when renaming 
4190: 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a  output columns..
41a0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
41b0: 0a 53 45 4c 45 43 54 20 63 6f 6c 31 20 2b 20 38  .SELECT col1 + 8
41c0: 37 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30  7 col0 FROM tab0
41d0: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
41e0: 31 37 33 0d 0a 31 37 38 0d 0a 31 38 34 0d 0a 0d  173..178..184...
41f0: 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
4200: 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51  support for MySQ
4210: 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65  L specific syste
4220: 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74  m types and synt
4230: 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ax..query I rows
4240: 6f 72 74 20 6c 61 62 65 6c 2d 31 31 32 0d 0a 53  ort label-112..S
4250: 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b  ELECT DISTINCT +
4260: 20 2d 20 43 41 53 54 28 20 4e 55 4c 4c 20 41 53   - CAST( NULL AS
4270: 20 53 49 47 4e 45 44 20 29 20 41 53 20 63 6f 6c   SIGNED ) AS col
4280: 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  2 FROM tab0 AS c
4290: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d  or0..----..NULL.
42a0: 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
42b0: 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
42c0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
42d0: 74 20 6c 61 62 65 6c 2d 31 31 32 0d 0a 53 45 4c  t label-112..SEL
42e0: 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 2d  ECT DISTINCT + -
42f0: 20 43 41 53 54 20 28 20 4e 55 4c 4c 20 41 53 20   CAST ( NULL AS 
4300: 49 4e 54 45 47 45 52 20 29 20 41 53 20 63 6f 6c  INTEGER ) AS col
4310: 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  2 FROM tab0 AS c
4320: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d  or0..----..NULL.
4330: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
4340: 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 31 20  rt..SELECT col1 
4350: 2b 20 33 30 20 2a 20 63 6f 72 30 2e 63 6f 6c 31  + 30 * cor0.col1
4360: 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
4370: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 31 30 0d 0a 34  r0..----..310..4
4380: 30 33 0d 0a 38 30 36 0d 0a 0d 0a 71 75 65 72 79  03..806....query
4390: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
43a0: 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 32  CT DISTINCT col2
43b0: 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 2a 20 2d   + cor0.col1 * -
43c0: 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20   col2 FROM tab0 
43d0: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
43e0: 32 38 30 35 0d 0a 2d 37 33 38 30 0d 0a 2d 39 36  2805..-7380..-96
43f0: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
4400: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 28 20  ort..SELECT - ( 
4410: 63 6f 6c 31 20 29 20 2b 20 2b 20 63 6f 6c 32 20  col1 ) + + col2 
4420: 2a 20 2b 20 35 37 20 41 53 20 63 6f 6c 32 20 46  * + 57 AS col2 F
4430: 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
4440: 0d 0a 2d 2d 2d 2d 0d 0a 31 34 32 33 0d 0a 31 35  ..----..1423..15
4450: 30 38 0d 0a 32 31 34 39 0d 0a 0d 0a 71 75 65 72  08..2149....quer
4460: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
4470: 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 31  ECT DISTINCT - 1
4480: 31 20 2a 20 2d 20 37 33 20 41 53 20 63 6f 6c 31  1 * - 73 AS col1
4490: 20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d   FROM tab1 cor0.
44a0: 0a 2d 2d 2d 2d 0d 0a 38 30 33 0d 0a 0d 0a 71 75  .----..803....qu
44b0: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
44c0: 45 4c 45 43 54 20 35 30 20 41 53 20 63 6f 6c 31  ELECT 50 AS col1
44d0: 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d   FROM tab0 cor0.
44e0: 0a 2d 2d 2d 2d 0d 0a 35 30 0d 0a 35 30 0d 0a 35  .----..50..50..5
44f0: 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  0....query I row
4500: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63  sort..SELECT - c
4510: 6f 6c 31 20 2a 20 33 34 20 2a 20 2d 20 74 61 62  ol1 * 34 * - tab
4520: 30 2e 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46  0.col1 AS col2 F
4530: 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab0..----..
4540: 32 35 31 34 36 34 0d 0a 32 38 31 35 35 34 0d 0a  251464..281554..
4550: 33 31 39 39 30 36 0d 0a 0d 0a 71 75 65 72 79 20  319906....query 
4560: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
4570: 54 20 2d 20 63 6f 6c 30 20 2a 20 2b 20 74 61 62  T - col0 * + tab
4580: 30 2e 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30  0.col0 FROM tab0
4590: 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32 32 35 0d 0a 2d  ..----..-1225..-
45a0: 35 37 36 0d 0a 2d 37 39 32 31 0d 0a 0d 0a 73 6b  576..-7921....sk
45b0: 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
45c0: 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
45d0: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
45e0: 4c 45 43 54 20 63 6f 6c 31 20 2d 20 43 41 53 54  LECT col1 - CAST
45f0: 20 28 20 2b 20 63 6f 6c 32 20 41 53 20 52 45 41   ( + col2 AS REA
4600: 4c 20 29 20 2a 20 74 61 62 30 2e 63 6f 6c 31 20  L ) * tab0.col1 
4610: 2a 20 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46  * col2 AS col2 F
4620: 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab0..----..
4630: 2d 36 31 31 37 39 33 0d 0a 2d 39 33 35 36 38 0d  -611793..-93568.
4640: 0a 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  .0....query I ro
4650: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
4660: 63 6f 6c 32 20 2a 20 63 6f 6c 32 20 2a 20 63 6f  col2 * col2 * co
4670: 6c 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d  l1 FROM tab0..--
4680: 2d 2d 0d 0a 36 31 31 38 38 34 0d 0a 39 33 36 35  --..611884..9365
4690: 34 0d 0a 39 37 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  4..97....onlyif 
46a0: 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20  mysql # support 
46b0: 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66  for MySQL specif
46c0: 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20  ic system types 
46d0: 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72  and syntax..quer
46e0: 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
46f0: 6c 2d 31 32 32 0d 0a 53 45 4c 45 43 54 20 41 4c  l-122..SELECT AL
4700: 4c 20 2b 20 2b 20 31 30 20 2a 20 63 6f 6c 30 20  L + + 10 * col0 
4710: 2b 20 63 6f 6c 30 20 2a 20 2b 20 43 41 53 54 28  + col0 * + CAST(
4720: 20 2d 20 38 34 20 41 53 20 53 49 47 4e 45 44 20   - 84 AS SIGNED 
4730: 29 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  ) FROM tab2 AS c
4740: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 31 38 0d  or0..----..-518.
4750: 0a 2d 35 37 37 32 0d 0a 2d 35 38 34 36 0d 0a 0d  .-5772..-5846...
4760: 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
4770: 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
4780: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
4790: 6c 61 62 65 6c 2d 31 32 32 0d 0a 53 45 4c 45 43  label-122..SELEC
47a0: 54 20 41 4c 4c 20 2b 20 2b 20 31 30 20 2a 20 63  T ALL + + 10 * c
47b0: 6f 6c 30 20 2b 20 63 6f 6c 30 20 2a 20 2b 20 43  ol0 + col0 * + C
47c0: 41 53 54 20 28 20 2d 20 38 34 20 41 53 20 49 4e  AST ( - 84 AS IN
47d0: 54 45 47 45 52 20 29 20 46 52 4f 4d 20 74 61 62  TEGER ) FROM tab
47e0: 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
47f0: 0a 2d 35 31 38 0d 0a 2d 35 37 37 32 0d 0a 2d 35  .-518..-5772..-5
4800: 38 34 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  846....query I r
4810: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
4820: 49 53 54 49 4e 43 54 20 2b 20 63 6f 72 30 2e 63  ISTINCT + cor0.c
4830: 6f 6c 31 20 2a 20 2b 20 63 6f 6c 30 20 46 52 4f  ol1 * + col0 FRO
4840: 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
4850: 2d 2d 2d 2d 0d 0a 31 33 34 33 0d 0a 32 31 37 0d  ----..1343..217.
4860: 0a 34 36 30 32 0d 0a 0d 0a 71 75 65 72 79 20 49  .4602....query I
4870: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
4880: 20 41 4c 4c 20 2b 20 38 32 20 2a 20 63 6f 72 30   ALL + 82 * cor0
4890: 2e 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c 31 20 46  .col0 + + col1 F
48a0: 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
48b0: 0d 0a 2d 2d 2d 2d 0d 0a 32 30 35 34 0d 0a 32 39  ..----..2054..29
48c0: 36 37 0d 0a 37 33 38 39 0d 0a 0d 0a 6f 6e 6c 79  67..7389....only
48d0: 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f  if mysql # suppo
48e0: 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65  rt for MySQL spe
48f0: 63 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70  cific system typ
4900: 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71  es and syntax..q
4910: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
4920: 61 62 65 6c 2d 31 32 35 0d 0a 53 45 4c 45 43 54  abel-125..SELECT
4930: 20 44 49 53 54 49 4e 43 54 20 43 41 53 54 28 20   DISTINCT CAST( 
4940: 39 32 20 41 53 20 53 49 47 4e 45 44 20 29 20 2f  92 AS SIGNED ) /
4950: 20 63 6f 6c 30 20 2b 20 43 41 53 54 28 20 4e 55   col0 + CAST( NU
4960: 4c 4c 20 41 53 20 53 49 47 4e 45 44 20 29 20 2a  LL AS SIGNED ) *
4970: 20 2b 20 32 34 20 2a 20 63 6f 6c 31 20 46 52 4f   + 24 * col1 FRO
4980: 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
4990: 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b  ----..NULL....sk
49a0: 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
49b0: 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
49c0: 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
49d0: 65 6c 2d 31 32 35 0d 0a 53 45 4c 45 43 54 20 44  el-125..SELECT D
49e0: 49 53 54 49 4e 43 54 20 43 41 53 54 20 28 20 39  ISTINCT CAST ( 9
49f0: 32 20 41 53 20 49 4e 54 45 47 45 52 20 29 20 2f  2 AS INTEGER ) /
4a00: 20 63 6f 6c 30 20 2b 20 43 41 53 54 20 28 20 4e   col0 + CAST ( N
4a10: 55 4c 4c 20 41 53 20 49 4e 54 45 47 45 52 20 29  ULL AS INTEGER )
4a20: 20 2a 20 2b 20 32 34 20 2a 20 63 6f 6c 31 20 46   * + 24 * col1 F
4a30: 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
4a40: 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 0d 0a  ..----..NULL....
4a50: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
4a60: 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
4a70: 20 2b 20 63 6f 72 31 2e 63 6f 6c 31 20 2a 20 2d   + cor1.col1 * -
4a80: 20 39 37 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d   97 AS col0 FROM
4a90: 20 74 61 62 32 20 41 53 20 63 6f 72 30 20 43 52   tab2 AS cor0 CR
4aa0: 4f 53 53 20 4a 4f 49 4e 20 74 61 62 31 2c 20 74  OSS JOIN tab1, t
4ab0: 61 62 31 20 41 53 20 63 6f 72 31 2c 20 74 61 62  ab1 AS cor1, tab
4ac0: 30 2c 20 74 61 62 31 20 41 53 20 63 6f 72 32 0d  0, tab1 AS cor2.
4ad0: 0a 2d 2d 2d 2d 0d 0a 2d 31 32 36 31 0d 0a 2d 32  .----..-1261..-2
4ae0: 35 32 32 0d 0a 2d 39 37 30 0d 0a 0d 0a 71 75 65  522..-970....que
4af0: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
4b00: 4c 45 43 54 20 41 4c 4c 20 2d 20 28 20 2d 20 33  LECT ALL - ( - 3
4b10: 38 20 29 20 2b 20 2d 20 63 6f 6c 30 20 2a 20 63  8 ) + - col0 * c
4b20: 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol1 FROM tab0 AS
4b30: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 30   cor0..----..-20
4b40: 32 36 0d 0a 2d 33 33 35 37 0d 0a 2d 38 30 36 31  26..-3357..-8061
4b50: 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
4b60: 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61   # use DIV opera
4b70: 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20  tor for integer 
4b80: 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20  division..query 
4b90: 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
4ba0: 31 32 38 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 30  128..SELECT col0
4bb0: 20 44 49 56 20 2b 20 39 31 20 2b 20 2b 20 63 6f   DIV + 91 + + co
4bc0: 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l0 FROM tab1 AS 
4bd0: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 0d 0a 36  cor0..----..3..6
4be0: 34 0d 0a 38 30 0d 0a 0d 0a 73 6b 69 70 69 66 20  4..80....skipif 
4bf0: 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
4c00: 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
4c10: 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 32  rowsort label-12
4c20: 38 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 30 20 2f  8..SELECT col0 /
4c30: 20 2b 20 39 31 20 2b 20 2b 20 63 6f 6c 30 20 46   + 91 + + col0 F
4c40: 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
4c50: 0d 0a 2d 2d 2d 2d 0d 0a 33 0d 0a 36 34 0d 0a 38  ..----..3..64..8
4c60: 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  0....onlyif mysq
4c70: 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72  l # use DIV oper
4c80: 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72  ator for integer
4c90: 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79   division..query
4ca0: 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
4cb0: 2d 31 32 39 0d 0a 53 45 4c 45 43 54 20 2d 20 2b  -129..SELECT - +
4cc0: 20 63 6f 72 30 2e 63 6f 6c 31 20 44 49 56 20 35   cor0.col1 DIV 5
4cd0: 36 20 2d 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20  6 - + cor0.col0 
4ce0: 46 52 4f 4d 20 74 61 62 31 2c 20 74 61 62 30 20  FROM tab1, tab0 
4cf0: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39  AS cor0..----..9
4d00: 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20   values hashing 
4d10: 74 6f 20 66 32 31 35 38 63 38 37 65 63 36 63 63  to f2158c87ec6cc
4d20: 63 38 30 63 64 34 37 37 66 34 31 34 39 38 64 66  c80cd477f41498df
4d30: 63 66 39 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  cf9....skipif my
4d40: 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
4d50: 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
4d60: 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 32 39 0d  wsort label-129.
4d70: 0a 53 45 4c 45 43 54 20 2d 20 2b 20 63 6f 72 30  .SELECT - + cor0
4d80: 2e 63 6f 6c 31 20 2f 20 35 36 20 2d 20 2b 20 63  .col1 / 56 - + c
4d90: 6f 72 30 2e 63 6f 6c 30 20 46 52 4f 4d 20 74 61  or0.col0 FROM ta
4da0: 62 31 2c 20 74 61 62 30 20 41 53 20 63 6f 72 30  b1, tab0 AS cor0
4db0: 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73  ..----..9 values
4dc0: 20 68 61 73 68 69 6e 67 20 74 6f 20 66 32 31 35   hashing to f215
4dd0: 38 63 38 37 65 63 36 63 63 63 38 30 63 64 34 37  8c87ec6ccc80cd47
4de0: 37 66 34 31 34 39 38 64 66 63 66 39 0d 0a 0d 0a  7f41498dfcf9....
4df0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
4e00: 0a 53 45 4c 45 43 54 20 2b 20 74 61 62 31 2e 63  .SELECT + tab1.c
4e10: 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  ol0 AS col1 FROM
4e20: 20 74 61 62 31 2c 20 74 61 62 32 2c 20 74 61 62   tab1, tab2, tab
4e30: 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
4e40: 0a 32 37 20 76 61 6c 75 65 73 20 68 61 73 68 69  .27 values hashi
4e50: 6e 67 20 74 6f 20 37 37 38 62 35 30 35 37 35 61  ng to 778b50575a
4e60: 39 62 39 31 34 34 38 31 31 39 65 65 30 65 65 31  9b91448119ee0ee1
4e70: 61 39 63 34 34 66 0d 0a 0d 0a 71 75 65 72 79 20  a9c44f....query 
4e80: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
4e90: 54 20 2d 20 63 6f 6c 30 20 2b 20 31 20 46 52 4f  T - col0 + 1 FRO
4ea0: 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 36  M tab2..----..-6
4eb0: 0d 0a 2d 37 37 0d 0a 2d 37 38 0d 0a 0d 0a 71 75  ..-77..-78....qu
4ec0: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
4ed0: 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b  ELECT DISTINCT +
4ee0: 20 63 6f 6c 31 20 2b 20 63 6f 6c 31 20 41 53 20   col1 + col1 AS 
4ef0: 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 0d 0a  col1 FROM tab1..
4f00: 2d 2d 2d 2d 0d 0a 32 30 0d 0a 32 36 0d 0a 35 32  ----..20..26..52
4f10: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
4f20: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
4f30: 32 36 20 2b 20 37 37 20 46 52 4f 4d 20 74 61 62  26 + 77 FROM tab
4f40: 32 0d 0a 2d 2d 2d 2d 0d 0a 31 30 33 0d 0a 31 30  2..----..103..10
4f50: 33 0d 0a 31 30 33 0d 0a 0d 0a 71 75 65 72 79 20  3..103....query 
4f60: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
4f70: 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c  T DISTINCT + col
4f80: 32 20 2a 20 32 35 20 2b 20 63 6f 6c 31 20 46 52  2 * 25 + col1 FR
4f90: 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 37  OM tab2..----..7
4fa0: 30 36 0d 0a 37 30 39 0d 0a 39 36 37 0d 0a 0d 0a  06..709..967....
4fb0: 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75  onlyif mysql # u
4fc0: 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20  se DIV operator 
4fd0: 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69  for integer divi
4fe0: 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f  sion..query I ro
4ff0: 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 33 35 0d  wsort label-135.
5000: 0a 53 45 4c 45 43 54 20 2b 20 35 37 20 2a 20 63  .SELECT + 57 * c
5010: 6f 6c 31 20 2b 20 31 37 20 2a 20 31 36 20 44 49  ol1 + 17 * 16 DI
5020: 56 20 2d 20 63 6f 6c 31 20 41 53 20 63 6f 6c 30  V - col1 AS col0
5030: 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d   FROM tab0 cor0.
5040: 0a 2d 2d 2d 2d 0d 0a 34 38 39 39 0d 0a 35 31 38  .----..4899..518
5050: 35 0d 0a 35 35 32 37 0d 0a 0d 0a 73 6b 69 70 69  5..5527....skipi
5060: 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
5070: 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
5080: 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
5090: 31 33 35 0d 0a 53 45 4c 45 43 54 20 2b 20 35 37  135..SELECT + 57
50a0: 20 2a 20 63 6f 6c 31 20 2b 20 31 37 20 2a 20 31   * col1 + 17 * 1
50b0: 36 20 2f 20 2d 20 63 6f 6c 31 20 41 53 20 63 6f  6 / - col1 AS co
50c0: 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72  l0 FROM tab0 cor
50d0: 30 0d 0a 2d 2d 2d 2d 0d 0a 34 38 39 39 0d 0a 35  0..----..4899..5
50e0: 31 38 35 0d 0a 35 35 32 37 0d 0a 0d 0a 71 75 65  185..5527....que
50f0: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
5100: 4c 45 43 54 20 28 20 74 61 62 32 2e 63 6f 6c 31  LECT ( tab2.col1
5110: 20 29 20 2d 20 63 6f 6c 31 20 46 52 4f 4d 20 74   ) - col1 FROM t
5120: 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d  ab2..----..0..0.
5130: 0a 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  .0....query I ro
5140: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
5150: 4c 20 28 20 2b 20 63 6f 6c 30 20 2b 20 63 6f 6c  L ( + col0 + col
5160: 32 20 29 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  2 ) AS col2 FROM
5170: 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 30 34   tab2..----..104
5180: 0d 0a 31 31 37 0d 0a 33 34 0d 0a 0d 0a 71 75 65  ..117..34....que
5190: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
51a0: 4c 45 43 54 20 2d 20 33 31 20 46 52 4f 4d 20 74  LECT - 31 FROM t
51b0: 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
51c0: 2d 0d 0a 2d 33 31 0d 0a 2d 33 31 0d 0a 2d 33 31  -..-31..-31..-31
51d0: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
51e0: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
51f0: 2d 20 63 6f 72 30 2e 63 6f 6c 30 20 2a 20 63 6f  - cor0.col0 * co
5200: 72 30 2e 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  r0.col2 FROM tab
5210: 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
5220: 0a 2d 31 38 39 0d 0a 2d 32 30 32 38 0d 0a 2d 33  .-189..-2028..-3
5230: 30 30 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  002....query I r
5240: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 28  owsort..SELECT (
5250: 20 28 20 2d 20 63 6f 6c 30 20 29 20 29 20 2a 20   ( - col0 ) ) * 
5260: 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52 4f  col1 AS col0 FRO
5270: 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  M tab2..----..-1
5280: 33 34 33 0d 0a 2d 32 31 37 0d 0a 2d 34 36 30 32  343..-217..-4602
5290: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
52a0: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
52b0: 2d 20 63 6f 6c 32 20 2b 20 36 39 20 46 52 4f 4d  - col2 + 69 FROM
52c0: 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33   tab0..----..-13
52d0: 0d 0a 33 36 0d 0a 36 38 0d 0a 0d 0a 71 75 65 72  ..36..68....quer
52e0: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
52f0: 45 43 54 20 41 4c 4c 20 2b 20 39 30 20 2b 20 2b  ECT ALL + 90 + +
5300: 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 0d   col1 FROM tab2.
5310: 0a 2d 2d 2d 2d 0d 0a 31 30 37 0d 0a 31 32 31 0d  .----..107..121.
5320: 0a 31 34 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .149....query I 
5330: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
5340: 41 4c 4c 20 36 37 20 2b 20 2b 20 63 6f 6c 30 20  ALL 67 + + col0 
5350: 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d  FROM tab1..----.
5360: 0a 31 33 31 0d 0a 31 34 37 0d 0a 37 30 0d 0a 0d  .131..147..70...
5370: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
5380: 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63  ..SELECT ALL + c
5390: 6f 6c 32 20 2d 20 2d 20 31 37 20 2a 20 63 6f 6c  ol2 - - 17 * col
53a0: 30 20 46 52 4f 4d 20 74 61 62 32 20 63 6f 72 30  0 FROM tab2 cor0
53b0: 0d 0a 2d 2d 2d 2d 0d 0a 31 33 35 32 0d 0a 31 33  ..----..1352..13
53c0: 38 31 0d 0a 31 34 36 0d 0a 0d 0a 71 75 65 72 79  81..146....query
53d0: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
53e0: 43 54 20 2d 20 2d 20 63 6f 6c 30 20 2b 20 63 6f  CT - - col0 + co
53f0: 6c 31 20 2a 20 63 6f 6c 30 20 46 52 4f 4d 20 74  l1 * col0 FROM t
5400: 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
5410: 2d 0d 0a 31 31 32 30 0d 0a 37 30 34 0d 0a 38 31  -..1120..704..81
5420: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
5430: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
5440: 49 4e 43 54 20 63 6f 6c 30 20 2b 20 63 6f 72 30  INCT col0 + cor0
5450: 2e 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46 52  .col1 AS col2 FR
5460: 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
5470: 0a 2d 2d 2d 2d 0d 0a 31 31 30 0d 0a 31 33 32 0d  .----..110..132.
5480: 0a 31 38 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .180....query I 
5490: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
54a0: 41 4c 4c 20 2d 20 63 6f 6c 30 20 2d 20 63 6f 72  ALL - col0 - cor
54b0: 30 2e 63 6f 6c 30 20 2a 20 63 6f 6c 31 20 41 53  0.col0 * col1 AS
54c0: 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20   col2 FROM tab1 
54d0: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
54e0: 31 31 32 30 0d 0a 2d 37 30 34 0d 0a 2d 38 31 0d  1120..-704..-81.
54f0: 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
5500: 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74  # use DIV operat
5510: 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64  or for integer d
5520: 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49  ivision..query I
5530: 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
5540: 34 38 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 30 20  48..SELECT col0 
5550: 2b 20 2b 20 31 32 20 44 49 56 20 28 20 63 6f 6c  + + 12 DIV ( col
5560: 31 20 29 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  1 ) AS col1 FROM
5570: 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
5580: 2d 2d 2d 0d 0a 37 0d 0a 37 38 0d 0a 37 39 0d 0a  ---..7..78..79..
5590: 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
55a0: 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
55b0: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
55c0: 20 6c 61 62 65 6c 2d 31 34 38 0d 0a 53 45 4c 45   label-148..SELE
55d0: 43 54 20 63 6f 6c 30 20 2b 20 2b 20 31 32 20 2f  CT col0 + + 12 /
55e0: 20 28 20 63 6f 6c 31 20 29 20 41 53 20 63 6f 6c   ( col1 ) AS col
55f0: 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  1 FROM tab2 AS c
5600: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 37 0d 0a 37 38  or0..----..7..78
5610: 0d 0a 37 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..79....query I 
5620: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
5630: 63 6f 6c 32 20 2d 20 2d 20 63 6f 6c 31 20 46 52  col2 - - col1 FR
5640: 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31  OM tab1..----..1
5650: 30 39 0d 0a 36 37 0d 0a 38 30 0d 0a 0d 0a 6f 6e  09..67..80....on
5660: 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
5670: 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
5680: 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
5690: 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
56a0: 6f 72 74 20 6c 61 62 65 6c 2d 31 35 30 0d 0a 53  ort label-150..S
56b0: 45 4c 45 43 54 20 28 20 63 6f 6c 30 20 29 20 2a  ELECT ( col0 ) *
56c0: 20 2d 20 38 37 20 2b 20 2d 20 63 6f 6c 32 20 44   - 87 + - col2 D
56d0: 49 56 20 2d 20 63 6f 6c 32 20 46 52 4f 4d 20 74  IV - col2 FROM t
56e0: 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 30 38 37  ab0..----..-2087
56f0: 0d 0a 2d 33 30 34 34 0d 0a 2d 37 37 34 32 0d 0a  ..-3044..-7742..
5700: 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
5710: 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
5720: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
5730: 20 6c 61 62 65 6c 2d 31 35 30 0d 0a 53 45 4c 45   label-150..SELE
5740: 43 54 20 28 20 63 6f 6c 30 20 29 20 2a 20 2d 20  CT ( col0 ) * - 
5750: 38 37 20 2b 20 2d 20 63 6f 6c 32 20 2f 20 2d 20  87 + - col2 / - 
5760: 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 0d 0a  col2 FROM tab0..
5770: 2d 2d 2d 2d 0d 0a 2d 32 30 38 37 0d 0a 2d 33 30  ----..-2087..-30
5780: 34 34 0d 0a 2d 37 37 34 32 0d 0a 0d 0a 71 75 65  44..-7742....que
5790: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
57a0: 4c 45 43 54 20 2b 20 31 34 20 41 53 20 63 6f 6c  LECT + 14 AS col
57b0: 31 20 46 52 4f 4d 20 74 61 62 31 2c 20 74 61 62  1 FROM tab1, tab
57c0: 32 2c 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  2, tab1 AS cor0.
57d0: 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75 65 73  .----..27 values
57e0: 20 68 61 73 68 69 6e 67 20 74 6f 20 34 30 39 63   hashing to 409c
57f0: 31 37 39 30 62 37 30 32 35 34 30 64 64 39 64 63  1790b702540dd9dc
5800: 30 36 37 63 31 39 36 35 62 37 63 30 0d 0a 0d 0a  067c1965b7c0....
5810: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
5820: 0a 53 45 4c 45 43 54 20 2b 20 34 32 20 41 53 20  .SELECT + 42 AS 
5830: 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 2c 20  col0 FROM tab1, 
5840: 74 61 62 32 20 41 53 20 63 6f 72 30 2c 20 74 61  tab2 AS cor0, ta
5850: 62 31 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d  b1 AS cor1..----
5860: 0d 0a 32 37 20 76 61 6c 75 65 73 20 68 61 73 68  ..27 values hash
5870: 69 6e 67 20 74 6f 20 33 32 35 61 61 64 61 32 32  ing to 325aada22
5880: 33 39 62 36 66 65 31 66 65 32 64 38 34 33 35 31  39b6fe1fe2d84351
5890: 35 61 65 38 63 35 65 0d 0a 0d 0a 71 75 65 72 79  5ae8c5e....query
58a0: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
58b0: 43 54 20 2d 20 37 35 20 2b 20 2d 20 63 6f 72 30  CT - 75 + - cor0
58c0: 2e 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 2c  .col0 FROM tab2,
58d0: 20 74 61 62 31 20 41 53 20 63 6f 72 30 2c 20 74   tab1 AS cor0, t
58e0: 61 62 31 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d  ab1 AS cor1..---
58f0: 2d 0d 0a 32 37 20 76 61 6c 75 65 73 20 68 61 73  -..27 values has
5900: 68 69 6e 67 20 74 6f 20 63 31 31 65 66 38 37 65  hing to c11ef87e
5910: 31 34 31 36 62 34 30 63 31 63 34 33 32 64 31 61  1416b40c1c432d1a
5920: 34 31 64 63 34 37 37 63 0d 0a 0d 0a 71 75 65 72  41dc477c....quer
5930: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
5940: 45 43 54 20 2b 20 2b 20 63 6f 6c 32 20 2d 20 2d  ECT + + col2 - -
5950: 20 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46 52   col2 AS col0 FR
5960: 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
5970: 0a 2d 2d 2d 2d 0d 0a 31 30 38 0d 0a 31 31 34 0d  .----..108..114.
5980: 0a 31 39 32 0d 0a 0d 0a 71 75 65 72 79 20 49 49  .192....query II
5990: 49 49 49 49 49 49 49 49 49 49 20 72 6f 77 73 6f  IIIIIIIIII rowso
59a0: 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2a  rt..SELECT ALL *
59b0: 20 46 52 4f 4d 20 74 61 62 30 2c 20 74 61 62 30   FROM tab0, tab0
59c0: 20 63 6f 72 30 2c 20 74 61 62 31 2c 20 74 61 62   cor0, tab1, tab
59d0: 31 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 39 37  1 cor1..----..97
59e0: 32 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67  2 values hashing
59f0: 20 74 6f 20 64 32 32 32 62 61 33 30 32 62 64 31   to d222ba302bd1
5a00: 64 64 64 31 63 38 62 32 64 64 66 31 61 34 64 30  ddd1c8b2ddf1a4d0
5a10: 62 30 37 61 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  b07a....onlyif m
5a20: 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f  ysql # use DIV o
5a30: 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65  perator for inte
5a40: 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75  ger division..qu
5a50: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
5a60: 62 65 6c 2d 31 35 36 0d 0a 53 45 4c 45 43 54 20  bel-156..SELECT 
5a70: 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 72 30 2e  DISTINCT - cor0.
5a80: 63 6f 6c 31 20 44 49 56 20 2d 20 34 35 20 46 52  col1 DIV - 45 FR
5a90: 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
5aa0: 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 31 0d 0a 0d 0a 73  .----..0..1....s
5ab0: 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
5ac0: 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
5ad0: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
5ae0: 62 65 6c 2d 31 35 36 0d 0a 53 45 4c 45 43 54 20  bel-156..SELECT 
5af0: 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 72 30 2e  DISTINCT - cor0.
5b00: 63 6f 6c 31 20 2f 20 2d 20 34 35 20 46 52 4f 4d  col1 / - 45 FROM
5b10: 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
5b20: 2d 2d 2d 0d 0a 30 0d 0a 31 0d 0a 0d 0a 71 75 65  ---..0..1....que
5b30: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
5b40: 4c 45 43 54 20 2b 20 63 6f 6c 30 20 2a 20 2b 20  LECT + col0 * + 
5b50: 31 38 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  18 FROM tab1 AS 
5b60: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 35 32  cor0..----..1152
5b70: 0d 0a 31 34 34 30 0d 0a 35 34 0d 0a 0d 0a 71 75  ..1440..54....qu
5b80: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
5b90: 45 4c 45 43 54 20 2b 20 63 6f 6c 32 20 2b 20 63  ELECT + col2 + c
5ba0: 6f 72 30 2e 63 6f 6c 31 20 2a 20 63 6f 6c 32 20  or0.col1 * col2 
5bb0: 2b 20 2d 20 63 6f 6c 31 20 41 53 20 63 6f 6c 32  + - col1 AS col2
5bc0: 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
5bd0: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33 33 31 0d 0a  r0..----..1331..
5be0: 31 34 33 32 0d 0a 36 31 37 0d 0a 0d 0a 6f 6e 6c  1432..617....onl
5bf0: 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70  yif mysql # supp
5c00: 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70  ort for MySQL sp
5c10: 65 63 69 66 69 63 20 73 79 73 74 65 6d 20 74 79  ecific system ty
5c20: 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a  pes and syntax..
5c30: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
5c40: 6c 61 62 65 6c 2d 31 35 39 0d 0a 53 45 4c 45 43  label-159..SELEC
5c50: 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c  T DISTINCT + col
5c60: 31 20 2b 20 2d 20 43 41 53 54 28 20 4e 55 4c 4c  1 + - CAST( NULL
5c70: 20 41 53 20 53 49 47 4e 45 44 20 29 20 46 52 4f   AS SIGNED ) FRO
5c80: 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
5c90: 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b  ----..NULL....sk
5ca0: 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
5cb0: 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
5cc0: 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
5cd0: 65 6c 2d 31 35 39 0d 0a 53 45 4c 45 43 54 20 44  el-159..SELECT D
5ce0: 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c 31 20 2b  ISTINCT + col1 +
5cf0: 20 2d 20 43 41 53 54 20 28 20 4e 55 4c 4c 20 41   - CAST ( NULL A
5d00: 53 20 49 4e 54 45 47 45 52 20 29 20 46 52 4f 4d  S INTEGER ) FROM
5d10: 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
5d20: 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75 65  ---..NULL....que
5d30: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
5d40: 4c 45 43 54 20 2b 20 63 6f 6c 32 20 2a 20 63 6f  LECT + col2 * co
5d50: 6c 32 20 2d 20 2b 20 63 6f 6c 32 20 46 52 4f 4d  l2 - + col2 FROM
5d60: 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
5d70: 2d 2d 2d 0d 0a 31 34 30 36 0d 0a 36 35 30 0d 0a  ---..1406..650..
5d80: 37 30 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  702....query I r
5d90: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
5da0: 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c 30 20 2a  ISTINCT + col0 *
5db0: 20 36 31 20 2b 20 2b 20 63 6f 6c 31 20 2b 20 2d   61 + + col1 + -
5dc0: 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20   col1 FROM tab1 
5dd0: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
5de0: 38 33 0d 0a 33 39 30 34 0d 0a 34 38 38 30 0d 0a  83..3904..4880..
5df0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
5e00: 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20  t..SELECT ALL - 
5e10: 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c 32 20 41 53  col1 * - col2 AS
5e20: 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20   col1 FROM tab1 
5e30: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
5e40: 32 34 38 0d 0a 31 34 30 34 0d 0a 35 37 30 0d 0a  248..1404..570..
5e50: 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
5e60: 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53   support for MyS
5e70: 51 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74  QL specific syst
5e80: 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e  em types and syn
5e90: 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  tax..query I row
5ea0: 73 6f 72 74 20 6c 61 62 65 6c 2d 31 36 33 0d 0a  sort label-163..
5eb0: 53 45 4c 45 43 54 20 2d 20 63 6f 6c 32 20 2b 20  SELECT - col2 + 
5ec0: 43 41 53 54 28 20 4e 55 4c 4c 20 41 53 20 53 49  CAST( NULL AS SI
5ed0: 47 4e 45 44 20 29 20 2b 20 2b 20 32 35 20 2a 20  GNED ) + + 25 * 
5ee0: 2d 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32  - col2 FROM tab2
5ef0: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c   cor0..----..NUL
5f00: 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d  L..NULL..NULL...
5f10: 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
5f20: 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
5f30: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
5f40: 6c 61 62 65 6c 2d 31 36 33 0d 0a 53 45 4c 45 43  label-163..SELEC
5f50: 54 20 2d 20 63 6f 6c 32 20 2b 20 43 41 53 54 20  T - col2 + CAST 
5f60: 28 20 4e 55 4c 4c 20 41 53 20 49 4e 54 45 47 45  ( NULL AS INTEGE
5f70: 52 20 29 20 2b 20 2b 20 32 35 20 2a 20 2d 20 63  R ) + + 25 * - c
5f80: 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 63 6f  ol2 FROM tab2 co
5f90: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a  r0..----..NULL..
5fa0: 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75  NULL..NULL....qu
5fb0: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
5fc0: 45 4c 45 43 54 20 63 6f 6c 30 20 2a 20 2b 20 63  ELECT col0 * + c
5fd0: 6f 72 30 2e 63 6f 6c 30 20 2d 20 2b 20 63 6f 6c  or0.col0 - + col
5fe0: 32 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  2 AS col1 FROM t
5ff0: 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
6000: 2d 0d 0a 31 32 32 34 0d 0a 35 34 33 0d 0a 37 38  -..1224..543..78
6010: 33 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  39....query I ro
6020: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
6030: 63 6f 6c 32 20 2a 20 63 6f 6c 30 20 2d 20 2b 20  col2 * col0 - + 
6040: 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46 52 4f  col2 AS col0 FRO
6050: 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
6060: 2d 2d 2d 2d 0d 0a 2d 32 31 36 0d 0a 2d 33 37 30  ----..-216..-370
6070: 35 0d 0a 2d 37 37 37 36 0d 0a 0d 0a 71 75 65 72  5..-7776....quer
6080: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
6090: 45 43 54 20 41 4c 4c 20 2d 20 2b 20 63 6f 72 30  ECT ALL - + cor0
60a0: 2e 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46 52  .col0 AS col0 FR
60b0: 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d  OM tab1 cor0..--
60c0: 2d 2d 0d 0a 2d 33 0d 0a 2d 36 34 0d 0a 2d 38 30  --..-3..-64..-80
60d0: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
60e0: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
60f0: 49 4e 43 54 20 63 6f 72 30 2e 63 6f 6c 30 20 2a  INCT cor0.col0 *
6100: 20 63 6f 72 30 2e 63 6f 6c 30 20 2b 20 2d 20 33   cor0.col0 + - 3
6110: 38 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  8 FROM tab1 AS c
6120: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 39 0d 0a  or0..----..-29..
6130: 34 30 35 38 0d 0a 36 33 36 32 0d 0a 0d 0a 71 75  4058..6362....qu
6140: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
6150: 45 4c 45 43 54 20 2d 20 63 6f 72 30 2e 63 6f 6c  ELECT - cor0.col
6160: 31 20 2a 20 2b 20 33 30 20 2b 20 63 6f 6c 31 20  1 * + 30 + col1 
6170: 2b 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32  + col2 FROM tab2
6180: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
6190: 2d 31 36 38 35 0d 0a 2d 34 35 35 0d 0a 2d 38 37  -1685..-455..-87
61a0: 32 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  2....onlyif mysq
61b0: 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72  l # use DIV oper
61c0: 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72  ator for integer
61d0: 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79   division..query
61e0: 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
61f0: 2d 31 36 39 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  -169..SELECT ALL
6200: 20 63 6f 6c 32 20 2a 20 63 6f 6c 31 20 44 49 56   col2 * col1 DIV
6210: 20 2b 20 28 20 2d 20 63 6f 6c 31 20 29 20 41 53   + ( - col1 ) AS
6220: 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 0d   col1 FROM tab1.
6230: 0a 2d 2d 2d 2d 0d 0a 2d 35 34 0d 0a 2d 35 37 0d  .----..-54..-57.
6240: 0a 2d 39 36 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  .-96....skipif m
6250: 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
6260: 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
6270: 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 36 39  owsort label-169
6280: 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c  ..SELECT ALL col
6290: 32 20 2a 20 63 6f 6c 31 20 2f 20 2b 20 28 20 2d  2 * col1 / + ( -
62a0: 20 63 6f 6c 31 20 29 20 41 53 20 63 6f 6c 31 20   col1 ) AS col1 
62b0: 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d  FROM tab1..----.
62c0: 0a 2d 35 34 0d 0a 2d 35 37 0d 0a 2d 39 36 0d 0a  .-54..-57..-96..
62d0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
62e0: 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 28 20  t..SELECT ALL ( 
62f0: 2b 20 63 6f 6c 31 20 29 20 2a 20 2d 20 63 6f 6c  + col1 ) * - col
6300: 31 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  1 AS col1 FROM t
6310: 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 37 33 39 36  ab0..----..-7396
6320: 0d 0a 2d 38 32 38 31 0d 0a 2d 39 34 30 39 0d 0a  ..-8281..-9409..
6330: 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
6340: 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f   use DIV operato
6350: 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69  r for integer di
6360: 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20  vision..query I 
6370: 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 37  rowsort label-17
6380: 31 0d 0a 53 45 4c 45 43 54 20 2b 20 33 20 44 49  1..SELECT + 3 DI
6390: 56 20 63 6f 6c 31 20 2b 20 63 6f 6c 30 20 46 52  V col1 + col0 FR
63a0: 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 33  OM tab1..----..3
63b0: 0d 0a 36 34 0d 0a 38 30 0d 0a 0d 0a 73 6b 69 70  ..64..80....skip
63c0: 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
63d0: 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
63e0: 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
63f0: 2d 31 37 31 0d 0a 53 45 4c 45 43 54 20 2b 20 33  -171..SELECT + 3
6400: 20 2f 20 63 6f 6c 31 20 2b 20 63 6f 6c 30 20 46   / col1 + col0 F
6410: 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab1..----..
6420: 33 0d 0a 36 34 0d 0a 38 30 0d 0a 0d 0a 71 75 65  3..64..80....que
6430: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
6440: 4c 45 43 54 20 2d 20 35 31 20 41 53 20 63 6f 6c  LECT - 51 AS col
6450: 30 20 46 52 4f 4d 20 74 61 62 31 2c 20 74 61 62  0 FROM tab1, tab
6460: 30 20 41 53 20 63 6f 72 30 2c 20 74 61 62 30 20  0 AS cor0, tab0 
6470: 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76  cor1..----..27 v
6480: 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f  alues hashing to
6490: 20 32 37 62 63 63 33 31 34 33 33 63 65 39 30 38   27bcc31433ce908
64a0: 33 33 65 64 37 36 36 31 39 63 62 64 38 64 36 61  33ed76619cbd8d6a
64b0: 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  4....query I row
64c0: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
64d0: 54 49 4e 43 54 20 36 38 20 2a 20 63 6f 6c 30 20  TINCT 68 * col0 
64e0: 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
64f0: 30 0d 0a 2d 2d 2d 2d 0d 0a 31 36 33 32 0d 0a 32  0..----..1632..2
6500: 33 38 30 0d 0a 36 30 35 32 0d 0a 0d 0a 71 75 65  380..6052....que
6510: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
6520: 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20  LECT DISTINCT + 
6530: 63 6f 6c 30 20 2a 20 2d 20 63 6f 72 30 2e 63 6f  col0 * - cor0.co
6540: 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l2 FROM tab1 AS 
6550: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 36 32  cor0..----..-162
6560: 0d 0a 2d 33 36 34 38 0d 0a 2d 37 36 38 30 0d 0a  ..-3648..-7680..
6570: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
6580: 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20  t..SELECT ALL + 
6590: 63 6f 72 30 2e 63 6f 6c 30 20 2b 20 63 6f 72 30  cor0.col0 + cor0
65a0: 2e 63 6f 6c 30 20 2a 20 32 31 20 2a 20 2d 20 37  .col0 * 21 * - 7
65b0: 34 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  4 AS col0 FROM t
65c0: 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
65d0: 2d 0d 0a 2d 31 33 38 32 31 37 0d 0a 2d 33 37 32  -..-138217..-372
65e0: 37 32 0d 0a 2d 35 34 33 35 35 0d 0a 0d 0a 73 6b  72..-54355....sk
65f0: 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20  ipif postgresql 
6600: 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71  # PostgreSQL req
6610: 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65  uires AS when re
6620: 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f  naming output co
6630: 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72  lumns..query I r
6640: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
6650: 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c 31 20 2b  ISTINCT + col1 +
6660: 20 63 6f 72 30 2e 63 6f 6c 32 20 2a 20 2b 20 37   cor0.col2 * + 7
6670: 31 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30  1 col1 FROM tab0
6680: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
6690: 31 36 38 0d 0a 32 34 32 39 0d 0a 35 39 31 33 0d  168..2429..5913.
66a0: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
66b0: 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c  rt..SELECT + col
66c0: 32 20 2b 20 28 20 2b 20 63 6f 6c 32 20 29 20 2a  2 + ( + col2 ) *
66d0: 20 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46 52   col1 AS col1 FR
66e0: 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
66f0: 0a 2d 2d 2d 2d 0d 0a 32 38 37 31 0d 0a 37 35 34  .----..2871..754
6700: 34 0d 0a 39 38 0d 0a 0d 0a 71 75 65 72 79 20 49  4..98....query I
6710: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
6720: 20 2d 20 63 6f 72 30 2e 63 6f 6c 30 20 2b 20 2b   - cor0.col0 + +
6730: 20 28 20 38 20 2b 20 63 6f 6c 30 20 29 20 2a 20   ( 8 + col0 ) * 
6740: 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46 52 4f  col1 AS col1 FRO
6750: 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
6760: 2d 2d 2d 2d 0d 0a 32 37 32 38 0d 0a 34 31 33 36  ----..2728..4136
6770: 0d 0a 38 37 33 38 0d 0a 0d 0a 71 75 65 72 79 20  ..8738....query 
6780: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
6790: 54 20 2b 20 2d 20 63 6f 72 30 2e 63 6f 6c 31 20  T + - cor0.col1 
67a0: 2a 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31  * col0 FROM tab1
67b0: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
67c0: 2d 31 30 34 30 0d 0a 2d 36 34 30 0d 0a 2d 37 38  -1040..-640..-78
67d0: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
67e0: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2b 20  ort..SELECT - + 
67f0: 63 6f 72 30 2e 63 6f 6c 30 20 2a 20 2d 20 37 20  cor0.col0 * - 7 
6800: 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
6810: 30 0d 0a 2d 2d 2d 2d 0d 0a 32 31 0d 0a 34 34 38  0..----..21..448
6820: 0d 0a 35 36 30 0d 0a 0d 0a 71 75 65 72 79 20 49  ..560....query I
6830: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
6840: 20 2b 20 2b 20 63 6f 6c 31 20 2b 20 2b 20 63 6f   + + col1 + + co
6850: 72 30 2e 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c 30  r0.col1 * + col0
6860: 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d   FROM tab0 cor0.
6870: 0a 2d 2d 2d 2d 0d 0a 32 31 35 30 0d 0a 33 34 39  .----..2150..349
6880: 32 0d 0a 38 31 39 30 0d 0a 0d 0a 71 75 65 72 79  2..8190....query
6890: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
68a0: 43 54 20 2d 20 63 6f 6c 31 20 2b 20 63 6f 6c 30  CT - col1 + col0
68b0: 20 2a 20 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20   * col1 AS col2 
68c0: 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d  FROM tab1..----.
68d0: 0a 31 30 32 37 0d 0a 35 32 0d 0a 36 33 30 0d 0a  .1027..52..630..
68e0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
68f0: 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
6900: 43 54 20 63 6f 6c 31 20 2b 20 2b 20 63 6f 6c 32  CT col1 + + col2
6910: 20 2a 20 2d 20 63 6f 6c 30 20 46 52 4f 4d 20 74   * - col0 FROM t
6920: 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 35 38 0d  ab2..----..-158.
6930: 0a 2d 31 39 36 39 0d 0a 2d 32 39 38 35 0d 0a 0d  .-1969..-2985...
6940: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
6950: 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 31 20  ..SELECT + col1 
6960: 2b 20 2d 20 63 6f 72 30 2e 63 6f 6c 31 20 2a 20  + - cor0.col1 * 
6970: 33 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  30 AS col1 FROM 
6980: 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
6990: 2d 2d 0d 0a 2d 32 39 30 0d 0a 2d 33 37 37 0d 0a  --..-290..-377..
69a0: 2d 37 35 34 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  -754....onlyif m
69b0: 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f  ysql # use DIV o
69c0: 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65  perator for inte
69d0: 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75  ger division..qu
69e0: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
69f0: 62 65 6c 2d 31 38 35 0d 0a 53 45 4c 45 43 54 20  bel-185..SELECT 
6a00: 63 6f 6c 32 20 44 49 56 20 2b 20 63 6f 6c 32 20  col2 DIV + col2 
6a10: 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
6a20: 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
6a30: 0a 31 0d 0a 31 0d 0a 31 0d 0a 0d 0a 73 6b 69 70  .1..1..1....skip
6a40: 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
6a50: 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
6a60: 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
6a70: 2d 31 38 35 0d 0a 53 45 4c 45 43 54 20 63 6f 6c  -185..SELECT col
6a80: 32 20 2f 20 2b 20 63 6f 6c 32 20 41 53 20 63 6f  2 / + col2 AS co
6a90: 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l2 FROM tab0 AS 
6aa0: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 0d 0a 31  cor0..----..1..1
6ab0: 0d 0a 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  ..1....query I r
6ac0: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
6ad0: 49 53 54 49 4e 43 54 20 63 6f 6c 32 20 2a 20 2b  ISTINCT col2 * +
6ae0: 20 63 6f 6c 30 20 2a 20 35 20 2b 20 2b 20 63 6f   col0 * 5 + + co
6af0: 6c 30 20 2b 20 2d 20 63 6f 6c 32 20 41 53 20 63  l0 + - col2 AS c
6b00: 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d  ol0 FROM tab1..-
6b10: 2d 2d 2d 0d 0a 31 38 32 34 37 0d 0a 33 38 33 38  ---..18247..3838
6b20: 34 0d 0a 37 35 39 0d 0a 0d 0a 6f 6e 6c 79 69 66  4..759....onlyif
6b30: 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74   mysql # support
6b40: 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69   for MySQL speci
6b50: 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73  fic system types
6b60: 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65   and syntax..que
6b70: 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
6b80: 65 6c 2d 31 38 37 0d 0a 53 45 4c 45 43 54 20 43  el-187..SELECT C
6b90: 41 53 54 28 20 4e 55 4c 4c 20 41 53 20 53 49 47  AST( NULL AS SIG
6ba0: 4e 45 44 20 29 20 46 52 4f 4d 20 74 61 62 30 2c  NED ) FROM tab0,
6bb0: 20 74 61 62 31 20 63 6f 72 30 2c 20 74 61 62 30   tab1 cor0, tab0
6bc0: 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a   AS cor1..----..
6bd0: 32 37 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e  27 values hashin
6be0: 67 20 74 6f 20 31 36 62 65 38 38 36 38 61 31 65  g to 16be8868a1e
6bf0: 36 66 34 65 38 38 35 30 35 30 39 66 39 33 32 37  6f4e8850509f9327
6c00: 61 66 65 39 30 0d 0a 0d 0a 73 6b 69 70 69 66 20  afe90....skipif 
6c10: 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
6c20: 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
6c30: 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 38  rowsort label-18
6c40: 37 0d 0a 53 45 4c 45 43 54 20 43 41 53 54 20 28  7..SELECT CAST (
6c50: 20 4e 55 4c 4c 20 41 53 20 49 4e 54 45 47 45 52   NULL AS INTEGER
6c60: 20 29 20 46 52 4f 4d 20 74 61 62 30 2c 20 74 61   ) FROM tab0, ta
6c70: 62 31 20 63 6f 72 30 2c 20 74 61 62 30 20 41 53  b1 cor0, tab0 AS
6c80: 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20   cor1..----..27 
6c90: 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74  values hashing t
6ca0: 6f 20 31 36 62 65 38 38 36 38 61 31 65 36 66 34  o 16be8868a1e6f4
6cb0: 65 38 38 35 30 35 30 39 66 39 33 32 37 61 66 65  e8850509f9327afe
6cc0: 39 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  90....query I ro
6cd0: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
6ce0: 4c 20 2b 20 63 6f 6c 30 20 2a 20 28 20 2d 20 63  L + col0 * ( - c
6cf0: 6f 6c 31 20 29 20 2b 20 36 31 20 46 52 4f 4d 20  ol1 ) + 61 FROM 
6d00: 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
6d10: 2d 2d 0d 0a 2d 31 32 38 32 0d 0a 2d 31 35 36 0d  --..-1282..-156.
6d20: 0a 2d 34 35 34 31 0d 0a 0d 0a 71 75 65 72 79 20  .-4541....query 
6d30: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
6d40: 54 20 44 49 53 54 49 4e 43 54 20 2b 20 2d 20 38  T DISTINCT + - 8
6d50: 37 20 2a 20 2d 20 34 35 20 2b 20 2d 20 63 6f 6c  7 * - 45 + - col
6d60: 31 20 2a 20 63 6f 6c 32 20 2b 20 63 6f 72 30 2e  1 * col2 + cor0.
6d70: 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c 32 20 41 53  col1 * - col2 AS
6d80: 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20   col0 FROM tab2 
6d90: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32  AS cor0..----..2
6da0: 32 34 31 0d 0a 32 36 32 33 0d 0a 38 34 37 0d 0a  241..2623..847..
6db0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
6dc0: 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
6dd0: 43 54 20 2d 20 38 37 20 2a 20 2d 20 28 20 2d 20  CT - 87 * - ( - 
6de0: 63 6f 6c 32 20 29 20 2b 20 63 6f 6c 30 20 2a 20  col2 ) + col0 * 
6df0: 63 6f 72 30 2e 63 6f 6c 30 20 46 52 4f 4d 20 74  cor0.col0 FROM t
6e00: 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab0 cor0..----..
6e10: 2d 32 32 39 35 0d 0a 31 31 33 38 0d 0a 37 38 37  -2295..1138..787
6e20: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
6e30: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
6e40: 49 4e 43 54 20 63 6f 72 30 2e 63 6f 6c 30 20 2b  INCT cor0.col0 +
6e50: 20 2b 20 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c 32   + col0 * + col2
6e60: 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
6e70: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 39 36 0d 0a 32  r0..----..196..2
6e80: 31 30 36 0d 0a 33 30 38 31 0d 0a 0d 0a 6f 6e 6c  106..3081....onl
6e90: 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20  yif mysql # use 
6ea0: 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72  DIV operator for
6eb0: 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f   integer divisio
6ec0: 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  n..query I rowso
6ed0: 72 74 20 6c 61 62 65 6c 2d 31 39 32 0d 0a 53 45  rt label-192..SE
6ee0: 4c 45 43 54 20 41 4c 4c 20 2d 20 2b 20 63 6f 6c  LECT ALL - + col
6ef0: 30 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 2a 20  0 + cor0.col1 * 
6f00: 2d 20 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c 32 20  - col0 + + col2 
6f10: 44 49 56 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f  DIV + col0 AS co
6f20: 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l0 FROM tab2 AS 
6f30: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 34 32  cor0..----..-142
6f40: 32 0d 0a 2d 32 32 31 0d 0a 2d 34 36 38 30 0d 0a  2..-221..-4680..
6f50: 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
6f60: 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
6f70: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
6f80: 20 6c 61 62 65 6c 2d 31 39 32 0d 0a 53 45 4c 45   label-192..SELE
6f90: 43 54 20 41 4c 4c 20 2d 20 2b 20 63 6f 6c 30 20  CT ALL - + col0 
6fa0: 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 2a 20 2d 20  + cor0.col1 * - 
6fb0: 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c 32 20 2f 20  col0 + + col2 / 
6fc0: 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46  + col0 AS col0 F
6fd0: 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
6fe0: 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 34 32 32 0d 0a 2d  ..----..-1422..-
6ff0: 32 32 31 0d 0a 2d 34 36 38 30 0d 0a 0d 0a 71 75  221..-4680....qu
7000: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
7010: 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 30  ELECT ALL - col0
7020: 20 2a 20 63 6f 72 30 2e 63 6f 6c 32 20 46 52 4f   * cor0.col2 FRO
7030: 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
7040: 2d 2d 2d 2d 0d 0a 2d 33 35 0d 0a 2d 37 32 39 38  ----..-35..-7298
7050: 0d 0a 2d 37 39 32 0d 0a 0d 0a 6f 6e 6c 79 69 66  ..-792....onlyif
7060: 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56   mysql # use DIV
7070: 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e   operator for in
7080: 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a  teger division..
7090: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
70a0: 6c 61 62 65 6c 2d 31 39 34 0d 0a 53 45 4c 45 43  label-194..SELEC
70b0: 54 20 44 49 53 54 49 4e 43 54 20 2b 20 39 36 20  T DISTINCT + 96 
70c0: 44 49 56 20 63 6f 72 30 2e 63 6f 6c 30 20 2b 20  DIV cor0.col0 + 
70d0: 63 6f 6c 31 20 2a 20 39 35 20 2b 20 2d 20 39 30  col1 * 95 + - 90
70e0: 20 44 49 56 20 2d 20 63 6f 72 30 2e 63 6f 6c 31   DIV - cor0.col1
70f0: 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
7100: 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
7110: 0d 0a 38 31 37 35 0d 0a 38 36 34 36 0d 0a 39 32  ..8175..8646..92
7120: 31 37 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  17....skipif mys
7130: 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
7140: 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
7150: 73 6f 72 74 20 6c 61 62 65 6c 2d 31 39 34 0d 0a  sort label-194..
7160: 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
7170: 2b 20 39 36 20 2f 20 63 6f 72 30 2e 63 6f 6c 30  + 96 / cor0.col0
7180: 20 2b 20 63 6f 6c 31 20 2a 20 39 35 20 2b 20 2d   + col1 * 95 + -
7190: 20 39 30 20 2f 20 2d 20 63 6f 72 30 2e 63 6f 6c   90 / - cor0.col
71a0: 31 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  1 AS col1 FROM t
71b0: 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
71c0: 2d 0d 0a 38 31 37 35 0d 0a 38 36 34 36 0d 0a 39  -..8175..8646..9
71d0: 32 31 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  217....query I r
71e0: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
71f0: 20 2d 20 39 31 20 46 52 4f 4d 20 74 61 62 30 20   - 91 FROM tab0 
7200: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 31 0d 0a  cor0..----..91..
7210: 39 31 0d 0a 39 31 0d 0a 0d 0a 6f 6e 6c 79 69 66  91..91....onlyif
7220: 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74   mysql # support
7230: 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69   for MySQL speci
7240: 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73  fic system types
7250: 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65   and syntax..que
7260: 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
7270: 65 6c 2d 31 39 36 0d 0a 53 45 4c 45 43 54 20 41  el-196..SELECT A
7280: 4c 4c 20 2b 20 2b 20 43 41 53 54 28 20 4e 55 4c  LL + + CAST( NUL
7290: 4c 20 41 53 20 53 49 47 4e 45 44 20 29 20 2a 20  L AS SIGNED ) * 
72a0: 63 6f 6c 31 20 2b 20 2b 20 63 6f 6c 30 20 41 53  col1 + + col0 AS
72b0: 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20   col1 FROM tab2 
72c0: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e  AS cor0..----..N
72d0: 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d  ULL..NULL..NULL.
72e0: 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
72f0: 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
7300: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
7310: 74 20 6c 61 62 65 6c 2d 31 39 36 0d 0a 53 45 4c  t label-196..SEL
7320: 45 43 54 20 41 4c 4c 20 2b 20 2b 20 43 41 53 54  ECT ALL + + CAST
7330: 20 28 20 4e 55 4c 4c 20 41 53 20 49 4e 54 45 47   ( NULL AS INTEG
7340: 45 52 20 29 20 2a 20 63 6f 6c 31 20 2b 20 2b 20  ER ) * col1 + + 
7350: 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46 52 4f  col0 AS col1 FRO
7360: 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
7370: 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c  ----..NULL..NULL
7380: 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 6f 6e 6c 79 69 66  ..NULL....onlyif
7390: 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74   mysql # support
73a0: 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69   for MySQL speci
73b0: 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73  fic system types
73c0: 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65   and syntax..que
73d0: 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
73e0: 65 6c 2d 31 39 37 0d 0a 53 45 4c 45 43 54 20 44  el-197..SELECT D
73f0: 49 53 54 49 4e 43 54 20 43 41 53 54 28 20 2d 20  ISTINCT CAST( - 
7400: 63 6f 6c 32 20 41 53 20 53 49 47 4e 45 44 20 29  col2 AS SIGNED )
7410: 20 2b 20 2b 20 63 6f 6c 32 20 2b 20 2d 20 63 6f   + + col2 + - co
7420: 6c 31 20 2a 20 2b 20 31 38 20 46 52 4f 4d 20 74  l1 * + 18 FROM t
7430: 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
7440: 2d 0d 0a 2d 31 35 34 38 0d 0a 2d 31 36 33 38 0d  -..-1548..-1638.
7450: 0a 2d 31 37 34 36 0d 0a 0d 0a 73 6b 69 70 69 66  .-1746....skipif
7460: 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
7470: 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
7480: 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
7490: 39 37 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  97..SELECT DISTI
74a0: 4e 43 54 20 43 41 53 54 20 28 20 2d 20 63 6f 6c  NCT CAST ( - col
74b0: 32 20 41 53 20 49 4e 54 45 47 45 52 20 29 20 2b  2 AS INTEGER ) +
74c0: 20 2b 20 63 6f 6c 32 20 2b 20 2d 20 63 6f 6c 31   + col2 + - col1
74d0: 20 2a 20 2b 20 31 38 20 46 52 4f 4d 20 74 61 62   * + 18 FROM tab
74e0: 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
74f0: 0a 2d 31 35 34 38 0d 0a 2d 31 36 33 38 0d 0a 2d  .-1548..-1638..-
7500: 31 37 34 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20  1746....query I 
7510: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
7520: 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c 32 20  DISTINCT - col2 
7530: 2b 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 41 53  + + cor0.col2 AS
7540: 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20   col0 FROM tab0 
7550: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30  AS cor0..----..0
7560: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
7570: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 39 36 20 2a  ort..SELECT 96 *
7580: 20 35 34 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d   54 AS col0 FROM
7590: 20 74 61 62 30 2c 20 74 61 62 32 20 41 53 20 63   tab0, tab2 AS c
75a0: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c  or0..----..9 val
75b0: 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 34  ues hashing to 4
75c0: 63 39 66 64 37 30 39 37 62 64 63 65 31 35 33 61  c9fd7097bdce153a
75d0: 31 38 35 37 36 30 61 33 33 36 33 61 66 32 33 0d  185760a3363af23.
75e0: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
75f0: 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d  rt..SELECT ALL -
7600: 20 63 6f 6c 30 20 2a 20 2b 20 35 39 20 41 53 20   col0 * + 59 AS 
7610: 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 0d 0a  col1 FROM tab2..
7620: 2d 2d 2d 2d 0d 0a 2d 34 31 33 0d 0a 2d 34 36 30  ----..-413..-460
7630: 32 0d 0a 2d 34 36 36 31 0d 0a 0d 0a 71 75 65 72  2..-4661....quer
7640: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
7650: 45 43 54 20 63 6f 6c 30 20 2b 20 74 61 62 30 2e  ECT col0 + tab0.
7660: 63 6f 6c 31 20 2a 20 63 6f 6c 30 20 46 52 4f 4d  col1 * col0 FROM
7670: 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 32 30 38   tab0..----..208
7680: 38 0d 0a 33 34 33 30 0d 0a 38 31 38 38 0d 0a 0d  8..3430..8188...
7690: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
76a0: 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 35  ..SELECT ALL - 5
76b0: 34 20 2a 20 63 6f 6c 31 20 2b 20 2b 20 63 6f 6c  4 * col1 + + col
76c0: 32 20 2b 20 2b 20 63 6f 6c 32 20 41 53 20 63 6f  2 + + col2 AS co
76d0: 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72  l0 FROM tab0 cor
76e0: 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 35 37 38 0d 0a  0..----..-4578..
76f0: 2d 34 37 35 30 0d 0a 2d 35 32 33 36 0d 0a 0d 0a  -4750..-5236....
7700: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
7710: 0a 53 45 4c 45 43 54 20 2b 20 2d 20 35 33 20 41  .SELECT + - 53 A
7720: 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31  S col1 FROM tab1
7730: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
7740: 2d 35 33 0d 0a 2d 35 33 0d 0a 2d 35 33 0d 0a 0d  -53..-53..-53...
7750: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
7760: 0d 0a 53 45 4c 45 43 54 20 2b 20 39 30 20 2a 20  ..SELECT + 90 * 
7770: 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46  + col0 AS col2 F
7780: 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab1..----..
7790: 32 37 30 0d 0a 35 37 36 30 0d 0a 37 32 30 30 0d  270..5760..7200.
77a0: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
77b0: 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 32 39 20  rt..SELECT + 29 
77c0: 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30  + col0 FROM tab0
77d0: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 38   cor0..----..118
77e0: 0d 0a 35 33 0d 0a 36 34 0d 0a 0d 0a 6f 6e 6c 79  ..53..64....only
77f0: 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44  if mysql # use D
7800: 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20  IV operator for 
7810: 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e  integer division
7820: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
7830: 74 20 6c 61 62 65 6c 2d 32 30 36 0d 0a 53 45 4c  t label-206..SEL
7840: 45 43 54 20 63 6f 6c 31 20 44 49 56 20 63 6f 72  ECT col1 DIV cor
7850: 30 2e 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46  0.col1 AS col2 F
7860: 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
7870: 0d 0a 2d 2d 2d 2d 0d 0a 31 0d 0a 31 0d 0a 31 0d  ..----..1..1..1.
7880: 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
7890: 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
78a0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
78b0: 74 20 6c 61 62 65 6c 2d 32 30 36 0d 0a 53 45 4c  t label-206..SEL
78c0: 45 43 54 20 63 6f 6c 31 20 2f 20 63 6f 72 30 2e  ECT col1 / cor0.
78d0: 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46 52 4f  col1 AS col2 FRO
78e0: 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
78f0: 2d 2d 2d 2d 0d 0a 31 0d 0a 31 0d 0a 31 0d 0a 0d  ----..1..1..1...
7900: 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
7910: 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72  use DIV operator
7920: 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76   for integer div
7930: 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72  ision..query I r
7940: 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 32 30 37  owsort label-207
7950: 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
7960: 54 20 2b 20 63 6f 6c 30 20 2b 20 63 6f 6c 30 20  T + col0 + col0 
7970: 44 49 56 20 63 6f 6c 30 20 2d 20 2b 20 43 41 53  DIV col0 - + CAS
7980: 54 28 20 63 6f 6c 32 20 41 53 20 53 49 47 4e 45  T( col2 AS SIGNE
7990: 44 20 29 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d  D ) FROM tab1..-
79a0: 2d 2d 2d 0d 0a 2d 31 35 0d 0a 2d 35 30 0d 0a 38  ---..-15..-50..8
79b0: 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
79c0: 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
79d0: 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
79e0: 72 74 20 6c 61 62 65 6c 2d 32 30 37 0d 0a 53 45  rt label-207..SE
79f0: 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20  LECT DISTINCT + 
7a00: 63 6f 6c 30 20 2b 20 63 6f 6c 30 20 2f 20 63 6f  col0 + col0 / co
7a10: 6c 30 20 2d 20 2b 20 43 41 53 54 20 28 20 63 6f  l0 - + CAST ( co
7a20: 6c 32 20 41 53 20 49 4e 54 45 47 45 52 20 29 20  l2 AS INTEGER ) 
7a30: 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d  FROM tab1..----.
7a40: 0a 2d 31 35 0d 0a 2d 35 30 0d 0a 38 0d 0a 0d 0a  .-15..-50..8....
7a50: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
7a60: 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 33 20  .SELECT ALL + 3 
7a70: 2b 20 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c 32 20  + col0 + - col2 
7a80: 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
7a90: 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
7aa0: 0a 2d 31 37 0d 0a 34 34 0d 0a 35 35 0d 0a 0d 0a  .-17..44..55....
7ab0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
7ac0: 0a 53 45 4c 45 43 54 20 2b 20 34 37 20 41 53 20  .SELECT + 47 AS 
7ad0: 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 2c 20  col0 FROM tab2, 
7ae0: 74 61 62 30 2c 20 74 61 62 31 20 41 53 20 63 6f  tab0, tab1 AS co
7af0: 72 30 2c 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a  r0, tab1..----..
7b00: 38 31 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e  81 values hashin
7b10: 67 20 74 6f 20 35 63 37 61 36 66 35 39 31 66 62  g to 5c7a6f591fb
7b20: 32 61 33 38 38 39 33 64 61 66 65 35 36 63 34 62  2a38893dafe56c4b
7b30: 39 62 39 37 66 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  9b97f....onlyif 
7b40: 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20  mysql # use DIV 
7b50: 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74  operator for int
7b60: 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71  eger division..q
7b70: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
7b80: 61 62 65 6c 2d 32 31 30 0d 0a 53 45 4c 45 43 54  abel-210..SELECT
7b90: 20 74 61 62 30 2e 63 6f 6c 32 20 44 49 56 20 63   tab0.col2 DIV c
7ba0: 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  ol1 AS col1 FROM
7bb0: 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a   tab0..----..0..
7bc0: 30 0d 0a 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  0..0....skipif m
7bd0: 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
7be0: 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
7bf0: 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 32 31 30  owsort label-210
7c00: 0d 0a 53 45 4c 45 43 54 20 74 61 62 30 2e 63 6f  ..SELECT tab0.co
7c10: 6c 32 20 2f 20 63 6f 6c 31 20 41 53 20 63 6f 6c  l2 / col1 AS col
7c20: 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d  1 FROM tab0..---
7c30: 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a 71 75  -..0..0..0....qu
7c40: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
7c50: 45 4c 45 43 54 20 2b 20 2d 20 63 6f 6c 30 20 2a  ELECT + - col0 *
7c60: 20 2b 20 63 6f 6c 31 20 2b 20 37 34 20 2a 20 2b   + col1 + 74 * +
7c70: 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20   col0 FROM tab2 
7c80: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
7c90: 31 37 30 0d 0a 33 30 31 0d 0a 34 35 30 33 0d 0a  170..301..4503..
7ca0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
7cb0: 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2d 20 28 20  t..SELECT - - ( 
7cc0: 2d 20 63 6f 6c 31 20 29 20 2b 20 63 6f 6c 31 20  - col1 ) + col1 
7cd0: 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
7ce0: 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d  1 cor0..----..0.
7cf0: 0a 30 0d 0a 30 0d 0a 0d 0a 71 75 65 72 79 20 49  .0..0....query I
7d00: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
7d10: 20 44 49 53 54 49 4e 43 54 20 2b 20 36 34 20 2a   DISTINCT + 64 *
7d20: 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d   col0 FROM tab0.
7d30: 0a 2d 2d 2d 2d 0d 0a 31 35 33 36 0d 0a 32 32 34  .----..1536..224
7d40: 30 0d 0a 35 36 39 36 0d 0a 0d 0a 71 75 65 72 79  0..5696....query
7d50: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
7d60: 43 54 20 41 4c 4c 20 2b 20 2d 20 38 31 20 41 53  CT ALL + - 81 AS
7d70: 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 2c   col0 FROM tab1,
7d80: 20 74 61 62 31 20 41 53 20 63 6f 72 30 2c 20 74   tab1 AS cor0, t
7d90: 61 62 32 2c 20 74 61 62 30 20 41 53 20 63 6f 72  ab2, tab0 AS cor
7da0: 31 0d 0a 2d 2d 2d 2d 0d 0a 38 31 20 76 61 6c 75  1..----..81 valu
7db0: 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 62 61  es hashing to ba
7dc0: 62 37 63 62 32 33 37 65 65 37 33 32 38 33 30 38  b7cb237ee7328308
7dd0: 39 33 38 38 63 33 33 30 66 35 39 35 39 38 0d 0a  9388c330f59598..
7de0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
7df0: 74 0d 0a 53 45 4c 45 43 54 20 2b 20 31 32 20 41  t..SELECT + 12 A
7e00: 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31  S col1 FROM tab1
7e10: 20 41 53 20 63 6f 72 30 20 43 52 4f 53 53 20 4a   AS cor0 CROSS J
7e20: 4f 49 4e 20 74 61 62 32 2c 20 74 61 62 31 20 41  OIN tab2, tab1 A
7e30: 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 32 37  S cor1..----..27
7e40: 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20   values hashing 
7e50: 74 6f 20 37 30 32 34 37 38 63 35 33 63 61 66 32  to 702478c53caf2
7e60: 66 37 65 62 62 39 66 66 66 39 36 64 38 30 30 66  f7ebb9fff96d800f
7e70: 35 61 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  5a6....query I r
7e80: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
7e90: 20 63 6f 72 30 2e 63 6f 6c 30 20 2a 20 28 20 63   cor0.col0 * ( c
7ea0: 6f 6c 31 20 2a 20 63 6f 72 30 2e 63 6f 6c 31 20  ol1 * cor0.col1 
7eb0: 29 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  ) FROM tab1 AS c
7ec0: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 35 32  or0..----..-1352
7ed0: 30 0d 0a 2d 32 30 32 38 0d 0a 2d 36 34 30 30 0d  0..-2028..-6400.
7ee0: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
7ef0: 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d  rt..SELECT ALL -
7f00: 20 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20   0 AS col2 FROM 
7f10: 74 61 62 31 2c 20 74 61 62 30 20 41 53 20 63 6f  tab1, tab0 AS co
7f20: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75  r0..----..9 valu
7f30: 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 38 62  es hashing to 8b
7f40: 37 35 31 33 36 62 32 62 35 31 63 37 37 33 34 35  75136b2b51c77345
7f50: 63 30 33 38 30 34 65 63 31 63 64 61 35 63 0d 0a  c03804ec1cda5c..
7f60: 0d 0a 71 75 65 72 79 20 49 49 49 49 49 49 49 49  ..query IIIIIIII
7f70: 49 49 49 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  IIII rowsort..SE
7f80: 4c 45 43 54 20 41 4c 4c 20 2a 20 46 52 4f 4d 20  LECT ALL * FROM 
7f90: 74 61 62 31 20 63 6f 72 30 20 43 52 4f 53 53 20  tab1 cor0 CROSS 
7fa0: 4a 4f 49 4e 20 74 61 62 32 2c 20 74 61 62 31 20  JOIN tab2, tab1 
7fb0: 41 53 20 63 6f 72 31 2c 20 74 61 62 30 20 41 53  AS cor1, tab0 AS
7fc0: 20 63 6f 72 32 0d 0a 2d 2d 2d 2d 0d 0a 39 37 32   cor2..----..972
7fd0: 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20   values hashing 
7fe0: 74 6f 20 39 62 39 31 63 66 39 66 63 63 30 36 34  to 9b91cf9fcc064
7ff0: 65 65 31 63 31 33 30 37 34 61 36 37 38 62 37 32  ee1c13074a678b72
8000: 61 63 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  ac7....query I r
8010: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
8020: 4c 4c 20 2b 20 2d 20 32 30 20 2b 20 63 6f 6c 32  LL + - 20 + col2
8030: 20 2a 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62   * col1 FROM tab
8040: 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
8050: 0a 32 38 31 38 0d 0a 37 34 34 32 0d 0a 37 37 0d  .2818..7442..77.
8060: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
8070: 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d  rt..SELECT ALL -
8080: 20 63 6f 6c 32 20 2b 20 2b 20 28 20 2d 20 63 6f   col2 + + ( - co
8090: 6c 31 20 29 20 46 52 4f 4d 20 74 61 62 30 20 41  l1 ) FROM tab0 A
80a0: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
80b0: 31 39 0d 0a 2d 31 37 33 0d 0a 2d 39 38 0d 0a 0d  19..-173..-98...
80c0: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
80d0: 0d 0a 53 45 4c 45 43 54 20 28 20 63 6f 72 30 2e  ..SELECT ( cor0.
80e0: 63 6f 6c 30 20 29 20 41 53 20 63 6f 6c 31 20 46  col0 ) AS col1 F
80f0: 52 4f 4d 20 74 61 62 30 2c 20 74 61 62 32 20 41  ROM tab0, tab2 A
8100: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20  S cor0..----..9 
8110: 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74  values hashing t
8120: 6f 20 39 35 62 39 36 63 61 31 64 62 65 32 65 33  o 95b96ca1dbe2e3
8130: 39 61 30 66 61 37 38 66 35 30 64 33 37 34 66 35  9a0fa78f50d374f5
8140: 31 61 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  1a....skipif mys
8150: 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
8160: 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
8170: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
8180: 54 49 4e 43 54 20 2b 20 2b 20 43 41 53 54 20 28  TINCT + + CAST (
8190: 20 2b 20 63 6f 6c 30 20 41 53 20 52 45 41 4c 20   + col0 AS REAL 
81a0: 29 20 2b 20 2d 20 63 6f 6c 30 20 2d 20 2d 20 28  ) + - col0 - - (
81b0: 20 63 6f 72 30 2e 63 6f 6c 30 20 29 20 46 52 4f   cor0.col0 ) FRO
81c0: 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab1 cor0..---
81d0: 2d 0d 0a 33 0d 0a 36 34 0d 0a 38 30 0d 0a 0d 0a  -..3..64..80....
81e0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
81f0: 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 37 39  .SELECT ALL + 79
8200: 20 2a 20 2b 20 28 20 63 6f 6c 32 20 29 20 46 52   * + ( col2 ) FR
8210: 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 34  OM tab1..----..4
8220: 32 36 36 0d 0a 34 35 30 33 0d 0a 37 35 38 34 0d  266..4503..7584.
8230: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
8240: 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c  rt..SELECT - col
8250: 30 20 2b 20 2b 20 63 6f 6c 31 20 2a 20 63 6f 6c  0 + + col1 * col
8260: 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  0 AS col1 FROM t
8270: 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab0 cor0..----..
8280: 32 30 34 30 0d 0a 33 33 36 30 0d 0a 38 30 31 30  2040..3360..8010
8290: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
82a0: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
82b0: 2b 20 63 6f 6c 30 20 2a 20 33 31 20 2b 20 2b 20  + col0 * 31 + + 
82c0: 63 6f 6c 32 20 2a 20 63 6f 6c 32 20 41 53 20 63  col2 * col2 AS c
82d0: 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol0 FROM tab0 AS
82e0: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 38   cor0..----..108
82f0: 36 0d 0a 31 38 33 33 0d 0a 39 34 38 33 0d 0a 0d  6..1833..9483...
8300: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
8310: 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63  ..SELECT ALL + c
8320: 6f 6c 32 20 2a 20 63 6f 6c 30 20 41 53 20 63 6f  ol2 * col0 AS co
8330: 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72  l1 FROM tab0 cor
8340: 30 0d 0a 2d 2d 2d 2d 0d 0a 33 35 0d 0a 37 32 39  0..----..35..729
8350: 38 0d 0a 37 39 32 0d 0a 0d 0a 71 75 65 72 79 20  8..792....query 
8360: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
8370: 54 20 41 4c 4c 20 2b 20 36 33 20 46 52 4f 4d 20  T ALL + 63 FROM 
8380: 74 61 62 31 2c 20 74 61 62 30 20 63 6f 72 30 2c  tab1, tab0 cor0,
8390: 20 74 61 62 30 20 41 53 20 63 6f 72 31 0d 0a 2d   tab0 AS cor1..-
83a0: 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75 65 73 20 68  ---..27 values h
83b0: 61 73 68 69 6e 67 20 74 6f 20 33 38 37 36 34 61  ashing to 38764a
83c0: 36 65 36 39 36 64 31 61 36 62 35 30 39 35 65 32  6e696d1a6b5095e2
83d0: 39 65 66 38 34 39 35 39 63 30 0d 0a 0d 0a 71 75  9ef84959c0....qu
83e0: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
83f0: 45 4c 45 43 54 20 2d 20 63 6f 72 30 2e 63 6f 6c  ELECT - cor0.col
8400: 31 20 2b 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61  1 + col2 FROM ta
8410: 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  b2 cor0..----..-
8420: 33 33 0d 0a 2d 34 0d 0a 32 31 0d 0a 0d 0a 71 75  33..-4..21....qu
8430: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
8440: 45 4c 45 43 54 20 2b 20 63 6f 6c 31 20 2b 20 28  ELECT + col1 + (
8450: 20 63 6f 6c 31 20 29 20 41 53 20 63 6f 6c 32 20   col1 ) AS col2 
8460: 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
8470: 30 0d 0a 2d 2d 2d 2d 0d 0a 32 30 0d 0a 32 36 0d  0..----..20..26.
8480: 0a 35 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .52....query I r
8490: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
84a0: 49 53 54 49 4e 43 54 20 2d 20 2d 20 63 6f 72 30  ISTINCT - - cor0
84b0: 2e 63 6f 6c 32 20 2b 20 2d 20 63 6f 6c 30 20 46  .col2 + - col0 F
84c0: 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
84d0: 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 34 0d 0a 2d 37 0d  ..----..-34..-7.
84e0: 0a 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  .9....query I ro
84f0: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
8500: 53 54 49 4e 43 54 20 2b 20 63 6f 6c 30 20 2a 20  STINCT + col0 * 
8510: 2d 20 63 6f 6c 30 20 2b 20 63 6f 6c 32 20 2b 20  - col0 + col2 + 
8520: 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52 4f  col1 AS col0 FRO
8530: 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
8540: 2d 2d 2d 2d 0d 0a 2d 31 31 32 37 0d 0a 2d 34 35  ----..-1127..-45
8550: 37 0d 0a 2d 37 37 34 38 0d 0a 0d 0a 73 6b 69 70  7..-7748....skip
8560: 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20  if postgresql # 
8570: 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69  PostgreSQL requi
8580: 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61  res AS when rena
8590: 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75  ming output colu
85a0: 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  mns..query I row
85b0: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63  sort..SELECT + c
85c0: 6f 6c 31 20 2a 20 63 6f 6c 30 20 2b 20 28 20 2b  ol1 * col0 + ( +
85d0: 20 63 6f 6c 30 20 29 20 63 6f 6c 32 20 46 52 4f   col0 ) col2 FRO
85e0: 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
85f0: 2d 2d 2d 2d 0d 0a 32 30 38 38 0d 0a 33 34 33 30  ----..2088..3430
8600: 0d 0a 38 31 38 38 0d 0a 0d 0a 71 75 65 72 79 20  ..8188....query 
8610: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
8620: 54 20 44 49 53 54 49 4e 43 54 20 2d 20 35 35 20  T DISTINCT - 55 
8630: 2b 20 2d 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61  + - col1 FROM ta
8640: 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 36 35 0d 0a 2d  b1..----..-65..-
8650: 36 38 0d 0a 2d 38 31 0d 0a 0d 0a 71 75 65 72 79  68..-81....query
8660: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
8670: 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 31  CT DISTINCT col1
8680: 20 2a 20 2b 20 63 6f 6c 32 20 2b 20 2b 20 35 38   * + col2 + + 58
8690: 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d   FROM tab2..----
86a0: 0d 0a 31 35 39 32 0d 0a 37 30 34 0d 0a 38 39 35  ..1592..704..895
86b0: 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
86c0: 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61   # use DIV opera
86d0: 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20  tor for integer 
86e0: 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20  division..query 
86f0: 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
8700: 32 33 35 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f  235..SELECT + co
8710: 6c 32 20 2d 20 63 6f 6c 32 20 44 49 56 20 63 6f  l2 - col2 DIV co
8720: 6c 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d  l1 FROM tab0..--
8730: 2d 2d 0d 0a 31 0d 0a 33 33 0d 0a 38 32 0d 0a 0d  --..1..33..82...
8740: 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
8750: 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
8760: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
8770: 6c 61 62 65 6c 2d 32 33 35 0d 0a 53 45 4c 45 43  label-235..SELEC
8780: 54 20 2b 20 63 6f 6c 32 20 2d 20 63 6f 6c 32 20  T + col2 - col2 
8790: 2f 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30  / col1 FROM tab0
87a0: 0d 0a 2d 2d 2d 2d 0d 0a 31 0d 0a 33 33 0d 0a 38  ..----..1..33..8
87b0: 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  2....query I row
87c0: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
87d0: 54 49 4e 43 54 20 63 6f 6c 30 20 2b 20 2d 20 36  TINCT col0 + - 6
87e0: 38 20 2a 20 38 30 20 46 52 4f 4d 20 74 61 62 32  8 * 80 FROM tab2
87f0: 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 33 36 31 0d 0a 2d  ..----..-5361..-
8800: 35 33 36 32 0d 0a 2d 35 34 33 33 0d 0a 0d 0a 71  5362..-5433....q
8810: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
8820: 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
8830: 63 6f 72 31 2e 63 6f 6c 32 20 46 52 4f 4d 20 74  cor1.col2 FROM t
8840: 61 62 32 20 41 53 20 63 6f 72 30 20 43 52 4f 53  ab2 AS cor0 CROS
8850: 53 20 4a 4f 49 4e 20 74 61 62 31 2c 20 74 61 62  S JOIN tab1, tab
8860: 30 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d  0 AS cor1..----.
8870: 0a 31 0d 0a 33 33 0d 0a 38 32 0d 0a 0d 0a 71 75  .1..33..82....qu
8880: 65 72 79 20 49 49 49 49 49 49 49 49 49 49 49 49  ery IIIIIIIIIIII
8890: 49 49 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  III rowsort..SEL
88a0: 45 43 54 20 2a 20 46 52 4f 4d 20 74 61 62 30 20  ECT * FROM tab0 
88b0: 41 53 20 63 6f 72 30 20 43 52 4f 53 53 20 4a 4f  AS cor0 CROSS JO
88c0: 49 4e 20 74 61 62 32 2c 20 74 61 62 31 20 41 53  IN tab2, tab1 AS
88d0: 20 63 6f 72 31 2c 20 74 61 62 30 2c 20 74 61 62   cor1, tab0, tab
88e0: 31 20 63 6f 72 32 0d 0a 2d 2d 2d 2d 0d 0a 33 36  1 cor2..----..36
88f0: 34 35 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e  45 values hashin
8900: 67 20 74 6f 20 66 33 65 64 65 38 36 33 63 37 39  g to f3ede863c79
8910: 33 64 66 30 64 65 35 63 32 36 63 36 35 34 32 39  3df0de5c26c65429
8920: 30 62 33 62 37 0d 0a 0d 0a 71 75 65 72 79 20 49  0b3b7....query I
8930: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
8940: 20 41 4c 4c 20 2d 20 63 6f 6c 32 20 2a 20 2d 20   ALL - col2 * - 
8950: 63 6f 6c 32 20 2b 20 74 61 62 30 2e 63 6f 6c 30  col2 + tab0.col0
8960: 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d   FROM tab0..----
8970: 0d 0a 31 31 31 33 0d 0a 33 36 0d 0a 36 38 31 33  ..1113..36..6813
8980: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
8990: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
89a0: 2d 20 2b 20 63 6f 6c 30 20 2a 20 28 20 63 6f 6c  - + col0 * ( col
89b0: 32 20 29 20 2d 20 2d 20 63 6f 6c 32 20 46 52 4f  2 ) - - col2 FRO
89c0: 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab0 cor0..---
89d0: 2d 0d 0a 2d 33 34 0d 0a 2d 37 32 31 36 0d 0a 2d  -..-34..-7216..-
89e0: 37 35 39 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  759....onlyif my
89f0: 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f  sql # support fo
8a00: 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63  r MySQL specific
8a10: 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e   system types an
8a20: 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20  d syntax..query 
8a30: 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
8a40: 32 34 31 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f  241..SELECT - co
8a50: 72 30 2e 63 6f 6c 30 20 2a 20 43 41 53 54 28 20  r0.col0 * CAST( 
8a60: 2b 20 36 35 20 41 53 20 53 49 47 4e 45 44 20 29  + 65 AS SIGNED )
8a70: 20 2a 20 2d 20 63 6f 6c 31 20 2b 20 63 6f 6c 32   * - col1 + col2
8a80: 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
8a90: 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
8aa0: 0d 0a 34 31 36 35 37 0d 0a 35 31 32 34 0d 0a 36  ..41657..5124..6
8ab0: 37 36 39 36 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  7696....skipif m
8ac0: 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
8ad0: 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
8ae0: 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 32 34 31  owsort label-241
8af0: 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 72 30 2e  ..SELECT - cor0.
8b00: 63 6f 6c 30 20 2a 20 43 41 53 54 20 28 20 2b 20  col0 * CAST ( + 
8b10: 36 35 20 41 53 20 49 4e 54 45 47 45 52 20 29 20  65 AS INTEGER ) 
8b20: 2a 20 2d 20 63 6f 6c 31 20 2b 20 63 6f 6c 32 20  * - col1 + col2 
8b30: 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
8b40: 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
8b50: 0a 34 31 36 35 37 0d 0a 35 31 32 34 0d 0a 36 37  .41657..5124..67
8b60: 36 39 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  696....query I r
8b70: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
8b80: 49 53 54 49 4e 43 54 20 2b 20 2b 20 63 6f 6c 32  ISTINCT + + col2
8b90: 20 2a 20 28 20 63 6f 6c 30 20 29 20 2b 20 63 6f   * ( col0 ) + co
8ba0: 6c 30 20 2a 20 63 6f 6c 31 20 46 52 4f 4d 20 74  l0 * col1 FROM t
8bb0: 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab0 cor0..----..
8bc0: 31 35 33 39 37 0d 0a 32 38 35 36 0d 0a 33 34 33  15397..2856..343
8bd0: 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  0....query I row
8be0: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
8bf0: 20 2b 20 63 6f 6c 32 20 2d 20 2b 20 63 6f 72 30   + col2 - + cor0
8c00: 2e 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46 52  .col0 AS col1 FR
8c10: 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d  OM tab2 cor0..--
8c20: 2d 2d 0d 0a 2d 34 31 0d 0a 2d 35 32 0d 0a 32 30  --..-41..-52..20
8c30: 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
8c40: 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61   # use DIV opera
8c50: 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20  tor for integer 
8c60: 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20  division..query 
8c70: 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
8c80: 32 34 34 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  244..SELECT DIST
8c90: 49 4e 43 54 20 63 6f 6c 31 20 44 49 56 20 2d 20  INCT col1 DIV - 
8ca0: 36 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  6 AS col0 FROM t
8cb0: 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
8cc0: 2d 0d 0a 2d 31 34 0d 0a 2d 31 35 0d 0a 2d 31 36  -..-14..-15..-16
8cd0: 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
8ce0: 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
8cf0: 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
8d00: 72 74 20 6c 61 62 65 6c 2d 32 34 34 0d 0a 53 45  rt label-244..SE
8d10: 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f  LECT DISTINCT co
8d20: 6c 31 20 2f 20 2d 20 36 20 41 53 20 63 6f 6c 30  l1 / - 6 AS col0
8d30: 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
8d40: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 34 0d 0a 2d  r0..----..-14..-
8d50: 31 35 0d 0a 2d 31 36 0d 0a 0d 0a 71 75 65 72 79  15..-16....query
8d60: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
8d70: 43 54 20 2b 20 2b 20 63 6f 6c 32 20 2b 20 33 35  CT + + col2 + 35
8d80: 20 2a 20 32 30 20 41 53 20 63 6f 6c 31 20 46 52   * 20 AS col1 FR
8d90: 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
8da0: 0a 2d 2d 2d 2d 0d 0a 37 35 34 0d 0a 37 35 37 0d  .----..754..757.
8db0: 0a 37 39 36 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  .796....onlyif m
8dc0: 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f  ysql # use DIV o
8dd0: 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65  perator for inte
8de0: 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75  ger division..qu
8df0: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
8e00: 62 65 6c 2d 32 34 36 0d 0a 53 45 4c 45 43 54 20  bel-246..SELECT 
8e10: 63 6f 6c 30 20 44 49 56 20 39 32 20 41 53 20 63  col0 DIV 92 AS c
8e20: 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d  ol2 FROM tab0..-
8e30: 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a  ---..0..0..0....
8e40: 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
8e50: 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
8e60: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
8e70: 61 62 65 6c 2d 32 34 36 0d 0a 53 45 4c 45 43 54  abel-246..SELECT
8e80: 20 63 6f 6c 30 20 2f 20 39 32 20 41 53 20 63 6f   col0 / 92 AS co
8e90: 6c 32 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d  l2 FROM tab0..--
8ea0: 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a 71  --..0..0..0....q
8eb0: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
8ec0: 53 45 4c 45 43 54 20 2d 20 36 36 20 2a 20 2d 20  SELECT - 66 * - 
8ed0: 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 63  col1 FROM tab1 c
8ee0: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 37 31 36 0d  or0..----..1716.
8ef0: 0a 36 36 30 0d 0a 38 35 38 0d 0a 0d 0a 71 75 65  .660..858....que
8f00: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
8f10: 4c 45 43 54 20 41 4c 4c 20 2b 20 37 33 20 46 52  LECT ALL + 73 FR
8f20: 4f 4d 20 74 61 62 31 2c 20 74 61 62 31 20 63 6f  OM tab1, tab1 co
8f30: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75  r0..----..9 valu
8f40: 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 65 35  es hashing to e5
8f50: 66 62 66 35 64 31 32 39 62 31 38 31 62 61 63 64  fbf5d129b181bacd
8f60: 36 31 31 33 62 62 63 38 37 33 32 34 39 36 0d 0a  6113bbc8732496..
8f70: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
8f80: 74 0d 0a 53 45 4c 45 43 54 20 38 38 20 2a 20 2d  t..SELECT 88 * -
8f90: 20 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52   col1 AS col0 FR
8fa0: 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d  OM tab2..----..-
8fb0: 31 34 39 36 0d 0a 2d 32 37 32 38 0d 0a 2d 35 31  1496..-2728..-51
8fc0: 39 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  92....query I ro
8fd0: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
8fe0: 2d 20 63 6f 6c 30 20 2b 20 2d 20 63 6f 72 30 2e  - col0 + - cor0.
8ff0: 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46 52 4f  col2 AS col2 FRO
9000: 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
9010: 2d 2d 2d 2d 0d 0a 2d 31 30 34 0d 0a 2d 31 31 37  ----..-104..-117
9020: 0d 0a 2d 33 34 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  ..-34....onlyif 
9030: 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20  mysql # use DIV 
9040: 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74  operator for int
9050: 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71  eger division..q
9060: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
9070: 61 62 65 6c 2d 32 35 31 0d 0a 53 45 4c 45 43 54  abel-251..SELECT
9080: 20 2d 20 63 6f 6c 32 20 2b 20 2b 20 63 6f 72 30   - col2 + + cor0
9090: 2e 63 6f 6c 30 20 2a 20 63 6f 6c 32 20 44 49 56  .col0 * col2 DIV
90a0: 20 63 6f 6c 31 20 2b 20 2b 20 63 6f 6c 30 20 41   col1 + + col0 A
90b0: 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31  S col1 FROM tab1
90c0: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
90d0: 2d 34 35 0d 0a 33 37 31 0d 0a 35 37 34 0d 0a 0d  -45..371..574...
90e0: 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
90f0: 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
9100: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
9110: 6c 61 62 65 6c 2d 32 35 31 0d 0a 53 45 4c 45 43  label-251..SELEC
9120: 54 20 2d 20 63 6f 6c 32 20 2b 20 2b 20 63 6f 72  T - col2 + + cor
9130: 30 2e 63 6f 6c 30 20 2a 20 63 6f 6c 32 20 2f 20  0.col0 * col2 / 
9140: 63 6f 6c 31 20 2b 20 2b 20 63 6f 6c 30 20 41 53  col1 + + col0 AS
9150: 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20   col1 FROM tab1 
9160: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
9170: 34 35 0d 0a 33 37 31 0d 0a 35 37 34 0d 0a 0d 0a  45..371..574....
9180: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
9190: 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
91a0: 20 63 6f 6c 32 20 2b 20 63 6f 6c 31 20 2a 20 32   col2 + col1 * 2
91b0: 35 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  5 FROM tab2 AS c
91c0: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 35 30 31 0d  or0..----..1501.
91d0: 0a 34 36 33 0d 0a 38 30 32 0d 0a 0d 0a 71 75 65  .463..802....que
91e0: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
91f0: 4c 45 43 54 20 33 35 20 2a 20 2d 20 63 6f 6c 30  LECT 35 * - col0
9200: 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d   FROM tab0 cor0.
9210: 0a 2d 2d 2d 2d 0d 0a 2d 31 32 32 35 0d 0a 2d 33  .----..-1225..-3
9220: 31 31 35 0d 0a 2d 38 34 30 0d 0a 0d 0a 71 75 65  115..-840....que
9230: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
9240: 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20  LECT DISTINCT - 
9250: 2d 20 63 6f 6c 31 20 2b 20 63 6f 72 30 2e 63 6f  - col1 + cor0.co
9260: 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l0 FROM tab0 AS 
9270: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 30 0d  cor0..----..110.
9280: 0a 31 33 32 0d 0a 31 38 30 0d 0a 0d 0a 71 75 65  .132..180....que
9290: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
92a0: 4c 45 43 54 20 41 4c 4c 20 2d 20 2b 20 34 32 20  LECT ALL - + 42 
92b0: 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
92c0: 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 32 0d 0a 2d 34  0..----..-42..-4
92d0: 32 0d 0a 2d 34 32 0d 0a 0d 0a 71 75 65 72 79 20  2..-42....query 
92e0: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
92f0: 54 20 2b 20 2d 20 32 35 20 46 52 4f 4d 20 74 61  T + - 25 FROM ta
9300: 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
9310: 0d 0a 2d 32 35 0d 0a 2d 32 35 0d 0a 2d 32 35 0d  ..-25..-25..-25.
9320: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
9330: 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
9340: 4e 43 54 20 2b 20 2d 20 38 38 20 46 52 4f 4d 20  NCT + - 88 FROM 
9350: 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
9360: 2d 2d 0d 0a 2d 38 38 0d 0a 0d 0a 71 75 65 72 79  --..-88....query
9370: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
9380: 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 31 20 2a 20  CT ALL - col1 * 
9390: 63 6f 6c 30 20 2b 20 2d 20 74 61 62 32 2e 63 6f  col0 + - tab2.co
93a0: 6c 32 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d  l2 FROM tab2..--
93b0: 2d 2d 0d 0a 2d 31 33 38 31 0d 0a 2d 32 34 34 0d  --..-1381..-244.
93c0: 0a 2d 34 36 32 38 0d 0a 0d 0a 73 6b 69 70 69 66  .-4628....skipif
93d0: 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f   postgresql # Po
93e0: 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65  stgreSQL require
93f0: 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69  s AS when renami
9400: 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e  ng output column
9410: 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  s..query I rowso
9420: 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 35  rt..SELECT ALL 5
9430: 34 20 2b 20 63 6f 6c 30 20 2a 20 63 6f 6c 32 20  4 + col0 * col2 
9440: 2b 20 2d 20 74 61 62 31 2e 63 6f 6c 30 20 63 6f  + - tab1.col0 co
9450: 6c 32 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d  l2 FROM tab1..--
9460: 2d 2d 0d 0a 32 31 33 0d 0a 33 36 33 38 0d 0a 37  --..213..3638..7
9470: 36 35 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  654....query I r
9480: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
9490: 4c 4c 20 2b 20 28 20 2b 20 63 6f 6c 32 20 29 20  LL + ( + col2 ) 
94a0: 2a 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30  * + col0 AS col0
94b0: 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
94c0: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 38 39 0d 0a 32  r0..----..189..2
94d0: 30 32 38 0d 0a 33 30 30 32 0d 0a 0d 0a 71 75 65  028..3002....que
94e0: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
94f0: 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20  LECT DISTINCT + 
9500: 2d 20 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c 31 20  - col2 * + col1 
9510: 2b 20 2d 20 63 6f 6c 30 20 2b 20 63 6f 6c 31 20  + - col0 + col1 
9520: 46 52 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a  FROM tab2 cor0..
9530: 2d 2d 2d 2d 0d 0a 2d 31 35 35 33 0d 0a 2d 37 30  ----..-1553..-70
9540: 38 0d 0a 2d 38 31 33 0d 0a 0d 0a 71 75 65 72 79  8..-813....query
9550: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
9560: 43 54 20 2b 20 33 34 20 2d 20 2d 20 63 6f 6c 30  CT + 34 - - col0
9570: 20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d   FROM tab1 cor0.
9580: 0a 2d 2d 2d 2d 0d 0a 31 31 34 0d 0a 33 37 0d 0a  .----..114..37..
9590: 39 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  98....query I ro
95a0: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
95b0: 4c 20 63 6f 6c 31 20 2a 20 63 6f 6c 31 20 46 52  L col1 * col1 FR
95c0: 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d  OM tab0 cor0..--
95d0: 2d 2d 0d 0a 37 33 39 36 0d 0a 38 32 38 31 0d 0a  --..7396..8281..
95e0: 39 34 30 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20  9409....query I 
95f0: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
9600: 41 4c 4c 20 33 38 20 41 53 20 63 6f 6c 31 20 46  ALL 38 AS col1 F
9610: 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
9620: 0d 0a 2d 2d 2d 2d 0d 0a 33 38 0d 0a 33 38 0d 0a  ..----..38..38..
9630: 33 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  38....query I ro
9640: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
9650: 53 54 49 4e 43 54 20 63 6f 72 30 2e 63 6f 6c 32  STINCT cor0.col2
9660: 20 2a 20 2d 20 63 6f 6c 31 20 2b 20 63 6f 6c 32   * - col1 + col2
9670: 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
9680: 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  b2 cor0..----..-
9690: 31 35 30 38 0d 0a 2d 36 30 38 0d 0a 2d 38 31 30  1508..-608..-810
96a0: 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67  ....skipif postg
96b0: 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53  resql # PostgreS
96c0: 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77  QL requires AS w
96d0: 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74  hen renaming out
96e0: 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65  put columns..que
96f0: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
9700: 4c 45 43 54 20 2d 20 2d 20 63 6f 6c 31 20 2a 20  LECT - - col1 * 
9710: 2d 20 63 6f 6c 31 20 63 6f 6c 32 20 46 52 4f 4d  - col1 col2 FROM
9720: 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
9730: 2d 2d 2d 0d 0a 2d 37 33 39 36 0d 0a 2d 38 32 38  ---..-7396..-828
9740: 31 0d 0a 2d 39 34 30 39 0d 0a 0d 0a 73 6b 69 70  1..-9409....skip
9750: 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20  if postgresql # 
9760: 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69  PostgreSQL requi
9770: 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61  res AS when rena
9780: 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75  ming output colu
9790: 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  mns..query I row
97a0: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c  sort..SELECT col
97b0: 32 20 2b 20 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c  2 + col1 * + col
97c0: 32 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32  2 col1 FROM tab2
97d0: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
97e0: 31 35 36 30 0d 0a 36 38 34 0d 0a 38 36 34 0d 0a  1560..684..864..
97f0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
9800: 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
9810: 43 54 20 2b 20 63 6f 6c 32 20 2b 20 2d 20 63 6f  CT + col2 + - co
9820: 6c 30 20 2a 20 2d 20 63 6f 6c 31 20 41 53 20 63  l0 * - col1 AS c
9830: 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol0 FROM tab2 AS
9840: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33 38   cor0..----..138
9850: 31 0d 0a 32 34 34 0d 0a 34 36 32 38 0d 0a 0d 0a  1..244..4628....
9860: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
9870: 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 2d 20  .SELECT ALL + - 
9880: 63 6f 72 31 2e 63 6f 6c 30 20 41 53 20 63 6f 6c  cor1.col0 AS col
9890: 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  2 FROM tab2 AS c
98a0: 6f 72 30 20 43 52 4f 53 53 20 4a 4f 49 4e 20 74  or0 CROSS JOIN t
98b0: 61 62 32 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d  ab2 AS cor1..---
98c0: 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68  -..9 values hash
98d0: 69 6e 67 20 74 6f 20 33 30 30 30 33 33 37 64 64  ing to 3000337dd
98e0: 33 66 31 31 65 39 63 66 64 35 61 33 31 32 62 30  3f11e9cfd5a312b0
98f0: 31 65 66 33 66 38 62 0d 0a 0d 0a 73 6b 69 70 69  1ef3f8b....skipi
9900: 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50  f postgresql # P
9910: 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72  ostgreSQL requir
9920: 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d  es AS when renam
9930: 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d  ing output colum
9940: 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ns..query I rows
9950: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f  ort..SELECT - co
9960: 6c 31 20 2a 20 2d 20 63 6f 6c 32 20 63 6f 6c 31  l1 * - col2 col1
9970: 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d   FROM tab0..----
9980: 0d 0a 32 38 33 38 0d 0a 37 34 36 32 0d 0a 39 37  ..2838..7462..97
9990: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
99a0: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 31 39 20 2a  ort..SELECT 19 *
99b0: 20 2d 20 74 61 62 32 2e 63 6f 6c 32 20 2b 20 2b   - tab2.col2 + +
99c0: 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 0d   col2 FROM tab2.
99d0: 0a 2d 2d 2d 2d 0d 0a 2d 34 36 38 0d 0a 2d 34 38  .----..-468..-48
99e0: 36 0d 0a 2d 36 38 34 0d 0a 0d 0a 6f 6e 6c 79 69  6..-684....onlyi
99f0: 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72  f mysql # suppor
9a00: 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63  t for MySQL spec
9a10: 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65  ific system type
9a20: 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75  s and syntax..qu
9a30: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
9a40: 62 65 6c 2d 32 37 32 0d 0a 53 45 4c 45 43 54 20  bel-272..SELECT 
9a50: 41 4c 4c 20 2b 20 43 41 53 54 28 20 2d 20 38 37  ALL + CAST( - 87
9a60: 20 41 53 20 53 49 47 4e 45 44 20 29 20 2b 20 63   AS SIGNED ) + c
9a70: 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol0 FROM tab1 AS
9a80: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 33   cor0..----..-23
9a90: 0d 0a 2d 37 0d 0a 2d 38 34 0d 0a 0d 0a 73 6b 69  ..-7..-84....ski
9aa0: 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
9ab0: 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
9ac0: 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
9ad0: 6c 2d 32 37 32 0d 0a 53 45 4c 45 43 54 20 41 4c  l-272..SELECT AL
9ae0: 4c 20 2b 20 43 41 53 54 20 28 20 2d 20 38 37 20  L + CAST ( - 87 
9af0: 41 53 20 49 4e 54 45 47 45 52 20 29 20 2b 20 63  AS INTEGER ) + c
9b00: 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol0 FROM tab1 AS
9b10: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 33   cor0..----..-23
9b20: 0d 0a 2d 37 0d 0a 2d 38 34 0d 0a 0d 0a 6f 6e 6c  ..-7..-84....onl
9b30: 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20  yif mysql # use 
9b40: 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72  DIV operator for
9b50: 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f   integer divisio
9b60: 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  n..query I rowso
9b70: 72 74 20 6c 61 62 65 6c 2d 32 37 33 0d 0a 53 45  rt label-273..SE
9b80: 4c 45 43 54 20 63 6f 6c 30 20 44 49 56 20 28 20  LECT col0 DIV ( 
9b90: 2d 20 63 6f 6c 30 20 29 20 41 53 20 63 6f 6c 30  - col0 ) AS col0
9ba0: 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
9bb0: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 2d 31  r0..----..-1..-1
9bc0: 0d 0a 2d 31 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  ..-1....skipif m
9bd0: 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
9be0: 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
9bf0: 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 32 37 33  owsort label-273
9c00: 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 30 20 2f 20  ..SELECT col0 / 
9c10: 28 20 2d 20 63 6f 6c 30 20 29 20 41 53 20 63 6f  ( - col0 ) AS co
9c20: 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l0 FROM tab0 AS 
9c30: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a  cor0..----..-1..
9c40: 2d 31 0d 0a 2d 31 0d 0a 0d 0a 71 75 65 72 79 20  -1..-1....query 
9c50: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
9c60: 54 20 41 4c 4c 20 2d 20 2b 20 28 20 63 6f 6c 30  T ALL - + ( col0
9c70: 20 29 20 2b 20 63 6f 6c 31 20 2a 20 2b 20 63 6f   ) + col1 * + co
9c80: 6c 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  l0 AS col1 FROM 
9c90: 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
9ca0: 2d 2d 0d 0a 32 30 34 30 0d 0a 33 33 36 30 0d 0a  --..2040..3360..
9cb0: 38 30 31 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20  8010....query I 
9cc0: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
9cd0: 41 4c 4c 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20  ALL - cor0.col2 
9ce0: 2b 20 2b 20 28 20 63 6f 6c 31 20 29 20 41 53 20  + + ( col1 ) AS 
9cf0: 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41  col2 FROM tab1 A
9d00: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32  S cor0..----..-2
9d10: 38 0d 0a 2d 34 37 0d 0a 2d 38 33 0d 0a 0d 0a 71  8..-47..-83....q
9d20: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
9d30: 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 28 20 39  SELECT ALL - ( 9
9d40: 33 20 29 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20  3 ) + col1 FROM 
9d50: 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
9d60: 2d 2d 0d 0a 2d 36 37 0d 0a 2d 38 30 0d 0a 2d 38  --..-67..-80..-8
9d70: 33 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74  3....skipif post
9d80: 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65  gresql # Postgre
9d90: 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20  SQL requires AS 
9da0: 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75  when renaming ou
9db0: 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75  tput columns..qu
9dc0: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
9dd0: 45 4c 45 43 54 20 41 4c 4c 20 35 37 20 63 6f 6c  ELECT ALL 57 col
9de0: 31 20 46 52 4f 4d 20 74 61 62 30 2c 20 74 61 62  1 FROM tab0, tab
9df0: 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20  1 cor0..----..9 
9e00: 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74  values hashing t
9e10: 6f 20 36 31 64 61 37 30 63 36 32 34 61 64 36 30  o 61da70c624ad60
9e20: 36 30 34 61 36 36 38 66 37 66 38 66 32 39 33 39  604a668f7f8f2939
9e30: 32 61 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  2a....onlyif mys
9e40: 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65  ql # use DIV ope
9e50: 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65  rator for intege
9e60: 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72  r division..quer
9e70: 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
9e80: 6c 2d 32 37 38 0d 0a 53 45 4c 45 43 54 20 44 49  l-278..SELECT DI
9e90: 53 54 49 4e 43 54 20 2d 20 2d 20 28 20 28 20 63  STINCT - - ( ( c
9ea0: 6f 6c 32 20 29 20 29 20 44 49 56 20 63 6f 6c 30  ol2 ) ) DIV col0
9eb0: 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
9ec0: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 31 0d 0a  r0..----..0..1..
9ed0: 31 38 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  18....skipif mys
9ee0: 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
9ef0: 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
9f00: 73 6f 72 74 20 6c 61 62 65 6c 2d 32 37 38 0d 0a  sort label-278..
9f10: 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
9f20: 2d 20 2d 20 28 20 28 20 63 6f 6c 32 20 29 20 29  - - ( ( col2 ) )
9f30: 20 2f 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62   / col0 FROM tab
9f40: 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
9f50: 0a 30 0d 0a 31 0d 0a 31 38 0d 0a 0d 0a 71 75 65  .0..1..18....que
9f60: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
9f70: 4c 45 43 54 20 41 4c 4c 20 28 20 2b 20 63 6f 6c  LECT ALL ( + col
9f80: 30 20 29 20 2a 20 63 6f 6c 32 20 2a 20 2d 20 63  0 ) * col2 * - c
9f90: 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  ol1 AS col0 FROM
9fa0: 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
9fb0: 2d 2d 2d 0d 0a 2d 33 36 34 38 30 0d 0a 2d 34 32  ---..-36480..-42
9fc0: 31 32 0d 0a 2d 39 39 38 34 30 0d 0a 0d 0a 71 75  12..-99840....qu
9fd0: 65 72 79 20 49 49 49 49 49 49 49 49 49 20 72 6f  ery IIIIIIIII ro
9fe0: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
9ff0: 53 54 49 4e 43 54 20 2a 20 46 52 4f 4d 20 74 61  STINCT * FROM ta
a000: 62 30 20 63 6f 72 30 20 43 52 4f 53 53 20 4a 4f  b0 cor0 CROSS JO
a010: 49 4e 20 74 61 62 32 2c 20 74 61 62 31 20 63 6f  IN tab2, tab1 co
a020: 72 31 0d 0a 2d 2d 2d 2d 0d 0a 32 34 33 20 76 61  r1..----..243 va
a030: 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20  lues hashing to 
a040: 30 39 38 65 32 32 33 64 37 38 30 65 31 38 62 36  098e223d780e18b6
a050: 35 38 32 35 32 33 66 64 36 66 35 35 65 65 63 39  582523fd6f55eec9
a060: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
a070: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
a080: 49 4e 43 54 20 28 20 2d 20 35 35 20 29 20 41 53  INCT ( - 55 ) AS
a090: 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 2c   col2 FROM tab1,
a0a0: 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
a0b0: 2d 2d 2d 0d 0a 2d 35 35 0d 0a 0d 0a 73 6b 69 70  ---..-55....skip
a0c0: 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
a0d0: 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
a0e0: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
a0f0: 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 2d 20  CT DISTINCT + - 
a100: 43 41 53 54 20 28 20 35 38 20 41 53 20 52 45 41  CAST ( 58 AS REA
a110: 4c 20 29 20 2b 20 2d 20 63 6f 72 30 2e 63 6f 6c  L ) + - cor0.col
a120: 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  0 AS col2 FROM t
a130: 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
a140: 2d 0d 0a 2d 31 33 36 0d 0a 2d 31 33 37 0d 0a 2d  -..-136..-137..-
a150: 36 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  65....query I ro
a160: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
a170: 28 20 2b 20 37 37 20 29 20 41 53 20 63 6f 6c 32  ( + 77 ) AS col2
a180: 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
a190: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 37 37 0d 0a 37 37  r0..----..77..77
a1a0: 0d 0a 37 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..77....query I 
a1b0: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
a1c0: 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 46 52 4f 4d  + cor0.col2 FROM
a1d0: 20 74 61 62 30 2c 20 74 61 62 32 2c 20 74 61 62   tab0, tab2, tab
a1e0: 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 37  1 cor0..----..27
a1f0: 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20   values hashing 
a200: 74 6f 20 37 66 34 61 39 62 66 32 34 64 36 34 38  to 7f4a9bf24d648
a210: 33 33 37 30 36 64 66 62 64 64 30 62 61 66 34 39  33706dfbdd0baf49
a220: 64 37 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  d79....query I r
a230: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
a240: 4c 4c 20 28 20 63 6f 6c 31 20 2a 20 2b 20 63 6f  LL ( col1 * + co
a250: 6c 31 20 29 20 46 52 4f 4d 20 74 61 62 31 0d 0a  l1 ) FROM tab1..
a260: 2d 2d 2d 2d 0d 0a 31 30 30 0d 0a 31 36 39 0d 0a  ----..100..169..
a270: 36 37 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  676....query I r
a280: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
a290: 49 53 54 49 4e 43 54 20 2b 20 28 20 37 38 20 29  ISTINCT + ( 78 )
a2a0: 20 2a 20 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c 32   * col1 * - col2
a2b0: 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d   FROM tab2..----
a2c0: 0d 0a 2d 31 31 39 36 35 32 0d 0a 2d 35 30 33 38  ..-119652..-5038
a2d0: 38 0d 0a 2d 36 35 32 38 36 0d 0a 0d 0a 71 75 65  8..-65286....que
a2e0: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
a2f0: 4c 45 43 54 20 41 4c 4c 20 28 20 63 6f 6c 32 20  LECT ALL ( col2 
a300: 2b 20 2d 20 63 6f 6c 30 20 29 20 2a 20 63 6f 6c  + - col0 ) * col
a310: 31 20 2a 20 2b 20 63 6f 6c 32 20 41 53 20 63 6f  1 * + col2 AS co
a320: 6c 32 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d  l2 FROM tab2..--
a330: 2d 2d 0d 0a 2d 32 36 34 38 36 0d 0a 2d 37 39 37  --..-26486..-797
a340: 36 38 0d 0a 31 36 37 34 30 0d 0a 0d 0a 73 6b 69  68..16740....ski
a350: 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23  pif postgresql #
a360: 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75   PostgreSQL requ
a370: 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e  ires AS when ren
a380: 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c  aming output col
a390: 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f  umns..query I ro
a3a0: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
a3b0: 4c 20 63 6f 6c 31 20 2a 20 63 6f 6c 30 20 2a 20  L col1 * col0 * 
a3c0: 63 6f 72 30 2e 63 6f 6c 31 20 2b 20 63 6f 6c 30  cor0.col1 + col0
a3d0: 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20   col2 FROM tab1 
a3e0: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
a3f0: 33 36 30 30 0d 0a 32 30 33 31 0d 0a 36 34 36 34  3600..2031..6464
a400: 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67  ....skipif postg
a410: 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53  resql # PostgreS
a420: 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77  QL requires AS w
a430: 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74  hen renaming out
a440: 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65  put columns..que
a450: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
a460: 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20  LECT DISTINCT - 
a470: 38 35 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  85 col0 FROM tab
a480: 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
a490: 0a 2d 38 35 0d 0a 0d 0a 73 6b 69 70 69 66 20 70  .-85....skipif p
a4a0: 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74  ostgresql # Post
a4b0: 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20  greSQL requires 
a4c0: 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67  AS when renaming
a4d0: 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d   output columns.
a4e0: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
a4f0: 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 33 35 20  ..SELECT ALL 35 
a500: 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41  col1 FROM tab2 A
a510: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 35  S cor0..----..35
a520: 0d 0a 33 35 0d 0a 33 35 0d 0a 0d 0a 71 75 65 72  ..35..35....quer
a530: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
a540: 45 43 54 20 63 6f 6c 32 20 2a 20 63 6f 6c 31 20  ECT col2 * col1 
a550: 2b 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30  + col2 FROM tab0
a560: 0d 0a 2d 2d 2d 2d 0d 0a 32 38 37 31 0d 0a 37 35  ..----..2871..75
a570: 34 34 0d 0a 39 38 0d 0a 0d 0a 71 75 65 72 79 20  44..98....query 
a580: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
a590: 54 20 44 49 53 54 49 4e 43 54 20 36 31 20 41 53  T DISTINCT 61 AS
a5a0: 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 2c   col0 FROM tab2,
a5b0: 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
a5c0: 2d 2d 2d 0d 0a 36 31 0d 0a 0d 0a 6f 6e 6c 79 69  ---..61....onlyi
a5d0: 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72  f mysql # suppor
a5e0: 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63  t for MySQL spec
a5f0: 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65  ific system type
a600: 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75  s and syntax..qu
a610: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
a620: 62 65 6c 2d 32 39 33 0d 0a 53 45 4c 45 43 54 20  bel-293..SELECT 
a630: 41 4c 4c 20 43 41 53 54 28 20 2d 20 63 6f 6c 32  ALL CAST( - col2
a640: 20 41 53 20 53 49 47 4e 45 44 20 29 20 2a 20 63   AS SIGNED ) * c
a650: 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d  ol0 FROM tab1..-
a660: 2d 2d 2d 0d 0a 2d 31 36 32 0d 0a 2d 33 36 34 38  ---..-162..-3648
a670: 0d 0a 2d 37 36 38 30 0d 0a 0d 0a 73 6b 69 70 69  ..-7680....skipi
a680: 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
a690: 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
a6a0: 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
a6b0: 32 39 33 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  293..SELECT ALL 
a6c0: 43 41 53 54 20 28 20 2d 20 63 6f 6c 32 20 41 53  CAST ( - col2 AS
a6d0: 20 49 4e 54 45 47 45 52 20 29 20 2a 20 63 6f 6c   INTEGER ) * col
a6e0: 30 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d  0 FROM tab1..---
a6f0: 2d 0d 0a 2d 31 36 32 0d 0a 2d 33 36 34 38 0d 0a  -..-162..-3648..
a700: 2d 37 36 38 30 0d 0a 0d 0a 73 6b 69 70 69 66 20  -7680....skipif 
a710: 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73  postgresql # Pos
a720: 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73  tgreSQL requires
a730: 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e   AS when renamin
a740: 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73  g output columns
a750: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
a760: 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 28 20  t..SELECT ALL ( 
a770: 2d 20 63 6f 6c 30 20 29 20 63 6f 6c 30 20 46 52  - col0 ) col0 FR
a780: 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  OM tab0..----..-
a790: 32 34 0d 0a 2d 33 35 0d 0a 2d 38 39 0d 0a 0d 0a  24..-35..-89....
a7a0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
a7b0: 0a 53 45 4c 45 43 54 20 2b 20 31 38 20 41 53 20  .SELECT + 18 AS 
a7c0: 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 2c 20  col1 FROM tab2, 
a7d0: 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
a7e0: 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73  --..9 values has
a7f0: 68 69 6e 67 20 74 6f 20 62 39 35 62 61 66 61 37  hing to b95bafa7
a800: 33 33 36 36 36 64 66 33 39 63 35 64 33 66 39 34  33666df39c5d3f94
a810: 37 36 30 64 30 31 30 66 0d 0a 0d 0a 71 75 65 72  760d010f....quer
a820: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
a830: 45 43 54 20 2b 20 2d 20 63 6f 6c 32 20 2b 20 2b  ECT + - col2 + +
a840: 20 63 6f 72 30 2e 63 6f 6c 30 20 2a 20 2b 20 63   cor0.col0 * + c
a850: 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol0 FROM tab0 AS
a860: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 32   cor0..----..122
a870: 34 0d 0a 35 34 33 0d 0a 37 38 33 39 0d 0a 0d 0a  4..543..7839....
a880: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
a890: 0a 53 45 4c 45 43 54 20 2d 20 63 6f 72 30 2e 63  .SELECT - cor0.c
a8a0: 6f 6c 30 20 2b 20 39 36 20 41 53 20 63 6f 6c 31  ol0 + 96 AS col1
a8b0: 20 46 52 4f 4d 20 74 61 62 32 2c 20 74 61 62 31   FROM tab2, tab1
a8c0: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
a8d0: 39 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67  9 values hashing
a8e0: 20 74 6f 20 61 62 35 35 62 62 36 38 61 30 61 66   to ab55bb68a0af
a8f0: 30 32 39 36 32 38 37 39 31 39 63 63 65 35 34 33  0296287919cce543
a900: 34 37 61 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20  47a5....query I 
a910: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
a920: 2b 20 2d 20 37 39 20 2b 20 2d 20 63 6f 6c 32 20  + - 79 + - col2 
a930: 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
a940: 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 32 0d 0a 2d  0..----..-112..-
a950: 31 36 31 0d 0a 2d 38 30 0d 0a 0d 0a 71 75 65 72  161..-80....quer
a960: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
a970: 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 30 20 2a  ECT ALL + col0 *
a980: 20 2d 20 30 20 46 52 4f 4d 20 74 61 62 32 0d 0a   - 0 FROM tab2..
a990: 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d  ----..0..0..0...
a9a0: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
a9b0: 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
a9c0: 54 20 39 39 20 2b 20 2d 20 74 61 62 32 2e 63 6f  T 99 + - tab2.co
a9d0: 6c 31 20 46 52 4f 4d 20 74 61 62 32 2c 20 74 61  l1 FROM tab2, ta
a9e0: 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
a9f0: 0d 0a 34 30 0d 0a 36 38 0d 0a 38 32 0d 0a 0d 0a  ..40..68..82....
aa00: 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75  onlyif mysql # u
aa10: 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20  se DIV operator 
aa20: 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69  for integer divi
aa30: 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f  sion..query I ro
aa40: 77 73 6f 72 74 20 6c 61 62 65 6c 2d 33 30 31 0d  wsort label-301.
aa50: 0a 53 45 4c 45 43 54 20 43 41 53 54 28 20 2b 20  .SELECT CAST( + 
aa60: 63 6f 6c 31 20 41 53 20 53 49 47 4e 45 44 20 29  col1 AS SIGNED )
aa70: 20 44 49 56 20 2d 20 63 6f 6c 31 20 41 53 20 63   DIV - col1 AS c
aa80: 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d  ol0 FROM tab2..-
aa90: 2d 2d 2d 0d 0a 2d 31 0d 0a 2d 31 0d 0a 2d 31 0d  ---..-1..-1..-1.
aaa0: 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
aab0: 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
aac0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
aad0: 74 20 6c 61 62 65 6c 2d 33 30 31 0d 0a 53 45 4c  t label-301..SEL
aae0: 45 43 54 20 43 41 53 54 20 28 20 2b 20 63 6f 6c  ECT CAST ( + col
aaf0: 31 20 41 53 20 49 4e 54 45 47 45 52 20 29 20 2f  1 AS INTEGER ) /
ab00: 20 2d 20 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20   - col1 AS col0 
ab10: 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d  FROM tab2..----.
ab20: 0a 2d 31 0d 0a 2d 31 0d 0a 2d 31 0d 0a 0d 0a 6f  .-1..-1..-1....o
ab30: 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75  nlyif mysql # su
ab40: 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20  pport for MySQL 
ab50: 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20  specific system 
ab60: 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78  types and syntax
ab70: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
ab80: 74 20 6c 61 62 65 6c 2d 33 30 32 0d 0a 53 45 4c  t label-302..SEL
ab90: 45 43 54 20 63 6f 72 30 2e 63 6f 6c 30 20 2b 20  ECT cor0.col0 + 
aba0: 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 2a 20 2d 20  + cor0.col1 * - 
abb0: 63 6f 6c 32 20 2a 20 43 41 53 54 28 20 4e 55 4c  col2 * CAST( NUL
abc0: 4c 20 41 53 20 53 49 47 4e 45 44 20 29 20 41 53  L AS SIGNED ) AS
abd0: 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20   col0 FROM tab0 
abe0: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e  AS cor0..----..N
abf0: 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d  ULL..NULL..NULL.
ac00: 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
ac10: 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
ac20: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
ac30: 74 20 6c 61 62 65 6c 2d 33 30 32 0d 0a 53 45 4c  t label-302..SEL
ac40: 45 43 54 20 63 6f 72 30 2e 63 6f 6c 30 20 2b 20  ECT cor0.col0 + 
ac50: 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 2a 20 2d 20  + cor0.col1 * - 
ac60: 63 6f 6c 32 20 2a 20 43 41 53 54 20 28 20 4e 55  col2 * CAST ( NU
ac70: 4c 4c 20 41 53 20 49 4e 54 45 47 45 52 20 29 20  LL AS INTEGER ) 
ac80: 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
ac90: 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
aca0: 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c  .NULL..NULL..NUL
acb0: 4c 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  L....query I row
acc0: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
acd0: 54 49 4e 43 54 20 2d 20 35 37 20 2b 20 2b 20 63  TINCT - 57 + + c
ace0: 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol2 FROM tab2 AS
acf0: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 39   cor0..----..-19
ad00: 0d 0a 2d 33 30 0d 0a 2d 33 31 0d 0a 0d 0a 71 75  ..-30..-31....qu
ad10: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
ad20: 45 4c 45 43 54 20 41 4c 4c 20 2b 20 28 20 37 39  ELECT ALL + ( 79
ad30: 20 29 20 2a 20 2d 20 63 6f 72 30 2e 63 6f 6c 30   ) * - cor0.col0
ad40: 20 2a 20 2d 20 63 6f 6c 31 20 46 52 4f 4d 20 74   * - col1 FROM t
ad50: 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
ad60: 2d 0d 0a 35 30 35 36 30 0d 0a 36 31 36 32 0d 0a  -..50560..6162..
ad70: 38 32 31 36 30 0d 0a 0d 0a 71 75 65 72 79 20 49  82160....query I
ad80: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
ad90: 20 41 4c 4c 20 2b 20 36 34 20 46 52 4f 4d 20 74   ALL + 64 FROM t
ada0: 61 62 31 2c 20 74 61 62 31 20 63 6f 72 30 2c 20  ab1, tab1 cor0, 
adb0: 74 61 62 32 20 41 53 20 63 6f 72 31 0d 0a 2d 2d  tab2 AS cor1..--
adc0: 2d 2d 0d 0a 32 37 20 76 61 6c 75 65 73 20 68 61  --..27 values ha
add0: 73 68 69 6e 67 20 74 6f 20 63 38 62 31 39 66 34  shing to c8b19f4
ade0: 63 33 66 66 33 38 37 30 30 63 64 32 62 62 38 61  c3ff38700cd2bb8a
adf0: 30 37 37 62 66 32 39 62 39 0d 0a 0d 0a 71 75 65  077bf29b9....que
ae00: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
ae10: 4c 45 43 54 20 2b 20 31 32 20 41 53 20 63 6f 6c  LECT + 12 AS col
ae20: 31 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d  1 FROM tab1..---
ae30: 2d 0d 0a 31 32 0d 0a 31 32 0d 0a 31 32 0d 0a 0d  -..12..12..12...
ae40: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
ae50: 0d 0a 53 45 4c 45 43 54 20 2d 20 2b 20 63 6f 6c  ..SELECT - + col
ae60: 30 20 2a 20 63 6f 6c 32 20 41 53 20 63 6f 6c 31  0 * col2 AS col1
ae70: 20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d   FROM tab1 cor0.
ae80: 0a 2d 2d 2d 2d 0d 0a 2d 31 36 32 0d 0a 2d 33 36  .----..-162..-36
ae90: 34 38 0d 0a 2d 37 36 38 30 0d 0a 0d 0a 71 75 65  48..-7680....que
aea0: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
aeb0: 4c 45 43 54 20 41 4c 4c 20 2d 20 2d 20 63 6f 6c  LECT ALL - - col
aec0: 30 20 2a 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f  0 * + col0 AS co
aed0: 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l0 FROM tab1 AS 
aee0: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 34 30 39 36  cor0..----..4096
aef0: 0d 0a 36 34 30 30 0d 0a 39 0d 0a 0d 0a 71 75 65  ..6400..9....que
af00: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
af10: 4c 45 43 54 20 63 6f 6c 32 20 2a 20 2b 20 63 6f  LECT col2 * + co
af20: 72 30 2e 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20  r0.col2 AS col1 
af30: 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a  FROM tab1 cor0..
af40: 2d 2d 2d 2d 0d 0a 32 39 31 36 0d 0a 33 32 34 39  ----..2916..3249
af50: 0d 0a 39 32 31 36 0d 0a 0d 0a 71 75 65 72 79 20  ..9216....query 
af60: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
af70: 54 20 41 4c 4c 20 2d 20 31 39 20 2a 20 63 6f 6c  T ALL - 19 * col
af80: 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  0 FROM tab1 AS c
af90: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32 31 36  or0..----..-1216
afa0: 0d 0a 2d 31 35 32 30 0d 0a 2d 35 37 0d 0a 0d 0a  ..-1520..-57....
afb0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
afc0: 0a 53 45 4c 45 43 54 20 2d 20 63 6f 72 30 2e 63  .SELECT - cor0.c
afd0: 6f 6c 30 20 2a 20 2b 20 63 6f 6c 32 20 2a 20 33  ol0 * + col2 * 3
afe0: 33 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  3 FROM tab2 AS c
aff0: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 36 32 33 37  or0..----..-6237
b000: 0d 0a 2d 36 36 39 32 34 0d 0a 2d 39 39 30 36 36  ..-66924..-99066
b010: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
b020: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
b030: 49 4e 43 54 20 2b 20 39 20 46 52 4f 4d 20 74 61  INCT + 9 FROM ta
b040: 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39  b2 cor0..----..9
b050: 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
b060: 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d   # support for M
b070: 79 53 51 4c 20 73 70 65 63 69 66 69 63 20 73 79  ySQL specific sy
b080: 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73  stem types and s
b090: 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72  yntax..query I r
b0a0: 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 33 31 33  owsort label-313
b0b0: 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 2d  ..SELECT ALL + -
b0c0: 20 63 6f 6c 31 20 2f 20 2d 20 43 41 53 54 28 20   col1 / - CAST( 
b0d0: 4e 55 4c 4c 20 41 53 20 53 49 47 4e 45 44 20 29  NULL AS SIGNED )
b0e0: 20 2b 20 28 20 2d 20 63 6f 72 30 2e 63 6f 6c 32   + ( - cor0.col2
b0f0: 20 29 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20   ) AS col0 FROM 
b100: 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
b110: 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a  --..NULL..NULL..
b120: 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  NULL....skipif m
b130: 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
b140: 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
b150: 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 33 31 33  owsort label-313
b160: 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 2d  ..SELECT ALL + -
b170: 20 63 6f 6c 31 20 2f 20 2d 20 43 41 53 54 20 28   col1 / - CAST (
b180: 20 4e 55 4c 4c 20 41 53 20 49 4e 54 45 47 45 52   NULL AS INTEGER
b190: 20 29 20 2b 20 28 20 2d 20 63 6f 72 30 2e 63 6f   ) + ( - cor0.co
b1a0: 6c 32 20 29 20 41 53 20 63 6f 6c 30 20 46 52 4f  l2 ) AS col0 FRO
b1b0: 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
b1c0: 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c  ----..NULL..NULL
b1d0: 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 6f 6e 6c 79 69 66  ..NULL....onlyif
b1e0: 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74   mysql # support
b1f0: 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69   for MySQL speci
b200: 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73  fic system types
b210: 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65   and syntax..que
b220: 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
b230: 65 6c 2d 33 31 34 0d 0a 53 45 4c 45 43 54 20 41  el-314..SELECT A
b240: 4c 4c 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 2a  LL + cor0.col1 *
b250: 20 2d 20 43 41 53 54 28 20 4e 55 4c 4c 20 41 53   - CAST( NULL AS
b260: 20 53 49 47 4e 45 44 20 29 20 2d 20 63 6f 6c 32   SIGNED ) - col2
b270: 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
b280: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a  r0..----..NULL..
b290: 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b  NULL..NULL....sk
b2a0: 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
b2b0: 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
b2c0: 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
b2d0: 65 6c 2d 33 31 34 0d 0a 53 45 4c 45 43 54 20 41  el-314..SELECT A
b2e0: 4c 4c 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 2a  LL + cor0.col1 *
b2f0: 20 2d 20 43 41 53 54 20 28 20 4e 55 4c 4c 20 41   - CAST ( NULL A
b300: 53 20 49 4e 54 45 47 45 52 20 29 20 2d 20 63 6f  S INTEGER ) - co
b310: 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l2 FROM tab2 AS 
b320: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c  cor0..----..NULL
b330: 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a  ..NULL..NULL....
b340: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
b350: 0a 53 45 4c 45 43 54 20 2b 20 2b 20 63 6f 6c 32  .SELECT + + col2
b360: 20 2a 20 2b 20 37 39 20 41 53 20 63 6f 6c 31 20   * + 79 AS col1 
b370: 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
b380: 30 0d 0a 2d 2d 2d 2d 0d 0a 32 36 30 37 0d 0a 36  0..----..2607..6
b390: 34 37 38 0d 0a 37 39 0d 0a 0d 0a 6f 6e 6c 79 69  478..79....onlyi
b3a0: 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72  f mysql # suppor
b3b0: 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63  t for MySQL spec
b3c0: 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65  ific system type
b3d0: 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75  s and syntax..qu
b3e0: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
b3f0: 62 65 6c 2d 33 31 36 0d 0a 53 45 4c 45 43 54 20  bel-316..SELECT 
b400: 2b 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 2b 20  + + cor0.col2 + 
b410: 43 41 53 54 28 20 63 6f 6c 31 20 41 53 20 53 49  CAST( col1 AS SI
b420: 47 4e 45 44 20 29 20 2a 20 2d 20 63 6f 6c 30 20  GNED ) * - col0 
b430: 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
b440: 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 30 33 31 0d 0a  0..----..-2031..
b450: 2d 33 33 39 34 0d 0a 2d 38 30 31 37 0d 0a 0d 0a  -3394..-8017....
b460: 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
b470: 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
b480: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
b490: 61 62 65 6c 2d 33 31 36 0d 0a 53 45 4c 45 43 54  abel-316..SELECT
b4a0: 20 2b 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 2b   + + cor0.col2 +
b4b0: 20 43 41 53 54 20 28 20 63 6f 6c 31 20 41 53 20   CAST ( col1 AS 
b4c0: 49 4e 54 45 47 45 52 20 29 20 2a 20 2d 20 63 6f  INTEGER ) * - co
b4d0: 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l0 FROM tab0 AS 
b4e0: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 30 33  cor0..----..-203
b4f0: 31 0d 0a 2d 33 33 39 34 0d 0a 2d 38 30 31 37 0d  1..-3394..-8017.
b500: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
b510: 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2d 20 63  rt..SELECT + - c
b520: 6f 6c 32 20 2a 20 2d 20 31 31 20 46 52 4f 4d 20  ol2 * - 11 FROM 
b530: 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
b540: 2d 2d 0d 0a 31 30 35 36 0d 0a 35 39 34 0d 0a 36  --..1056..594..6
b550: 32 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  27....query I ro
b560: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
b570: 4c 20 2d 20 2d 20 63 6f 72 30 2e 63 6f 6c 30 20  L - - cor0.col0 
b580: 2b 20 2b 20 30 20 2d 20 39 20 41 53 20 63 6f 6c  + + 0 - 9 AS col
b590: 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  2 FROM tab2 AS c
b5a0: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 0d 0a 36  or0..----..-2..6
b5b0: 39 0d 0a 37 30 0d 0a 0d 0a 73 6b 69 70 69 66 20  9..70....skipif 
b5c0: 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73  postgresql # Pos
b5d0: 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73  tgreSQL requires
b5e0: 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e   AS when renamin
b5f0: 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73  g output columns
b600: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
b610: 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
b620: 43 54 20 63 6f 6c 32 20 2a 20 63 6f 72 30 2e 63  CT col2 * cor0.c
b630: 6f 6c 31 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61  ol1 col0 FROM ta
b640: 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
b650: 0d 0a 31 35 33 34 0d 0a 36 34 36 0d 0a 38 33 37  ..1534..646..837
b660: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
b670: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
b680: 49 4e 43 54 20 63 6f 6c 32 20 2a 20 63 6f 6c 31  INCT col2 * col1
b690: 20 2b 20 2d 20 63 6f 6c 32 20 41 53 20 63 6f 6c   + - col2 AS col
b6a0: 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  0 FROM tab2 AS c
b6b0: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 35 30 38 0d  or0..----..1508.
b6c0: 0a 36 30 38 0d 0a 38 31 30 0d 0a 0d 0a 71 75 65  .608..810....que
b6d0: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
b6e0: 4c 45 43 54 20 2b 20 63 6f 6c 32 20 2b 20 39 38  LECT + col2 + 98
b6f0: 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
b700: 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
b710: 0d 0a 31 33 31 0d 0a 31 38 30 0d 0a 39 39 0d 0a  ..131..180..99..
b720: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
b730: 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20  t..SELECT ALL + 
b740: 63 6f 6c 30 20 2a 20 63 6f 6c 30 20 2b 20 2d 20  col0 * col0 + - 
b750: 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41  col2 FROM tab0 A
b760: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32  S cor0..----..12
b770: 32 34 0d 0a 35 34 33 0d 0a 37 38 33 39 0d 0a 0d  24..543..7839...
b780: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
b790: 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 72 30 2e  ..SELECT + cor0.
b7a0: 63 6f 6c 30 20 2b 20 63 6f 6c 31 20 2a 20 2b 20  col0 + col1 * + 
b7b0: 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46 52 4f  col0 AS col2 FRO
b7c0: 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab2 cor0..---
b7d0: 2d 0d 0a 31 34 32 32 0d 0a 32 32 34 0d 0a 34 36  -..1422..224..46
b7e0: 38 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  80....query I ro
b7f0: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
b800: 63 6f 6c 32 20 2a 20 2b 20 28 20 63 6f 6c 31 20  col2 * + ( col1 
b810: 2b 20 63 6f 6c 30 20 29 20 41 53 20 63 6f 6c 30  + col0 ) AS col0
b820: 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
b830: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33 32 0d 0a 31  r0..----..132..1
b840: 34 37 36 30 0d 0a 33 36 33 30 0d 0a 0d 0a 73 6b  4760..3630....sk
b850: 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20  ipif postgresql 
b860: 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71  # PostgreSQL req
b870: 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65  uires AS when re
b880: 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f  naming output co
b890: 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72  lumns..query I r
b8a0: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63  owsort..SELECT c
b8b0: 6f 72 30 2e 63 6f 6c 31 20 63 6f 6c 32 20 46 52  or0.col1 col2 FR
b8c0: 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d  OM tab2 cor0..--
b8d0: 2d 2d 0d 0a 31 37 0d 0a 33 31 0d 0a 35 39 0d 0a  --..17..31..59..
b8e0: 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65  ..skipif postgre
b8f0: 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c  sql # PostgreSQL
b900: 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65   requires AS whe
b910: 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75  n renaming outpu
b920: 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79  t columns..query
b930: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
b940: 43 54 20 2b 20 63 6f 6c 30 20 2a 20 2b 20 63 6f  CT + col0 * + co
b950: 6c 31 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  l1 col1 FROM tab
b960: 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
b970: 0a 32 30 36 34 0d 0a 33 33 39 35 0d 0a 38 30 39  .2064..3395..809
b980: 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  9....query I row
b990: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
b9a0: 20 2d 20 31 34 20 41 53 20 63 6f 6c 32 20 46 52   - 14 AS col2 FR
b9b0: 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
b9c0: 0a 2d 2d 2d 2d 0d 0a 2d 31 34 0d 0a 2d 31 34 0d  .----..-14..-14.
b9d0: 0a 2d 31 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .-14....query I 
b9e0: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
b9f0: 44 49 53 54 49 4e 43 54 20 2b 20 2b 20 28 20 2d  DISTINCT + + ( -
ba00: 20 63 6f 6c 32 20 29 20 46 52 4f 4d 20 74 61 62   col2 ) FROM tab
ba10: 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 35  1 cor0..----..-5
ba20: 34 0d 0a 2d 35 37 0d 0a 2d 39 36 0d 0a 0d 0a 71  4..-57..-96....q
ba30: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
ba40: 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 2b 20 63  SELECT ALL - + c
ba50: 6f 6c 31 20 2a 20 63 6f 72 30 2e 63 6f 6c 32 20  ol1 * cor0.col2 
ba60: 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a  FROM tab0 cor0..
ba70: 2d 2d 2d 2d 0d 0a 2d 32 38 33 38 0d 0a 2d 37 34  ----..-2838..-74
ba80: 36 32 0d 0a 2d 39 37 0d 0a 0d 0a 71 75 65 72 79  62..-97....query
ba90: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
baa0: 43 54 20 2b 20 63 6f 6c 32 20 2a 20 2d 20 39 31  CT + col2 * - 91
bab0: 20 46 52 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d   FROM tab2 cor0.
bac0: 0a 2d 2d 2d 2d 0d 0a 2d 32 33 36 36 0d 0a 2d 32  .----..-2366..-2
bad0: 34 35 37 0d 0a 2d 33 34 35 38 0d 0a 0d 0a 71 75  457..-3458....qu
bae0: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
baf0: 45 4c 45 43 54 20 2b 20 63 6f 6c 31 20 2a 20 2d  ELECT + col1 * -
bb00: 20 33 37 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d   37 AS col1 FROM
bb10: 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
bb20: 2d 2d 2d 0d 0a 2d 31 31 34 37 0d 0a 2d 32 31 38  ---..-1147..-218
bb30: 33 0d 0a 2d 36 32 39 0d 0a 0d 0a 71 75 65 72 79  3..-629....query
bb40: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
bb50: 43 54 20 28 20 2d 20 63 6f 6c 30 20 29 20 2a 20  CT ( - col0 ) * 
bb60: 2d 20 63 6f 72 30 2e 63 6f 6c 30 20 41 53 20 63  - cor0.col0 AS c
bb70: 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol0 FROM tab0 AS
bb80: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 32   cor0..----..122
bb90: 35 0d 0a 35 37 36 0d 0a 37 39 32 31 0d 0a 0d 0a  5..576..7921....
bba0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
bbb0: 0a 53 45 4c 45 43 54 20 2b 20 38 33 20 41 53 20  .SELECT + 83 AS 
bbc0: 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 2c 20  col2 FROM tab2, 
bbd0: 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
bbe0: 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73  --..9 values has
bbf0: 68 69 6e 67 20 74 6f 20 31 38 66 34 30 35 63 33  hing to 18f405c3
bc00: 31 61 30 66 62 34 37 63 65 33 63 63 39 66 37 65  1a0fb47ce3cc9f7e
bc10: 66 66 61 38 38 35 35 63 0d 0a 0d 0a 6f 6e 6c 79  ffa8855c....only
bc20: 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f  if mysql # suppo
bc30: 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65  rt for MySQL spe
bc40: 63 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70  cific system typ
bc50: 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71  es and syntax..q
bc60: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
bc70: 61 62 65 6c 2d 33 33 34 0d 0a 53 45 4c 45 43 54  abel-334..SELECT
bc80: 20 44 49 53 54 49 4e 43 54 20 2b 20 2d 20 43 41   DISTINCT + - CA
bc90: 53 54 28 20 4e 55 4c 4c 20 41 53 20 53 49 47 4e  ST( NULL AS SIGN
bca0: 45 44 20 29 20 46 52 4f 4d 20 74 61 62 31 2c 20  ED ) FROM tab1, 
bcb0: 74 61 62 32 2c 20 74 61 62 30 20 41 53 20 63 6f  tab2, tab0 AS co
bcc0: 72 30 2c 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a  r0, tab0..----..
bcd0: 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  NULL....skipif m
bce0: 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
bcf0: 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
bd00: 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 33 33 34  owsort label-334
bd10: 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
bd20: 54 20 2b 20 2d 20 43 41 53 54 20 28 20 4e 55 4c  T + - CAST ( NUL
bd30: 4c 20 41 53 20 49 4e 54 45 47 45 52 20 29 20 46  L AS INTEGER ) F
bd40: 52 4f 4d 20 74 61 62 31 2c 20 74 61 62 32 2c 20  ROM tab1, tab2, 
bd50: 74 61 62 30 20 41 53 20 63 6f 72 30 2c 20 74 61  tab0 AS cor0, ta
bd60: 62 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a  b0..----..NULL..
bd70: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
bd80: 74 0d 0a 53 45 4c 45 43 54 20 2b 20 39 31 20 46  t..SELECT + 91 F
bd90: 52 4f 4d 20 74 61 62 31 2c 20 74 61 62 30 20 63  ROM tab1, tab0 c
bda0: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c  or0..----..9 val
bdb0: 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 35  ues hashing to 5
bdc0: 37 34 38 36 32 37 65 66 35 66 64 38 36 61 32 31  748627ef5fd86a21
bdd0: 63 64 35 35 39 66 64 32 37 38 64 37 32 37 37 0d  cd559fd278d7277.
bde0: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
bdf0: 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 72 30 2e  rt..SELECT cor0.
be00: 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46 52 4f  col1 AS col2 FRO
be10: 4d 20 74 61 62 31 2c 20 74 61 62 32 2c 20 74 61  M tab1, tab2, ta
be20: 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
be30: 0d 0a 32 37 20 76 61 6c 75 65 73 20 68 61 73 68  ..27 values hash
be40: 69 6e 67 20 74 6f 20 37 35 39 39 62 34 38 30 31  ing to 7599b4801
be50: 32 35 64 65 35 32 31 65 66 65 64 37 31 62 35 62  25de521efed71b5b
be60: 32 34 31 33 63 37 64 0d 0a 0d 0a 6f 6e 6c 79 69  2413c7d....onlyi
be70: 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49  f mysql # use DI
be80: 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69  V operator for i
be90: 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d  nteger division.
bea0: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
beb0: 20 6c 61 62 65 6c 2d 33 33 37 0d 0a 53 45 4c 45   label-337..SELE
bec0: 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 31  CT DISTINCT col1
bed0: 20 44 49 56 20 33 20 46 52 4f 4d 20 74 61 62 30   DIV 3 FROM tab0
bee0: 0d 0a 2d 2d 2d 2d 0d 0a 32 38 0d 0a 33 30 0d 0a  ..----..28..30..
bef0: 33 32 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  32....skipif mys
bf00: 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
bf10: 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
bf20: 73 6f 72 74 20 6c 61 62 65 6c 2d 33 33 37 0d 0a  sort label-337..
bf30: 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
bf40: 63 6f 6c 31 20 2f 20 33 20 46 52 4f 4d 20 74 61  col1 / 3 FROM ta
bf50: 62 30 0d 0a 2d 2d 2d 2d 0d 0a 32 38 0d 0a 33 30  b0..----..28..30
bf60: 0d 0a 33 32 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  ..32....onlyif m
bf70: 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f  ysql # use DIV o
bf80: 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65  perator for inte
bf90: 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75  ger division..qu
bfa0: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
bfb0: 62 65 6c 2d 33 33 38 0d 0a 53 45 4c 45 43 54 20  bel-338..SELECT 
bfc0: 2b 20 28 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20  + ( + cor0.col0 
bfd0: 29 20 2a 20 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c  ) * col1 * + col
bfe0: 30 20 2b 20 63 6f 6c 31 20 44 49 56 20 38 30 20  0 + col1 DIV 80 
bff0: 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
c000: 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
c010: 0a 31 31 38 38 32 36 0d 0a 34 39 35 33 37 0d 0a  .118826..49537..
c020: 37 32 30 38 31 32 0d 0a 0d 0a 73 6b 69 70 69 66  720812....skipif
c030: 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
c040: 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
c050: 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 33   rowsort label-3
c060: 33 38 0d 0a 53 45 4c 45 43 54 20 2b 20 28 20 2b  38..SELECT + ( +
c070: 20 63 6f 72 30 2e 63 6f 6c 30 20 29 20 2a 20 63   cor0.col0 ) * c
c080: 6f 6c 31 20 2a 20 2b 20 63 6f 6c 30 20 2b 20 63  ol1 * + col0 + c
c090: 6f 6c 31 20 2f 20 38 30 20 41 53 20 63 6f 6c 32  ol1 / 80 AS col2
c0a0: 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
c0b0: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 38 38 32 36  r0..----..118826
c0c0: 0d 0a 34 39 35 33 37 0d 0a 37 32 30 38 31 32 0d  ..49537..720812.
c0d0: 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72  ...skipif postgr
c0e0: 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51  esql # PostgreSQ
c0f0: 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68  L requires AS wh
c100: 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70  en renaming outp
c110: 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72  ut columns..quer
c120: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
c130: 45 43 54 20 2b 20 2d 20 63 6f 6c 30 20 2a 20 2d  ECT + - col0 * -
c140: 20 63 6f 6c 31 20 63 6f 6c 32 20 46 52 4f 4d 20   col1 col2 FROM 
c150: 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
c160: 2d 2d 0d 0a 31 30 34 30 0d 0a 36 34 30 0d 0a 37  --..1040..640..7
c170: 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  8....query I row
c180: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2b  sort..SELECT + +
c190: 20 31 30 20 2a 20 2d 20 63 6f 6c 31 20 46 52 4f   10 * - col1 FRO
c1a0: 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
c1b0: 2d 2d 2d 2d 0d 0a 2d 38 36 30 0d 0a 2d 39 31 30  ----..-860..-910
c1c0: 0d 0a 2d 39 37 30 0d 0a 0d 0a 71 75 65 72 79 20  ..-970....query 
c1d0: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
c1e0: 54 20 41 4c 4c 20 36 36 20 41 53 20 63 6f 6c 30  T ALL 66 AS col0
c1f0: 20 46 52 4f 4d 20 74 61 62 31 2c 20 74 61 62 30   FROM tab1, tab0
c200: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
c210: 39 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67  9 values hashing
c220: 20 74 6f 20 32 39 37 39 34 39 31 35 62 35 38 35   to 29794915b585
c230: 65 65 61 38 34 38 61 64 36 37 30 30 37 35 34 35  eea848ad67007545
c240: 32 63 38 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20  2c88....query I 
c250: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
c260: 44 49 53 54 49 4e 43 54 20 2b 20 31 33 20 2b 20  DISTINCT + 13 + 
c270: 2b 20 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46  + col2 AS col1 F
c280: 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab1..----..
c290: 31 30 39 0d 0a 36 37 0d 0a 37 30 0d 0a 0d 0a 71  109..67..70....q
c2a0: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
c2b0: 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 32 31 20  SELECT ALL - 21 
c2c0: 46 52 4f 4d 20 74 61 62 31 2c 20 74 61 62 32 2c  FROM tab1, tab2,
c2d0: 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
c2e0: 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75 65 73 20 68  ---..27 values h
c2f0: 61 73 68 69 6e 67 20 74 6f 20 63 64 63 62 34 30  ashing to cdcb40
c300: 63 39 65 31 62 62 39 61 33 33 63 65 39 31 36 37  c9e1bb9a33ce9167
c310: 61 30 64 32 62 61 63 30 62 31 0d 0a 0d 0a 71 75  a0d2bac0b1....qu
c320: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
c330: 45 4c 45 43 54 20 63 6f 6c 31 20 2a 20 28 20 2d  ELECT col1 * ( -
c340: 20 63 6f 6c 31 20 29 20 41 53 20 63 6f 6c 32 20   col1 ) AS col2 
c350: 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d  FROM tab0..----.
c360: 0a 2d 37 33 39 36 0d 0a 2d 38 32 38 31 0d 0a 2d  .-7396..-8281..-
c370: 39 34 30 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20  9409....query I 
c380: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
c390: 2b 20 35 30 20 2a 20 2b 20 31 39 20 41 53 20 63  + 50 * + 19 AS c
c3a0: 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d  ol2 FROM tab1..-
c3b0: 2d 2d 2d 0d 0a 39 35 30 0d 0a 39 35 30 0d 0a 39  ---..950..950..9
c3c0: 35 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73  50....skipif pos
c3d0: 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72  tgresql # Postgr
c3e0: 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53  eSQL requires AS
c3f0: 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f   when renaming o
c400: 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71  utput columns..q
c410: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
c420: 53 45 4c 45 43 54 20 2b 20 63 6f 6c 32 20 2b 20  SELECT + col2 + 
c430: 63 6f 6c 30 20 63 6f 6c 30 20 46 52 4f 4d 20 74  col0 col0 FROM t
c440: 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
c450: 2d 0d 0a 31 37 31 0d 0a 33 36 0d 0a 35 37 0d 0a  -..171..36..57..
c460: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
c470: 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 32  t..SELECT - col2
c480: 20 2b 20 63 6f 6c 30 20 2a 20 63 6f 6c 31 20 41   + col0 * col1 A
c490: 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31  S col2 FROM tab1
c4a0: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 34 0d   cor0..----..24.
c4b0: 0a 35 38 33 0d 0a 39 34 34 0d 0a 0d 0a 71 75 65  .583..944....que
c4c0: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
c4d0: 4c 45 43 54 20 2b 20 39 20 2a 20 36 36 20 46 52  LECT + 9 * 66 FR
c4e0: 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 35  OM tab0..----..5
c4f0: 39 34 0d 0a 35 39 34 0d 0a 35 39 34 0d 0a 0d 0a  94..594..594....
c500: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
c510: 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
c520: 20 63 6f 72 30 2e 63 6f 6c 30 20 41 53 20 63 6f   cor0.col0 AS co
c530: 6c 32 20 46 52 4f 4d 20 74 61 62 30 2c 20 74 61  l2 FROM tab0, ta
c540: 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 37  b2 cor0..----..7
c550: 0d 0a 37 38 0d 0a 37 39 0d 0a 0d 0a 71 75 65 72  ..78..79....quer
c560: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
c570: 45 43 54 20 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c  ECT col2 * - col
c580: 32 20 2a 20 2b 20 32 36 20 46 52 4f 4d 20 74 61  2 * + 26 FROM ta
c590: 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 33 39 36 31  b1..----..-23961
c5a0: 36 0d 0a 2d 37 35 38 31 36 0d 0a 2d 38 34 34 37  6..-75816..-8447
c5b0: 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  4....query I row
c5c0: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
c5d0: 20 2b 20 74 61 62 31 2e 63 6f 6c 31 20 41 53 20   + tab1.col1 AS 
c5e0: 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 2c 20  col2 FROM tab1, 
c5f0: 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
c600: 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73  --..9 values has
c610: 68 69 6e 67 20 74 6f 20 33 36 36 65 63 35 33 39  hing to 366ec539
c620: 61 66 30 66 33 37 62 64 31 35 31 39 62 63 35 36  af0f37bd1519bc56
c630: 38 66 33 64 36 37 37 35 0d 0a 0d 0a 71 75 65 72  8f3d6775....quer
c640: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
c650: 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 2d  ECT DISTINCT - -
c660: 20 28 20 2d 20 37 20 29 20 41 53 20 63 6f 6c 31   ( - 7 ) AS col1
c670: 20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 20   FROM tab1 cor0 
c680: 43 52 4f 53 53 20 4a 4f 49 4e 20 74 61 62 31 20  CROSS JOIN tab1 
c690: 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor1..----..-
c6a0: 37 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74  7....skipif post
c6b0: 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65  gresql # Postgre
c6c0: 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20  SQL requires AS 
c6d0: 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75  when renaming ou
c6e0: 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75  tput columns..qu
c6f0: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
c700: 45 4c 45 43 54 20 2b 20 2b 20 28 20 35 34 20 29  ELECT + + ( 54 )
c710: 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20   col2 FROM tab1 
c720: 41 53 20 63 6f 72 30 20 43 52 4f 53 53 20 4a 4f  AS cor0 CROSS JO
c730: 49 4e 20 74 61 62 31 20 41 53 20 63 6f 72 31 0d  IN tab1 AS cor1.
c740: 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20  .----..9 values 
c750: 68 61 73 68 69 6e 67 20 74 6f 20 64 32 33 36 34  hashing to d2364
c760: 63 34 66 66 63 30 39 61 63 32 63 66 31 66 36 66  c4ffc09ac2cf1f6f
c770: 61 34 64 37 36 37 64 38 62 30 39 0d 0a 0d 0a 71  a4d767d8b09....q
c780: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
c790: 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
c7a0: 28 20 63 6f 6c 30 20 29 20 41 53 20 63 6f 6c 30  ( col0 ) AS col0
c7b0: 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d   FROM tab2..----
c7c0: 0d 0a 37 0d 0a 37 38 0d 0a 37 39 0d 0a 0d 0a 71  ..7..78..79....q
c7d0: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
c7e0: 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
c7f0: 2d 20 2d 20 36 32 20 2a 20 2b 20 63 6f 6c 30 20  - - 62 * + col0 
c800: 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
c810: 30 0d 0a 2d 2d 2d 2d 0d 0a 34 33 34 0d 0a 34 38  0..----..434..48
c820: 33 36 0d 0a 34 38 39 38 0d 0a 0d 0a 71 75 65 72  36..4898....quer
c830: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
c840: 45 43 54 20 2b 20 63 6f 6c 32 20 2a 20 2b 20 63  ECT + col2 * + c
c850: 6f 6c 30 20 2d 20 28 20 63 6f 6c 32 20 29 20 46  ol0 - ( col2 ) F
c860: 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
c870: 0d 0a 2d 2d 2d 2d 0d 0a 33 34 0d 0a 37 32 31 36  ..----..34..7216
c880: 0d 0a 37 35 39 0d 0a 0d 0a 71 75 65 72 79 20 49  ..759....query I
c890: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
c8a0: 20 41 4c 4c 20 2b 20 63 6f 6c 32 20 2a 20 2b 20   ALL + col2 * + 
c8b0: 63 6f 72 30 2e 63 6f 6c 32 20 41 53 20 63 6f 6c  cor0.col2 AS col
c8c0: 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  1 FROM tab0 AS c
c8d0: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 0d 0a 31 30  or0..----..1..10
c8e0: 38 39 0d 0a 36 37 32 34 0d 0a 0d 0a 71 75 65 72  89..6724....quer
c8f0: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
c900: 45 43 54 20 34 30 20 2d 20 2b 20 63 6f 6c 31 20  ECT 40 - + col1 
c910: 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
c920: 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  2 cor0..----..-1
c930: 39 0d 0a 32 33 0d 0a 39 0d 0a 0d 0a 71 75 65 72  9..23..9....quer
c940: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
c950: 45 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c  ECT DISTINCT col
c960: 32 20 2b 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20  2 + + cor0.col0 
c970: 2a 20 39 32 20 41 53 20 63 6f 6c 32 20 46 52 4f  * 92 AS col2 FRO
c980: 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab0 cor0..---
c990: 2d 0d 0a 32 32 34 31 0d 0a 33 32 32 31 0d 0a 38  -..2241..3221..8
c9a0: 32 37 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  270....query I r
c9b0: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
c9c0: 20 63 6f 6c 31 20 2a 20 63 6f 6c 32 20 2a 20 63   col1 * col2 * c
c9d0: 6f 6c 30 20 2d 20 63 6f 6c 31 20 41 53 20 63 6f  ol0 - col1 AS co
c9e0: 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l0 FROM tab0 AS 
c9f0: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 34 39  cor0..----..-349
ca00: 32 0d 0a 2d 36 36 34 32 30 39 0d 0a 2d 36 38 31  2..-664209..-681
ca10: 39 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  98....query I ro
ca20: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
ca30: 53 54 49 4e 43 54 20 2d 20 2b 20 37 32 20 2b 20  STINCT - + 72 + 
ca40: 2d 20 63 6f 6c 30 20 2a 20 2b 20 63 6f 72 30 2e  - col0 * + cor0.
ca50: 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41  col1 FROM tab1 A
ca60: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
ca70: 31 31 32 0d 0a 2d 31 35 30 0d 0a 2d 37 31 32 0d  112..-150..-712.
ca80: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
ca90: 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
caa0: 4e 43 54 20 2b 20 38 30 20 2b 20 2d 20 63 6f 6c  NCT + 80 + - col
cab0: 31 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  1 AS col2 FROM t
cac0: 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
cad0: 2d 0d 0a 32 31 0d 0a 34 39 0d 0a 36 33 0d 0a 0d  -..21..49..63...
cae0: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
caf0: 0d 0a 53 45 4c 45 43 54 20 2d 20 2d 20 63 6f 72  ..SELECT - - cor
cb00: 30 2e 63 6f 6c 30 20 2a 20 63 6f 6c 31 20 2b 20  0.col0 * col1 + 
cb10: 28 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 29 20  ( - cor0.col2 ) 
cb20: 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
cb30: 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
cb40: 0a 32 30 33 31 0d 0a 33 33 39 34 0d 0a 38 30 31  .2031..3394..801
cb50: 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  7....query I row
cb60: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
cb70: 20 63 6f 6c 32 20 2a 20 63 6f 72 30 2e 63 6f 6c   col2 * cor0.col
cb80: 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  0 AS col1 FROM t
cb90: 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
cba0: 2d 0d 0a 31 38 39 0d 0a 32 30 32 38 0d 0a 33 30  -..189..2028..30
cbb0: 30 32 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  02....onlyif mys
cbc0: 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65  ql # use DIV ope
cbd0: 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65  rator for intege
cbe0: 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72  r division..quer
cbf0: 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
cc00: 6c 2d 33 36 35 0d 0a 53 45 4c 45 43 54 20 2d 20  l-365..SELECT - 
cc10: 2d 20 63 6f 6c 32 20 2b 20 63 6f 6c 30 20 44 49  - col2 + col0 DI
cc20: 56 20 2b 20 36 39 20 41 53 20 63 6f 6c 30 20 46  V + 69 AS col0 F
cc30: 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
cc40: 0d 0a 2d 2d 2d 2d 0d 0a 35 34 0d 0a 35 37 0d 0a  ..----..54..57..
cc50: 39 37 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  97....skipif mys
cc60: 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
cc70: 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
cc80: 73 6f 72 74 20 6c 61 62 65 6c 2d 33 36 35 0d 0a  sort label-365..
cc90: 53 45 4c 45 43 54 20 2d 20 2d 20 63 6f 6c 32 20  SELECT - - col2 
cca0: 2b 20 63 6f 6c 30 20 2f 20 2b 20 36 39 20 41 53  + col0 / + 69 AS
ccb0: 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20   col0 FROM tab1 
ccc0: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 35  AS cor0..----..5
ccd0: 34 0d 0a 35 37 0d 0a 39 37 0d 0a 0d 0a 6f 6e 6c  4..57..97....onl
cce0: 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20  yif mysql # use 
ccf0: 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72  DIV operator for
cd00: 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f   integer divisio
cd10: 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  n..query I rowso
cd20: 72 74 20 6c 61 62 65 6c 2d 33 36 36 0d 0a 53 45  rt label-366..SE
cd30: 4c 45 43 54 20 2d 20 28 20 2d 20 63 6f 6c 32 20  LECT - ( - col2 
cd40: 29 20 44 49 56 20 63 6f 6c 31 20 46 52 4f 4d 20  ) DIV col1 FROM 
cd50: 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30  tab0..----..0..0
cd60: 0d 0a 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  ..0....skipif my
cd70: 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
cd80: 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
cd90: 77 73 6f 72 74 20 6c 61 62 65 6c 2d 33 36 36 0d  wsort label-366.
cda0: 0a 53 45 4c 45 43 54 20 2d 20 28 20 2d 20 63 6f  .SELECT - ( - co
cdb0: 6c 32 20 29 20 2f 20 63 6f 6c 31 20 46 52 4f 4d  l2 ) / col1 FROM
cdc0: 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a   tab0..----..0..
cdd0: 30 0d 0a 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  0..0....onlyif m
cde0: 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f  ysql # use DIV o
cdf0: 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65  perator for inte
ce00: 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75  ger division..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 36 37 0d 0a 53 45 4c 45 43 54 20  bel-367..SELECT 
ce30: 2b 20 2d 20 63 6f 6c 30 20 2d 20 63 6f 6c 31 20  + - col0 - col1 
ce40: 44 49 56 20 2d 20 63 6f 6c 30 20 41 53 20 63 6f  DIV - col0 AS co
ce50: 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l1 FROM tab2 AS 
ce60: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 0d 0a  cor0..----..-3..
ce70: 2d 37 38 0d 0a 2d 37 39 0d 0a 0d 0a 73 6b 69 70  -78..-79....skip
ce80: 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
ce90: 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
cea0: 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
ceb0: 2d 33 36 37 0d 0a 53 45 4c 45 43 54 20 2b 20 2d  -367..SELECT + -
cec0: 20 63 6f 6c 30 20 2d 20 63 6f 6c 31 20 2f 20 2d   col0 - col1 / -
ced0: 20 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46 52   col0 AS col1 FR
cee0: 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
cef0: 0a 2d 2d 2d 2d 0d 0a 2d 33 0d 0a 2d 37 38 0d 0a  .----..-3..-78..
cf00: 2d 37 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  -79....query I r
cf10: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
cf20: 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c 31 20 2b  ISTINCT - col1 +
cf30: 20 2b 20 63 6f 6c 31 20 2a 20 2b 20 63 6f 72 30   + col1 * + cor0
cf40: 2e 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20  .col1 FROM tab0 
cf50: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 37 33 31 30  cor0..----..7310
cf60: 0d 0a 38 31 39 30 0d 0a 39 33 31 32 0d 0a 0d 0a  ..8190..9312....
cf70: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
cf80: 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 2d 20  .SELECT ALL - - 
cf90: 39 39 20 2a 20 2b 20 63 6f 72 30 2e 63 6f 6c 30  99 * + cor0.col0
cfa0: 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
cfb0: 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
cfc0: 0d 0a 32 33 37 36 0d 0a 33 34 36 35 0d 0a 38 38  ..2376..3465..88
cfd0: 31 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  11....query I ro
cfe0: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
cff0: 4c 20 2d 20 63 6f 72 30 2e 63 6f 6c 30 20 2a 20  L - cor0.col0 * 
d000: 2d 20 63 6f 6c 32 20 2b 20 63 6f 6c 30 20 2a 20  - col2 + col0 * 
d010: 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46  + col1 AS col2 F
d020: 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
d030: 0d 0a 2d 2d 2d 2d 0d 0a 34 30 36 0d 0a 34 33 34  ..----..406..434
d040: 35 0d 0a 36 36 33 30 0d 0a 0d 0a 73 6b 69 70 69  5..6630....skipi
d050: 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50  f postgresql # P
d060: 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72  ostgreSQL requir
d070: 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d  es AS when renam
d080: 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d  ing output colum
d090: 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ns..query I rows
d0a0: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f  ort..SELECT - co
d0b0: 6c 32 20 2a 20 63 6f 6c 32 20 2b 20 63 6f 72 30  l2 * col2 + cor0
d0c0: 2e 63 6f 6c 31 20 63 6f 6c 32 20 46 52 4f 4d 20  .col1 col2 FROM 
d0d0: 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
d0e0: 2d 2d 0d 0a 2d 31 30 30 33 0d 0a 2d 36 36 33 33  --..-1003..-6633
d0f0: 0d 0a 39 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..96....query I 
d100: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
d110: 44 49 53 54 49 4e 43 54 20 63 6f 72 30 2e 63 6f  DISTINCT cor0.co
d120: 6c 31 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74  l1 + col0 FROM t
d130: 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
d140: 2d 0d 0a 32 39 0d 0a 37 34 0d 0a 39 33 0d 0a 0d  -..29..74..93...
d150: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
d160: 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
d170: 54 20 2b 20 2d 20 39 20 2b 20 63 6f 72 30 2e 63  T + - 9 + cor0.c
d180: 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  ol0 AS col0 FROM
d190: 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab0 cor0..----
d1a0: 0d 0a 31 35 0d 0a 32 36 0d 0a 38 30 0d 0a 0d 0a  ..15..26..80....
d1b0: 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
d1c0: 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
d1d0: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
d1e0: 53 45 4c 45 43 54 20 43 41 53 54 20 28 20 2b 20  SELECT CAST ( + 
d1f0: 63 6f 6c 31 20 41 53 20 52 45 41 4c 20 29 20 41  col1 AS REAL ) A
d200: 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32  S col0 FROM tab2
d210: 0d 0a 2d 2d 2d 2d 0d 0a 31 37 0d 0a 33 31 0d 0a  ..----..17..31..
d220: 35 39 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  59....onlyif mys
d230: 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65  ql # use DIV ope
d240: 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65  rator for intege
d250: 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72  r division..quer
d260: 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
d270: 6c 2d 33 37 35 0d 0a 53 45 4c 45 43 54 20 38 39  l-375..SELECT 89
d280: 20 44 49 56 20 28 20 63 6f 6c 32 20 2a 20 2b 20   DIV ( col2 * + 
d290: 63 6f 6c 30 20 29 20 41 53 20 63 6f 6c 30 20 46  col0 ) AS col0 F
d2a0: 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab0..----..
d2b0: 30 0d 0a 30 0d 0a 32 0d 0a 0d 0a 73 6b 69 70 69  0..0..2....skipi
d2c0: 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
d2d0: 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
d2e0: 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
d2f0: 33 37 35 0d 0a 53 45 4c 45 43 54 20 38 39 20 2f  375..SELECT 89 /
d300: 20 28 20 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c 30   ( col2 * + col0
d310: 20 29 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20   ) AS col0 FROM 
d320: 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30  tab0..----..0..0
d330: 0d 0a 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  ..2....query I r
d340: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
d350: 20 2d 20 63 6f 72 31 2e 63 6f 6c 31 20 2a 20 34   - cor1.col1 * 4
d360: 31 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  1 AS col0 FROM t
d370: 61 62 32 20 41 53 20 63 6f 72 30 20 43 52 4f 53  ab2 AS cor0 CROS
d380: 53 20 4a 4f 49 4e 20 74 61 62 32 20 41 53 20 63  S JOIN tab2 AS c
d390: 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c  or1..----..9 val
d3a0: 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 38  ues hashing to 8
d3b0: 34 64 35 34 38 36 62 32 61 34 38 30 66 37 64 39  4d5486b2a480f7d9
d3c0: 31 39 65 65 61 30 64 63 38 62 39 62 35 35 33 0d  19eea0dc8b9b553.
d3d0: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
d3e0: 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
d3f0: 4e 43 54 20 2b 20 63 6f 6c 31 20 2d 20 2b 20 63  NCT + col1 - + c
d400: 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  ol2 AS col0 FROM
d410: 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 35 33 0d   tab0..----..53.
d420: 0a 39 0d 0a 39 36 0d 0a 0d 0a 71 75 65 72 79 20  .9..96....query 
d430: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
d440: 54 20 44 49 53 54 49 4e 43 54 20 63 6f 72 30 2e  T DISTINCT cor0.
d450: 63 6f 6c 30 20 2a 20 2d 20 35 37 20 46 52 4f 4d  col0 * - 57 FROM
d460: 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
d470: 2d 2d 2d 0d 0a 2d 31 33 36 38 0d 0a 2d 31 39 39  ---..-1368..-199
d480: 35 0d 0a 2d 35 30 37 33 0d 0a 0d 0a 6f 6e 6c 79  5..-5073....only
d490: 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44  if mysql # use D
d4a0: 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20  IV operator for 
d4b0: 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e  integer division
d4c0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
d4d0: 74 20 6c 61 62 65 6c 2d 33 37 39 0d 0a 53 45 4c  t label-379..SEL
d4e0: 45 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f 72  ECT DISTINCT cor
d4f0: 30 2e 63 6f 6c 32 20 44 49 56 20 63 6f 6c 30 20  0.col2 DIV col0 
d500: 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
d510: 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d  1 cor0..----..0.
d520: 0a 31 0d 0a 31 38 0d 0a 0d 0a 73 6b 69 70 69 66  .1..18....skipif
d530: 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
d540: 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
d550: 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 33   rowsort label-3
d560: 37 39 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  79..SELECT DISTI
d570: 4e 43 54 20 63 6f 72 30 2e 63 6f 6c 32 20 2f 20  NCT cor0.col2 / 
d580: 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46 52 4f  col0 AS col2 FRO
d590: 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab1 cor0..---
d5a0: 2d 0d 0a 30 0d 0a 31 0d 0a 31 38 0d 0a 0d 0a 71  -..0..1..18....q
d5b0: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
d5c0: 53 45 4c 45 43 54 20 2b 20 2b 20 37 30 20 46 52  SELECT + + 70 FR
d5d0: 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 20  OM tab2 AS cor0 
d5e0: 43 52 4f 53 53 20 4a 4f 49 4e 20 74 61 62 30 20  CROSS JOIN tab0 
d5f0: 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 39  AS cor1..----..9
d600: 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20   values hashing 
d610: 74 6f 20 39 37 35 38 64 61 36 35 61 65 34 37 31  to 9758da65ae471
d620: 31 65 33 65 38 63 38 64 65 66 32 66 65 30 32 36  1e3e8c8def2fe026
d630: 39 31 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  911....query I r
d640: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
d650: 20 2b 20 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c 31   + col0 + + col1
d660: 20 2a 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 46   * - cor0.col2 F
d670: 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
d680: 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 38 31 34 0d 0a 2d  ..----..-2814..-
d690: 36 32 0d 0a 2d 37 33 37 33 0d 0a 0d 0a 71 75 65  62..-7373....que
d6a0: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
d6b0: 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 32 20 2a 20  LECT ALL col2 * 
d6c0: 2d 20 63 6f 6c 31 20 2b 20 63 6f 6c 30 20 2a 20  - col1 + col0 * 
d6d0: 2b 20 31 33 20 41 53 20 63 6f 6c 32 20 46 52 4f  + 13 AS col2 FRO
d6e0: 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
d6f0: 2d 2d 2d 2d 0d 0a 2d 32 35 32 36 0d 0a 2d 36 33  ----..-2526..-63
d700: 30 35 0d 0a 33 35 38 0d 0a 0d 0a 71 75 65 72 79  05..358....query
d710: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
d720: 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 30  CT DISTINCT col0
d730: 20 2b 20 2d 20 63 6f 6c 32 20 2d 20 2b 20 63 6f   + - col2 - + co
d740: 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l1 FROM tab2 AS 
d750: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 31 0d  cor0..----..-51.
d760: 0a 2d 37 0d 0a 32 34 0d 0a 0d 0a 71 75 65 72 79  .-7..24....query
d770: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
d780: 43 54 20 41 4c 4c 20 2d 20 33 20 41 53 20 63 6f  CT ALL - 3 AS co
d790: 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l1 FROM tab2 AS 
d7a0: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 0d 0a  cor0..----..-3..
d7b0: 2d 33 0d 0a 2d 33 0d 0a 0d 0a 71 75 65 72 79 20  -3..-3....query 
d7c0: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
d7d0: 54 20 2d 20 2b 20 35 31 20 46 52 4f 4d 20 74 61  T - + 51 FROM ta
d7e0: 62 32 20 41 53 20 63 6f 72 30 20 43 52 4f 53 53  b2 AS cor0 CROSS
d7f0: 20 4a 4f 49 4e 20 74 61 62 30 20 41 53 20 63 6f   JOIN tab0 AS co
d800: 72 31 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75  r1..----..9 valu
d810: 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 30 38  es hashing to 08
d820: 64 33 38 35 33 65 33 39 39 32 34 64 33 63 36 33  d3853e39924d3c63
d830: 36 32 36 30 61 36 64 64 38 35 36 38 33 37 0d 0a  6260a6dd856837..
d840: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
d850: 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20  t..SELECT ALL - 
d860: 28 20 36 38 20 29 20 46 52 4f 4d 20 74 61 62 31  ( 68 ) FROM tab1
d870: 0d 0a 2d 2d 2d 2d 0d 0a 2d 36 38 0d 0a 2d 36 38  ..----..-68..-68
d880: 0d 0a 2d 36 38 0d 0a 0d 0a 71 75 65 72 79 20 49  ..-68....query I
d890: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
d8a0: 20 41 4c 4c 20 2b 20 28 20 33 37 20 29 20 46 52   ALL + ( 37 ) FR
d8b0: 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 33  OM tab2..----..3
d8c0: 37 0d 0a 33 37 0d 0a 33 37 0d 0a 0d 0a 71 75 65  7..37..37....que
d8d0: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
d8e0: 4c 45 43 54 20 2b 20 2d 20 31 36 20 2a 20 2b 20  LECT + - 16 * + 
d8f0: 28 20 2d 20 63 6f 72 30 2e 63 6f 6c 31 20 29 20  ( - cor0.col1 ) 
d900: 2a 20 2b 20 63 6f 6c 32 20 41 53 20 63 6f 6c 31  * + col2 AS col1
d910: 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
d920: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 39 33 39 32  r0..----..119392
d930: 0d 0a 31 35 35 32 0d 0a 34 35 34 30 38 0d 0a 0d  ..1552..45408...
d940: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
d950: 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 32 20 2d 20  ..SELECT col2 - 
d960: 2b 20 63 6f 6c 30 20 2a 20 74 61 62 30 2e 63 6f  + col0 * tab0.co
d970: 6c 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d  l1 FROM tab0..--
d980: 2d 2d 0d 0a 2d 32 30 33 31 0d 0a 2d 33 33 39 34  --..-2031..-3394
d990: 0d 0a 2d 38 30 31 37 0d 0a 0d 0a 71 75 65 72 79  ..-8017....query
d9a0: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
d9b0: 43 54 20 28 20 2d 20 34 34 20 29 20 2a 20 2b 20  CT ( - 44 ) * + 
d9c0: 74 61 62 32 2e 63 6f 6c 31 20 2b 20 28 20 2d 20  tab2.col1 + ( - 
d9d0: 74 61 62 32 2e 63 6f 6c 32 20 29 20 46 52 4f 4d  tab2.col2 ) FROM
d9e0: 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33   tab2..----..-13
d9f0: 39 31 0d 0a 2d 32 36 32 32 0d 0a 2d 37 38 36 0d  91..-2622..-786.
da00: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
da10: 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b  rt..SELECT ALL +
da20: 20 34 39 20 2a 20 2d 20 39 31 20 46 52 4f 4d 20   49 * - 91 FROM 
da30: 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
da40: 2d 2d 0d 0a 2d 34 34 35 39 0d 0a 2d 34 34 35 39  --..-4459..-4459
da50: 0d 0a 2d 34 34 35 39 0d 0a 0d 0a 71 75 65 72 79  ..-4459....query
da60: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
da70: 43 54 20 41 4c 4c 20 34 31 20 2a 20 2d 20 33 35  CT ALL 41 * - 35
da80: 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
da90: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 34 33 35 0d  r0..----..-1435.
daa0: 0a 2d 31 34 33 35 0d 0a 2d 31 34 33 35 0d 0a 0d  .-1435..-1435...
dab0: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
dac0: 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
dad0: 54 20 63 6f 6c 30 20 2a 20 33 31 20 46 52 4f 4d  T col0 * 31 FROM
dae0: 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab2 cor0..----
daf0: 0d 0a 32 31 37 0d 0a 32 34 31 38 0d 0a 32 34 34  ..217..2418..244
db00: 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  9....query I row
db10: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
db20: 54 49 4e 43 54 20 2b 20 63 6f 6c 30 20 2b 20 2d  TINCT + col0 + -
db30: 20 32 33 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d   23 AS col0 FROM
db40: 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
db50: 2d 2d 2d 0d 0a 2d 32 30 0d 0a 34 31 0d 0a 35 37  ---..-20..41..57
db60: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
db70: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
db80: 49 4e 43 54 20 28 20 2d 20 63 6f 6c 30 20 2b 20  INCT ( - col0 + 
db90: 2b 20 63 6f 6c 30 20 29 20 2a 20 2b 20 63 6f 6c  + col0 ) * + col
dba0: 32 20 2a 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f  2 * + col1 AS co
dbb0: 6c 30 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d  l0 FROM tab1..--
dbc0: 2d 2d 0d 0a 30 0d 0a 0d 0a 73 6b 69 70 69 66 20  --..0....skipif 
dbd0: 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73  postgresql # Pos
dbe0: 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73  tgreSQL requires
dbf0: 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e   AS when renamin
dc00: 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73  g output columns
dc10: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
dc20: 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20  t..SELECT ALL - 
dc30: 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c 30 20 2d 20  col0 * - col0 - 
dc40: 38 34 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  84 col1 FROM tab
dc50: 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
dc60: 0a 2d 37 35 0d 0a 34 30 31 32 0d 0a 36 33 31 36  .-75..4012..6316
dc70: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
dc80: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
dc90: 49 4e 43 54 20 2d 20 34 34 20 2b 20 63 6f 72 30  INCT - 44 + cor0
dca0: 2e 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20  .col2 FROM tab0 
dcb0: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 0d  cor0..----..-11.
dcc0: 0a 2d 34 33 0d 0a 33 38 0d 0a 0d 0a 71 75 65 72  .-43..38....quer
dcd0: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
dce0: 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 34  ECT DISTINCT + 4
dcf0: 38 20 2a 20 2d 20 63 6f 6c 30 20 41 53 20 63 6f  8 * - col0 AS co
dd00: 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l1 FROM tab2 AS 
dd10: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 33 36  cor0..----..-336
dd20: 0d 0a 2d 33 37 34 34 0d 0a 2d 33 37 39 32 0d 0a  ..-3744..-3792..
dd30: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
dd40: 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
dd50: 43 54 20 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c 30  CT col0 * - col0
dd60: 20 2d 20 37 33 20 46 52 4f 4d 20 74 61 62 30 20   - 73 FROM tab0 
dd70: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32 39  cor0..----..-129
dd80: 38 0d 0a 2d 36 34 39 0d 0a 2d 37 39 39 34 0d 0a  8..-649..-7994..
dd90: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
dda0: 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f  t..SELECT ALL co
ddb0: 72 31 2e 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20  r1.col0 AS col2 
ddc0: 46 52 4f 4d 20 74 61 62 32 2c 20 74 61 62 31 20  FROM tab2, tab1 
ddd0: 41 53 20 63 6f 72 30 2c 20 74 61 62 30 20 41 53  AS cor0, tab0 AS
dde0: 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20   cor1..----..27 
ddf0: 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74  values hashing t
de00: 6f 20 39 66 63 31 64 63 64 37 36 66 65 61 66 34  o 9fc1dcd76feaf4
de10: 33 65 35 63 35 64 63 30 36 30 61 30 32 30 31 34  3e5c5dc060a02014
de20: 63 64 0d 0a 0d 0a 71 75 65 72 79 20 49 49 49 49  cd....query IIII
de30: 49 49 49 49 49 49 49 49 49 49 49 20 72 6f 77 73  IIIIIIIIIII rows
de40: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
de50: 2a 20 46 52 4f 4d 20 74 61 62 30 2c 20 74 61 62  * FROM tab0, tab
de60: 32 20 41 53 20 63 6f 72 30 2c 20 74 61 62 31 20  2 AS cor0, tab1 
de70: 41 53 20 63 6f 72 31 2c 20 74 61 62 31 2c 20 74  AS cor1, tab1, t
de80: 61 62 30 20 41 53 20 63 6f 72 32 0d 0a 2d 2d 2d  ab0 AS cor2..---
de90: 2d 0d 0a 33 36 34 35 20 76 61 6c 75 65 73 20 68  -..3645 values h
dea0: 61 73 68 69 6e 67 20 74 6f 20 33 62 34 35 38 37  ashing to 3b4587
deb0: 61 62 36 63 30 38 64 32 31 37 39 63 36 64 66 30  ab6c08d2179c6df0
dec0: 39 34 64 32 66 37 36 61 64 37 0d 0a 0d 0a 71 75  94d2f76ad7....qu
ded0: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
dee0: 45 4c 45 43 54 20 2d 20 63 6f 6c 30 20 2a 20 2b  ELECT - col0 * +
def0: 20 63 6f 6c 30 20 2b 20 2d 20 36 39 20 46 52 4f   col0 + - 69 FRO
df00: 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  M tab2..----..-1
df10: 31 38 0d 0a 2d 36 31 35 33 0d 0a 2d 36 33 31 30  18..-6153..-6310
df20: 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
df30: 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d   # support for M
df40: 79 53 51 4c 20 73 70 65 63 69 66 69 63 20 73 79  ySQL specific sy
df50: 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73  stem types and s
df60: 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72  yntax..query I r
df70: 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 34 30 33  owsort label-403
df80: 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
df90: 54 20 2d 20 43 41 53 54 28 20 4e 55 4c 4c 20 41  T - CAST( NULL A
dfa0: 53 20 53 49 47 4e 45 44 20 29 20 2f 20 2d 20 32  S SIGNED ) / - 2
dfb0: 36 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  6 AS col1 FROM t
dfc0: 61 62 30 2c 20 74 61 62 30 20 41 53 20 63 6f 72  ab0, tab0 AS cor
dfd0: 30 2c 20 74 61 62 30 20 63 6f 72 31 0d 0a 2d 2d  0, tab0 cor1..--
dfe0: 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70  --..NULL....skip
dff0: 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
e000: 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
e010: 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
e020: 2d 34 30 33 0d 0a 53 45 4c 45 43 54 20 44 49 53  -403..SELECT DIS
e030: 54 49 4e 43 54 20 2d 20 43 41 53 54 20 28 20 4e  TINCT - CAST ( N
e040: 55 4c 4c 20 41 53 20 49 4e 54 45 47 45 52 20 29  ULL AS INTEGER )
e050: 20 2f 20 2d 20 32 36 20 41 53 20 63 6f 6c 31 20   / - 26 AS col1 
e060: 46 52 4f 4d 20 74 61 62 30 2c 20 74 61 62 30 20  FROM tab0, tab0 
e070: 41 53 20 63 6f 72 30 2c 20 74 61 62 30 20 63 6f  AS cor0, tab0 co
e080: 72 31 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a  r1..----..NULL..
e090: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
e0a0: 74 0d 0a 53 45 4c 45 43 54 20 2b 20 28 20 63 6f  t..SELECT + ( co
e0b0: 6c 30 20 29 20 2b 20 28 20 2d 20 63 6f 6c 32 20  l0 ) + ( - col2 
e0c0: 29 20 2b 20 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c  ) + col2 * - col
e0d0: 30 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d  0 FROM tab2..---
e0e0: 2d 0d 0a 2d 31 39 37 36 0d 0a 2d 32 30 39 0d 0a  -..-1976..-209..
e0f0: 2d 32 39 36 31 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  -2961....onlyif 
e100: 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20  mysql # use DIV 
e110: 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74  operator for int
e120: 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71  eger division..q
e130: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
e140: 61 62 65 6c 2d 34 30 35 0d 0a 53 45 4c 45 43 54  abel-405..SELECT
e150: 20 41 4c 4c 20 2b 20 63 6f 6c 30 20 44 49 56 20   ALL + col0 DIV 
e160: 63 6f 6c 31 20 2b 20 34 33 20 46 52 4f 4d 20 74  col1 + 43 FROM t
e170: 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 34 33 0d 0a 34  ab1..----..43..4
e180: 39 0d 0a 34 39 0d 0a 0d 0a 73 6b 69 70 69 66 20  9..49....skipif 
e190: 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
e1a0: 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
e1b0: 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 34 30  rowsort label-40
e1c0: 35 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20  5..SELECT ALL + 
e1d0: 63 6f 6c 30 20 2f 20 63 6f 6c 31 20 2b 20 34 33  col0 / col1 + 43
e1e0: 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d   FROM tab1..----
e1f0: 0d 0a 34 33 0d 0a 34 39 0d 0a 34 39 0d 0a 0d 0a  ..43..49..49....
e200: 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71  skipif postgresq
e210: 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72  l # PostgreSQL r
e220: 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20  equires AS when 
e230: 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20  renaming output 
e240: 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49  columns..query I
e250: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
e260: 20 41 4c 4c 20 2b 20 2b 20 63 6f 6c 32 20 2a 20   ALL + + col2 * 
e270: 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c 32 20 63 6f  col0 * + col2 co
e280: 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l0 FROM tab0 AS 
e290: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 36 31 33  cor0..----..2613
e2a0: 36 0d 0a 33 35 0d 0a 35 39 38 34 33 36 0d 0a 0d  6..35..598436...
e2b0: 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
e2c0: 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51  support for MySQ
e2d0: 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65  L specific syste
e2e0: 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74  m types and synt
e2f0: 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ax..query I rows
e300: 6f 72 74 20 6c 61 62 65 6c 2d 34 30 37 0d 0a 53  ort label-407..S
e310: 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b  ELECT DISTINCT +
e320: 20 63 6f 72 30 2e 63 6f 6c 31 20 2b 20 63 6f 6c   cor0.col1 + col
e330: 31 20 2a 20 2b 20 43 41 53 54 28 20 2d 20 63 6f  1 * + CAST( - co
e340: 6c 30 20 41 53 20 53 49 47 4e 45 44 20 29 20 2a  l0 AS SIGNED ) *
e350: 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20   col0 FROM tab1 
e360: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
e370: 32 30 38 0d 0a 2d 34 30 39 35 30 0d 0a 2d 38 33  208..-40950..-83
e380: 31 38 37 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  187....skipif my
e390: 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
e3a0: 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
e3b0: 77 73 6f 72 74 20 6c 61 62 65 6c 2d 34 30 37 0d  wsort label-407.
e3c0: 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
e3d0: 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 2b 20 63   + cor0.col1 + c
e3e0: 6f 6c 31 20 2a 20 2b 20 43 41 53 54 20 28 20 2d  ol1 * + CAST ( -
e3f0: 20 63 6f 6c 30 20 41 53 20 49 4e 54 45 47 45 52   col0 AS INTEGER
e400: 20 29 20 2a 20 63 6f 6c 30 20 46 52 4f 4d 20 74   ) * col0 FROM t
e410: 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
e420: 2d 0d 0a 2d 32 30 38 0d 0a 2d 34 30 39 35 30 0d  -..-208..-40950.
e430: 0a 2d 38 33 31 38 37 0d 0a 0d 0a 73 6b 69 70 69  .-83187....skipi
e440: 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50  f postgresql # P
e450: 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72  ostgreSQL requir
e460: 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d  es AS when renam
e470: 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d  ing output colum
e480: 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ns..query I rows
e490: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
e4a0: 49 4e 43 54 20 37 33 20 2a 20 2b 20 63 6f 6c 32  INCT 73 * + col2
e4b0: 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20   col1 FROM tab2 
e4c0: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
e4d0: 38 39 38 0d 0a 31 39 37 31 0d 0a 32 37 37 34 0d  898..1971..2774.
e4e0: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
e4f0: 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b  rt..SELECT ALL +
e500: 20 2d 20 31 37 20 2a 20 63 6f 6c 31 20 46 52 4f   - 17 * col1 FRO
e510: 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
e520: 2d 2d 2d 2d 0d 0a 2d 31 34 36 32 0d 0a 2d 31 35  ----..-1462..-15
e530: 34 37 0d 0a 2d 31 36 34 39 0d 0a 0d 0a 71 75 65  47..-1649....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 2d 20 63 6f 6c 31 20  LECT ALL - col1 
e560: 2b 20 2d 20 39 35 20 46 52 4f 4d 20 74 61 62 31  + - 95 FROM tab1
e570: 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 35 0d 0a 2d 31  ..----..-105..-1
e580: 30 38 0d 0a 2d 31 32 31 0d 0a 0d 0a 71 75 65 72  08..-121....quer
e590: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
e5a0: 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63  ECT DISTINCT + c
e5b0: 6f 6c 30 20 2b 20 28 20 2d 20 63 6f 6c 30 20 29  ol0 + ( - col0 )
e5c0: 20 2a 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62   * col2 FROM tab
e5d0: 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 37 32 30 39 0d 0a  0..----..-7209..
e5e0: 2d 37 36 38 0d 0a 30 0d 0a 0d 0a 71 75 65 72 79  -768..0....query
e5f0: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
e600: 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 30 20 2b 20  CT ALL - col0 + 
e610: 2b 20 28 20 39 30 20 29 20 41 53 20 63 6f 6c 31  + ( 90 ) AS col1
e620: 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d   FROM tab0 cor0.
e630: 0a 2d 2d 2d 2d 0d 0a 31 0d 0a 35 35 0d 0a 36 36  .----..1..55..66
e640: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
e650: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
e660: 2b 20 2b 20 63 6f 6c 30 20 2a 20 28 20 37 38 20  + + col0 * ( 78 
e670: 29 20 2a 20 63 6f 6c 32 20 2b 20 39 30 20 2a 20  ) * col2 + 90 * 
e680: 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41  col0 FROM tab1 A
e690: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32  S cor0..----..12
e6a0: 39 30 36 0d 0a 32 39 30 33 30 34 0d 0a 36 30 36  906..290304..606
e6b0: 32 34 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  240....query I r
e6c0: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
e6d0: 4c 4c 20 2b 20 63 6f 6c 32 20 2b 20 2b 20 37 36  LL + col2 + + 76
e6e0: 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 2a 20 2d   + cor0.col0 * -
e6f0: 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20   col2 FROM tab0 
e700: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 36 38 33  cor0..----..-683
e710: 0d 0a 2d 37 31 34 30 0d 0a 34 32 0d 0a 0d 0a 71  ..-7140..42....q
e720: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
e730: 53 45 4c 45 43 54 20 2d 20 2b 20 63 6f 6c 31 20  SELECT - + col1 
e740: 2b 20 2d 20 63 6f 6c 30 20 2a 20 63 6f 72 30 2e  + - col0 * cor0.
e750: 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46 52 4f  col2 AS col0 FRO
e760: 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
e770: 2d 2d 2d 2d 0d 0a 2d 31 33 32 0d 0a 2d 37 33 38  ----..-132..-738
e780: 39 0d 0a 2d 38 37 38 0d 0a 0d 0a 73 6b 69 70 69  9..-878....skipi
e790: 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50  f postgresql # P
e7a0: 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72  ostgreSQL requir
e7b0: 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d  es AS when renam
e7c0: 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d  ing output colum
e7d0: 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ns..query I rows
e7e0: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f  ort..SELECT - co
e7f0: 6c 30 20 2a 20 63 6f 6c 30 20 63 6f 6c 32 20 46  l0 * col0 col2 F
e800: 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
e810: 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 30 39 36 0d 0a 2d  ..----..-4096..-
e820: 36 34 30 30 0d 0a 2d 39 0d 0a 0d 0a 71 75 65 72  6400..-9....quer
e830: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
e840: 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63  ECT DISTINCT + c
e850: 6f 6c 31 20 2a 20 28 20 2b 20 32 30 20 29 20 46  ol1 * ( + 20 ) F
e860: 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
e870: 0d 0a 2d 2d 2d 2d 0d 0a 32 30 30 0d 0a 32 36 30  ..----..200..260
e880: 0d 0a 35 32 30 0d 0a 0d 0a 71 75 65 72 79 20 49  ..520....query I
e890: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
e8a0: 20 41 4c 4c 20 28 20 35 34 20 29 20 46 52 4f 4d   ALL ( 54 ) FROM
e8b0: 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
e8c0: 2d 2d 2d 0d 0a 35 34 0d 0a 35 34 0d 0a 35 34 0d  ---..54..54..54.
e8d0: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
e8e0: 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
e8f0: 4e 43 54 20 2b 20 2d 20 63 6f 6c 30 20 2b 20 2d  NCT + - col0 + -
e900: 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20   col1 FROM tab0 
e910: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
e920: 31 31 30 0d 0a 2d 31 33 32 0d 0a 2d 31 38 30 0d  110..-132..-180.
e930: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
e940: 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2d 20 36  rt..SELECT + - 6
e950: 39 20 2a 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61  9 * col0 FROM ta
e960: 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
e970: 0d 0a 2d 34 38 33 0d 0a 2d 35 33 38 32 0d 0a 2d  ..-483..-5382..-
e980: 35 34 35 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20  5451....query I 
e990: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
e9a0: 41 4c 4c 20 34 37 20 41 53 20 63 6f 6c 31 20 46  ALL 47 AS col1 F
e9b0: 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d  ROM tab1 cor0..-
e9c0: 2d 2d 2d 0d 0a 34 37 0d 0a 34 37 0d 0a 34 37 0d  ---..47..47..47.
e9d0: 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
e9e0: 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74  # use DIV operat
e9f0: 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64  or for integer d
ea00: 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49  ivision..query I
ea10: 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 34   rowsort label-4
ea20: 32 32 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  22..SELECT DISTI
ea30: 4e 43 54 20 2b 20 2b 20 63 6f 6c 30 20 44 49 56  NCT + + col0 DIV
ea40: 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62   + col1 FROM tab
ea50: 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
ea60: 0a 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  .0....skipif mys
ea70: 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
ea80: 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
ea90: 73 6f 72 74 20 6c 61 62 65 6c 2d 34 32 32 0d 0a  sort label-422..
eaa0: 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
eab0: 2b 20 2b 20 63 6f 6c 30 20 2f 20 2b 20 63 6f 6c  + + col0 / + col
eac0: 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  1 FROM tab0 AS c
ead0: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 0d 0a  or0..----..0....
eae0: 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
eaf0: 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
eb00: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
eb10: 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 43 41 53  SELECT ALL + CAS
eb20: 54 20 28 20 2b 20 28 20 2b 20 63 6f 6c 32 20 29  T ( + ( + col2 )
eb30: 20 41 53 20 52 45 41 4c 20 29 20 41 53 20 63 6f   AS REAL ) AS co
eb40: 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l2 FROM tab1 AS 
eb50: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 35 34 0d 0a  cor0..----..54..
eb60: 35 37 0d 0a 39 36 0d 0a 0d 0a 73 6b 69 70 69 66  57..96....skipif
eb70: 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f   postgresql # Po
eb80: 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65  stgreSQL require
eb90: 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69  s AS when renami
eba0: 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e  ng output column
ebb0: 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  s..query I rowso
ebc0: 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
ebd0: 4e 43 54 20 2b 20 63 6f 6c 30 20 2b 20 39 34 20  NCT + col0 + 94 
ebe0: 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41  col2 FROM tab1 A
ebf0: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 35  S cor0..----..15
ec00: 38 0d 0a 31 37 34 0d 0a 39 37 0d 0a 0d 0a 71 75  8..174..97....qu
ec10: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
ec20: 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d  ELECT DISTINCT -
ec30: 20 2b 20 63 6f 6c 32 20 2d 20 28 20 2d 20 63 6f   + col2 - ( - co
ec40: 6c 30 20 29 20 41 53 20 63 6f 6c 31 20 46 52 4f  l0 ) AS col1 FRO
ec50: 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab1 cor0..---
ec60: 2d 0d 0a 2d 31 36 0d 0a 2d 35 31 0d 0a 37 0d 0a  -..-16..-51..7..
ec70: 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65  ..skipif postgre
ec80: 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c  sql # PostgreSQL
ec90: 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65   requires AS whe
eca0: 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75  n renaming outpu
ecb0: 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79  t columns..query
ecc0: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
ecd0: 43 54 20 2d 20 37 36 20 63 6f 6c 31 20 46 52 4f  CT - 76 col1 FRO
ece0: 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
ecf0: 2d 2d 2d 2d 0d 0a 2d 37 36 0d 0a 2d 37 36 0d 0a  ----..-76..-76..
ed00: 2d 37 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  -76....query I r
ed10: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
ed20: 49 53 54 49 4e 43 54 20 2b 20 2b 20 63 6f 6c 31  ISTINCT + + col1
ed30: 20 2a 20 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20   * col0 AS col1 
ed40: 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
ed50: 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 34 30 0d 0a 36  0..----..1040..6
ed60: 34 30 0d 0a 37 38 0d 0a 0d 0a 71 75 65 72 79 20  40..78....query 
ed70: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
ed80: 54 20 44 49 53 54 49 4e 43 54 20 2b 20 28 20 63  T DISTINCT + ( c
ed90: 6f 6c 30 20 29 20 2a 20 63 6f 6c 31 20 41 53 20  ol0 ) * col1 AS 
eda0: 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41  col0 FROM tab0 A
edb0: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 30  S cor0..----..20
edc0: 36 34 0d 0a 33 33 39 35 0d 0a 38 30 39 39 0d 0a  64..3395..8099..
edd0: 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
ede0: 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f   use DIV operato
edf0: 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69  r for integer di
ee00: 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20  vision..query I 
ee10: 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 34 32  rowsort label-42
ee20: 39 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20  9..SELECT ALL - 
ee30: 2d 20 63 6f 6c 32 20 44 49 56 20 2d 20 63 6f 72  - col2 DIV - cor
ee40: 30 2e 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31  0.col1 FROM tab1
ee50: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
ee60: 2d 32 0d 0a 2d 35 0d 0a 2d 37 0d 0a 0d 0a 73 6b  -2..-5..-7....sk
ee70: 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
ee80: 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
ee90: 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
eea0: 65 6c 2d 34 32 39 0d 0a 53 45 4c 45 43 54 20 41  el-429..SELECT A
eeb0: 4c 4c 20 2d 20 2d 20 63 6f 6c 32 20 2f 20 2d 20  LL - - col2 / - 
eec0: 63 6f 72 30 2e 63 6f 6c 31 20 46 52 4f 4d 20 74  cor0.col1 FROM t
eed0: 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
eee0: 2d 0d 0a 2d 32 0d 0a 2d 35 0d 0a 2d 37 0d 0a 0d  -..-2..-5..-7...
eef0: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
ef00: 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 32 20 2d 20  ..SELECT col2 - 
ef10: 2d 20 28 20 2b 20 63 6f 6c 31 20 2a 20 63 6f 6c  - ( + col1 * col
ef20: 32 20 29 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  2 ) AS col0 FROM
ef30: 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 35 36   tab2..----..156
ef40: 30 0d 0a 36 38 34 0d 0a 38 36 34 0d 0a 0d 0a 71  0..684..864....q
ef50: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
ef60: 53 45 4c 45 43 54 20 63 6f 6c 30 20 2a 20 63 6f  SELECT col0 * co
ef70: 6c 30 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74  l0 + col1 FROM t
ef80: 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33 32 32 0d  ab0..----..1322.
ef90: 0a 36 36 32 0d 0a 38 30 31 32 0d 0a 0d 0a 71 75  .662..8012....qu
efa0: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
efb0: 45 4c 45 43 54 20 63 6f 6c 30 20 2d 20 2b 20 63  ELECT col0 - + c
efc0: 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  ol2 AS col2 FROM
efd0: 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 36   tab1..----..-16
efe0: 0d 0a 2d 35 31 0d 0a 37 0d 0a 0d 0a 71 75 65 72  ..-51..7....quer
eff0: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
f000: 45 43 54 20 2d 20 63 6f 6c 32 20 2b 20 38 38 20  ECT - col2 + 88 
f010: 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
f020: 32 0d 0a 2d 2d 2d 2d 0d 0a 35 30 0d 0a 36 31 0d  2..----..50..61.
f030: 0a 36 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .62....query I r
f040: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 74  owsort..SELECT t
f050: 61 62 31 2e 63 6f 6c 30 20 2b 20 63 6f 72 30 2e  ab1.col0 + cor0.
f060: 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46 52 4f  col2 AS col0 FRO
f070: 4d 20 74 61 62 31 2c 20 74 61 62 31 20 41 53 20  M tab1, tab1 AS 
f080: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61  cor0..----..9 va
f090: 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20  lues hashing to 
f0a0: 66 32 36 35 36 64 39 65 37 36 61 65 32 64 36 64  f2656d9e76ae2d6d
f0b0: 63 35 36 38 62 62 61 32 31 63 38 35 65 33 39 38  c568bba21c85e398
f0c0: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
f0d0: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
f0e0: 49 4e 43 54 20 2d 20 63 6f 6c 30 20 2b 20 63 6f  INCT - col0 + co
f0f0: 6c 32 20 2a 20 31 32 20 2a 20 2b 20 63 6f 6c 32  l2 * 12 * + col2
f100: 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d   FROM tab2..----
f110: 0d 0a 31 37 32 34 39 0d 0a 38 30 33 34 0d 0a 38  ..17249..8034..8
f120: 37 34 31 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f  741....skipif po
f130: 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67  stgresql # Postg
f140: 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41  reSQL requires A
f150: 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20  S when renaming 
f160: 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a  output columns..
f170: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
f180: 0a 53 45 4c 45 43 54 20 63 6f 6c 30 20 2d 20 63  .SELECT col0 - c
f190: 6f 6c 32 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61  ol2 col0 FROM ta
f1a0: 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 30 0d 0a 34  b2..----..-20..4
f1b0: 31 0d 0a 35 32 0d 0a 0d 0a 71 75 65 72 79 20 49  1..52....query I
f1c0: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
f1d0: 20 2d 20 74 61 62 30 2e 63 6f 6c 30 20 46 52 4f   - tab0.col0 FRO
f1e0: 4d 20 74 61 62 30 20 57 48 45 52 45 20 4e 4f 54  M tab0 WHERE NOT
f1f0: 20 28 20 4e 55 4c 4c 20 29 20 3c 3e 20 4e 55 4c   ( NULL ) <> NUL
f200: 4c 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a 71 75 65 72 79  L..----....query
f210: 20 49 49 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45   III rowsort..SE
f220: 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2a 20  LECT DISTINCT * 
f230: 46 52 4f 4d 20 74 61 62 30 20 57 48 45 52 45 20  FROM tab0 WHERE 
f240: 4e 4f 54 20 28 20 2b 20 63 6f 6c 32 20 2a 20 63  NOT ( + col2 * c
f250: 6f 6c 32 20 2f 20 63 6f 6c 31 20 29 20 4e 4f 54  ol2 / col1 ) NOT
f260: 20 49 4e 20 28 20 63 6f 6c 30 20 2a 20 63 6f 6c   IN ( col0 * col
f270: 31 20 29 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a 73 6b 69  1 )..----....ski
f280: 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23  pif postgresql #
f290: 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75   PostgreSQL requ
f2a0: 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e  ires AS when ren
f2b0: 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c  aming output col
f2c0: 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f  umns..query I ro
f2d0: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f  wsort..SELECT co
f2e0: 6c 32 20 2a 20 2d 20 63 6f 6c 30 20 63 6f 6c 31  l2 * - col0 col1
f2f0: 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d   FROM tab0..----
f300: 0d 0a 2d 33 35 0d 0a 2d 37 32 39 38 0d 0a 2d 37  ..-35..-7298..-7
f310: 39 32 0d 0a 0d 0a 71 75 65 72 79 20 49 49 49 20  92....query III 
f320: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
f330: 41 4c 4c 20 2a 20 46 52 4f 4d 20 74 61 62 30 20  ALL * FROM tab0 
f340: 57 48 45 52 45 20 4e 55 4c 4c 20 49 4e 20 28 20  WHERE NULL IN ( 
f350: 2d 20 74 61 62 30 2e 63 6f 6c 31 20 29 0d 0a 2d  - tab0.col1 )..-
f360: 2d 2d 2d 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  ---....query I r
f370: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63  owsort..SELECT c
f380: 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  ol0 AS col1 FROM
f390: 20 74 61 62 31 20 57 48 45 52 45 20 28 20 63 6f   tab1 WHERE ( co
f3a0: 6c 30 20 2a 20 2b 20 63 6f 6c 32 20 29 20 4e 4f  l0 * + col2 ) NO
f3b0: 54 20 42 45 54 57 45 45 4e 20 4e 55 4c 4c 20 41  T BETWEEN NULL A
f3c0: 4e 44 20 28 20 4e 55 4c 4c 20 29 0d 0a 2d 2d 2d  ND ( NULL )..---
f3d0: 2d 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  -....query I row
f3e0: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c  sort..SELECT col
f3f0: 30 20 2a 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61  0 * col1 FROM ta
f400: 62 30 20 57 48 45 52 45 20 28 20 4e 55 4c 4c 20  b0 WHERE ( NULL 
f410: 29 20 3c 3e 20 4e 55 4c 4c 0d 0a 2d 2d 2d 2d 0d  ) <> NULL..----.
f420: 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72  ...skipif postgr
f430: 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51  esql # PostgreSQ
f440: 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68  L requires AS wh
f450: 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70  en renaming outp
f460: 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72  ut columns..quer
f470: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
f480: 45 43 54 20 41 4c 4c 20 63 6f 6c 31 20 2b 20 63  ECT ALL col1 + c
f490: 6f 72 30 2e 63 6f 6c 30 20 63 6f 6c 30 20 46 52  or0.col0 col0 FR
f4a0: 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d  OM tab0 cor0..--
f4b0: 2d 2d 0d 0a 31 31 30 0d 0a 31 33 32 0d 0a 31 38  --..110..132..18
f4c0: 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  0....query I row
f4d0: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
f4e0: 54 49 4e 43 54 20 63 6f 6c 30 20 2b 20 63 6f 6c  TINCT col0 + col
f4f0: 32 20 2a 20 63 6f 6c 30 20 2d 20 2b 20 63 6f 6c  2 * col0 - + col
f500: 31 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  1 AS col0 FROM t
f510: 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
f520: 2d 0d 0a 2d 32 37 0d 0a 37 32 39 36 0d 0a 37 33  -..-27..7296..73
f530: 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  0....query I row
f540: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63  sort..SELECT + c
f550: 6f 6c 31 20 2b 20 2b 20 63 6f 6c 30 20 2a 20 2d  ol1 + + col0 * -
f560: 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 0d   col0 FROM tab2.
f570: 0a 2d 2d 2d 2d 0d 0a 2d 31 38 0d 0a 2d 36 30 32  .----..-18..-602
f580: 35 0d 0a 2d 36 32 32 34 0d 0a 0d 0a 71 75 65 72  5..-6224....quer
f590: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
f5a0: 45 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c  ECT DISTINCT col
f5b0: 30 20 2a 20 2b 20 63 6f 6c 32 20 2b 20 2d 20 74  0 * + col2 + - t
f5c0: 61 62 32 2e 63 6f 6c 30 20 46 52 4f 4d 20 74 61  ab2.col0 FROM ta
f5d0: 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 38 32 0d 0a 31  b2..----..182..1
f5e0: 39 35 30 0d 0a 32 39 32 33 0d 0a 0d 0a 71 75 65  950..2923....que
f5f0: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
f600: 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 32 20  LECT ALL - col2 
f610: 2a 20 2b 20 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c  * + col2 * + col
f620: 32 20 2b 20 63 6f 6c 32 20 41 53 20 63 6f 6c 31  2 + col2 AS col1
f630: 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d   FROM tab1..----
f640: 0d 0a 2d 31 35 37 34 31 30 0d 0a 2d 31 38 35 31  ..-157410..-1851
f650: 33 36 0d 0a 2d 38 38 34 36 34 30 0d 0a 0d 0a 71  36..-884640....q
f660: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
f670: 53 45 4c 45 43 54 20 2d 20 74 61 62 31 2e 63 6f  SELECT - tab1.co
f680: 6c 31 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  l1 AS col1 FROM 
f690: 74 61 62 31 2c 20 74 61 62 32 2c 20 74 61 62 31  tab1, tab2, tab1
f6a0: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
f6b0: 32 37 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e  27 values hashin
f6c0: 67 20 74 6f 20 63 37 38 39 30 34 36 39 65 61 62  g to c7890469eab
f6d0: 62 32 63 36 66 63 38 31 34 35 34 62 33 35 64 32  b2c6fc81454b35d2
f6e0: 33 33 33 62 36 0d 0a 0d 0a 71 75 65 72 79 20 49  333b6....query I
f6f0: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
f700: 20 2b 20 2d 20 63 6f 6c 30 20 2b 20 63 6f 6c 32   + - col0 + col2
f710: 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
f720: 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  b2 cor0..----..-
f730: 34 31 0d 0a 2d 35 32 0d 0a 32 30 0d 0a 0d 0a 71  41..-52..20....q
f740: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
f750: 53 45 4c 45 43 54 20 63 6f 6c 31 20 2b 20 2b 20  SELECT col1 + + 
f760: 74 61 62 30 2e 63 6f 6c 31 20 41 53 20 63 6f 6c  tab0.col1 AS col
f770: 32 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d  2 FROM tab0..---
f780: 2d 0d 0a 31 37 32 0d 0a 31 38 32 0d 0a 31 39 34  -..172..182..194
f790: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
f7a0: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f  ort..SELECT - co
f7b0: 6c 32 20 2a 20 63 6f 6c 32 20 2b 20 2d 20 63 6f  l2 * col2 + - co
f7c0: 6c 32 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  l2 AS col0 FROM 
f7d0: 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 34 38  tab2..----..-148
f7e0: 32 0d 0a 2d 37 30 32 0d 0a 2d 37 35 36 0d 0a 0d  2..-702..-756...
f7f0: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
f800: 0d 0a 53 45 4c 45 43 54 20 74 61 62 32 2e 63 6f  ..SELECT tab2.co
f810: 6c 32 20 2b 20 63 6f 6c 30 20 2a 20 2d 20 63 6f  l2 + col0 * - co
f820: 6c 30 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d  l0 FROM tab2..--
f830: 2d 2d 0d 0a 2d 32 32 0d 0a 2d 36 30 35 38 0d 0a  --..-22..-6058..
f840: 2d 36 32 30 33 0d 0a 0d 0a 71 75 65 72 79 20 49  -6203....query I
f850: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
f860: 20 44 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c 31   DISTINCT + col1
f870: 20 2a 20 2b 20 74 61 62 32 2e 63 6f 6c 32 20 2a   * + tab2.col2 *
f880: 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 0d   col0 FROM tab2.
f890: 0a 2d 2d 2d 2d 0d 0a 31 31 39 36 35 32 0d 0a 35  .----..119652..5
f8a0: 31 30 33 34 0d 0a 35 38 35 39 0d 0a 0d 0a 71 75  1034..5859....qu
f8b0: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
f8c0: 45 4c 45 43 54 20 41 4c 4c 20 2b 20 2d 20 63 6f  ELECT ALL + - co
f8d0: 6c 32 20 2a 20 2b 20 63 6f 6c 30 20 2d 20 2b 20  l2 * + col0 - + 
f8e0: 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41  col0 FROM tab2 A
f8f0: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
f900: 39 36 0d 0a 2d 32 31 30 36 0d 0a 2d 33 30 38 31  96..-2106..-3081
f910: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
f920: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
f930: 49 4e 43 54 20 2d 20 63 6f 6c 32 20 2a 20 63 6f  INCT - col2 * co
f940: 6c 31 20 2b 20 2d 20 63 6f 6c 32 20 46 52 4f 4d  l1 + - col2 FROM
f950: 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab0 cor0..----
f960: 0d 0a 2d 32 38 37 31 0d 0a 2d 37 35 34 34 0d 0a  ..-2871..-7544..
f970: 2d 39 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  -98....query I r
f980: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
f990: 4c 4c 20 2d 20 2b 20 63 6f 6c 30 20 2a 20 63 6f  LL - + col0 * co
f9a0: 6c 31 20 2d 20 63 6f 72 30 2e 63 6f 6c 30 20 2a  l1 - cor0.col0 *
f9b0: 20 2d 20 63 6f 72 30 2e 63 6f 6c 30 20 46 52 4f   - cor0.col0 FRO
f9c0: 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
f9d0: 2d 2d 2d 2d 0d 0a 2d 31 34 38 38 0d 0a 2d 31 37  ----..-1488..-17
f9e0: 38 0d 0a 2d 32 31 37 30 0d 0a 0d 0a 71 75 65 72  8..-2170....quer
f9f0: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
fa00: 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 30 20 2d  ECT ALL - col0 -
fa10: 20 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46 52   col1 AS col2 FR
fa20: 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
fa30: 0a 2d 2d 2d 2d 0d 0a 2d 31 31 30 0d 0a 2d 31 33  .----..-110..-13
fa40: 32 0d 0a 2d 31 38 30 0d 0a 0d 0a 6f 6e 6c 79 69  2..-180....onlyi
fa50: 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49  f mysql # use DI
fa60: 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69  V operator for i
fa70: 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d  nteger division.
fa80: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
fa90: 20 6c 61 62 65 6c 2d 34 35 38 0d 0a 53 45 4c 45   label-458..SELE
faa0: 43 54 20 2b 20 63 6f 6c 30 20 44 49 56 20 63 6f  CT + col0 DIV co
fab0: 6c 32 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 41  l2 + cor0.col1 A
fac0: 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30  S col1 FROM tab0
fad0: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
fae0: 31 33 32 0d 0a 38 36 0d 0a 39 32 0d 0a 0d 0a 73  132..86..92....s
faf0: 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
fb00: 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
fb10: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
fb20: 62 65 6c 2d 34 35 38 0d 0a 53 45 4c 45 43 54 20  bel-458..SELECT 
fb30: 2b 20 63 6f 6c 30 20 2f 20 63 6f 6c 32 20 2b 20  + col0 / col2 + 
fb40: 63 6f 72 30 2e 63 6f 6c 31 20 41 53 20 63 6f 6c  cor0.col1 AS col
fb50: 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  1 FROM tab0 AS c
fb60: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33 32 0d 0a  or0..----..132..
fb70: 38 36 0d 0a 39 32 0d 0a 0d 0a 71 75 65 72 79 20  86..92....query 
fb80: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
fb90: 54 20 41 4c 4c 20 2b 20 2d 20 63 6f 6c 30 20 2a  T ALL + - col0 *
fba0: 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20   + col1 AS col2 
fbb0: 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
fbc0: 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 34 33 0d 0a  0..----..-1343..
fbd0: 2d 32 31 37 0d 0a 2d 34 36 30 32 0d 0a 0d 0a 6f  -217..-4602....o
fbe0: 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73  nlyif mysql # us
fbf0: 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66  e DIV operator f
fc00: 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73  or integer divis
fc10: 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ion..query I row
fc20: 73 6f 72 74 20 6c 61 62 65 6c 2d 34 36 30 0d 0a  sort label-460..
fc30: 53 45 4c 45 43 54 20 2d 20 35 20 44 49 56 20 2d  SELECT - 5 DIV -
fc40: 20 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46 52   col1 AS col1 FR
fc50: 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
fc60: 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a  .----..0..0..0..
fc70: 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
fc80: 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
fc90: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
fca0: 20 6c 61 62 65 6c 2d 34 36 30 0d 0a 53 45 4c 45   label-460..SELE
fcb0: 43 54 20 2d 20 35 20 2f 20 2d 20 63 6f 6c 31 20  CT - 5 / - col1 
fcc0: 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
fcd0: 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
fce0: 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a 6f 6e 6c 79  .0..0..0....only
fcf0: 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44  if mysql # use D
fd00: 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20  IV operator for 
fd10: 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e  integer division
fd20: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
fd30: 74 20 6c 61 62 65 6c 2d 34 36 31 0d 0a 53 45 4c  t label-461..SEL
fd40: 45 43 54 20 28 20 63 6f 6c 30 20 29 20 2b 20 63  ECT ( col0 ) + c
fd50: 6f 6c 32 20 44 49 56 20 2b 20 36 20 46 52 4f 4d  ol2 DIV + 6 FROM
fd60: 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
fd70: 2d 2d 2d 0d 0a 31 32 0d 0a 37 33 0d 0a 39 36 0d  ---..12..73..96.
fd80: 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
fd90: 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
fda0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
fdb0: 74 20 6c 61 62 65 6c 2d 34 36 31 0d 0a 53 45 4c  t label-461..SEL
fdc0: 45 43 54 20 28 20 63 6f 6c 30 20 29 20 2b 20 63  ECT ( col0 ) + c
fdd0: 6f 6c 32 20 2f 20 2b 20 36 20 46 52 4f 4d 20 74  ol2 / + 6 FROM t
fde0: 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
fdf0: 2d 0d 0a 31 32 0d 0a 37 33 0d 0a 39 36 0d 0a 0d  -..12..73..96...
fe00: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
fe10: 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
fe20: 54 20 35 39 20 2a 20 63 6f 6c 31 20 2b 20 2b 20  T 59 * col1 + + 
fe30: 28 20 2d 20 63 6f 6c 32 20 29 20 2a 20 2b 20 63  ( - col2 ) * + c
fe40: 6f 6c 31 20 2b 20 28 20 31 20 2b 20 63 6f 6c 30  ol1 + ( 1 + col0
fe50: 20 29 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20   ) AS col1 FROM 
fe60: 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 30 30  tab0..----..-200
fe70: 33 0d 0a 32 32 36 31 0d 0a 35 36 36 32 0d 0a 0d  3..2261..5662...
fe80: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
fe90: 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 32 20 2a 20  ..SELECT col2 * 
fea0: 2d 20 33 33 20 46 52 4f 4d 20 74 61 62 30 20 41  - 33 FROM tab0 A
feb0: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
fec0: 30 38 39 0d 0a 2d 32 37 30 36 0d 0a 2d 33 33 0d  089..-2706..-33.
fed0: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
fee0: 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 72  rt..SELECT - cor
fef0: 30 2e 63 6f 6c 31 20 2a 20 2d 20 39 35 20 41 53  0.col1 * - 95 AS
ff00: 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20   col1 FROM tab2 
ff10: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
ff20: 36 31 35 0d 0a 32 39 34 35 0d 0a 35 36 30 35 0d  615..2945..5605.
ff30: 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
ff40: 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79  # support for My
ff50: 53 51 4c 20 73 70 65 63 69 66 69 63 20 73 79 73  SQL specific sys
ff60: 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79  tem types and sy
ff70: 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f  ntax..query I ro
ff80: 77 73 6f 72 74 20 6c 61 62 65 6c 2d 34 36 35 0d  wsort label-465.
ff90: 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 30 20 2a  .SELECT + col0 *
ffa0: 20 2d 20 43 41 53 54 28 20 4e 55 4c 4c 20 41 53   - CAST( NULL AS
ffb0: 20 53 49 47 4e 45 44 20 29 20 63 6f 6c 30 20 46   SIGNED ) col0 F
ffc0: 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
ffd0: 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55  ..----..NULL..NU
ffe0: 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70  LL..NULL....skip
fff0: 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20  if postgresql # 
10000 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69  PostgreSQL requi
10010 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61  res AS when rena
10020 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75  ming output colu
10030 6d 6e 73 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  mns..skipif mysq
10040 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
10050 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
10060 6f 72 74 20 6c 61 62 65 6c 2d 34 36 35 0d 0a 53  ort label-465..S
10070 45 4c 45 43 54 20 2b 20 63 6f 6c 30 20 2a 20 2d  ELECT + col0 * -
10080 20 43 41 53 54 20 28 20 4e 55 4c 4c 20 41 53 20   CAST ( NULL AS 
10090 49 4e 54 45 47 45 52 20 29 20 63 6f 6c 30 20 46  INTEGER ) col0 F
100a0 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
100b0 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55  ..----..NULL..NU
100c0 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75 65 72  LL..NULL....quer
100d0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
100e0 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 32 20 2a  ECT ALL - col2 *
100f0 20 2d 20 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20   - col2 AS col2 
10100 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d  FROM tab2..----.
10110 0a 31 34 34 34 0d 0a 36 37 36 0d 0a 37 32 39 0d  .1444..676..729.
10120 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72  ...skipif postgr
10130 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51  esql # PostgreSQ
10140 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68  L requires AS wh
10150 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70  en renaming outp
10160 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72  ut columns..quer
10170 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
10180 45 43 54 20 2b 20 63 6f 6c 32 20 2a 20 37 38 20  ECT + col2 * 78 
10190 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41  col2 FROM tab2 A
101a0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 30  S cor0..----..20
101b0 32 38 0d 0a 32 31 30 36 0d 0a 32 39 36 34 0d 0a  28..2106..2964..
101c0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
101d0 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
101e0 43 54 20 63 6f 6c 32 20 2b 20 35 30 20 2a 20 63  CT col2 + 50 * c
101f0 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  ol2 AS col2 FROM
10200 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
10210 2d 2d 2d 0d 0a 31 33 32 36 0d 0a 31 33 37 37 0d  ---..1326..1377.
10220 0a 31 39 33 38 0d 0a 0d 0a 73 6b 69 70 69 66 20  .1938....skipif 
10230 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73  postgresql # Pos
10240 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73  tgreSQL requires
10250 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e   AS when renamin
10260 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73  g output columns
10270 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
10280 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20  t..SELECT ALL - 
10290 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c 30 20 2a 20  col0 + - col0 * 
102a0 63 6f 6c 31 20 2b 20 2d 20 63 6f 6c 31 20 63 6f  col1 + - col1 co
102b0 6c 30 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d  l0 FROM tab1..--
102c0 2d 2d 0d 0a 2d 31 30 37 0d 0a 2d 31 31 33 33 0d  --..-107..-1133.
102d0 0a 2d 37 31 34 0d 0a 0d 0a 71 75 65 72 79 20 49  .-714....query I
102e0 49 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45  II rowsort..SELE
102f0 43 54 20 2a 20 46 52 4f 4d 20 74 61 62 30 20 57  CT * FROM tab0 W
10300 48 45 52 45 20 2b 20 63 6f 6c 31 20 2d 20 2d 20  HERE + col1 - - 
10310 63 6f 6c 32 20 49 4e 20 28 20 74 61 62 30 2e 63  col2 IN ( tab0.c
10320 6f 6c 31 20 2a 20 74 61 62 30 2e 63 6f 6c 30 20  ol1 * tab0.col0 
10330 2b 20 74 61 62 30 2e 63 6f 6c 31 20 29 0d 0a 2d  + tab0.col1 )..-
10340 2d 2d 2d 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  ---....onlyif my
10350 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70  sql # use DIV op
10360 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67  erator for integ
10370 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65  er division..que
10380 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
10390 65 6c 2d 34 37 31 0d 0a 53 45 4c 45 43 54 20 41  el-471..SELECT A
103a0 4c 4c 20 63 6f 6c 31 20 44 49 56 20 2d 20 74 61  LL col1 DIV - ta
103b0 62 31 2e 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  b1.col1 FROM tab
103c0 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 2d 31 0d  1..----..-1..-1.
103d0 0a 2d 31 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  .-1....skipif my
103e0 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
103f0 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
10400 77 73 6f 72 74 20 6c 61 62 65 6c 2d 34 37 31 0d  wsort label-471.
10410 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 31  .SELECT ALL col1
10420 20 2f 20 2d 20 74 61 62 31 2e 63 6f 6c 31 20 46   / - tab1.col1 F
10430 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab1..----..
10440 2d 31 0d 0a 2d 31 0d 0a 2d 31 0d 0a 0d 0a 6f 6e  -1..-1..-1....on
10450 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
10460 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
10470 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
10480 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
10490 6f 72 74 20 6c 61 62 65 6c 2d 34 37 32 0d 0a 53  ort label-472..S
104a0 45 4c 45 43 54 20 2d 20 63 6f 6c 31 20 44 49 56  ELECT - col1 DIV
104b0 20 63 6f 6c 32 20 2b 20 63 6f 6c 31 20 2a 20 2d   col2 + col1 * -
104c0 20 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46 52   col1 AS col2 FR
104d0 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d  OM tab1..----..-
104e0 31 30 30 0d 0a 2d 31 36 39 0d 0a 2d 36 37 36 0d  100..-169..-676.
104f0 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
10500 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
10510 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
10520 74 20 6c 61 62 65 6c 2d 34 37 32 0d 0a 53 45 4c  t label-472..SEL
10530 45 43 54 20 2d 20 63 6f 6c 31 20 2f 20 63 6f 6c  ECT - col1 / col
10540 32 20 2b 20 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c  2 + col1 * - col
10550 31 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  1 AS col2 FROM t
10560 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 30 0d  ab1..----..-100.
10570 0a 2d 31 36 39 0d 0a 2d 36 37 36 0d 0a 0d 0a 71  .-169..-676....q
10580 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
10590 53 45 4c 45 43 54 20 63 6f 6c 31 20 46 52 4f 4d  SELECT col1 FROM
105a0 20 74 61 62 31 20 57 48 45 52 45 20 2b 20 63 6f   tab1 WHERE + co
105b0 6c 30 20 3c 20 63 6f 6c 30 0d 0a 2d 2d 2d 2d 0d  l0 < col0..----.
105c0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
105d0 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 31 20  rt..SELECT col1 
105e0 2b 20 2d 20 74 61 62 30 2e 63 6f 6c 32 20 2a 20  + - tab0.col2 * 
105f0 2d 20 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46  - col1 AS col0 F
10600 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab0..----..
10610 31 39 34 0d 0a 32 39 32 34 0d 0a 37 35 35 33 0d  194..2924..7553.
10620 0a 0d 0a 71 75 65 72 79 20 49 49 49 20 72 6f 77  ...query III row
10630 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2a 20 46  sort..SELECT * F
10640 52 4f 4d 20 74 61 62 32 20 57 48 45 52 45 20 4e  ROM tab2 WHERE N
10650 4f 54 20 4e 55 4c 4c 20 4e 4f 54 20 49 4e 20 28  OT NULL NOT IN (
10660 20 2d 20 74 61 62 32 2e 63 6f 6c 30 20 29 0d 0a   - tab2.col0 )..
10670 2d 2d 2d 2d 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ----....query I 
10680 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
10690 41 4c 4c 20 2b 20 63 6f 6c 32 20 2b 20 2b 20 63  ALL + col2 + + c
106a0 6f 6c 32 20 2b 20 2d 20 63 6f 6c 31 20 46 52 4f  ol2 + - col1 FRO
106b0 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32  M tab0..----..-2
106c0 30 0d 0a 2d 39 35 0d 0a 37 33 0d 0a 0d 0a 6f 6e  0..-95..73....on
106d0 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
106e0 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
106f0 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
10700 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
10710 6f 72 74 20 6c 61 62 65 6c 2d 34 37 37 0d 0a 53  ort label-477..S
10720 45 4c 45 43 54 20 2d 20 63 6f 6c 30 20 2d 20 63  ELECT - col0 - c
10730 6f 6c 32 20 44 49 56 20 2d 20 63 6f 6c 32 20 46  ol2 DIV - col2 F
10740 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab0..----..
10750 2d 32 33 0d 0a 2d 33 34 0d 0a 2d 38 38 0d 0a 0d  -23..-34..-88...
10760 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
10770 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
10780 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
10790 6c 61 62 65 6c 2d 34 37 37 0d 0a 53 45 4c 45 43  label-477..SELEC
107a0 54 20 2d 20 63 6f 6c 30 20 2d 20 63 6f 6c 32 20  T - col0 - col2 
107b0 2f 20 2d 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61  / - col2 FROM ta
107c0 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 33 0d 0a 2d  b0..----..-23..-
107d0 33 34 0d 0a 2d 38 38 0d 0a 0d 0a 71 75 65 72 79  34..-88....query
107e0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
107f0 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 30 20 41 53  CT ALL + col0 AS
10800 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20   col2 FROM tab1 
10810 57 48 45 52 45 20 4e 55 4c 4c 20 49 4e 20 28 20  WHERE NULL IN ( 
10820 63 6f 6c 32 20 2a 20 63 6f 6c 32 20 29 0d 0a 2d  col2 * col2 )..-
10830 2d 2d 2d 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  ---....query I r
10840 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
10850 4c 4c 20 74 61 62 31 2e 63 6f 6c 31 20 2a 20 2b  LL tab1.col1 * +
10860 20 63 6f 6c 32 20 2d 20 2b 20 63 6f 6c 32 20 46   col2 - + col2 F
10870 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab1..----..
10880 31 31 35 32 0d 0a 31 33 35 30 0d 0a 35 31 33 0d  1152..1350..513.
10890 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
108a0 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
108b0 4e 43 54 20 74 61 62 32 2e 63 6f 6c 30 20 2f 20  NCT tab2.col0 / 
108c0 2d 20 63 6f 6c 30 20 2b 20 63 6f 6c 30 20 46 52  - col0 + col0 FR
108d0 4f 4d 20 74 61 62 32 20 57 48 45 52 45 20 4e 4f  OM tab2 WHERE NO
108e0 54 20 28 20 4e 55 4c 4c 20 29 20 4e 4f 54 20 49  T ( NULL ) NOT I
108f0 4e 20 28 20 63 6f 6c 30 20 29 0d 0a 2d 2d 2d 2d  N ( col0 )..----
10900 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
10910 6f 72 74 0d 0a 53 45 4c 45 43 54 20 74 61 62 30  ort..SELECT tab0
10920 2e 63 6f 6c 30 20 2a 20 2b 20 74 61 62 30 2e 63  .col0 * + tab0.c
10930 6f 6c 32 20 2a 20 2d 20 63 6f 6c 31 20 46 52 4f  ol2 * - col1 FRO
10940 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33  M tab0..----..-3
10950 33 39 35 0d 0a 2d 36 36 34 31 31 38 0d 0a 2d 36  395..-664118..-6
10960 38 31 31 32 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  8112....onlyif m
10970 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f  ysql # use DIV o
10980 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65  perator for inte
10990 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75  ger division..qu
109a0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
109b0 62 65 6c 2d 34 38 32 0d 0a 53 45 4c 45 43 54 20  bel-482..SELECT 
109c0 41 4c 4c 20 63 6f 6c 32 20 44 49 56 20 2d 20 63  ALL col2 DIV - c
109d0 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  ol0 AS col0 FROM
109e0 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 0d   tab2..----..-3.
109f0 0a 30 0d 0a 30 0d 0a 0d 0a 73 6b 69 70 69 66 20  .0..0....skipif 
10a00 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
10a10 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
10a20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 34 38  rowsort label-48
10a30 32 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f  2..SELECT ALL co
10a40 6c 32 20 2f 20 2d 20 63 6f 6c 30 20 41 53 20 63  l2 / - col0 AS c
10a50 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d  ol0 FROM tab2..-
10a60 2d 2d 2d 0d 0a 2d 33 0d 0a 30 0d 0a 30 0d 0a 0d  ---..-3..0..0...
10a70 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
10a80 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c  ..SELECT ALL col
10a90 31 20 2a 20 2b 20 74 61 62 31 2e 63 6f 6c 30 20  1 * + tab1.col0 
10aa0 2b 20 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c 30 20  + col2 * - col0 
10ab0 2d 20 2b 20 74 61 62 31 2e 63 6f 6c 31 20 2a 20  - + tab1.col1 * 
10ac0 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46 52 4f  col0 AS col2 FRO
10ad0 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  M tab1..----..-1
10ae0 36 32 0d 0a 2d 33 36 34 38 0d 0a 2d 37 36 38 30  62..-3648..-7680
10af0 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
10b00 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61   # use DIV opera
10b10 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20  tor for integer 
10b20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20  division..query 
10b30 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
10b40 34 38 34 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  484..SELECT DIST
10b50 49 4e 43 54 20 2d 20 74 61 62 30 2e 63 6f 6c 31  INCT - tab0.col1
10b60 20 2b 20 63 6f 6c 31 20 2b 20 2b 20 74 61 62 30   + col1 + + tab0
10b70 2e 63 6f 6c 31 20 44 49 56 20 2b 20 63 6f 6c 31  .col1 DIV + col1
10b80 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
10b90 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 0d 0a 0d 0a 73  b0..----..1....s
10ba0 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
10bb0 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
10bc0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
10bd0 62 65 6c 2d 34 38 34 0d 0a 53 45 4c 45 43 54 20  bel-484..SELECT 
10be0 44 49 53 54 49 4e 43 54 20 2d 20 74 61 62 30 2e  DISTINCT - tab0.
10bf0 63 6f 6c 31 20 2b 20 63 6f 6c 31 20 2b 20 2b 20  col1 + col1 + + 
10c00 74 61 62 30 2e 63 6f 6c 31 20 2f 20 2b 20 63 6f  tab0.col1 / + co
10c10 6c 31 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  l1 AS col0 FROM 
10c20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 0d 0a 0d  tab0..----..1...
10c30 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
10c40 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63  ..SELECT ALL - c
10c50 6f 6c 30 20 2b 20 2b 20 74 61 62 32 2e 63 6f 6c  ol0 + + tab2.col
10c60 30 20 2b 20 2b 20 63 6f 6c 32 20 46 52 4f 4d 20  0 + + col2 FROM 
10c70 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 32 36 0d 0a  tab2..----..26..
10c80 32 37 0d 0a 33 38 0d 0a 0d 0a 73 6b 69 70 69 66  27..38....skipif
10c90 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f   postgresql # Po
10ca0 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65  stgreSQL require
10cb0 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69  s AS when renami
10cc0 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e  ng output column
10cd0 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  s..query I rowso
10ce0 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 31 20  rt..SELECT col1 
10cf0 2a 20 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c 31 20  * col1 * + col1 
10d00 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a  col1 FROM tab0..
10d10 2d 2d 2d 2d 0d 0a 36 33 36 30 35 36 0d 0a 37 35  ----..636056..75
10d20 33 35 37 31 0d 0a 39 31 32 36 37 33 0d 0a 0d 0a  3571..912673....
10d30 71 75 65 72 79 20 49 49 49 20 72 6f 77 73 6f 72  query III rowsor
10d40 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
10d50 43 54 20 2a 20 46 52 4f 4d 20 74 61 62 30 20 57  CT * FROM tab0 W
10d60 48 45 52 45 20 4e 4f 54 20 63 6f 6c 32 20 2a 20  HERE NOT col2 * 
10d70 63 6f 6c 31 20 2d 20 63 6f 6c 30 20 2a 20 2d 20  col1 - col0 * - 
10d80 63 6f 6c 32 20 4e 4f 54 20 49 4e 20 28 20 63 6f  col2 NOT IN ( co
10d90 6c 31 20 29 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a 71 75  l1 )..----....qu
10da0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
10db0 45 4c 45 43 54 20 32 20 2b 20 2b 20 63 6f 72 30  ELECT 2 + + cor0
10dc0 2e 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c 32 20 41  .col1 * + col2 A
10dd0 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32  S col0 FROM tab2
10de0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 35 33   cor0..----..153
10df0 36 0d 0a 36 34 38 0d 0a 38 33 39 0d 0a 0d 0a 71  6..648..839....q
10e00 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
10e10 53 45 4c 45 43 54 20 63 6f 6c 32 20 2d 20 2d 20  SELECT col2 - - 
10e20 74 61 62 30 2e 63 6f 6c 32 20 41 53 20 63 6f 6c  tab0.col2 AS col
10e30 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d  1 FROM tab0..---
10e40 2d 0d 0a 31 36 34 0d 0a 32 0d 0a 36 36 0d 0a 0d  -..164..2..66...
10e50 0a 71 75 65 72 79 20 49 49 49 20 72 6f 77 73 6f  .query III rowso
10e60 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
10e70 4e 43 54 20 2a 20 46 52 4f 4d 20 74 61 62 32 20  NCT * FROM tab2 
10e80 57 48 45 52 45 20 2b 20 63 6f 6c 32 20 2b 20 2d  WHERE + col2 + -
10e90 20 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c 30 20 42   col0 + + col0 B
10ea0 45 54 57 45 45 4e 20 63 6f 6c 31 20 2a 20 2d 20  ETWEEN col1 * - 
10eb0 63 6f 6c 30 20 41 4e 44 20 63 6f 6c 30 20 2d 20  col0 AND col0 - 
10ec0 2d 20 63 6f 6c 31 0d 0a 2d 2d 2d 2d 0d 0a 39 20  - col1..----..9 
10ed0 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74  values hashing t
10ee0 6f 20 61 64 30 35 62 35 39 34 32 34 30 30 64 35  o ad05b5942400d5
10ef0 65 37 61 32 31 62 33 32 33 62 33 64 61 36 35 61  e7a21b323b3da65a
10f00 34 35 0d 0a 0d 0a 71 75 65 72 79 20 49 49 49 20  45....query III 
10f10 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
10f20 2a 20 46 52 4f 4d 20 74 61 62 32 20 57 48 45 52  * FROM tab2 WHER
10f30 45 20 4e 4f 54 20 28 20 4e 55 4c 4c 20 29 20 4e  E NOT ( NULL ) N
10f40 4f 54 20 42 45 54 57 45 45 4e 20 4e 55 4c 4c 20  OT BETWEEN NULL 
10f50 41 4e 44 20 4e 55 4c 4c 0d 0a 2d 2d 2d 2d 0d 0a  AND NULL..----..
10f60 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
10f70 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 31 20 2a  t..SELECT col1 *
10f80 20 2b 20 63 6f 6c 30 20 2b 20 2b 20 74 61 62 32   + col0 + + tab2
10f90 2e 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 0d  .col1 FROM tab2.
10fa0 0a 2d 2d 2d 2d 0d 0a 31 33 36 30 0d 0a 32 34 38  .----..1360..248
10fb0 0d 0a 34 36 36 31 0d 0a 0d 0a 71 75 65 72 79 20  ..4661....query 
10fc0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
10fd0 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 32 20  T DISTINCT col2 
10fe0 2a 20 2d 20 63 6f 6c 32 20 2d 20 63 6f 6c 32 20  * - col2 - col2 
10ff0 2a 20 2d 20 74 61 62 32 2e 63 6f 6c 30 20 46 52  * - tab2.col0 FR
11000 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d  OM tab2..----..-
11010 35 34 30 0d 0a 31 33 35 32 0d 0a 31 35 35 38 0d  540..1352..1558.
11020 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
11030 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c  rt..SELECT - col
11040 31 20 2a 20 63 6f 6c 32 20 2b 20 2b 20 63 6f 6c  1 * col2 + + col
11050 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d  0 FROM tab0..---
11060 2d 0d 0a 2d 32 38 31 34 0d 0a 2d 36 32 0d 0a 2d  -..-2814..-62..-
11070 37 33 37 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20  7373....query I 
11080 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
11090 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c 30 20 2b 20  col1 * - col0 + 
110a0 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30  + col0 FROM tab0
110b0 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 30 34 30 0d 0a 2d  ..----..-2040..-
110c0 33 33 36 30 0d 0a 2d 38 30 31 30 0d 0a 0d 0a 71  3360..-8010....q
110d0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
110e0 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
110f0 2d 20 74 61 62 30 2e 63 6f 6c 31 20 2a 20 2d 20  - tab0.col1 * - 
11100 31 35 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  15 AS col2 FROM 
11110 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 39 30  tab0..----..1290
11120 0d 0a 31 33 36 35 0d 0a 31 34 35 35 0d 0a 0d 0a  ..1365..1455....
11130 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
11140 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 38 39  .SELECT ALL - 89
11150 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
11160 62 31 2c 20 74 61 62 30 20 63 6f 72 30 2c 20 74  b1, tab0 cor0, t
11170 61 62 30 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d  ab0 AS cor1..---
11180 2d 0d 0a 32 37 20 76 61 6c 75 65 73 20 68 61 73  -..27 values has
11190 68 69 6e 67 20 74 6f 20 63 33 36 65 35 39 37 62  hing to c36e597b
111a0 37 62 63 35 37 32 37 35 33 36 66 35 62 62 35 38  7bc5727536f5bb58
111b0 30 65 36 63 65 62 62 63 0d 0a 0d 0a 71 75 65 72  0e6cebbc....quer
111c0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
111d0 45 43 54 20 41 4c 4c 20 74 61 62 32 2e 63 6f 6c  ECT ALL tab2.col
111e0 30 20 2a 20 2b 20 63 6f 6c 32 20 46 52 4f 4d 20  0 * + col2 FROM 
111f0 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 38 39 0d  tab2..----..189.
11200 0a 32 30 32 38 0d 0a 33 30 30 32 0d 0a 0d 0a 71  .2028..3002....q
11210 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
11220 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
11230 2d 20 63 6f 6c 32 20 2b 20 2d 20 63 6f 6c 30 20  - col2 + - col0 
11240 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
11250 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
11260 0a 2d 31 37 31 0d 0a 2d 33 36 0d 0a 2d 35 37 0d  .-171..-36..-57.
11270 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
11280 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63  rt..SELECT ALL c
11290 6f 6c 30 20 2a 20 37 35 20 41 53 20 63 6f 6c 31  ol0 * 75 AS col1
112a0 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
112b0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 35 32 35 0d 0a 35  r0..----..525..5
112c0 38 35 30 0d 0a 35 39 32 35 0d 0a 0d 0a 71 75 65  850..5925....que
112d0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
112e0 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f  LECT DISTINCT co
112f0 6c 32 20 2a 20 63 6f 6c 30 20 41 53 20 63 6f 6c  l2 * col0 AS col
11300 31 20 46 52 4f 4d 20 74 61 62 32 20 63 6f 72 30  1 FROM tab2 cor0
11310 0d 0a 2d 2d 2d 2d 0d 0a 31 38 39 0d 0a 32 30 32  ..----..189..202
11320 38 0d 0a 33 30 30 32 0d 0a 0d 0a 71 75 65 72 79  8..3002....query
11330 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
11340 43 54 20 63 6f 6c 31 20 2a 20 2b 20 28 20 2d 20  CT col1 * + ( - 
11350 63 6f 6c 31 20 29 20 41 53 20 63 6f 6c 32 20 46  col1 ) AS col2 F
11360 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
11370 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 38 39 0d 0a 2d 33  ..----..-289..-3
11380 34 38 31 0d 0a 2d 39 36 31 0d 0a 0d 0a 71 75 65  481..-961....que
11390 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
113a0 4c 45 43 54 20 2b 20 2d 20 63 6f 6c 30 20 2a 20  LECT + - col0 * 
113b0 2d 20 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46  - col0 AS col1 F
113c0 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
113d0 0d 0a 2d 2d 2d 2d 0d 0a 31 32 32 35 0d 0a 35 37  ..----..1225..57
113e0 36 0d 0a 37 39 32 31 0d 0a 0d 0a 71 75 65 72 79  6..7921....query
113f0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
11400 43 54 20 41 4c 4c 20 63 6f 6c 32 20 2a 20 2d 20  CT ALL col2 * - 
11410 63 6f 72 30 2e 63 6f 6c 31 20 2b 20 2b 20 63 6f  cor0.col1 + + co
11420 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l1 FROM tab0 AS 
11430 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 37 35  cor0..----..-275
11440 32 0d 0a 2d 37 33 37 31 0d 0a 30 0d 0a 0d 0a 71  2..-7371..0....q
11450 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
11460 53 45 4c 45 43 54 20 2b 20 28 20 63 6f 72 30 2e  SELECT + ( cor0.
11470 63 6f 6c 30 20 29 20 2b 20 63 6f 6c 32 20 46 52  col0 ) + col2 FR
11480 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
11490 0a 2d 2d 2d 2d 0d 0a 31 32 31 0d 0a 31 37 36 0d  .----..121..176.
114a0 0a 35 37 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  .57....onlyif my
114b0 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70  sql # use DIV op
114c0 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67  erator for integ
114d0 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65  er division..que
114e0 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
114f0 65 6c 2d 35 30 36 0d 0a 53 45 4c 45 43 54 20 41  el-506..SELECT A
11500 4c 4c 20 2d 20 28 20 2d 20 63 6f 72 30 2e 63 6f  LL - ( - cor0.co
11510 6c 30 20 29 20 44 49 56 20 2d 20 63 6f 6c 31 20  l0 ) DIV - col1 
11520 2b 20 63 6f 6c 31 20 2b 20 2d 20 34 39 20 41 53  + col1 + - 49 AS
11530 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20   col0 FROM tab2 
11540 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
11550 31 38 0d 0a 2d 33 36 0d 0a 39 0d 0a 0d 0a 73 6b  18..-36..9....sk
11560 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
11570 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
11580 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
11590 65 6c 2d 35 30 36 0d 0a 53 45 4c 45 43 54 20 41  el-506..SELECT A
115a0 4c 4c 20 2d 20 28 20 2d 20 63 6f 72 30 2e 63 6f  LL - ( - cor0.co
115b0 6c 30 20 29 20 2f 20 2d 20 63 6f 6c 31 20 2b 20  l0 ) / - col1 + 
115c0 63 6f 6c 31 20 2b 20 2d 20 34 39 20 41 53 20 63  col1 + - 49 AS c
115d0 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol0 FROM tab2 AS
115e0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 38   cor0..----..-18
115f0 0d 0a 2d 33 36 0d 0a 39 0d 0a 0d 0a 71 75 65 72  ..-36..9....quer
11600 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
11610 45 43 54 20 41 4c 4c 20 2b 20 2d 20 63 6f 6c 30  ECT ALL + - col0
11620 20 2d 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c   - + col0 AS col
11630 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  2 FROM tab1 AS c
11640 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32 38 0d  or0..----..-128.
11650 0a 2d 31 36 30 0d 0a 2d 36 0d 0a 0d 0a 71 75 65  .-160..-6....que
11660 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
11670 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20  LECT DISTINCT - 
11680 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c 32 20 2d 20  col0 * - col2 - 
11690 2d 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30  - col1 FROM tab0
116a0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
116b0 31 33 32 0d 0a 37 33 38 39 0d 0a 38 37 38 0d 0a  132..7389..878..
116c0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
116d0 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 31  t..SELECT + col1
116e0 20 2a 20 38 30 20 2d 20 2d 20 63 6f 6c 31 20 46   * 80 - - col1 F
116f0 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
11700 0d 0a 2d 2d 2d 2d 0d 0a 31 33 37 37 0d 0a 32 35  ..----..1377..25
11710 31 31 0d 0a 34 37 37 39 0d 0a 0d 0a 71 75 65 72  11..4779....quer
11720 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
11730 45 43 54 20 2b 20 2b 20 31 31 20 41 53 20 63 6f  ECT + + 11 AS co
11740 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l0 FROM tab1 AS 
11750 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 0d 0a  cor0..----..11..
11760 31 31 0d 0a 31 31 0d 0a 0d 0a 6f 6e 6c 79 69 66  11..11....onlyif
11770 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74   mysql # support
11780 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69   for MySQL speci
11790 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73  fic system types
117a0 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65   and syntax..que
117b0 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
117c0 65 6c 2d 35 31 31 0d 0a 53 45 4c 45 43 54 20 2b  el-511..SELECT +
117d0 20 2b 20 43 41 53 54 28 20 63 6f 6c 32 20 41 53   + CAST( col2 AS
117e0 20 53 49 47 4e 45 44 20 29 20 46 52 4f 4d 20 74   SIGNED ) FROM t
117f0 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
11800 2d 0d 0a 35 34 0d 0a 35 37 0d 0a 39 36 0d 0a 0d  -..54..57..96...
11810 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
11820 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
11830 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
11840 6c 61 62 65 6c 2d 35 31 31 0d 0a 53 45 4c 45 43  label-511..SELEC
11850 54 20 2b 20 2b 20 43 41 53 54 20 28 20 63 6f 6c  T + + CAST ( col
11860 32 20 41 53 20 49 4e 54 45 47 45 52 20 29 20 46  2 AS INTEGER ) F
11870 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
11880 0d 0a 2d 2d 2d 2d 0d 0a 35 34 0d 0a 35 37 0d 0a  ..----..54..57..
11890 39 36 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  96....onlyif mys
118a0 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65  ql # use DIV ope
118b0 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65  rator for intege
118c0 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72  r division..quer
118d0 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
118e0 6c 2d 35 31 32 0d 0a 53 45 4c 45 43 54 20 31 20  l-512..SELECT 1 
118f0 44 49 56 20 63 6f 6c 30 20 2d 20 63 6f 72 30 2e  DIV col0 - cor0.
11900 63 6f 6c 32 20 63 6f 6c 30 20 46 52 4f 4d 20 74  col2 col0 FROM t
11910 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
11920 2d 0d 0a 2d 31 0d 0a 2d 33 33 0d 0a 2d 38 32 0d  -..-1..-33..-82.
11930 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72  ...skipif postgr
11940 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51  esql # PostgreSQ
11950 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68  L requires AS wh
11960 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70  en renaming outp
11970 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 73 6b 69 70  ut columns..skip
11980 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
11990 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
119a0 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
119b0 2d 35 31 32 0d 0a 53 45 4c 45 43 54 20 31 20 2f  -512..SELECT 1 /
119c0 20 63 6f 6c 30 20 2d 20 63 6f 72 30 2e 63 6f 6c   col0 - cor0.col
119d0 32 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30  2 col0 FROM tab0
119e0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
119f0 2d 31 0d 0a 2d 33 33 0d 0a 2d 38 32 0d 0a 0d 0a  -1..-33..-82....
11a00 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71  skipif postgresq
11a10 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72  l # PostgreSQL r
11a20 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20  equires AS when 
11a30 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20  renaming output 
11a40 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49  columns..query I
11a50 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
11a60 20 41 4c 4c 20 2b 20 2d 20 39 35 20 63 6f 6c 30   ALL + - 95 col0
11a70 20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d   FROM tab1 cor0.
11a80 0a 2d 2d 2d 2d 0d 0a 2d 39 35 0d 0a 2d 39 35 0d  .----..-95..-95.
11a90 0a 2d 39 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .-95....query I 
11aa0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
11ab0 44 49 53 54 49 4e 43 54 20 2d 20 31 33 20 2a 20  DISTINCT - 13 * 
11ac0 63 6f 6c 31 20 2b 20 2b 20 63 6f 6c 32 20 46 52  col1 + + col2 FR
11ad0 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
11ae0 0a 2d 2d 2d 2d 0d 0a 2d 31 38 33 0d 0a 2d 33 37  .----..-183..-37
11af0 36 0d 0a 2d 37 34 31 0d 0a 0d 0a 71 75 65 72 79  6..-741....query
11b00 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
11b10 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 35 20  CT DISTINCT + 5 
11b20 2b 20 63 6f 6c 31 20 2a 20 63 6f 6c 30 20 46 52  + col1 * col0 FR
11b30 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
11b40 0a 2d 2d 2d 2d 0d 0a 31 33 34 38 0d 0a 32 32 32  .----..1348..222
11b50 0d 0a 34 36 30 37 0d 0a 0d 0a 71 75 65 72 79 20  ..4607....query 
11b60 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
11b70 54 20 41 4c 4c 20 2b 20 36 20 2b 20 28 20 63 6f  T ALL + 6 + ( co
11b80 6c 32 20 29 20 46 52 4f 4d 20 74 61 62 32 20 41  l2 ) FROM tab2 A
11b90 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 32  S cor0..----..32
11ba0 0d 0a 33 33 0d 0a 34 34 0d 0a 0d 0a 71 75 65 72  ..33..44....quer
11bb0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
11bc0 45 43 54 20 2d 20 28 20 63 6f 6c 30 20 29 20 2a  ECT - ( col0 ) *
11bd0 20 63 6f 6c 31 20 2b 20 2d 20 28 20 63 6f 6c 32   col1 + - ( col2
11be0 20 29 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20   ) AS col2 FROM 
11bf0 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
11c00 2d 2d 0d 0a 2d 32 30 39 37 0d 0a 2d 33 33 39 36  --..-2097..-3396
11c10 0d 0a 2d 38 31 38 31 0d 0a 0d 0a 71 75 65 72 79  ..-8181....query
11c20 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
11c30 43 54 20 63 6f 6c 30 20 2a 20 28 20 35 32 20 29  CT col0 * ( 52 )
11c40 20 2b 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74   + + col1 FROM t
11c50 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 33 39 35 0d 0a  ab2..----..395..
11c60 34 31 31 35 0d 0a 34 31 32 35 0d 0a 0d 0a 71 75  4115..4125....qu
11c70 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
11c80 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b  ELECT DISTINCT +
11c90 20 28 20 2d 20 63 6f 72 30 2e 63 6f 6c 30 20 29   ( - cor0.col0 )
11ca0 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62   + col0 FROM tab
11cb0 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
11cc0 0a 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  .0....query I ro
11cd0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
11ce0 4c 20 2b 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20  L + + cor0.col1 
11cf0 2a 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 41 53  * + cor0.col0 AS
11d00 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20   col1 FROM tab0 
11d10 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32  AS cor0..----..2
11d20 30 36 34 0d 0a 33 33 39 35 0d 0a 38 30 39 39 0d  064..3395..8099.
11d30 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
11d40 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74  # use DIV operat
11d50 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64  or for integer d
11d60 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49  ivision..query I
11d70 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 35   rowsort label-5
11d80 32 31 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  21..SELECT DISTI
11d90 4e 43 54 20 2d 20 63 6f 6c 30 20 44 49 56 20 2b  NCT - col0 DIV +
11da0 20 32 34 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d   24 AS col0 FROM
11db0 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
11dc0 2d 2d 2d 0d 0a 2d 32 0d 0a 2d 33 0d 0a 30 0d 0a  ---..-2..-3..0..
11dd0 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
11de0 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
11df0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
11e00 20 6c 61 62 65 6c 2d 35 32 31 0d 0a 53 45 4c 45   label-521..SELE
11e10 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f  CT DISTINCT - co
11e20 6c 30 20 2f 20 2b 20 32 34 20 41 53 20 63 6f 6c  l0 / + 24 AS col
11e30 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  0 FROM tab1 AS c
11e40 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 0d 0a 2d  or0..----..-2..-
11e50 33 0d 0a 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  3..0....onlyif m
11e60 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f  ysql # use DIV o
11e70 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65  perator for inte
11e80 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75  ger division..qu
11e90 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
11ea0 62 65 6c 2d 35 32 32 0d 0a 53 45 4c 45 43 54 20  bel-522..SELECT 
11eb0 2d 20 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c 30 20  - col0 + - col0 
11ec0 44 49 56 20 63 6f 6c 30 20 2b 20 63 6f 6c 30 20  DIV col0 + col0 
11ed0 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
11ee0 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
11ef0 0a 2d 31 0d 0a 2d 31 0d 0a 2d 31 0d 0a 0d 0a 73  .-1..-1..-1....s
11f00 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
11f10 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
11f20 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
11f30 62 65 6c 2d 35 32 32 0d 0a 53 45 4c 45 43 54 20  bel-522..SELECT 
11f40 2d 20 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c 30 20  - col0 + - col0 
11f50 2f 20 63 6f 6c 30 20 2b 20 63 6f 6c 30 20 41 53  / col0 + col0 AS
11f60 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20   col0 FROM tab2 
11f70 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
11f80 31 0d 0a 2d 31 0d 0a 2d 31 0d 0a 0d 0a 71 75 65  1..-1..-1....que
11f90 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
11fa0 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20  LECT DISTINCT - 
11fb0 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 2b 20 2b 20  + cor0.col1 + + 
11fc0 63 6f 72 30 2e 63 6f 6c 30 20 2b 20 33 33 20 46  cor0.col0 + 33 F
11fd0 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
11fe0 0d 0a 2d 2d 2d 2d 0d 0a 35 32 0d 0a 39 0d 0a 39  ..----..52..9..9
11ff0 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  5....query I row
12000 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
12010 54 49 4e 43 54 20 2d 20 2b 20 63 6f 6c 30 20 2a  TINCT - + col0 *
12020 20 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46 52   col0 AS col2 FR
12030 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
12040 0a 2d 2d 2d 2d 0d 0a 2d 34 39 0d 0a 2d 36 30 38  .----..-49..-608
12050 34 0d 0a 2d 36 32 34 31 0d 0a 0d 0a 71 75 65 72  4..-6241....quer
12060 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
12070 45 43 54 20 2d 20 28 20 2b 20 63 6f 6c 30 20 29  ECT - ( + col0 )
12080 20 2b 20 2d 20 63 6f 6c 31 20 46 52 4f 4d 20 74   + - col1 FROM t
12090 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
120a0 2d 0d 0a 2d 31 33 37 0d 0a 2d 33 38 0d 0a 2d 39  -..-137..-38..-9
120b0 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  6....query I row
120c0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 38  sort..SELECT + 8
120d0 31 20 2a 20 63 6f 6c 31 20 41 53 20 63 6f 6c 30  1 * col1 AS col0
120e0 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
120f0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33 37 37 0d 0a  r0..----..1377..
12100 32 35 31 31 0d 0a 34 37 37 39 0d 0a 0d 0a 71 75  2511..4779....qu
12110 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
12120 45 4c 45 43 54 20 2b 20 2b 20 35 34 20 41 53 20  ELECT + + 54 AS 
12130 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41  col1 FROM tab0 A
12140 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 35 34  S cor0..----..54
12150 0d 0a 35 34 0d 0a 35 34 0d 0a 0d 0a 71 75 65 72  ..54..54....quer
12160 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
12170 45 43 54 20 63 6f 72 30 2e 63 6f 6c 32 20 46 52  ECT cor0.col2 FR
12180 4f 4d 20 74 61 62 32 2c 20 74 61 62 31 2c 20 74  OM tab2, tab1, t
12190 61 62 30 20 41 53 20 63 6f 72 30 2c 20 74 61 62  ab0 AS cor0, tab
121a0 31 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 38 31  1 cor1..----..81
121b0 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20   values hashing 
121c0 74 6f 20 65 39 33 38 37 37 37 65 62 66 66 63 32  to e938777ebffc2
121d0 65 33 65 39 63 30 63 64 66 61 61 34 66 37 33 32  e3e9c0cdfaa4f732
121e0 63 30 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  c05....query I r
121f0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
12200 20 74 61 62 30 2e 63 6f 6c 32 20 2a 20 63 6f 6c   tab0.col2 * col
12210 30 20 2a 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20  0 * + col1 FROM 
12220 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 33 33 39 35  tab0..----..3395
12230 0d 0a 36 36 34 31 31 38 0d 0a 36 38 31 31 32 0d  ..664118..68112.
12240 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
12250 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d  rt..SELECT ALL -
12260 20 63 6f 6c 32 20 2b 20 63 6f 72 30 2e 63 6f 6c   col2 + cor0.col
12270 31 20 2a 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f  1 * + col0 AS co
12280 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l1 FROM tab0 AS 
12290 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 30 33 31  cor0..----..2031
122a0 0d 0a 33 33 39 34 0d 0a 38 30 31 37 0d 0a 0d 0a  ..3394..8017....
122b0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
122c0 0a 53 45 4c 45 43 54 20 2d 20 2d 20 63 6f 6c 30  .SELECT - - col0
122d0 20 2b 20 63 6f 6c 31 20 2b 20 63 6f 6c 31 20 46   + col1 + col1 F
122e0 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
122f0 0d 0a 2d 2d 2d 2d 0d 0a 31 31 33 0d 0a 31 39 36  ..----..113..196
12300 0d 0a 36 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..69....query I 
12310 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
12320 44 49 53 54 49 4e 43 54 20 28 20 2b 20 63 6f 72  DISTINCT ( + cor
12330 30 2e 63 6f 6c 32 20 29 20 2b 20 63 6f 6c 31 20  0.col2 ) + col1 
12340 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
12350 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 39 0d 0a 36 37  0..----..109..67
12360 0d 0a 38 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..80....query I 
12370 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
12380 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c 31 20 2a 20  col2 * - col1 * 
12390 2b 20 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46  + col2 AS col0 F
123a0 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
123b0 0d 0a 2d 2d 2d 2d 0d 0a 2d 36 31 31 38 38 34 0d  ..----..-611884.
123c0 0a 2d 39 33 36 35 34 0d 0a 2d 39 37 0d 0a 0d 0a  .-93654..-97....
123d0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
123e0 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 30 20 2b  .SELECT + col0 +
123f0 20 63 6f 6c 30 20 2b 20 2d 20 28 20 2b 20 63 6f   col0 + - ( + co
12400 6c 30 20 29 20 41 53 20 63 6f 6c 30 20 46 52 4f  l0 ) AS col0 FRO
12410 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab1 cor0..---
12420 2d 0d 0a 33 0d 0a 36 34 0d 0a 38 30 0d 0a 0d 0a  -..3..64..80....
12430 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
12440 0a 53 45 4c 45 43 54 20 41 4c 4c 20 28 20 2d 20  .SELECT ALL ( - 
12450 63 6f 6c 30 20 29 20 2b 20 63 6f 6c 32 20 46 52  col0 ) + col2 FR
12460 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
12470 0a 2d 2d 2d 2d 0d 0a 2d 33 34 0d 0a 2d 37 0d 0a  .----..-34..-7..
12480 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  9....query I row
12490 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
124a0 54 49 4e 43 54 20 37 39 20 41 53 20 63 6f 6c 30  TINCT 79 AS col0
124b0 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
124c0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 37 39 0d 0a 0d 0a  r0..----..79....
124d0 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75  onlyif mysql # u
124e0 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20  se DIV operator 
124f0 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69  for integer divi
12500 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f  sion..query I ro
12510 77 73 6f 72 74 20 6c 61 62 65 6c 2d 35 33 37 0d  wsort label-537.
12520 0a 53 45 4c 45 43 54 20 63 6f 6c 32 20 44 49 56  .SELECT col2 DIV
12530 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20   col0 FROM tab0 
12540 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30  cor0..----..0..0
12550 0d 0a 31 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  ..1....skipif my
12560 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
12570 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
12580 77 73 6f 72 74 20 6c 61 62 65 6c 2d 35 33 37 0d  wsort label-537.
12590 0a 53 45 4c 45 43 54 20 63 6f 6c 32 20 2f 20 63  .SELECT col2 / c
125a0 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 63 6f  ol0 FROM tab0 co
125b0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a  r0..----..0..0..
125c0 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  1....query I row
125d0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
125e0 20 2b 20 63 6f 6c 32 20 2b 20 2b 20 28 20 2d 20   + col2 + + ( - 
125f0 63 6f 72 30 2e 63 6f 6c 32 20 29 20 2a 20 2b 20  cor0.col2 ) * + 
12600 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41  col0 FROM tab2 A
12610 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
12620 36 32 0d 0a 2d 32 30 30 32 0d 0a 2d 32 39 36 34  62..-2002..-2964
12630 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
12640 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
12650 49 4e 43 54 20 2d 20 63 6f 6c 30 20 2a 20 2d 20  INCT - col0 * - 
12660 28 20 2d 20 63 6f 6c 31 20 2b 20 2b 20 63 6f 6c  ( - col1 + + col
12670 30 20 29 20 46 52 4f 4d 20 74 61 62 32 20 41 53  0 ) FROM tab2 AS
12680 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 36   cor0..----..-16
12690 38 0d 0a 31 34 38 32 0d 0a 34 38 39 38 0d 0a 0d  8..1482..4898...
126a0 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
126b0 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72  use DIV operator
126c0 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76   for integer div
126d0 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72  ision..query I r
126e0 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 35 34 30  owsort label-540
126f0 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
12700 54 20 2b 20 63 6f 6c 31 20 44 49 56 20 2b 20 63  T + col1 DIV + c
12710 6f 6c 32 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61  ol2 col0 FROM ta
12720 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
12730 0d 0a 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f  ..0....skipif po
12740 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67  stgresql # Postg
12750 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41  reSQL requires A
12760 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20  S when renaming 
12770 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a  output columns..
12780 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
12790 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
127a0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
127b0 61 62 65 6c 2d 35 34 30 0d 0a 53 45 4c 45 43 54  abel-540..SELECT
127c0 20 44 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c 31   DISTINCT + col1
127d0 20 2f 20 2b 20 63 6f 6c 32 20 63 6f 6c 30 20 46   / + col2 col0 F
127e0 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
127f0 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 0d 0a 71 75 65  ..----..0....que
12800 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
12810 4c 45 43 54 20 41 4c 4c 20 39 34 20 41 53 20 63  LECT ALL 94 AS c
12820 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d  ol0 FROM tab2..-
12830 2d 2d 2d 0d 0a 39 34 0d 0a 39 34 0d 0a 39 34 0d  ---..94..94..94.
12840 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
12850 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b  rt..SELECT ALL +
12860 20 28 20 2b 20 63 6f 6c 30 20 29 20 2b 20 28 20   ( + col0 ) + ( 
12870 2d 20 28 20 2d 20 74 61 62 30 2e 63 6f 6c 30 20  - ( - tab0.col0 
12880 29 20 29 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  ) ) AS col1 FROM
12890 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 37 38   tab0..----..178
128a0 0d 0a 34 38 0d 0a 37 30 0d 0a 0d 0a 6f 6e 6c 79  ..48..70....only
128b0 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44  if mysql # use D
128c0 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20  IV operator for 
128d0 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e  integer division
128e0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
128f0 74 20 6c 61 62 65 6c 2d 35 34 33 0d 0a 53 45 4c  t label-543..SEL
12900 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63  ECT DISTINCT + c
12910 6f 6c 30 20 44 49 56 20 2d 20 28 20 32 38 20 29  ol0 DIV - ( 28 )
12920 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
12930 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 2d 33  r0..----..-1..-3
12940 0d 0a 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  ..0....skipif my
12950 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
12960 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
12970 77 73 6f 72 74 20 6c 61 62 65 6c 2d 35 34 33 0d  wsort label-543.
12980 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
12990 20 2b 20 63 6f 6c 30 20 2f 20 2d 20 28 20 32 38   + col0 / - ( 28
129a0 20 29 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20   ) FROM tab0 AS 
129b0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a  cor0..----..-1..
129c0 2d 33 0d 0a 30 0d 0a 0d 0a 71 75 65 72 79 20 49  -3..0....query I
129d0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
129e0 20 41 4c 4c 20 2b 20 63 6f 6c 31 20 2a 20 63 6f   ALL + col1 * co
129f0 6c 30 20 2b 20 2b 20 63 6f 6c 30 20 41 53 20 63  l0 + + col0 AS c
12a00 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol1 FROM tab1 AS
12a10 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 32   cor0..----..112
12a20 30 0d 0a 37 30 34 0d 0a 38 31 0d 0a 0d 0a 71 75  0..704..81....qu
12a30 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
12a40 45 4c 45 43 54 20 41 4c 4c 20 2d 20 2b 20 63 6f  ELECT ALL - + co
12a50 6c 30 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 41  l0 - cor0.col2 A
12a60 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31  S col2 FROM tab1
12a70 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
12a80 2d 31 32 31 0d 0a 2d 31 37 36 0d 0a 2d 35 37 0d  -121..-176..-57.
12a90 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
12aa0 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 72  rt..SELECT + cor
12ab0 30 2e 63 6f 6c 31 20 2b 20 2b 20 28 20 2b 20 63  0.col1 + + ( + c
12ac0 6f 72 30 2e 63 6f 6c 30 20 29 20 2a 20 63 6f 6c  or0.col0 ) * col
12ad0 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  2 FROM tab0 AS c
12ae0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33 32 0d 0a  or0..----..132..
12af0 37 33 38 39 0d 0a 38 37 38 0d 0a 0d 0a 71 75 65  7389..878....que
12b00 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
12b10 4c 45 43 54 20 41 4c 4c 20 2d 20 2d 20 63 6f 6c  LECT ALL - - col
12b20 30 20 2a 20 2b 20 63 6f 6c 32 20 2b 20 2d 20 63  0 * + col2 + - c
12b30 6f 6c 30 20 2a 20 2b 20 63 6f 6c 30 20 46 52 4f  ol0 * + col0 FRO
12b40 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab0 cor0..---
12b50 2d 0d 0a 2d 31 31 39 30 0d 0a 2d 36 32 33 0d 0a  -..-1190..-623..
12b60 32 31 36 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  216....onlyif my
12b70 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70  sql # use DIV op
12b80 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67  erator for integ
12b90 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65  er division..que
12ba0 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
12bb0 65 6c 2d 35 34 38 0d 0a 53 45 4c 45 43 54 20 44  el-548..SELECT D
12bc0 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c 30 20 2b  ISTINCT - col0 +
12bd0 20 63 6f 6c 31 20 44 49 56 20 2b 20 63 6f 6c 30   col1 DIV + col0
12be0 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
12bf0 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 31 0d 0a 2d  b0..----..-21..-
12c00 33 33 0d 0a 2d 38 38 0d 0a 0d 0a 73 6b 69 70 69  33..-88....skipi
12c10 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
12c20 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
12c30 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
12c40 35 34 38 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  548..SELECT DIST
12c50 49 4e 43 54 20 2d 20 63 6f 6c 30 20 2b 20 63 6f  INCT - col0 + co
12c60 6c 31 20 2f 20 2b 20 63 6f 6c 30 20 41 53 20 63  l1 / + col0 AS c
12c70 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d  ol0 FROM tab0..-
12c80 2d 2d 2d 0d 0a 2d 32 31 0d 0a 2d 33 33 0d 0a 2d  ---..-21..-33..-
12c90 38 38 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  88....onlyif mys
12ca0 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72  ql # support for
12cb0 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63 20   MySQL specific 
12cc0 73 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64  system types and
12cd0 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49   syntax..query I
12ce0 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 35   rowsort label-5
12cf0 34 39 0d 0a 53 45 4c 45 43 54 20 2b 20 2b 20 63  49..SELECT + + c
12d00 6f 6c 32 20 2b 20 43 41 53 54 28 20 2b 20 63 6f  ol2 + CAST( + co
12d10 6c 31 20 2a 20 2b 20 63 6f 6c 30 20 41 53 20 53  l1 * + col0 AS S
12d20 49 47 4e 45 44 20 29 20 41 53 20 63 6f 6c 31 20  IGNED ) AS col1 
12d30 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
12d40 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 33 36 0d 0a 31  0..----..1136..1
12d50 33 32 0d 0a 36 39 37 0d 0a 0d 0a 73 6b 69 70 69  32..697....skipi
12d60 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
12d70 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
12d80 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
12d90 35 34 39 0d 0a 53 45 4c 45 43 54 20 2b 20 2b 20  549..SELECT + + 
12da0 63 6f 6c 32 20 2b 20 43 41 53 54 20 28 20 2b 20  col2 + CAST ( + 
12db0 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c 30 20 41 53  col1 * + col0 AS
12dc0 20 49 4e 54 45 47 45 52 20 29 20 41 53 20 63 6f   INTEGER ) AS co
12dd0 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l1 FROM tab1 AS 
12de0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 33 36  cor0..----..1136
12df0 0d 0a 31 33 32 0d 0a 36 39 37 0d 0a 0d 0a 71 75  ..132..697....qu
12e00 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
12e10 45 4c 45 43 54 20 63 6f 6c 32 20 2a 20 2b 20 63  ELECT col2 * + c
12e20 6f 6c 30 20 2b 20 2b 20 63 6f 6c 30 20 41 53 20  ol0 + + col0 AS 
12e30 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 0d 0a  col1 FROM tab1..
12e40 2d 2d 2d 2d 0d 0a 31 36 35 0d 0a 33 37 31 32 0d  ----..165..3712.
12e50 0a 37 37 36 30 0d 0a 0d 0a 71 75 65 72 79 20 49  .7760....query I
12e60 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
12e70 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 41 53 20   - cor0.col2 AS 
12e80 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41  col0 FROM tab2 A
12e90 53 20 63 6f 72 30 20 43 52 4f 53 53 20 4a 4f 49  S cor0 CROSS JOI
12ea0 4e 20 74 61 62 30 2c 20 74 61 62 30 20 41 53 20  N tab0, tab0 AS 
12eb0 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76  cor1..----..27 v
12ec0 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f  alues hashing to
12ed0 20 66 39 64 34 62 62 38 36 37 37 64 62 37 62 39   f9d4bb8677db7b9
12ee0 38 63 37 65 64 38 39 64 30 36 65 36 65 38 63 64  8c7ed89d06e6e8cd
12ef0 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  6....query I row
12f00 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
12f10 54 49 4e 43 54 20 2b 20 2b 20 63 6f 72 30 2e 63  TINCT + + cor0.c
12f20 6f 6c 32 20 2b 20 33 34 20 2a 20 63 6f 6c 30 20  ol2 + 34 * col0 
12f30 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
12f40 30 0d 0a 2d 2d 2d 2d 0d 0a 31 35 36 0d 0a 32 32  0..----..156..22
12f50 33 33 0d 0a 32 38 31 36 0d 0a 0d 0a 71 75 65 72  33..2816....quer
12f60 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
12f70 45 43 54 20 33 31 20 46 52 4f 4d 20 74 61 62 32  ECT 31 FROM tab2
12f80 2c 20 74 61 62 30 20 41 53 20 63 6f 72 30 2c 20  , tab0 AS cor0, 
12f90 74 61 62 30 20 41 53 20 63 6f 72 31 0d 0a 2d 2d  tab0 AS cor1..--
12fa0 2d 2d 0d 0a 32 37 20 76 61 6c 75 65 73 20 68 61  --..27 values ha
12fb0 73 68 69 6e 67 20 74 6f 20 63 33 63 36 66 39 32  shing to c3c6f92
12fc0 66 30 63 61 37 32 64 37 31 37 39 33 33 33 39 66  f0ca72d71793339f
12fd0 38 38 61 35 37 65 33 33 36 0d 0a 0d 0a 6f 6e 6c  88a57e336....onl
12fe0 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20  yif mysql # use 
12ff0 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72  DIV operator for
13000 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f   integer divisio
13010 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  n..query I rowso
13020 72 74 20 6c 61 62 65 6c 2d 35 35 34 0d 0a 53 45  rt label-554..SE
13030 4c 45 43 54 20 41 4c 4c 20 2b 20 74 61 62 30 2e  LECT ALL + tab0.
13040 63 6f 6c 31 20 44 49 56 20 38 20 2d 20 63 6f 6c  col1 DIV 8 - col
13050 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d  1 FROM tab0..---
13060 2d 0d 0a 2d 37 36 0d 0a 2d 38 30 0d 0a 2d 38 35  -..-76..-80..-85
13070 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
13080 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
13090 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
130a0 72 74 20 6c 61 62 65 6c 2d 35 35 34 0d 0a 53 45  rt label-554..SE
130b0 4c 45 43 54 20 41 4c 4c 20 2b 20 74 61 62 30 2e  LECT ALL + tab0.
130c0 63 6f 6c 31 20 2f 20 38 20 2d 20 63 6f 6c 31 20  col1 / 8 - col1 
130d0 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d  FROM tab0..----.
130e0 0a 2d 37 36 0d 0a 2d 38 30 0d 0a 2d 38 35 0d 0a  .-76..-80..-85..
130f0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
13100 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
13110 43 54 20 31 36 20 2a 20 2b 20 63 6f 6c 32 20 41  CT 16 * + col2 A
13120 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30  S col1 FROM tab0
13130 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
13140 31 33 31 32 0d 0a 31 36 0d 0a 35 32 38 0d 0a 0d  1312..16..528...
13150 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
13160 0d 0a 53 45 4c 45 43 54 20 2d 20 38 32 20 2b 20  ..SELECT - 82 + 
13170 2d 20 74 61 62 32 2e 63 6f 6c 30 20 2d 20 63 6f  - tab2.col0 - co
13180 6c 32 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  l2 AS col0 FROM 
13190 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 36  tab2..----..-116
131a0 0d 0a 2d 31 38 36 0d 0a 2d 31 39 39 0d 0a 0d 0a  ..-186..-199....
131b0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
131c0 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 33 34  .SELECT ALL - 34
131d0 20 2b 20 2b 20 63 6f 6c 32 20 41 53 20 63 6f 6c   + + col2 AS col
131e0 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d  1 FROM tab0..---
131f0 2d 0d 0a 2d 31 0d 0a 2d 33 33 0d 0a 34 38 0d 0a  -..-1..-33..48..
13200 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
13210 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2d 20 63 6f  t..SELECT + - co
13220 6c 32 20 2a 20 33 35 20 46 52 4f 4d 20 74 61 62  l2 * 35 FROM tab
13230 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
13240 0a 2d 31 31 35 35 0d 0a 2d 32 38 37 30 0d 0a 2d  .-1155..-2870..-
13250 33 35 0d 0a 0d 0a 71 75 65 72 79 20 49 49 49 49  35....query IIII
13260 49 49 49 49 49 49 49 49 49 49 49 20 72 6f 77 73  IIIIIIIIIII rows
13270 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
13280 49 4e 43 54 20 2a 20 46 52 4f 4d 20 74 61 62 30  INCT * FROM tab0
13290 2c 20 74 61 62 31 20 41 53 20 63 6f 72 30 20 43  , tab1 AS cor0 C
132a0 52 4f 53 53 20 4a 4f 49 4e 20 74 61 62 31 2c 20  ROSS JOIN tab1, 
132b0 74 61 62 32 2c 20 74 61 62 30 20 41 53 20 63 6f  tab2, tab0 AS co
132c0 72 31 0d 0a 2d 2d 2d 2d 0d 0a 33 36 34 35 20 76  r1..----..3645 v
132d0 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f  alues hashing to
132e0 20 34 38 39 62 37 62 32 62 35 63 34 39 38 30 64   489b7b2b5c4980d
132f0 35 30 65 38 36 65 35 31 62 65 33 30 33 36 31 63  50e86e51be30361c
13300 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  3....query I row
13310 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63  sort..SELECT + c
13320 6f 6c 31 20 2b 20 63 6f 6c 32 20 2d 20 2b 20 63  ol1 + col2 - + c
13330 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d  ol1 FROM tab0..-
13340 2d 2d 2d 0d 0a 31 0d 0a 33 33 0d 0a 38 32 0d 0a  ---..1..33..82..
13350 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
13360 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f   use DIV operato
13370 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69  r for integer di
13380 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20  vision..query I 
13390 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 35 36  rowsort label-56
133a0 31 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 31  1..SELECT + col1
133b0 20 44 49 56 20 63 6f 6c 32 20 2b 20 2b 20 28 20   DIV col2 + + ( 
133c0 63 6f 6c 32 20 29 20 46 52 4f 4d 20 74 61 62 31  col2 ) FROM tab1
133d0 0d 0a 2d 2d 2d 2d 0d 0a 35 34 0d 0a 35 37 0d 0a  ..----..54..57..
133e0 39 36 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  96....skipif mys
133f0 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
13400 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
13410 73 6f 72 74 20 6c 61 62 65 6c 2d 35 36 31 0d 0a  sort label-561..
13420 53 45 4c 45 43 54 20 2b 20 63 6f 6c 31 20 2f 20  SELECT + col1 / 
13430 63 6f 6c 32 20 2b 20 2b 20 28 20 63 6f 6c 32 20  col2 + + ( col2 
13440 29 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d  ) FROM tab1..---
13450 2d 0d 0a 35 34 0d 0a 35 37 0d 0a 39 36 0d 0a 0d  -..54..57..96...
13460 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
13470 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
13480 54 20 2b 20 63 6f 6c 30 20 2b 20 63 6f 6c 32 20  T + col0 + col2 
13490 2a 20 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46  * col1 AS col0 F
134a0 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab0..----..
134b0 31 33 32 0d 0a 32 38 36 32 0d 0a 37 35 35 31 0d  132..2862..7551.
134c0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
134d0 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c  rt..SELECT - col
134e0 32 20 2a 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20  2 * - cor0.col2 
134f0 2b 20 2b 20 63 6f 6c 30 20 2a 20 63 6f 72 30 2e  + + col0 * cor0.
13500 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46 52 4f  col1 AS col1 FRO
13510 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
13520 2d 2d 2d 2d 0d 0a 32 37 38 37 0d 0a 35 32 37 38  ----..2787..5278
13530 0d 0a 39 34 36 0d 0a 0d 0a 71 75 65 72 79 20 49  ..946....query I
13540 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
13550 20 41 4c 4c 20 2d 20 63 6f 6c 31 20 2a 20 2b 20   ALL - col1 * + 
13560 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46 52 4f  col1 AS col1 FRO
13570 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab2 cor0..---
13580 2d 0d 0a 2d 32 38 39 0d 0a 2d 33 34 38 31 0d 0a  -..-289..-3481..
13590 2d 39 36 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20  -961....query I 
135a0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
135b0 41 4c 4c 20 37 34 20 2b 20 63 6f 6c 31 20 46 52  ALL 74 + col1 FR
135c0 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
135d0 0a 2d 2d 2d 2d 0d 0a 31 30 30 0d 0a 38 34 0d 0a  .----..100..84..
135e0 38 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  87....query I ro
135f0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
13600 53 54 49 4e 43 54 20 2b 20 2b 20 63 6f 6c 31 20  STINCT + + col1 
13610 2a 20 63 6f 6c 31 20 2b 20 63 6f 6c 30 20 46 52  * col1 + col0 FR
13620 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
13630 0a 2d 2d 2d 2d 0d 0a 37 34 32 30 0d 0a 38 33 37  .----..7420..837
13640 30 0d 0a 39 34 34 34 0d 0a 0d 0a 71 75 65 72 79  0..9444....query
13650 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
13660 43 54 20 2d 20 2d 20 33 20 2b 20 2b 20 63 6f 6c  CT - - 3 + + col
13670 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  1 FROM tab2 AS c
13680 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 30 0d 0a 33  or0..----..20..3
13690 34 0d 0a 36 32 0d 0a 0d 0a 71 75 65 72 79 20 49  4..62....query I
136a0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
136b0 20 2d 20 2d 20 63 6f 72 30 2e 63 6f 6c 30 20 2a   - - cor0.col0 *
136c0 20 63 6f 6c 31 20 2b 20 2d 20 63 6f 6c 30 20 2a   col1 + - col0 *
136d0 20 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46 52   col2 AS col1 FR
136e0 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
136f0 0a 2d 2d 2d 2d 0d 0a 2d 31 36 35 39 0d 0a 32 35  .----..-1659..25
13700 37 34 0d 0a 32 38 0d 0a 0d 0a 71 75 65 72 79 20  74..28....query 
13710 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
13720 54 20 2b 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20  T + + cor0.col0 
13730 2b 20 39 34 20 2a 20 63 6f 6c 30 20 41 53 20 63  + 94 * col0 AS c
13740 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol0 FROM tab0 AS
13750 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 32 38   cor0..----..228
13760 30 0d 0a 33 33 32 35 0d 0a 38 34 35 35 0d 0a 0d  0..3325..8455...
13770 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
13780 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51  support for MySQ
13790 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65  L specific syste
137a0 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74  m types and synt
137b0 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ax..query I rows
137c0 6f 72 74 20 6c 61 62 65 6c 2d 35 37 30 0d 0a 53  ort label-570..S
137d0 45 4c 45 43 54 20 43 41 53 54 28 20 4e 55 4c 4c  ELECT CAST( NULL
137e0 20 41 53 20 53 49 47 4e 45 44 20 29 20 2b 20 2b   AS SIGNED ) + +
137f0 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20   col0 FROM tab0 
13800 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e  AS cor0..----..N
13810 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d  ULL..NULL..NULL.
13820 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
13830 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
13840 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
13850 74 20 6c 61 62 65 6c 2d 35 37 30 0d 0a 53 45 4c  t label-570..SEL
13860 45 43 54 20 43 41 53 54 20 28 20 4e 55 4c 4c 20  ECT CAST ( NULL 
13870 41 53 20 49 4e 54 45 47 45 52 20 29 20 2b 20 2b  AS INTEGER ) + +
13880 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20   col0 FROM tab0 
13890 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e  AS cor0..----..N
138a0 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d  ULL..NULL..NULL.
138b0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
138c0 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 28 20 2b  rt..SELECT - ( +
138d0 20 63 6f 6c 32 20 29 20 2a 20 63 6f 6c 31 20 46   col2 ) * col1 F
138e0 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d  ROM tab0 cor0..-
138f0 2d 2d 2d 0d 0a 2d 32 38 33 38 0d 0a 2d 37 34 36  ---..-2838..-746
13900 32 0d 0a 2d 39 37 0d 0a 0d 0a 71 75 65 72 79 20  2..-97....query 
13910 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
13920 54 20 2d 20 63 6f 6c 30 20 2a 20 2b 20 38 36 20  T - col0 * + 86 
13930 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32  + col1 FROM tab2
13940 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
13950 2d 35 37 31 0d 0a 2d 36 36 34 39 0d 0a 2d 36 37  -571..-6649..-67
13960 37 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  77....query I ro
13970 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
13980 63 6f 6c 31 20 2a 20 28 20 63 6f 6c 32 20 2b 20  col1 * ( col2 + 
13990 63 6f 6c 32 20 29 20 41 53 20 63 6f 6c 31 20 46  col2 ) AS col1 F
139a0 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
139b0 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32 39 32 0d 0a 2d  ..----..-1292..-
139c0 31 36 37 34 0d 0a 2d 33 30 36 38 0d 0a 0d 0a 71  1674..-3068....q
139d0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
139e0 53 45 4c 45 43 54 20 2b 20 2d 20 63 6f 72 30 2e  SELECT + - cor0.
139f0 63 6f 6c 32 20 2b 20 2b 20 32 34 20 2a 20 2b 20  col2 + + 24 * + 
13a00 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41  col0 FROM tab2 A
13a10 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 34  S cor0..----..14
13a20 31 0d 0a 31 38 34 36 0d 0a 31 38 35 38 0d 0a 0d  1..1846..1858...
13a30 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
13a40 0d 0a 53 45 4c 45 43 54 20 2d 20 2d 20 34 34 20  ..SELECT - - 44 
13a50 2a 20 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46  * col0 AS col2 F
13a60 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
13a70 0d 0a 2d 2d 2d 2d 0d 0a 33 30 38 0d 0a 33 34 33  ..----..308..343
13a80 32 0d 0a 33 34 37 36 0d 0a 0d 0a 71 75 65 72 79  2..3476....query
13a90 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
13aa0 43 54 20 34 37 20 2a 20 2b 20 63 6f 6c 30 20 2b  CT 47 * + col0 +
13ab0 20 38 31 20 2a 20 63 6f 6c 32 20 2a 20 63 6f 72   81 * col2 * cor
13ac0 30 2e 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31  0.col1 FROM tab1
13ad0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
13ae0 31 30 34 38 34 38 0d 0a 31 31 33 38 36 35 0d 0a  104848..113865..
13af0 34 39 31 37 38 0d 0a 0d 0a 71 75 65 72 79 20 49  49178....query I
13b00 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
13b10 20 32 20 2a 20 63 6f 6c 32 20 41 53 20 63 6f 6c   2 * col2 AS col
13b20 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  1 FROM tab2 AS c
13b30 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 35 32 0d 0a 35  or0..----..52..5
13b40 34 0d 0a 37 36 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  4..76....onlyif 
13b50 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20  mysql # use DIV 
13b60 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74  operator for int
13b70 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71  eger division..q
13b80 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
13b90 61 62 65 6c 2d 35 37 38 0d 0a 53 45 4c 45 43 54  abel-578..SELECT
13ba0 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 44 49 56   + cor0.col2 DIV
13bb0 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20   col1 FROM tab0 
13bc0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30  AS cor0..----..0
13bd0 0d 0a 30 0d 0a 30 0d 0a 0d 0a 73 6b 69 70 69 66  ..0..0....skipif
13be0 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
13bf0 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
13c00 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 35   rowsort label-5
13c10 37 38 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 72  78..SELECT + cor
13c20 30 2e 63 6f 6c 32 20 2f 20 63 6f 6c 31 20 46 52  0.col2 / col1 FR
13c30 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
13c40 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a  .----..0..0..0..
13c50 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
13c60 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2d 20 63 6f  t..SELECT - - co
13c70 6c 31 20 2a 20 2d 20 63 6f 6c 30 20 46 52 4f 4d  l1 * - col0 FROM
13c80 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab0 cor0..----
13c90 0d 0a 2d 32 30 36 34 0d 0a 2d 33 33 39 35 0d 0a  ..-2064..-3395..
13ca0 2d 38 30 39 39 0d 0a 0d 0a 71 75 65 72 79 20 49  -8099....query I
13cb0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
13cc0 20 2d 20 63 6f 6c 31 20 2a 20 2d 20 28 20 2d 20   - col1 * - ( - 
13cd0 63 6f 6c 32 20 29 20 46 52 4f 4d 20 74 61 62 32  col2 ) FROM tab2
13ce0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
13cf0 2d 31 35 33 34 0d 0a 2d 36 34 36 0d 0a 2d 38 33  -1534..-646..-83
13d00 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  7....query I row
13d10 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2d  sort..SELECT - -
13d20 20 63 6f 6c 30 20 2b 20 63 6f 72 30 2e 63 6f 6c   col0 + cor0.col
13d30 32 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  2 AS col1 FROM t
13d40 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
13d50 2d 0d 0a 31 30 34 0d 0a 31 31 37 0d 0a 33 34 0d  -..104..117..34.
13d60 0a 0d 0a 71 75 65 72 79 20 49 49 49 49 49 49 49  ...query IIIIIII
13d70 49 49 49 49 49 20 72 6f 77 73 6f 72 74 0d 0a 53  IIIII rowsort..S
13d80 45 4c 45 43 54 20 2a 20 46 52 4f 4d 20 74 61 62  ELECT * FROM tab
13d90 30 2c 20 74 61 62 30 20 41 53 20 63 6f 72 30 2c  0, tab0 AS cor0,
13da0 20 74 61 62 30 20 41 53 20 63 6f 72 31 2c 20 74   tab0 AS cor1, t
13db0 61 62 32 20 63 6f 72 32 0d 0a 2d 2d 2d 2d 0d 0a  ab2 cor2..----..
13dc0 39 37 32 20 76 61 6c 75 65 73 20 68 61 73 68 69  972 values hashi
13dd0 6e 67 20 74 6f 20 36 64 66 62 31 38 66 62 38 34  ng to 6dfb18fb84
13de0 36 66 39 32 32 62 61 39 65 61 36 30 63 65 34 32  6f922ba9ea60ce42
13df0 62 38 36 66 62 30 0d 0a 0d 0a 71 75 65 72 79 20  b86fb0....query 
13e00 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
13e10 54 20 41 4c 4c 20 63 6f 6c 30 20 2a 20 31 34 20  T ALL col0 * 14 
13e20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a  FROM tab1 cor0..
13e30 2d 2d 2d 2d 0d 0a 31 31 32 30 0d 0a 34 32 0d 0a  ----..1120..42..
13e40 38 39 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  896....query I r
13e50 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
13e60 20 2d 20 63 6f 6c 32 20 2a 20 63 6f 6c 31 20 2b   - col2 * col1 +
13e70 20 32 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d   22 AS col2 FROM
13e80 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
13e90 2d 2d 2d 0d 0a 2d 31 35 31 32 0d 0a 2d 36 32 34  ---..-1512..-624
13ea0 0d 0a 2d 38 31 35 0d 0a 0d 0a 71 75 65 72 79 20  ..-815....query 
13eb0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
13ec0 54 20 44 49 53 54 49 4e 43 54 20 38 31 20 2b 20  T DISTINCT 81 + 
13ed0 2b 20 63 6f 6c 32 20 2a 20 2d 20 37 32 20 46 52  + col2 * - 72 FR
13ee0 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  OM tab0..----..-
13ef0 32 32 39 35 0d 0a 2d 35 38 32 33 0d 0a 39 0d 0a  2295..-5823..9..
13f00 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
13f10 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 31  t..SELECT + col1
13f20 20 2a 20 2b 20 74 61 62 32 2e 63 6f 6c 30 20 46   * + tab2.col0 F
13f30 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab2..----..
13f40 31 33 34 33 0d 0a 32 31 37 0d 0a 34 36 30 32 0d  1343..217..4602.
13f50 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
13f60 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
13f70 4e 43 54 20 2b 20 63 6f 6c 32 20 2a 20 2d 20 32  NCT + col2 * - 2
13f80 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d  0 FROM tab0..---
13f90 2d 0d 0a 2d 31 36 34 30 0d 0a 2d 32 30 0d 0a 2d  -..-1640..-20..-
13fa0 36 36 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  660....onlyif my
13fb0 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f  sql # support fo
13fc0 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63  r MySQL specific
13fd0 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e   system types an
13fe0 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20  d syntax..query 
13ff0 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
14000 35 38 38 0d 0a 53 45 4c 45 43 54 20 2d 20 2b 20  588..SELECT - + 
14010 43 41 53 54 28 20 2b 20 39 35 20 41 53 20 53 49  CAST( + 95 AS SI
14020 47 4e 45 44 20 29 20 2b 20 2d 20 63 6f 6c 32 20  GNED ) + - col2 
14030 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
14040 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32 31 0d 0a 2d  0..----..-121..-
14050 31 32 32 0d 0a 2d 31 33 33 0d 0a 0d 0a 73 6b 69  122..-133....ski
14060 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
14070 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
14080 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
14090 6c 2d 35 38 38 0d 0a 53 45 4c 45 43 54 20 2d 20  l-588..SELECT - 
140a0 2b 20 43 41 53 54 20 28 20 2b 20 39 35 20 41 53  + CAST ( + 95 AS
140b0 20 49 4e 54 45 47 45 52 20 29 20 2b 20 2d 20 63   INTEGER ) + - c
140c0 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol2 FROM tab2 AS
140d0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32   cor0..----..-12
140e0 31 0d 0a 2d 31 32 32 0d 0a 2d 31 33 33 0d 0a 0d  1..-122..-133...
140f0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
14100 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 31 20  ..SELECT - col1 
14110 2b 20 2b 20 31 33 20 46 52 4f 4d 20 74 61 62 32  + + 13 FROM tab2
14120 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
14130 2d 31 38 0d 0a 2d 34 0d 0a 2d 34 36 0d 0a 0d 0a  -18..-4..-46....
14140 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75  onlyif mysql # u
14150 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20  se DIV operator 
14160 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69  for integer divi
14170 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f  sion..query I ro
14180 77 73 6f 72 74 20 6c 61 62 65 6c 2d 35 39 30 0d  wsort label-590.
14190 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
141a0 20 63 6f 6c 32 20 44 49 56 20 2d 20 74 61 62 32   col2 DIV - tab2
141b0 2e 63 6f 6c 31 20 2b 20 34 20 44 49 56 20 2d 20  .col1 + 4 DIV - 
141c0 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46 52 4f  col1 AS col2 FRO
141d0 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 32  M tab2..----..-2
141e0 0d 0a 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  ..0....skipif my
141f0 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
14200 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
14210 77 73 6f 72 74 20 6c 61 62 65 6c 2d 35 39 30 0d  wsort label-590.
14220 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
14230 20 63 6f 6c 32 20 2f 20 2d 20 74 61 62 32 2e 63   col2 / - tab2.c
14240 6f 6c 31 20 2b 20 34 20 2f 20 2d 20 63 6f 6c 31  ol1 + 4 / - col1
14250 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
14260 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 0d 0a 30 0d  b2..----..-2..0.
14270 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
14280 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74  # use DIV operat
14290 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64  or for integer d
142a0 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49  ivision..query I
142b0 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 35   rowsort label-5
142c0 39 31 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 32 20  91..SELECT col2 
142d0 44 49 56 20 2d 20 63 6f 6c 32 20 2d 20 2d 20 39  DIV - col2 - - 9
142e0 34 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  4 FROM tab1 AS c
142f0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 33 0d 0a 39  or0..----..93..9
14300 33 0d 0a 39 33 0d 0a 0d 0a 73 6b 69 70 69 66 20  3..93....skipif 
14310 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
14320 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
14330 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 35 39  rowsort label-59
14340 31 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 32 20 2f  1..SELECT col2 /
14350 20 2d 20 63 6f 6c 32 20 2d 20 2d 20 39 34 20 46   - col2 - - 94 F
14360 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
14370 0d 0a 2d 2d 2d 2d 0d 0a 39 33 0d 0a 39 33 0d 0a  ..----..93..93..
14380 39 33 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  93....onlyif mys
14390 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65  ql # use DIV ope
143a0 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65  rator for intege
143b0 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72  r division..quer
143c0 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
143d0 6c 2d 35 39 32 0d 0a 53 45 4c 45 43 54 20 41 4c  l-592..SELECT AL
143e0 4c 20 2b 20 63 6f 6c 30 20 44 49 56 20 2d 20 32  L + col0 DIV - 2
143f0 35 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  5 AS col1 FROM t
14400 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 0d 0a 2d  ab2..----..-3..-
14410 33 0d 0a 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  3..0....skipif m
14420 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
14430 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
14440 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 35 39 32  owsort label-592
14450 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63  ..SELECT ALL + c
14460 6f 6c 30 20 2f 20 2d 20 32 35 20 41 53 20 63 6f  ol0 / - 25 AS co
14470 6c 31 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d  l1 FROM tab2..--
14480 2d 2d 0d 0a 2d 33 0d 0a 2d 33 0d 0a 30 0d 0a 0d  --..-3..-3..0...
14490 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
144a0 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 32 20  ..SELECT - col2 
144b0 2a 20 2d 20 28 20 2d 20 28 20 2b 20 63 6f 6c 31  * - ( - ( + col1
144c0 20 29 20 2b 20 2b 20 63 6f 6c 30 20 29 20 41 53   ) + + col0 ) AS
144d0 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d   col0 FROM tab0.
144e0 0a 2d 2d 2d 2d 0d 0a 2d 31 36 34 0d 0a 2d 32 30  .----..-164..-20
144f0 34 36 0d 0a 2d 36 32 0d 0a 0d 0a 71 75 65 72 79  46..-62....query
14500 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
14510 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 32 20 2a 20  CT ALL + col2 * 
14520 28 20 2b 20 63 6f 6c 30 20 29 20 2a 20 63 6f 6c  ( + col0 ) * col
14530 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  1 FROM tab1 AS c
14540 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 36 34 38 30  or0..----..36480
14550 0d 0a 34 32 31 32 0d 0a 39 39 38 34 30 0d 0a 0d  ..4212..99840...
14560 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
14570 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72  use DIV operator
14580 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76   for integer div
14590 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72  ision..query I r
145a0 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 35 39 35  owsort label-595
145b0 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c  ..SELECT ALL col
145c0 32 20 44 49 56 20 2b 20 63 6f 6c 31 20 41 53 20  2 DIV + col1 AS 
145d0 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41  col0 FROM tab2 A
145e0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d  S cor0..----..0.
145f0 0a 30 0d 0a 32 0d 0a 0d 0a 73 6b 69 70 69 66 20  .0..2....skipif 
14600 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
14610 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
14620 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 35 39  rowsort label-59
14630 35 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f  5..SELECT ALL co
14640 6c 32 20 2f 20 2b 20 63 6f 6c 31 20 41 53 20 63  l2 / + col1 AS c
14650 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol0 FROM tab2 AS
14660 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a   cor0..----..0..
14670 30 0d 0a 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20  0..2....query I 
14680 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
14690 41 4c 4c 20 2b 20 2d 20 63 6f 72 30 2e 63 6f 6c  ALL + - cor0.col
146a0 30 20 46 52 4f 4d 20 74 61 62 32 2c 20 74 61 62  0 FROM tab2, tab
146b0 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
146c0 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e  .9 values hashin
146d0 67 20 74 6f 20 33 30 30 30 33 33 37 64 64 33 66  g to 3000337dd3f
146e0 31 31 65 39 63 66 64 35 61 33 31 32 62 30 31 65  11e9cfd5a312b01e
146f0 66 33 66 38 62 0d 0a 0d 0a 71 75 65 72 79 20 49  f3f8b....query I
14700 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
14710 20 41 4c 4c 20 2d 20 38 33 20 46 52 4f 4d 20 74   ALL - 83 FROM t
14720 61 62 30 2c 20 74 61 62 31 20 41 53 20 63 6f 72  ab0, tab1 AS cor
14730 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65  0..----..9 value
14740 73 20 68 61 73 68 69 6e 67 20 74 6f 20 64 35 35  s hashing to d55
14750 37 34 38 66 33 39 66 34 30 33 65 63 32 37 33 30  748f39f403ec2730
14760 39 39 63 30 64 38 37 62 30 62 66 62 62 0d 0a 0d  99c0d87b0bfbb...
14770 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
14780 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51  support for MySQ
14790 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65  L specific syste
147a0 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74  m types and synt
147b0 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ax..query I rows
147c0 6f 72 74 20 6c 61 62 65 6c 2d 35 39 38 0d 0a 53  ort label-598..S
147d0 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 43  ELECT DISTINCT C
147e0 41 53 54 28 20 63 6f 6c 31 20 41 53 20 53 49 47  AST( col1 AS SIG
147f0 4e 45 44 20 29 20 41 53 20 63 6f 6c 31 20 46 52  NED ) AS col1 FR
14800 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d  OM tab2 cor0..--
14810 2d 2d 0d 0a 31 37 0d 0a 33 31 0d 0a 35 39 0d 0a  --..17..31..59..
14820 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
14830 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
14840 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
14850 20 6c 61 62 65 6c 2d 35 39 38 0d 0a 53 45 4c 45   label-598..SELE
14860 43 54 20 44 49 53 54 49 4e 43 54 20 43 41 53 54  CT DISTINCT CAST
14870 20 28 20 63 6f 6c 31 20 41 53 20 49 4e 54 45 47   ( col1 AS INTEG
14880 45 52 20 29 20 41 53 20 63 6f 6c 31 20 46 52 4f  ER ) AS col1 FRO
14890 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab2 cor0..---
148a0 2d 0d 0a 31 37 0d 0a 33 31 0d 0a 35 39 0d 0a 0d  -..17..31..59...
148b0 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
148c0 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72  use DIV operator
148d0 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76   for integer div
148e0 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72  ision..query I r
148f0 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 35 39 39  owsort label-599
14900 0d 0a 53 45 4c 45 43 54 20 2d 20 2b 20 38 34 20  ..SELECT - + 84 
14910 44 49 56 20 36 20 46 52 4f 4d 20 74 61 62 31 20  DIV 6 FROM tab1 
14920 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
14930 31 34 0d 0a 2d 31 34 0d 0a 2d 31 34 0d 0a 0d 0a  14..-14..-14....
14940 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
14950 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
14960 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
14970 61 62 65 6c 2d 35 39 39 0d 0a 53 45 4c 45 43 54  abel-599..SELECT
14980 20 2d 20 2b 20 38 34 20 2f 20 36 20 46 52 4f 4d   - + 84 / 6 FROM
14990 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
149a0 2d 2d 2d 0d 0a 2d 31 34 0d 0a 2d 31 34 0d 0a 2d  ---..-14..-14..-
149b0 31 34 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73  14....skipif pos
149c0 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72  tgresql # Postgr
149d0 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53  eSQL requires AS
149e0 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f   when renaming o
149f0 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71  utput columns..q
14a00 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
14a10 53 45 4c 45 43 54 20 63 6f 6c 30 20 2a 20 2d 20  SELECT col0 * - 
14a20 63 6f 6c 32 20 2d 20 63 6f 6c 31 20 63 6f 6c 32  col2 - col1 col2
14a30 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d   FROM tab0..----
14a40 0d 0a 2d 31 33 32 0d 0a 2d 37 33 38 39 0d 0a 2d  ..-132..-7389..-
14a50 38 37 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  878....query I r
14a60 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
14a70 4c 4c 20 28 20 63 6f 6c 31 20 29 20 2b 20 2b 20  LL ( col1 ) + + 
14a80 74 61 62 31 2e 63 6f 6c 31 20 2a 20 2d 20 63 6f  tab1.col1 * - co
14a90 6c 32 20 2b 20 63 6f 6c 31 20 2a 20 63 6f 6c 30  l2 + col1 * col0
14aa0 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d   FROM tab1..----
14ab0 0d 0a 2d 31 33 30 30 0d 0a 2d 31 39 35 0d 0a 38  ..-1300..-195..8
14ac0 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  0....query I row
14ad0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2b  sort..SELECT + +
14ae0 20 34 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d   40 AS col1 FROM
14af0 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
14b00 2d 2d 2d 0d 0a 34 30 0d 0a 34 30 0d 0a 34 30 0d  ---..40..40..40.
14b10 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
14b20 72 74 0d 0a 53 45 4c 45 43 54 20 34 35 20 2a 20  rt..SELECT 45 * 
14b30 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41  col0 FROM tab0 A
14b40 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30  S cor0..----..10
14b50 38 30 0d 0a 31 35 37 35 0d 0a 34 30 30 35 0d 0a  80..1575..4005..
14b60 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
14b70 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
14b80 43 54 20 2b 20 31 39 20 2b 20 63 6f 6c 31 20 46  CT + 19 + col1 F
14b90 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab0..----..
14ba0 31 30 35 0d 0a 31 31 30 0d 0a 31 31 36 0d 0a 0d  105..110..116...
14bb0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
14bc0 0d 0a 53 45 4c 45 43 54 20 2b 20 36 39 20 2a 20  ..SELECT + 69 * 
14bd0 63 6f 6c 31 20 2b 20 2b 20 63 6f 6c 30 20 46 52  col1 + + col0 FR
14be0 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 35  OM tab0..----..5
14bf0 39 35 38 0d 0a 36 33 36 38 0d 0a 36 37 32 38 0d  958..6368..6728.
14c00 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
14c10 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
14c20 4e 43 54 20 37 36 20 41 53 20 63 6f 6c 32 20 46  NCT 76 AS col2 F
14c30 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab2..----..
14c40 37 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  76....query I ro
14c50 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
14c60 4c 20 2b 20 63 6f 72 31 2e 63 6f 6c 31 20 2a 20  L + cor1.col1 * 
14c70 63 6f 72 30 2e 63 6f 6c 31 20 41 53 20 63 6f 6c  cor0.col1 AS col
14c80 30 20 46 52 4f 4d 20 74 61 62 32 2c 20 74 61 62  0 FROM tab2, tab
14c90 31 20 63 6f 72 30 2c 20 74 61 62 31 20 41 53 20  1 cor0, tab1 AS 
14ca0 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76  cor1..----..27 v
14cb0 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f  alues hashing to
14cc0 20 66 31 65 63 63 65 30 32 62 35 36 36 34 33 64   f1ecce02b56643d
14cd0 30 31 31 66 31 30 65 62 39 31 32 61 61 38 61 39  011f10eb912aa8a9
14ce0 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  0....query I row
14cf0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 33  sort..SELECT + 3
14d00 32 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  2 AS col0 FROM t
14d10 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 33 32 0d 0a 33  ab0..----..32..3
14d20 32 0d 0a 33 32 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  2..32....onlyif 
14d30 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20  mysql # use DIV 
14d40 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74  operator for int
14d50 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71  eger division..q
14d60 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
14d70 61 62 65 6c 2d 36 30 39 0d 0a 53 45 4c 45 43 54  abel-609..SELECT
14d80 20 44 49 53 54 49 4e 43 54 20 2d 20 74 61 62 30   DISTINCT - tab0
14d90 2e 63 6f 6c 31 20 44 49 56 20 28 20 74 61 62 30  .col1 DIV ( tab0
14da0 2e 63 6f 6c 31 20 29 20 41 53 20 63 6f 6c 31 20  .col1 ) AS col1 
14db0 46 52 4f 4d 20 74 61 62 30 2c 20 74 61 62 30 20  FROM tab0, tab0 
14dc0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a  cor0..----..-1..
14dd0 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
14de0 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
14df0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
14e00 20 6c 61 62 65 6c 2d 36 30 39 0d 0a 53 45 4c 45   label-609..SELE
14e10 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 74 61  CT DISTINCT - ta
14e20 62 30 2e 63 6f 6c 31 20 2f 20 28 20 74 61 62 30  b0.col1 / ( tab0
14e30 2e 63 6f 6c 31 20 29 20 41 53 20 63 6f 6c 31 20  .col1 ) AS col1 
14e40 46 52 4f 4d 20 74 61 62 30 2c 20 74 61 62 30 20  FROM tab0, tab0 
14e50 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a  cor0..----..-1..
14e60 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
14e70 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
14e80 43 54 20 2d 20 33 39 20 41 53 20 63 6f 6c 32 20  CT - 39 AS col2 
14e90 46 52 4f 4d 20 74 61 62 32 2c 20 74 61 62 31 20  FROM tab2, tab1 
14ea0 41 53 20 63 6f 72 30 2c 20 74 61 62 31 20 41 53  AS cor0, tab1 AS
14eb0 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 39   cor1..----..-39
14ec0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
14ed0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2b 20  ort..SELECT - + 
14ee0 63 6f 72 30 2e 63 6f 6c 30 20 2a 20 2b 20 63 6f  cor0.col0 * + co
14ef0 72 30 2e 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20  r0.col0 AS col0 
14f00 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
14f10 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 30 39 36 0d 0a  0..----..-4096..
14f20 2d 36 34 30 30 0d 0a 2d 39 0d 0a 0d 0a 71 75 65  -6400..-9....que
14f30 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
14f40 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 33 37  LECT DISTINCT 37
14f50 20 2a 20 2b 20 63 6f 6c 32 20 41 53 20 63 6f 6c   * + col2 AS col
14f60 31 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d  1 FROM tab2..---
14f70 2d 0d 0a 31 34 30 36 0d 0a 39 36 32 0d 0a 39 39  -..1406..962..99
14f80 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  9....query I row
14f90 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63  sort..SELECT - c
14fa0 6f 6c 32 20 2d 20 31 39 20 2a 20 63 6f 72 30 2e  ol2 - 19 * cor0.
14fb0 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41  col2 FROM tab1 A
14fc0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
14fd0 30 38 30 0d 0a 2d 31 31 34 30 0d 0a 2d 31 39 32  080..-1140..-192
14fe0 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  0....query I row
14ff0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2b  sort..SELECT - +
15000 20 63 6f 6c 30 20 2b 20 28 20 63 6f 6c 32 20 29   col0 + ( col2 )
15010 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
15020 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 34 0d 0a 2d  r0..----..-34..-
15030 37 0d 0a 39 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  7..9....onlyif m
15040 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66  ysql # support f
15050 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69  or MySQL specifi
15060 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61  c system types a
15070 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79  nd syntax..query
15080 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
15090 2d 36 31 35 0d 0a 53 45 4c 45 43 54 20 63 6f 72  -615..SELECT cor
150a0 30 2e 63 6f 6c 32 20 2a 20 2b 20 43 41 53 54 28  0.col2 * + CAST(
150b0 20 4e 55 4c 4c 20 41 53 20 53 49 47 4e 45 44 20   NULL AS SIGNED 
150c0 29 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  ) AS col0 FROM t
150d0 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
150e0 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e  -..NULL..NULL..N
150f0 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  ULL....skipif my
15100 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
15110 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
15120 77 73 6f 72 74 20 6c 61 62 65 6c 2d 36 31 35 0d  wsort label-615.
15130 0a 53 45 4c 45 43 54 20 63 6f 72 30 2e 63 6f 6c  .SELECT cor0.col
15140 32 20 2a 20 2b 20 43 41 53 54 20 28 20 4e 55 4c  2 * + CAST ( NUL
15150 4c 20 41 53 20 49 4e 54 45 47 45 52 20 29 20 41  L AS INTEGER ) A
15160 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30  S col0 FROM tab0
15170 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
15180 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c  NULL..NULL..NULL
15190 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
151a0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f  ort..SELECT - co
151b0 72 30 2e 63 6f 6c 31 20 2a 20 39 37 20 46 52 4f  r0.col1 * 97 FRO
151c0 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
151d0 2d 2d 2d 2d 0d 0a 2d 31 32 36 31 0d 0a 2d 32 35  ----..-1261..-25
151e0 32 32 0d 0a 2d 39 37 30 0d 0a 0d 0a 71 75 65 72  22..-970....quer
151f0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
15200 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63  ECT DISTINCT + c
15210 6f 6c 32 20 2a 20 63 6f 6c 30 20 2b 20 2d 20 63  ol2 * col0 + - c
15220 6f 6c 30 20 2a 20 63 6f 6c 32 20 46 52 4f 4d 20  ol0 * col2 FROM 
15230 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
15240 2d 2d 0d 0a 30 0d 0a 0d 0a 71 75 65 72 79 20 49  --..0....query I
15250 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
15260 20 2b 20 63 6f 6c 32 20 2a 20 2b 20 63 6f 72 30   + col2 * + cor0
15270 2e 63 6f 6c 31 20 2b 20 2d 20 63 6f 6c 30 20 46  .col1 + - col0 F
15280 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
15290 0d 0a 2d 2d 2d 2d 0d 0a 31 31 36 38 0d 0a 31 34  ..----..1168..14
152a0 30 31 0d 0a 35 30 36 0d 0a 0d 0a 71 75 65 72 79  01..506....query
152b0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
152c0 43 54 20 2b 20 63 6f 6c 31 20 2b 20 2b 20 37 31  CT + col1 + + 71
152d0 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
152e0 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 30 32 0d 0a 31  b2..----..102..1
152f0 33 30 0d 0a 38 38 0d 0a 0d 0a 71 75 65 72 79 20  30..88....query 
15300 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
15310 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c  T DISTINCT + col
15320 31 20 2a 20 32 30 20 46 52 4f 4d 20 74 61 62 31  1 * 20 FROM tab1
15330 0d 0a 2d 2d 2d 2d 0d 0a 32 30 30 0d 0a 32 36 30  ..----..200..260
15340 0d 0a 35 32 30 0d 0a 0d 0a 71 75 65 72 79 20 49  ..520....query I
15350 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
15360 20 2d 20 33 30 20 2a 20 63 6f 72 30 2e 63 6f 6c   - 30 * cor0.col
15370 32 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30  2 FROM tab0 cor0
15380 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 34 36 30 0d 0a 2d  ..----..-2460..-
15390 33 30 0d 0a 2d 39 39 30 0d 0a 0d 0a 71 75 65 72  30..-990....quer
153a0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
153b0 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 2b  ECT DISTINCT + +
153c0 20 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c 31 20 2a   col2 * + col1 *
153d0 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20   + col0 AS col0 
153e0 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
153f0 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 39 36 35 32 0d  0..----..119652.
15400 0a 35 31 30 33 34 0d 0a 35 38 35 39 0d 0a 0d 0a  .51034..5859....
15410 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
15420 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 28 20  .SELECT ALL - ( 
15430 36 35 20 29 20 41 53 20 63 6f 6c 32 20 46 52 4f  65 ) AS col2 FRO
15440 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 36  M tab1..----..-6
15450 35 0d 0a 2d 36 35 0d 0a 2d 36 35 0d 0a 0d 0a 71  5..-65..-65....q
15460 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
15470 53 45 4c 45 43 54 20 2d 20 36 37 20 2d 20 2d 20  SELECT - 67 - - 
15480 74 61 62 32 2e 63 6f 6c 30 20 46 52 4f 4d 20 74  tab2.col0 FROM t
15490 61 62 32 2c 20 74 61 62 30 20 41 53 20 63 6f 72  ab2, tab0 AS cor
154a0 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65  0..----..9 value
154b0 73 20 68 61 73 68 69 6e 67 20 74 6f 20 30 35 30  s hashing to 050
154c0 66 61 63 62 32 61 63 32 31 63 36 39 34 62 39 63  facb2ac21c694b9c
154d0 36 61 35 35 39 39 32 37 65 36 61 37 65 0d 0a 0d  6a559927e6a7e...
154e0 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
154f0 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51  support for MySQ
15500 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65  L specific syste
15510 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74  m types and synt
15520 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ax..query I rows
15530 6f 72 74 20 6c 61 62 65 6c 2d 36 32 35 0d 0a 53  ort label-625..S
15540 45 4c 45 43 54 20 2b 20 43 41 53 54 28 20 2b 20  ELECT + CAST( + 
15550 31 37 20 41 53 20 53 49 47 4e 45 44 20 29 20 63  17 AS SIGNED ) c
15560 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d  ol0 FROM tab0..-
15570 2d 2d 2d 0d 0a 31 37 0d 0a 31 37 0d 0a 31 37 0d  ---..17..17..17.
15580 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72  ...skipif postgr
15590 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51  esql # PostgreSQ
155a0 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68  L requires AS wh
155b0 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70  en renaming outp
155c0 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 73 6b 69 70  ut columns..skip
155d0 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
155e0 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
155f0 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
15600 2d 36 32 35 0d 0a 53 45 4c 45 43 54 20 2b 20 43  -625..SELECT + C
15610 41 53 54 20 28 20 2b 20 31 37 20 41 53 20 49 4e  AST ( + 17 AS IN
15620 54 45 47 45 52 20 29 20 63 6f 6c 30 20 46 52 4f  TEGER ) col0 FRO
15630 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 37  M tab0..----..17
15640 0d 0a 31 37 0d 0a 31 37 0d 0a 0d 0a 71 75 65 72  ..17..17....quer
15650 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
15660 45 43 54 20 2b 20 2d 20 37 33 20 46 52 4f 4d 20  ECT + - 73 FROM 
15670 74 61 62 31 2c 20 74 61 62 30 2c 20 74 61 62 32  tab1, tab0, tab2
15680 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
15690 32 37 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e  27 values hashin
156a0 67 20 74 6f 20 32 39 33 31 34 37 34 62 38 37 30  g to 2931474b870
156b0 63 30 35 36 39 34 65 34 34 36 37 37 31 30 33 31  c05694e446771031
156c0 61 36 39 34 39 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  a6949....onlyif 
156d0 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20  mysql # use DIV 
156e0 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74  operator for int
156f0 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71  eger division..q
15700 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
15710 61 62 65 6c 2d 36 32 37 0d 0a 53 45 4c 45 43 54  abel-627..SELECT
15720 20 63 6f 6c 32 20 44 49 56 20 2d 20 63 6f 72 30   col2 DIV - cor0
15730 2e 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46 52  .col2 AS col2 FR
15740 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d  OM tab0 cor0..--
15750 2d 2d 0d 0a 2d 31 0d 0a 2d 31 0d 0a 2d 31 0d 0a  --..-1..-1..-1..
15760 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
15770 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
15780 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
15790 20 6c 61 62 65 6c 2d 36 32 37 0d 0a 53 45 4c 45   label-627..SELE
157a0 43 54 20 63 6f 6c 32 20 2f 20 2d 20 63 6f 72 30  CT col2 / - cor0
157b0 2e 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46 52  .col2 AS col2 FR
157c0 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d  OM tab0 cor0..--
157d0 2d 2d 0d 0a 2d 31 0d 0a 2d 31 0d 0a 2d 31 0d 0a  --..-1..-1..-1..
157e0 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
157f0 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f   use DIV operato
15800 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69  r for integer di
15810 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20  vision..query I 
15820 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 36 32  rowsort label-62
15830 38 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  8..SELECT DISTIN
15840 43 54 20 2d 20 63 6f 72 30 2e 63 6f 6c 31 20 44  CT - cor0.col1 D
15850 49 56 20 63 6f 6c 31 20 2d 20 2b 20 63 6f 6c 31  IV col1 - + col1
15860 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
15870 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
15880 0d 0a 2d 38 37 0d 0a 2d 39 32 0d 0a 2d 39 38 0d  ..-87..-92..-98.
15890 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
158a0 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
158b0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
158c0 74 20 6c 61 62 65 6c 2d 36 32 38 0d 0a 53 45 4c  t label-628..SEL
158d0 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63  ECT DISTINCT - c
158e0 6f 72 30 2e 63 6f 6c 31 20 2f 20 63 6f 6c 31 20  or0.col1 / col1 
158f0 2d 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c 30  - + col1 AS col0
15900 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
15910 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 38 37 0d 0a 2d  r0..----..-87..-
15920 39 32 0d 0a 2d 39 38 0d 0a 0d 0a 71 75 65 72 79  92..-98....query
15930 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
15940 43 54 20 44 49 53 54 49 4e 43 54 20 39 32 20 2b  CT DISTINCT 92 +
15950 20 2b 20 63 6f 6c 31 20 2a 20 34 38 20 46 52 4f   + col1 * 48 FRO
15960 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab0 cor0..---
15970 2d 0d 0a 34 32 32 30 0d 0a 34 34 36 30 0d 0a 34  -..4220..4460..4
15980 37 34 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  748....query I r
15990 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
159a0 4c 4c 20 2b 20 63 6f 6c 31 20 2d 20 2b 20 63 6f  LL + col1 - + co
159b0 6c 31 20 2a 20 2d 20 35 32 20 41 53 20 63 6f 6c  l1 * - 52 AS col
159c0 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  0 FROM tab1 AS c
159d0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33 37 38 0d  or0..----..1378.
159e0 0a 35 33 30 0d 0a 36 38 39 0d 0a 0d 0a 71 75 65  .530..689....que
159f0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
15a00 4c 45 43 54 20 2d 20 28 20 63 6f 6c 31 20 29 20  LECT - ( col1 ) 
15a10 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30  + col0 FROM tab0
15a20 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
15a30 2d 32 0d 0a 2d 36 32 0d 0a 2d 36 32 0d 0a 0d 0a  -2..-62..-62....
15a40 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
15a50 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
15a60 20 2d 20 63 6f 6c 31 20 2a 20 63 6f 6c 30 20 2a   - col1 * col0 *
15a70 20 35 38 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d   58 FROM tab2..-
15a80 2d 2d 2d 0d 0a 2d 31 32 35 38 36 0d 0a 2d 32 36  ---..-12586..-26
15a90 36 39 31 36 0d 0a 2d 37 37 38 39 34 0d 0a 0d 0a  6916..-77894....
15aa0 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
15ab0 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
15ac0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
15ad0 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 2b 20 43  SELECT ALL + + C
15ae0 41 53 54 20 28 20 2b 20 63 6f 72 31 2e 63 6f 6c  AST ( + cor1.col
15af0 30 20 41 53 20 52 45 41 4c 20 29 20 46 52 4f 4d  0 AS REAL ) FROM
15b00 20 74 61 62 32 20 41 53 20 63 6f 72 30 20 43 52   tab2 AS cor0 CR
15b10 4f 53 53 20 4a 4f 49 4e 20 74 61 62 32 20 41 53  OSS JOIN tab2 AS
15b20 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76   cor1..----..9 v
15b30 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f  alues hashing to
15b40 20 39 35 62 39 36 63 61 31 64 62 65 32 65 33 39   95b96ca1dbe2e39
15b50 61 30 66 61 37 38 66 35 30 64 33 37 34 66 35 31  a0fa78f50d374f51
15b60 61 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  a....query I row
15b70 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
15b80 20 2b 20 2b 20 63 6f 6c 30 20 2a 20 2b 20 63 6f   + + col0 * + co
15b90 6c 30 20 2a 20 33 20 46 52 4f 4d 20 74 61 62 30  l0 * 3 FROM tab0
15ba0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
15bb0 31 37 32 38 0d 0a 32 33 37 36 33 0d 0a 33 36 37  1728..23763..367
15bc0 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  5....query I row
15bd0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
15be0 20 2d 20 2b 20 63 6f 6c 32 20 2a 20 2b 20 63 6f   - + col2 * + co
15bf0 6c 32 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  l2 AS col1 FROM 
15c00 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab2 cor0..----.
15c10 0a 2d 31 34 34 34 0d 0a 2d 36 37 36 0d 0a 2d 37  .-1444..-676..-7
15c20 32 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  29....query I ro
15c30 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f  wsort..SELECT co
15c40 6c 30 20 2a 20 2d 20 63 6f 6c 32 20 2b 20 63 6f  l0 * - col2 + co
15c50 6c 31 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  l1 AS col2 FROM 
15c60 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab0 cor0..----.
15c70 0a 2d 37 30 36 0d 0a 2d 37 32 30 37 0d 0a 36 32  .-706..-7207..62
15c80 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67  ....skipif postg
15c90 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53  resql # PostgreS
15ca0 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77  QL requires AS w
15cb0 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74  hen renaming out
15cc0 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65  put columns..que
15cd0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
15ce0 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20  LECT DISTINCT + 
15cf0 2b 20 63 6f 6c 31 20 2a 20 2d 20 63 6f 72 30 2e  + col1 * - cor0.
15d00 63 6f 6c 32 20 63 6f 6c 31 20 46 52 4f 4d 20 74  col2 col1 FROM t
15d10 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
15d20 2d 0d 0a 2d 31 32 34 38 0d 0a 2d 31 34 30 34 0d  -..-1248..-1404.
15d30 0a 2d 35 37 30 0d 0a 0d 0a 71 75 65 72 79 20 49  .-570....query I
15d40 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
15d50 20 41 4c 4c 20 2d 20 2d 20 63 6f 6c 30 20 2a 20   ALL - - col0 * 
15d60 2d 20 63 6f 72 30 2e 63 6f 6c 30 20 2d 20 39 33  - cor0.col0 - 93
15d70 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
15d80 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
15d90 0d 0a 2d 31 33 31 38 0d 0a 2d 36 36 39 0d 0a 2d  ..-1318..-669..-
15da0 38 30 31 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20  8014....query I 
15db0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
15dc0 41 4c 4c 20 2b 20 63 6f 6c 30 20 2b 20 2b 20 63  ALL + col0 + + c
15dd0 6f 6c 32 20 2a 20 2b 20 38 36 20 2b 20 2b 20 33  ol2 * + 86 + + 3
15de0 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  0 AS col1 FROM t
15df0 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
15e00 2d 0d 0a 31 35 31 0d 0a 32 38 39 32 0d 0a 37 31  -..151..2892..71
15e10 37 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  71....query I ro
15e20 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
15e30 53 54 49 4e 43 54 20 2b 20 63 6f 6c 32 20 2b 20  STINCT + col2 + 
15e40 63 6f 72 30 2e 63 6f 6c 32 20 2a 20 34 33 20 41  cor0.col2 * 43 A
15e50 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32  S col0 FROM tab2
15e60 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
15e70 31 31 34 34 0d 0a 31 31 38 38 0d 0a 31 36 37 32  1144..1188..1672
15e80 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
15e90 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2b 20  ort..SELECT + + 
15ea0 33 36 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  36 FROM tab0 AS 
15eb0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 36 0d 0a  cor0..----..36..
15ec0 33 36 0d 0a 33 36 0d 0a 0d 0a 71 75 65 72 79 20  36..36....query 
15ed0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
15ee0 54 20 44 49 53 54 49 4e 43 54 20 28 20 63 6f 72  T DISTINCT ( cor
15ef0 30 2e 63 6f 6c 32 20 29 20 2a 20 2d 20 63 6f 6c  0.col2 ) * - col
15f00 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  0 AS col2 FROM t
15f10 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
15f20 2d 0d 0a 2d 31 36 32 0d 0a 2d 33 36 34 38 0d 0a  -..-162..-3648..
15f30 2d 37 36 38 30 0d 0a 0d 0a 71 75 65 72 79 20 49  -7680....query I
15f40 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
15f50 20 41 4c 4c 20 2d 20 63 6f 6c 32 20 2d 20 63 6f   ALL - col2 - co
15f60 6c 30 20 2a 20 2d 20 33 20 46 52 4f 4d 20 74 61  l0 * - 3 FROM ta
15f70 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
15f80 0d 0a 31 30 34 0d 0a 31 38 35 0d 0a 33 39 0d 0a  ..104..185..39..
15f90 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
15fa0 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f   use DIV operato
15fb0 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69  r for integer di
15fc0 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20  vision..query I 
15fd0 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 36 34  rowsort label-64
15fe0 34 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 31 20 44  4..SELECT col1 D
15ff0 49 56 20 35 32 20 46 52 4f 4d 20 74 61 62 32 20  IV 52 FROM tab2 
16000 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30  AS cor0..----..0
16010 0d 0a 30 0d 0a 31 0d 0a 0d 0a 73 6b 69 70 69 66  ..0..1....skipif
16020 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
16030 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
16040 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 36   rowsort label-6
16050 34 34 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 31 20  44..SELECT col1 
16060 2f 20 35 32 20 46 52 4f 4d 20 74 61 62 32 20 41  / 52 FROM tab2 A
16070 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d  S cor0..----..0.
16080 0a 30 0d 0a 31 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  .0..1....onlyif 
16090 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20  mysql # use DIV 
160a0 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74  operator for int
160b0 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71  eger division..q
160c0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
160d0 61 62 65 6c 2d 36 34 35 0d 0a 53 45 4c 45 43 54  abel-645..SELECT
160e0 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 2b 20 2d   + cor0.col2 + -
160f0 20 33 20 44 49 56 20 2b 20 31 37 20 41 53 20 63   3 DIV + 17 AS c
16100 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol1 FROM tab2 AS
16110 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 36 0d   cor0..----..26.
16120 0a 32 37 0d 0a 33 38 0d 0a 0d 0a 73 6b 69 70 69  .27..38....skipi
16130 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
16140 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
16150 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
16160 36 34 35 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f  645..SELECT + co
16170 72 30 2e 63 6f 6c 32 20 2b 20 2d 20 33 20 2f 20  r0.col2 + - 3 / 
16180 2b 20 31 37 20 41 53 20 63 6f 6c 31 20 46 52 4f  + 17 AS col1 FRO
16190 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
161a0 2d 2d 2d 2d 0d 0a 32 36 0d 0a 32 37 0d 0a 33 38  ----..26..27..38
161b0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
161c0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
161d0 49 4e 43 54 20 63 6f 72 30 2e 63 6f 6c 30 20 2b  INCT cor0.col0 +
161e0 20 2b 20 38 34 20 2b 20 2b 20 63 6f 6c 31 20 46   + 84 + + col1 F
161f0 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
16200 0d 0a 2d 2d 2d 2d 0d 0a 31 32 32 0d 0a 31 38 30  ..----..122..180
16210 0d 0a 32 32 31 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  ..221....onlyif 
16220 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20  mysql # use DIV 
16230 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74  operator for int
16240 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71  eger division..q
16250 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
16260 61 62 65 6c 2d 36 34 37 0d 0a 53 45 4c 45 43 54  abel-647..SELECT
16270 20 44 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c 32   DISTINCT + col2
16280 20 44 49 56 20 2d 20 28 20 2b 20 28 20 2b 20 63   DIV - ( + ( + c
16290 6f 6c 31 20 29 20 29 20 2b 20 63 6f 6c 32 20 41  ol1 ) ) + col2 A
162a0 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31  S col1 FROM tab1
162b0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
162c0 35 32 0d 0a 38 39 0d 0a 0d 0a 73 6b 69 70 69 66  52..89....skipif
162d0 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
162e0 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
162f0 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 36   rowsort label-6
16300 34 37 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  47..SELECT DISTI
16310 4e 43 54 20 2b 20 63 6f 6c 32 20 2f 20 2d 20 28  NCT + col2 / - (
16320 20 2b 20 28 20 2b 20 63 6f 6c 31 20 29 20 29 20   + ( + col1 ) ) 
16330 2b 20 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46  + col2 AS col1 F
16340 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
16350 0d 0a 2d 2d 2d 2d 0d 0a 35 32 0d 0a 38 39 0d 0a  ..----..52..89..
16360 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
16370 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53   support for MyS
16380 51 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74  QL specific syst
16390 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e  em types and syn
163a0 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  tax..query I row
163b0 73 6f 72 74 20 6c 61 62 65 6c 2d 36 34 38 0d 0a  sort label-648..
163c0 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 32 20  SELECT ALL col2 
163d0 2a 20 28 20 2d 20 63 6f 6c 32 20 2a 20 2d 20 63  * ( - col2 * - c
163e0 6f 6c 30 20 29 20 2b 20 43 41 53 54 28 20 63 6f  ol0 ) + CAST( co
163f0 6c 30 20 2b 20 2d 20 63 6f 6c 32 20 41 53 20 53  l0 + - col2 AS S
16400 49 47 4e 45 44 20 29 20 46 52 4f 4d 20 74 61 62  IGNED ) FROM tab
16410 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
16420 0a 32 30 37 39 34 33 0d 0a 37 33 37 32 36 34 0d  .207943..737264.
16430 0a 38 36 39 37 0d 0a 0d 0a 73 6b 69 70 69 66 20  .8697....skipif 
16440 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
16450 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
16460 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 36 34  rowsort label-64
16470 38 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f  8..SELECT ALL co
16480 6c 32 20 2a 20 28 20 2d 20 63 6f 6c 32 20 2a 20  l2 * ( - col2 * 
16490 2d 20 63 6f 6c 30 20 29 20 2b 20 43 41 53 54 20  - col0 ) + CAST 
164a0 28 20 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c 32 20  ( col0 + - col2 
164b0 41 53 20 49 4e 54 45 47 45 52 20 29 20 46 52 4f  AS INTEGER ) FRO
164c0 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
164d0 2d 2d 2d 2d 0d 0a 32 30 37 39 34 33 0d 0a 37 33  ----..207943..73
164e0 37 32 36 34 0d 0a 38 36 39 37 0d 0a 0d 0a 71 75  7264..8697....qu
164f0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
16500 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 31 20 2a  ELECT ALL col1 *
16510 20 63 6f 72 30 2e 63 6f 6c 30 20 2b 20 31 34 20   cor0.col0 + 14 
16520 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
16530 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
16540 0a 31 30 35 34 0d 0a 36 35 34 0d 0a 39 32 0d 0a  .1054..654..92..
16550 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
16560 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2b 20 63 6f  t..SELECT + + co
16570 6c 32 20 2b 20 36 39 20 46 52 4f 4d 20 74 61 62  l2 + 69 FROM tab
16580 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
16590 0a 31 32 33 0d 0a 31 32 36 0d 0a 31 36 35 0d 0a  .123..126..165..
165a0 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
165b0 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f   use DIV operato
165c0 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69  r for integer di
165d0 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20  vision..query I 
165e0 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 36 35  rowsort label-65
165f0 31 0d 0a 53 45 4c 45 43 54 20 2b 20 2d 20 63 6f  1..SELECT + - co
16600 6c 30 20 44 49 56 20 2b 20 28 20 2d 20 63 6f 72  l0 DIV + ( - cor
16610 30 2e 63 6f 6c 30 20 29 20 46 52 4f 4d 20 74 61  0.col0 ) FROM ta
16620 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
16630 0d 0a 31 0d 0a 31 0d 0a 31 0d 0a 0d 0a 73 6b 69  ..1..1..1....ski
16640 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
16650 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
16660 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
16670 6c 2d 36 35 31 0d 0a 53 45 4c 45 43 54 20 2b 20  l-651..SELECT + 
16680 2d 20 63 6f 6c 30 20 2f 20 2b 20 28 20 2d 20 63  - col0 / + ( - c
16690 6f 72 30 2e 63 6f 6c 30 20 29 20 46 52 4f 4d 20  or0.col0 ) FROM 
166a0 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
166b0 2d 2d 0d 0a 31 0d 0a 31 0d 0a 31 0d 0a 0d 0a 6f  --..1..1..1....o
166c0 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75  nlyif mysql # su
166d0 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20  pport for MySQL 
166e0 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20  specific system 
166f0 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78  types and syntax
16700 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
16710 74 20 6c 61 62 65 6c 2d 36 35 32 0d 0a 53 45 4c  t label-652..SEL
16720 45 43 54 20 2b 20 63 6f 6c 31 20 2b 20 2d 20 43  ECT + col1 + - C
16730 41 53 54 28 20 2b 20 63 6f 6c 32 20 41 53 20 53  AST( + col2 AS S
16740 49 47 4e 45 44 20 29 20 2d 20 63 6f 6c 32 20 41  IGNED ) - col2 A
16750 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31  S col2 FROM tab1
16760 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
16770 2d 31 30 34 0d 0a 2d 31 37 39 0d 0a 2d 38 32 0d  -104..-179..-82.
16780 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
16790 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
167a0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
167b0 74 20 6c 61 62 65 6c 2d 36 35 32 0d 0a 53 45 4c  t label-652..SEL
167c0 45 43 54 20 2b 20 63 6f 6c 31 20 2b 20 2d 20 43  ECT + col1 + - C
167d0 41 53 54 20 28 20 2b 20 63 6f 6c 32 20 41 53 20  AST ( + col2 AS 
167e0 49 4e 54 45 47 45 52 20 29 20 2d 20 63 6f 6c 32  INTEGER ) - col2
167f0 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
16800 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
16810 0d 0a 2d 31 30 34 0d 0a 2d 31 37 39 0d 0a 2d 38  ..-104..-179..-8
16820 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  2....query I row
16830 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63  sort..SELECT - c
16840 6f 72 30 2e 63 6f 6c 32 20 2b 20 63 6f 6c 31 20  or0.col2 + col1 
16850 2a 20 63 6f 72 30 2e 63 6f 6c 32 20 46 52 4f 4d  * cor0.col2 FROM
16860 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
16870 2d 2d 2d 0d 0a 31 35 30 38 0d 0a 36 30 38 0d 0a  ---..1508..608..
16880 38 31 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  810....query I r
16890 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
168a0 49 53 54 49 4e 43 54 20 2d 20 39 32 20 41 53 20  ISTINCT - 92 AS 
168b0 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41  col1 FROM tab0 A
168c0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 39  S cor0..----..-9
168d0 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  2....query I row
168e0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
168f0 54 49 4e 43 54 20 2b 20 63 6f 6c 30 20 2a 20 63  TINCT + col0 * c
16900 6f 6c 30 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20  ol0 + col0 FROM 
16910 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
16920 2d 2d 0d 0a 35 36 0d 0a 36 31 36 32 0d 0a 36 33  --..56..6162..63
16930 32 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  20....query I ro
16940 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f  wsort..SELECT co
16950 72 30 2e 63 6f 6c 31 20 2b 20 33 34 20 2a 20 2d  r0.col1 + 34 * -
16960 20 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46 52   col2 AS col0 FR
16970 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
16980 0a 2d 2d 2d 2d 0d 0a 2d 31 38 31 30 0d 0a 2d 31  .----..-1810..-1
16990 39 32 38 0d 0a 2d 33 32 35 31 0d 0a 0d 0a 6f 6e  928..-3251....on
169a0 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
169b0 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
169c0 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
169d0 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
169e0 6f 72 74 20 6c 61 62 65 6c 2d 36 35 37 0d 0a 53  ort label-657..S
169f0 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d  ELECT DISTINCT -
16a00 20 63 6f 6c 30 20 44 49 56 20 2b 20 37 34 20 41   col0 DIV + 74 A
16a10 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31  S col2 FROM tab1
16a20 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 30 0d 0a 0d  ..----..-1..0...
16a30 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
16a40 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
16a50 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
16a60 6c 61 62 65 6c 2d 36 35 37 0d 0a 53 45 4c 45 43  label-657..SELEC
16a70 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c  T DISTINCT - col
16a80 30 20 2f 20 2b 20 37 34 20 41 53 20 63 6f 6c 32  0 / + 74 AS col2
16a90 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d   FROM tab1..----
16aa0 0d 0a 2d 31 0d 0a 30 0d 0a 0d 0a 71 75 65 72 79  ..-1..0....query
16ab0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
16ac0 43 54 20 41 4c 4c 20 63 6f 6c 30 20 2a 20 2d 20  CT ALL col0 * - 
16ad0 37 37 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  77 AS col0 FROM 
16ae0 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab1 cor0..----.
16af0 0a 2d 32 33 31 0d 0a 2d 34 39 32 38 0d 0a 2d 36  .-231..-4928..-6
16b00 31 36 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  160....onlyif my
16b10 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f  sql # support fo
16b20 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63  r MySQL specific
16b30 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e   system types an
16b40 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20  d syntax..query 
16b50 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
16b60 36 35 39 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f  659..SELECT + co
16b70 6c 30 20 2a 20 43 41 53 54 28 20 4e 55 4c 4c 20  l0 * CAST( NULL 
16b80 41 53 20 53 49 47 4e 45 44 20 29 20 41 53 20 63  AS SIGNED ) AS c
16b90 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d  ol2 FROM tab0..-
16ba0 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d  ---..NULL..NULL.
16bb0 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20  .NULL....skipif 
16bc0 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
16bd0 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
16be0 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 36 35  rowsort label-65
16bf0 39 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 30  9..SELECT + col0
16c00 20 2a 20 43 41 53 54 20 28 20 4e 55 4c 4c 20 41   * CAST ( NULL A
16c10 53 20 49 4e 54 45 47 45 52 20 29 20 41 53 20 63  S INTEGER ) AS c
16c20 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d  ol2 FROM tab0..-
16c30 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d  ---..NULL..NULL.
16c40 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75 65 72 79 20 49  .NULL....query I
16c50 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
16c60 20 41 4c 4c 20 36 38 20 41 53 20 63 6f 6c 31 20   ALL 68 AS col1 
16c70 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
16c80 30 0d 0a 2d 2d 2d 2d 0d 0a 36 38 0d 0a 36 38 0d  0..----..68..68.
16c90 0a 36 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .68....query I r
16ca0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
16cb0 20 63 6f 6c 30 20 2b 20 63 6f 72 30 2e 63 6f 6c   col0 + cor0.col
16cc0 32 20 2a 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20  2 * + cor0.col0 
16cd0 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
16ce0 30 0d 0a 2d 2d 2d 2d 0d 0a 37 30 0d 0a 37 33 38  0..----..70..738
16cf0 37 0d 0a 38 31 36 0d 0a 0d 0a 71 75 65 72 79 20  7..816....query 
16d00 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
16d10 54 20 2d 20 63 6f 72 30 2e 63 6f 6c 30 20 2a 20  T - cor0.col0 * 
16d20 2b 20 36 32 20 2d 20 2b 20 63 6f 6c 31 20 2a 20  + 62 - + col1 * 
16d30 2d 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31  - col0 FROM tab1
16d40 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
16d50 2d 31 30 38 0d 0a 2d 33 33 32 38 0d 0a 2d 33 39  -108..-3328..-39
16d60 32 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  20....onlyif mys
16d70 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72  ql # support for
16d80 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63 20   MySQL specific 
16d90 73 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64  system types and
16da0 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49   syntax..query I
16db0 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 36   rowsort label-6
16dc0 36 33 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d  63..SELECT ALL -
16dd0 20 43 41 53 54 28 20 2d 20 32 34 20 41 53 20 53   CAST( - 24 AS S
16de0 49 47 4e 45 44 20 29 20 2b 20 63 6f 6c 30 20 46  IGNED ) + col0 F
16df0 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d  ROM tab0 cor0..-
16e00 2d 2d 2d 0d 0a 31 31 33 0d 0a 34 38 0d 0a 35 39  ---..113..48..59
16e10 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
16e20 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
16e30 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
16e40 72 74 20 6c 61 62 65 6c 2d 36 36 33 0d 0a 53 45  rt label-663..SE
16e50 4c 45 43 54 20 41 4c 4c 20 2d 20 43 41 53 54 20  LECT ALL - CAST 
16e60 28 20 2d 20 32 34 20 41 53 20 49 4e 54 45 47 45  ( - 24 AS INTEGE
16e70 52 20 29 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20  R ) + col0 FROM 
16e80 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab0 cor0..----.
16e90 0a 31 31 33 0d 0a 34 38 0d 0a 35 39 0d 0a 0d 0a  .113..48..59....
16ea0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
16eb0 0a 53 45 4c 45 43 54 20 36 35 20 2b 20 63 6f 6c  .SELECT 65 + col
16ec0 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  1 FROM tab0 AS c
16ed0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 35 31 0d 0a  or0..----..151..
16ee0 31 35 36 0d 0a 31 36 32 0d 0a 0d 0a 71 75 65 72  156..162....quer
16ef0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
16f00 45 43 54 20 2b 20 63 6f 6c 32 20 2a 20 2b 20 34  ECT + col2 * + 4
16f10 36 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  6 AS col0 FROM t
16f20 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
16f30 2d 0d 0a 31 31 39 36 0d 0a 31 32 34 32 0d 0a 31  -..1196..1242..1
16f40 37 34 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  748....query I r
16f50 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
16f60 49 53 54 49 4e 43 54 20 2b 20 28 20 2b 20 63 6f  ISTINCT + ( + co
16f70 6c 30 20 29 20 2b 20 2b 20 63 6f 72 30 2e 63 6f  l0 ) + + cor0.co
16f80 6c 32 20 2a 20 28 20 2d 20 63 6f 6c 31 20 2b 20  l2 * ( - col1 + 
16f90 2d 20 63 6f 6c 31 20 29 20 41 53 20 63 6f 6c 30  - col1 ) AS col0
16fa0 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
16fb0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32 31 33 0d  r0..----..-1213.
16fc0 0a 2d 31 36 36 37 0d 0a 2d 32 39 39 30 0d 0a 0d  .-1667..-2990...
16fd0 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73  .skipif postgres
16fe0 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20  ql # PostgreSQL 
16ff0 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e  requires AS when
17000 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74   renaming output
17010 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20   columns..query 
17020 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
17030 54 20 34 34 20 63 6f 6c 32 20 46 52 4f 4d 20 74  T 44 col2 FROM t
17040 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 34 34 0d 0a 34  ab1..----..44..4
17050 34 0d 0a 34 34 0d 0a 0d 0a 71 75 65 72 79 20 49  4..44....query I
17060 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
17070 20 41 4c 4c 20 2b 20 63 6f 72 30 2e 63 6f 6c 32   ALL + cor0.col2
17080 20 2a 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62   * col0 FROM tab
17090 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
170a0 0a 33 35 0d 0a 37 32 39 38 0d 0a 37 39 32 0d 0a  .35..7298..792..
170b0 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65  ..skipif postgre
170c0 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c  sql # PostgreSQL
170d0 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65   requires AS whe
170e0 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75  n renaming outpu
170f0 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79  t columns..query
17100 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
17110 43 54 20 2d 20 63 6f 6c 30 20 2a 20 2b 20 63 6f  CT - col0 * + co
17120 6c 32 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  l2 col2 FROM tab
17130 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
17140 0a 2d 31 36 32 0d 0a 2d 33 36 34 38 0d 0a 2d 37  .-162..-3648..-7
17150 36 38 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  680....query I r
17160 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 38  owsort..SELECT 8
17170 37 20 2a 20 2d 20 63 6f 6c 30 20 46 52 4f 4d 20  7 * - col0 FROM 
17180 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
17190 2d 2d 0d 0a 2d 36 30 39 0d 0a 2d 36 37 38 36 0d  --..-609..-6786.
171a0 0a 2d 36 38 37 33 0d 0a 0d 0a 73 6b 69 70 69 66  .-6873....skipif
171b0 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f   postgresql # Po
171c0 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65  stgreSQL require
171d0 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69  s AS when renami
171e0 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e  ng output column
171f0 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  s..query I rowso
17200 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 28 20 31  rt..SELECT - ( 1
17210 20 29 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62   ) col2 FROM tab
17220 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
17230 0a 2d 31 0d 0a 2d 31 0d 0a 2d 31 0d 0a 0d 0a 71  .-1..-1..-1....q
17240 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
17250 53 45 4c 45 43 54 20 2b 20 28 20 2b 20 63 6f 6c  SELECT + ( + col
17260 30 20 29 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20  0 ) + cor0.col0 
17270 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
17280 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
17290 0a 31 37 38 0d 0a 34 38 0d 0a 37 30 0d 0a 0d 0a  .178..48..70....
172a0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
172b0 0a 53 45 4c 45 43 54 20 2d 20 2d 20 38 37 20 41  .SELECT - - 87 A
172c0 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31  S col2 FROM tab1
172d0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
172e0 38 37 0d 0a 38 37 0d 0a 38 37 0d 0a 0d 0a 71 75  87..87..87....qu
172f0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
17300 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 31  ELECT ALL - col1
17310 20 2d 20 2b 20 63 6f 6c 32 20 2a 20 2b 20 63 6f   - + col2 * + co
17320 6c 31 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d  l1 FROM tab2..--
17330 2d 2d 0d 0a 2d 31 35 39 33 0d 0a 2d 36 36 33 0d  --..-1593..-663.
17340 0a 2d 38 36 38 0d 0a 0d 0a 71 75 65 72 79 20 49  .-868....query I
17350 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
17360 20 2b 20 2b 20 28 20 63 6f 6c 32 20 29 20 2b 20   + + ( col2 ) + 
17370 2d 20 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46  - col0 AS col1 F
17380 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
17390 0d 0a 2d 2d 2d 2d 0d 0a 2d 37 0d 0a 31 36 0d 0a  ..----..-7..16..
173a0 35 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  51....query I ro
173b0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f  wsort..SELECT co
173c0 6c 31 20 2b 20 2d 20 63 6f 6c 32 20 2a 20 63 6f  l1 + - col2 * co
173d0 6c 30 20 2a 20 2b 20 63 6f 6c 30 20 46 52 4f 4d  l0 * + col0 FROM
173e0 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
173f0 2d 2d 2d 0d 0a 2d 31 31 32 38 0d 0a 2d 31 38 39  ---..-1128..-189
17400 32 32 0d 0a 2d 36 34 39 34 33 31 0d 0a 0d 0a 6f  22..-649431....o
17410 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75  nlyif mysql # su
17420 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20  pport for MySQL 
17430 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20  specific system 
17440 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78  types and syntax
17450 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
17460 74 20 6c 61 62 65 6c 2d 36 37 37 0d 0a 53 45 4c  t label-677..SEL
17470 45 43 54 20 44 49 53 54 49 4e 43 54 20 43 41 53  ECT DISTINCT CAS
17480 54 28 20 36 35 20 41 53 20 53 49 47 4e 45 44 20  T( 65 AS SIGNED 
17490 29 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  ) AS col0 FROM t
174a0 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
174b0 2d 0d 0a 36 35 0d 0a 0d 0a 73 6b 69 70 69 66 20  -..65....skipif 
174c0 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
174d0 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
174e0 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 36 37  rowsort label-67
174f0 37 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  7..SELECT DISTIN
17500 43 54 20 43 41 53 54 20 28 20 36 35 20 41 53 20  CT CAST ( 65 AS 
17510 49 4e 54 45 47 45 52 20 29 20 41 53 20 63 6f 6c  INTEGER ) AS col
17520 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  0 FROM tab1 AS c
17530 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 36 35 0d 0a 0d  or0..----..65...
17540 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
17550 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 32  ..SELECT ALL - 2
17560 36 20 2a 20 2d 20 63 6f 6c 31 20 2b 20 2b 20 63  6 * - col1 + + c
17570 6f 6c 31 20 2a 20 63 6f 6c 32 20 46 52 4f 4d 20  ol1 * col2 FROM 
17580 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
17590 2d 2d 0d 0a 31 35 38 36 0d 0a 32 30 38 30 0d 0a  --..1586..2080..
175a0 38 33 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  830....query I r
175b0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
175c0 4c 4c 20 2d 20 63 6f 6c 31 20 2b 20 2d 20 63 6f  LL - col1 + - co
175d0 6c 31 20 2a 20 63 6f 6c 32 20 46 52 4f 4d 20 74  l1 * col2 FROM t
175e0 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
175f0 2d 0d 0a 2d 31 35 39 33 0d 0a 2d 36 36 33 0d 0a  -..-1593..-663..
17600 2d 38 36 38 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  -868....onlyif m
17610 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66  ysql # support f
17620 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69  or MySQL specifi
17630 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61  c system types a
17640 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79  nd syntax..query
17650 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
17660 2d 36 38 30 0d 0a 53 45 4c 45 43 54 20 2b 20 43  -680..SELECT + C
17670 41 53 54 28 20 2d 20 33 34 20 41 53 20 53 49 47  AST( - 34 AS SIG
17680 4e 45 44 20 29 20 46 52 4f 4d 20 74 61 62 31 20  NED ) FROM tab1 
17690 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
176a0 33 34 0d 0a 2d 33 34 0d 0a 2d 33 34 0d 0a 0d 0a  34..-34..-34....
176b0 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
176c0 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..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 38 30 0d 0a 53 45 4c 45 43 54  abel-680..SELECT
176f0 20 2b 20 43 41 53 54 20 28 20 2d 20 33 34 20 41   + CAST ( - 34 A
17700 53 20 49 4e 54 45 47 45 52 20 29 20 46 52 4f 4d  S INTEGER ) FROM
17710 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
17720 2d 2d 2d 0d 0a 2d 33 34 0d 0a 2d 33 34 0d 0a 2d  ---..-34..-34..-
17730 33 34 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  34....onlyif mys
17740 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65  ql # use DIV ope
17750 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65  rator for intege
17760 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72  r division..quer
17770 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
17780 6c 2d 36 38 31 0d 0a 53 45 4c 45 43 54 20 44 49  l-681..SELECT DI
17790 53 54 49 4e 43 54 20 2b 20 39 34 20 44 49 56 20  STINCT + 94 DIV 
177a0 2b 20 63 6f 6c 30 20 63 6f 6c 32 20 46 52 4f 4d  + col0 col2 FROM
177b0 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
177c0 2d 2d 2d 0d 0a 31 0d 0a 33 31 0d 0a 0d 0a 73 6b  ---..1..31....sk
177d0 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20  ipif postgresql 
177e0 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71  # PostgreSQL req
177f0 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65  uires AS when re
17800 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f  naming output co
17810 6c 75 6d 6e 73 0d 0a 73 6b 69 70 69 66 20 6d 79  lumns..skipif my
17820 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
17830 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
17840 77 73 6f 72 74 20 6c 61 62 65 6c 2d 36 38 31 0d  wsort label-681.
17850 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
17860 20 2b 20 39 34 20 2f 20 2b 20 63 6f 6c 30 20 63   + 94 / + col0 c
17870 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol2 FROM tab1 AS
17880 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 0d 0a   cor0..----..1..
17890 33 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  31....query I ro
178a0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
178b0 28 20 63 6f 72 30 2e 63 6f 6c 30 20 29 20 2a 20  ( cor0.col0 ) * 
178c0 2d 20 28 20 63 6f 6c 31 20 29 20 2b 20 63 6f 6c  - ( col1 ) + col
178d0 31 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61  1 + col0 FROM ta
178e0 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
178f0 0d 0a 31 34 33 39 0d 0a 32 35 35 0d 0a 34 37 33  ..1439..255..473
17900 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  9....query I row
17910 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2d  sort..SELECT - -
17920 20 63 6f 6c 32 20 2b 20 2b 20 63 6f 72 30 2e 63   col2 + + cor0.c
17930 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  ol2 AS col0 FROM
17940 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
17950 2d 2d 2d 0d 0a 35 32 0d 0a 35 34 0d 0a 37 36 0d  ---..52..54..76.
17960 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
17970 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d  rt..SELECT ALL -
17980 20 63 6f 6c 30 20 2b 20 63 6f 6c 30 20 2a 20 2b   col0 + col0 * +
17990 20 63 6f 6c 32 20 2a 20 2d 20 74 61 62 32 2e 63   col2 * - tab2.c
179a0 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d  ol0 FROM tab2..-
179b0 2d 2d 2d 0d 0a 2d 31 33 33 30 0d 0a 2d 31 35 38  ---..-1330..-158
179c0 32 36 32 0d 0a 2d 32 33 37 32 33 37 0d 0a 0d 0a  262..-237237....
179d0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
179e0 0a 53 45 4c 45 43 54 20 2b 20 2b 20 63 6f 6c 30  .SELECT + + col0
179f0 20 2d 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62   - col0 FROM tab
17a00 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
17a10 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a 6f 6e 6c 79  .0..0..0....only
17a20 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f  if mysql # suppo
17a30 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65  rt for MySQL spe
17a40 63 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70  cific system typ
17a50 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71  es and syntax..q
17a60 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
17a70 61 62 65 6c 2d 36 38 36 0d 0a 53 45 4c 45 43 54  abel-686..SELECT
17a80 20 41 4c 4c 20 63 6f 72 30 2e 63 6f 6c 30 20 2d   ALL cor0.col0 -
17a90 20 43 41 53 54 28 20 2b 20 63 6f 6c 32 20 41 53   CAST( + col2 AS
17aa0 20 53 49 47 4e 45 44 20 29 20 41 53 20 63 6f 6c   SIGNED ) AS col
17ab0 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  2 FROM tab1 AS c
17ac0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 36 0d 0a  or0..----..-16..
17ad0 2d 35 31 0d 0a 37 0d 0a 0d 0a 73 6b 69 70 69 66  -51..7....skipif
17ae0 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
17af0 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
17b00 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 36   rowsort label-6
17b10 38 36 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63  86..SELECT ALL c
17b20 6f 72 30 2e 63 6f 6c 30 20 2d 20 43 41 53 54 20  or0.col0 - CAST 
17b30 28 20 2b 20 63 6f 6c 32 20 41 53 20 49 4e 54 45  ( + col2 AS INTE
17b40 47 45 52 20 29 20 41 53 20 63 6f 6c 32 20 46 52  GER ) AS col2 FR
17b50 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
17b60 0a 2d 2d 2d 2d 0d 0a 2d 31 36 0d 0a 2d 35 31 0d  .----..-16..-51.
17b70 0a 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  .7....query I ro
17b80 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
17b90 74 61 62 30 2e 63 6f 6c 30 20 2b 20 2b 20 63 6f  tab0.col0 + + co
17ba0 6c 30 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  l0 AS col0 FROM 
17bb0 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30  tab0..----..0..0
17bc0 0d 0a 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  ..0....query I r
17bd0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63  owsort..SELECT c
17be0 6f 6c 31 20 2a 20 28 20 2d 20 35 31 20 29 20 41  ol1 * ( - 51 ) A
17bf0 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30  S col1 FROM tab0
17c00 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 33 38 36 0d 0a 2d  ..----..-4386..-
17c10 34 36 34 31 0d 0a 2d 34 39 34 37 0d 0a 0d 0a 71  4641..-4947....q
17c20 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
17c30 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 37 35 20  SELECT ALL + 75 
17c40 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
17c50 32 2c 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  2, tab1 AS cor0.
17c60 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20  .----..9 values 
17c70 68 61 73 68 69 6e 67 20 74 6f 20 32 32 30 34 32  hashing to 22042
17c80 62 66 64 34 64 37 38 37 34 31 35 34 35 37 61 34  bfd4d787415457a4
17c90 32 62 62 39 33 64 34 38 65 65 61 0d 0a 0d 0a 71  2bb93d48eea....q
17ca0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
17cb0 53 45 4c 45 43 54 20 63 6f 6c 31 20 2b 20 63 6f  SELECT col1 + co
17cc0 6c 32 20 2a 20 2b 20 63 6f 6c 31 20 41 53 20 63  l2 * + col1 AS c
17cd0 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d  ol1 FROM tab0..-
17ce0 2d 2d 2d 0d 0a 31 39 34 0d 0a 32 39 32 34 0d 0a  ---..194..2924..
17cf0 37 35 35 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20  7553....query I 
17d00 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
17d10 44 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c 31 20  DISTINCT + col1 
17d20 2a 20 2b 20 63 6f 6c 32 20 2b 20 28 20 63 6f 6c  * + col2 + ( col
17d30 31 20 2a 20 2d 20 28 20 74 61 62 32 2e 63 6f 6c  1 * - ( tab2.col
17d40 32 20 29 20 29 20 46 52 4f 4d 20 74 61 62 32 0d  2 ) ) FROM tab2.
17d50 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 0d 0a 71 75 65 72  .----..0....quer
17d60 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
17d70 45 43 54 20 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c  ECT col0 + + col
17d80 32 20 2b 20 2b 20 63 6f 6c 32 20 2a 20 63 6f 6c  2 + + col2 * col
17d90 30 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d  0 FROM tab1..---
17da0 2d 0d 0a 32 31 39 0d 0a 33 37 36 39 0d 0a 37 38  -..219..3769..78
17db0 35 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  56....query I ro
17dc0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
17dd0 53 54 49 4e 43 54 20 63 6f 6c 30 20 2b 20 2d 20  STINCT col0 + - 
17de0 28 20 63 6f 6c 31 20 29 20 2a 20 63 6f 6c 32 20  ( col1 ) * col2 
17df0 2b 20 63 6f 6c 30 20 2a 20 2b 20 39 34 20 46 52  + col0 * + 94 FR
17e00 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d  OM tab2..----..-
17e10 31 37 32 0d 0a 35 38 37 36 0d 0a 36 38 35 39 0d  172..5876..6859.
17e20 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
17e30 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
17e40 4e 43 54 20 63 6f 6c 31 20 2b 20 63 6f 6c 30 20  NCT col1 + col0 
17e50 2b 20 2d 20 36 37 20 41 53 20 63 6f 6c 31 20 46  + - 67 AS col1 F
17e60 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab0..----..
17e70 31 31 33 0d 0a 34 33 0d 0a 36 35 0d 0a 0d 0a 73  113..43..65....s
17e80 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c  kipif postgresql
17e90 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65   # PostgreSQL re
17ea0 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72  quires AS when r
17eb0 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63  enaming output c
17ec0 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20  olumns..query I 
17ed0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
17ee0 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c 30 20  DISTINCT - col0 
17ef0 2a 20 2b 20 28 20 63 6f 6c 30 20 29 20 2a 20 2b  * + ( col0 ) * +
17f00 20 63 6f 6c 32 20 63 6f 6c 31 20 46 52 4f 4d 20   col2 col1 FROM 
17f10 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
17f20 2d 2d 0d 0a 2d 32 33 33 34 37 32 0d 0a 2d 34 38  --..-233472..-48
17f30 36 0d 0a 2d 36 31 34 34 30 30 0d 0a 0d 0a 71 75  6..-614400....qu
17f40 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
17f50 45 4c 45 43 54 20 63 6f 6c 30 20 2a 20 35 31 20  ELECT col0 * 51 
17f60 2d 20 35 30 20 46 52 4f 4d 20 74 61 62 30 20 41  - 50 FROM tab0 A
17f70 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31  S cor0..----..11
17f80 37 34 0d 0a 31 37 33 35 0d 0a 34 34 38 39 0d 0a  74..1735..4489..
17f90 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
17fa0 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f   use DIV operato
17fb0 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69  r for integer di
17fc0 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20  vision..query I 
17fd0 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 36 39  rowsort label-69
17fe0 37 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  7..SELECT DISTIN
17ff0 43 54 20 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c 31  CT col0 * - col1
18000 20 2d 20 63 6f 6c 31 20 44 49 56 20 63 6f 72 30   - col1 DIV cor0
18010 2e 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20  .col1 FROM tab0 
18020 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
18030 32 30 36 35 0d 0a 2d 33 33 39 36 0d 0a 2d 38 31  2065..-3396..-81
18040 30 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  00....skipif mys
18050 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
18060 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
18070 73 6f 72 74 20 6c 61 62 65 6c 2d 36 39 37 0d 0a  sort label-697..
18080 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
18090 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c 31 20 2d 20  col0 * - col1 - 
180a0 63 6f 6c 31 20 2f 20 63 6f 72 30 2e 63 6f 6c 31  col1 / cor0.col1
180b0 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
180c0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 30 36 35 0d  r0..----..-2065.
180d0 0a 2d 33 33 39 36 0d 0a 2d 38 31 30 30 0d 0a 0d  .-3396..-8100...
180e0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
180f0 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 32 20  ..SELECT + col2 
18100 2a 20 2b 20 28 20 63 6f 6c 31 20 29 20 46 52 4f  * + ( col1 ) FRO
18110 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 32 38  M tab0..----..28
18120 33 38 0d 0a 37 34 36 32 0d 0a 39 37 0d 0a 0d 0a  38..7462..97....
18130 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
18140 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 72 30  .SELECT ALL cor0
18150 2e 63 6f 6c 31 20 2b 20 2b 20 28 20 2d 20 63 6f  .col1 + + ( - co
18160 6c 32 20 29 20 41 53 20 63 6f 6c 32 20 46 52 4f  l2 ) AS col2 FRO
18170 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
18180 2d 2d 2d 2d 0d 0a 2d 32 38 0d 0a 2d 34 37 0d 0a  ----..-28..-47..
18190 2d 38 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  -83....query I r
181a0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
181b0 4c 4c 20 2b 20 35 39 20 41 53 20 63 6f 6c 30 20  LL + 59 AS col0 
181c0 46 52 4f 4d 20 74 61 62 32 2c 20 74 61 62 30 20  FROM tab2, tab0 
181d0 63 6f 72 30 2c 20 74 61 62 30 20 41 53 20 63 6f  cor0, tab0 AS co
181e0 72 31 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c  r1..----..27 val
181f0 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 65  ues hashing to e
18200 32 39 66 65 66 38 63 64 65 63 31 65 65 34 35 61  29fef8cdec1ee45a
18210 37 31 64 32 31 33 66 31 36 64 32 66 31 64 33 0d  71d213f16d2f1d3.
18220 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
18230 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 32  rt..SELECT ALL 2
18240 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 41 53 20   + cor0.col0 AS 
18250 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 2c 20  col2 FROM tab1, 
18260 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
18270 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73  --..9 values has
18280 68 69 6e 67 20 74 6f 20 35 66 33 61 37 31 34 30  hing to 5f3a7140
18290 62 63 65 63 64 38 62 62 65 37 39 35 38 62 33 33  bcecd8bbe7958b33
182a0 34 61 30 37 63 63 66 61 0d 0a 0d 0a 71 75 65 72  4a07ccfa....quer
182b0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
182c0 45 43 54 20 44 49 53 54 49 4e 43 54 20 74 61 62  ECT DISTINCT tab
182d0 30 2e 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46  0.col2 AS col0 F
182e0 52 4f 4d 20 74 61 62 30 2c 20 74 61 62 32 20 41  ROM tab0, tab2 A
182f0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 0d  S cor0..----..1.
18300 0a 33 33 0d 0a 38 32 0d 0a 0d 0a 71 75 65 72 79  .33..82....query
18310 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
18320 43 54 20 63 6f 6c 31 20 2b 20 2d 20 63 6f 6c 30  CT col1 + - col0
18330 20 2a 20 2d 20 37 20 2b 20 2d 20 36 30 20 46 52   * - 7 + - 60 FR
18340 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 32  OM tab2..----..2
18350 30 0d 0a 35 31 30 0d 0a 35 34 35 0d 0a 0d 0a 71  0..510..545....q
18360 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
18370 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
18380 2b 20 2b 20 38 39 20 41 53 20 63 6f 6c 31 20 46  + + 89 AS col1 F
18390 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
183a0 20 43 52 4f 53 53 20 4a 4f 49 4e 20 74 61 62 31   CROSS JOIN tab1
183b0 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a   AS cor1..----..
183c0 38 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  89....query I ro
183d0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
183e0 28 20 63 6f 6c 31 20 29 20 2b 20 2b 20 28 20 2d  ( col1 ) + + ( -
183f0 20 37 20 2a 20 63 6f 6c 30 20 29 20 2d 20 28 20   7 * col0 ) - ( 
18400 2d 20 39 34 20 29 20 46 52 4f 4d 20 74 61 62 30  - 94 ) FROM tab0
18410 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
18420 2d 31 36 30 0d 0a 2d 32 34 38 0d 0a 2d 36 32 30  -160..-248..-620
18430 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
18440 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61   # use DIV opera
18450 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20  tor for integer 
18460 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20  division..query 
18470 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
18480 37 30 36 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  706..SELECT DIST
18490 49 4e 43 54 20 2b 20 2d 20 63 6f 6c 30 20 44 49  INCT + - col0 DI
184a0 56 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30  V col2 FROM tab0
184b0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
184c0 2d 31 0d 0a 2d 33 35 0d 0a 30 0d 0a 0d 0a 73 6b  -1..-35..0....sk
184d0 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
184e0 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
184f0 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
18500 65 6c 2d 37 30 36 0d 0a 53 45 4c 45 43 54 20 44  el-706..SELECT D
18510 49 53 54 49 4e 43 54 20 2b 20 2d 20 63 6f 6c 30  ISTINCT + - col0
18520 20 2f 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62   / col2 FROM tab
18530 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
18540 0a 2d 31 0d 0a 2d 33 35 0d 0a 30 0d 0a 0d 0a 71  .-1..-35..0....q
18550 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
18560 53 45 4c 45 43 54 20 2b 20 2d 20 63 6f 6c 30 20  SELECT + - col0 
18570 2a 20 63 6f 72 30 2e 63 6f 6c 30 20 2a 20 2b 20  * cor0.col0 * + 
18580 35 30 20 2b 20 2b 20 63 6f 6c 30 20 46 52 4f 4d  50 + + col0 FROM
18590 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
185a0 2d 2d 2d 0d 0a 2d 32 34 34 33 0d 0a 2d 33 30 34  ---..-2443..-304
185b0 31 32 32 0d 0a 2d 33 31 31 39 37 31 0d 0a 0d 0a  122..-311971....
185c0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
185d0 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 2b 20  .SELECT ALL + + 
185e0 63 6f 6c 31 20 2b 20 2b 20 63 6f 6c 31 20 46 52  col1 + + col1 FR
185f0 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
18600 0a 2d 2d 2d 2d 0d 0a 31 37 32 0d 0a 31 38 32 0d  .----..172..182.
18610 0a 31 39 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .194....query I 
18620 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
18630 2d 20 39 37 20 2b 20 63 6f 6c 32 20 41 53 20 63  - 97 + col2 AS c
18640 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol0 FROM tab0 AS
18650 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 35   cor0..----..-15
18660 0d 0a 2d 36 34 0d 0a 2d 39 36 0d 0a 0d 0a 71 75  ..-64..-96....qu
18670 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
18680 45 4c 45 43 54 20 2b 20 63 6f 6c 32 20 2a 20 2b  ELECT + col2 * +
18690 20 63 6f 6c 32 20 2a 20 2b 20 32 32 20 2b 20 2b   col2 * + 22 + +
186a0 20 63 6f 6c 32 20 2a 20 63 6f 6c 32 20 2b 20 2b   col2 * col2 + +
186b0 20 34 20 2a 20 63 6f 6c 30 20 41 53 20 63 6f 6c   4 * col0 AS col
186c0 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  2 FROM tab0 AS c
186d0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 35 35 30 30  or0..----..15500
186e0 38 0d 0a 31 36 33 0d 0a 32 35 31 34 33 0d 0a 0d  8..163..25143...
186f0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
18700 0d 0a 53 45 4c 45 43 54 20 2b 20 2d 20 37 31 20  ..SELECT + - 71 
18710 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46  + col0 AS col2 F
18720 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
18730 0d 0a 2d 2d 2d 2d 0d 0a 2d 36 34 0d 0a 37 0d 0a  ..----..-64..7..
18740 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  8....query I row
18750 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2b  sort..SELECT - +
18760 20 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c 32 20 2a   col0 + + col2 *
18770 20 37 34 20 46 52 4f 4d 20 74 61 62 31 20 41 53   74 FROM tab1 AS
18780 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 39 39   cor0..----..399
18790 33 0d 0a 34 31 35 34 0d 0a 37 30 32 34 0d 0a 0d  3..4154..7024...
187a0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
187b0 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
187c0 54 20 2b 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20  T + + cor0.col0 
187d0 2a 20 31 33 20 46 52 4f 4d 20 74 61 62 30 20 41  * 13 FROM tab0 A
187e0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31  S cor0..----..11
187f0 35 37 0d 0a 33 31 32 0d 0a 34 35 35 0d 0a 0d 0a  57..312..455....
18800 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73  onlyif mysql # s
18810 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c  upport for MySQL
18820 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d   specific system
18830 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61   types and synta
18840 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  x..query I rowso
18850 72 74 20 6c 61 62 65 6c 2d 37 31 34 0d 0a 53 45  rt label-714..SE
18860 4c 45 43 54 20 63 6f 6c 30 20 2a 20 43 41 53 54  LECT col0 * CAST
18870 28 20 2b 20 63 6f 6c 32 20 41 53 20 53 49 47 4e  ( + col2 AS SIGN
18880 45 44 20 29 20 46 52 4f 4d 20 74 61 62 30 0d 0a  ED ) FROM tab0..
18890 2d 2d 2d 2d 0d 0a 33 35 0d 0a 37 32 39 38 0d 0a  ----..35..7298..
188a0 37 39 32 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  792....skipif my
188b0 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
188c0 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
188d0 77 73 6f 72 74 20 6c 61 62 65 6c 2d 37 31 34 0d  wsort label-714.
188e0 0a 53 45 4c 45 43 54 20 63 6f 6c 30 20 2a 20 43  .SELECT col0 * C
188f0 41 53 54 20 28 20 2b 20 63 6f 6c 32 20 41 53 20  AST ( + col2 AS 
18900 49 4e 54 45 47 45 52 20 29 20 46 52 4f 4d 20 74  INTEGER ) FROM t
18910 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 33 35 0d 0a 37  ab0..----..35..7
18920 32 39 38 0d 0a 37 39 32 0d 0a 0d 0a 71 75 65 72  298..792....quer
18930 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
18940 45 43 54 20 2d 20 63 6f 6c 32 20 2a 20 2b 20 34  ECT - col2 * + 4
18950 30 20 2b 20 2d 20 63 6f 6c 32 20 46 52 4f 4d 20  0 + - col2 FROM 
18960 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
18970 2d 2d 0d 0a 2d 31 33 35 33 0d 0a 2d 33 33 36 32  --..-1353..-3362
18980 0d 0a 2d 34 31 0d 0a 0d 0a 71 75 65 72 79 20 49  ..-41....query I
18990 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
189a0 20 41 4c 4c 20 32 32 20 41 53 20 63 6f 6c 31 20   ALL 22 AS col1 
189b0 46 52 4f 4d 20 74 61 62 31 2c 20 74 61 62 30 20  FROM tab1, tab0 
189c0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39  AS cor0..----..9
189d0 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20   values hashing 
189e0 74 6f 20 63 35 35 65 65 37 34 33 33 64 38 64 33  to c55ee7433d8d3
189f0 39 61 35 39 62 31 64 65 32 61 61 64 64 39 35 33  9a59b1de2aadd953
18a00 38 63 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  8c9....query I r
18a10 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
18a20 20 2d 20 63 6f 72 30 2e 63 6f 6c 30 20 2b 20 63   - cor0.col0 + c
18a30 6f 6c 30 20 2a 20 63 6f 6c 30 20 46 52 4f 4d 20  ol0 * col0 FROM 
18a40 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
18a50 2d 2d 0d 0a 35 36 0d 0a 36 31 36 32 0d 0a 36 33  --..56..6162..63
18a60 32 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  20....query I ro
18a70 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
18a80 63 6f 72 30 2e 63 6f 6c 32 20 2a 20 33 20 2b 20  cor0.col2 * 3 + 
18a90 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41  col0 FROM tab1 A
18aa0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 36  S cor0..----..16
18ab0 35 0d 0a 32 33 35 0d 0a 33 36 38 0d 0a 0d 0a 6f  5..235..368....o
18ac0 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73  nlyif mysql # us
18ad0 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66  e DIV operator f
18ae0 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73  or integer divis
18af0 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ion..query I row
18b00 73 6f 72 74 20 6c 61 62 65 6c 2d 37 31 39 0d 0a  sort label-719..
18b10 53 45 4c 45 43 54 20 2d 20 36 32 20 2a 20 63 6f  SELECT - 62 * co
18b20 6c 32 20 44 49 56 20 2b 20 63 6f 6c 32 20 63 6f  l2 DIV + col2 co
18b30 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l0 FROM tab0 AS 
18b40 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 36 32 0d  cor0..----..-62.
18b50 0a 2d 36 32 0d 0a 2d 36 32 0d 0a 0d 0a 73 6b 69  .-62..-62....ski
18b60 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23  pif postgresql #
18b70 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75   PostgreSQL requ
18b80 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e  ires AS when ren
18b90 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c  aming output col
18ba0 75 6d 6e 73 0d 0a 73 6b 69 70 69 66 20 6d 79 73  umns..skipif mys
18bb0 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
18bc0 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
18bd0 73 6f 72 74 20 6c 61 62 65 6c 2d 37 31 39 0d 0a  sort label-719..
18be0 53 45 4c 45 43 54 20 2d 20 36 32 20 2a 20 63 6f  SELECT - 62 * co
18bf0 6c 32 20 2f 20 2b 20 63 6f 6c 32 20 63 6f 6c 30  l2 / + col2 col0
18c00 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
18c10 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 36 32 0d 0a 2d  r0..----..-62..-
18c20 36 32 0d 0a 2d 36 32 0d 0a 0d 0a 6f 6e 6c 79 69  62..-62....onlyi
18c30 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72  f mysql # suppor
18c40 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63  t for MySQL spec
18c50 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65  ific system type
18c60 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75  s and syntax..qu
18c70 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
18c80 62 65 6c 2d 37 32 30 0d 0a 53 45 4c 45 43 54 20  bel-720..SELECT 
18c90 41 4c 4c 20 2b 20 43 41 53 54 28 20 63 6f 6c 32  ALL + CAST( col2
18ca0 20 41 53 20 53 49 47 4e 45 44 20 29 20 2b 20 2b   AS SIGNED ) + +
18cb0 20 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46 52   col2 AS col2 FR
18cc0 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d  OM tab2 cor0..--
18cd0 2d 2d 0d 0a 35 32 0d 0a 35 34 0d 0a 37 36 0d 0a  --..52..54..76..
18ce0 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
18cf0 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
18d00 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
18d10 20 6c 61 62 65 6c 2d 37 32 30 0d 0a 53 45 4c 45   label-720..SELE
18d20 43 54 20 41 4c 4c 20 2b 20 43 41 53 54 20 28 20  CT ALL + CAST ( 
18d30 63 6f 6c 32 20 41 53 20 49 4e 54 45 47 45 52 20  col2 AS INTEGER 
18d40 29 20 2b 20 2b 20 63 6f 6c 32 20 41 53 20 63 6f  ) + + col2 AS co
18d50 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 63 6f 72  l2 FROM tab2 cor
18d60 30 0d 0a 2d 2d 2d 2d 0d 0a 35 32 0d 0a 35 34 0d  0..----..52..54.
18d70 0a 37 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .76....query I r
18d80 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
18d90 20 38 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20   8 AS col2 FROM 
18da0 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 38 0d 0a  tab2..----..-8..
18db0 2d 38 0d 0a 2d 38 0d 0a 0d 0a 71 75 65 72 79 20  -8..-8....query 
18dc0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
18dd0 54 20 2d 20 2b 20 36 30 20 46 52 4f 4d 20 74 61  T - + 60 FROM ta
18de0 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
18df0 0d 0a 2d 36 30 0d 0a 2d 36 30 0d 0a 2d 36 30 0d  ..-60..-60..-60.
18e00 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
18e10 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79  # support for My
18e20 53 51 4c 20 73 70 65 63 69 66 69 63 20 73 79 73  SQL specific sys
18e30 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79  tem types and sy
18e40 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f  ntax..query I ro
18e50 77 73 6f 72 74 20 6c 61 62 65 6c 2d 37 32 33 0d  wsort label-723.
18e60 0a 53 45 4c 45 43 54 20 2d 20 28 20 36 38 20 29  .SELECT - ( 68 )
18e70 20 2b 20 63 6f 6c 30 20 2a 20 2d 20 43 41 53 54   + col0 * - CAST
18e80 28 20 4e 55 4c 4c 20 41 53 20 53 49 47 4e 45 44  ( NULL AS SIGNED
18e90 20 29 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62   ) col2 FROM tab
18ea0 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
18eb0 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c  .NULL..NULL..NUL
18ec0 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74  L....skipif post
18ed0 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65  gresql # Postgre
18ee0 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20  SQL requires AS 
18ef0 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75  when renaming ou
18f00 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 73 6b  tput columns..sk
18f10 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
18f20 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
18f30 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
18f40 65 6c 2d 37 32 33 0d 0a 53 45 4c 45 43 54 20 2d  el-723..SELECT -
18f50 20 28 20 36 38 20 29 20 2b 20 63 6f 6c 30 20 2a   ( 68 ) + col0 *
18f60 20 2d 20 43 41 53 54 20 28 20 4e 55 4c 4c 20 41   - CAST ( NULL A
18f70 53 20 49 4e 54 45 47 45 52 20 29 20 63 6f 6c 32  S INTEGER ) col2
18f80 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
18f90 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a  r0..----..NULL..
18fa0 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75  NULL..NULL....qu
18fb0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
18fc0 45 4c 45 43 54 20 2b 20 63 6f 6c 30 20 2b 20 63  ELECT + col0 + c
18fd0 6f 6c 30 20 2a 20 2b 20 63 6f 6c 32 20 46 52 4f  ol0 * + col2 FRO
18fe0 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
18ff0 2d 2d 2d 2d 0d 0a 31 39 36 0d 0a 32 31 30 36 0d  ----..196..2106.
19000 0a 33 30 38 31 0d 0a 0d 0a 71 75 65 72 79 20 49  .3081....query I
19010 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
19020 20 2d 20 63 6f 6c 32 20 2a 20 63 6f 6c 31 20 2a   - col2 * col1 *
19030 20 2b 20 63 6f 6c 32 20 2d 20 2b 20 63 6f 6c 32   + col2 - + col2
19040 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
19050 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 32 36 32 36  r0..----..-22626
19060 0d 0a 2d 32 34 35 38 36 0d 0a 2d 33 39 39 31 30  ..-24586..-39910
19070 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
19080 6f 72 74 0d 0a 53 45 4c 45 43 54 20 30 20 2b 20  ort..SELECT 0 + 
19090 2d 20 63 6f 6c 32 20 2a 20 63 6f 72 30 2e 63 6f  - col2 * cor0.co
190a0 6c 32 20 2a 20 39 37 20 46 52 4f 4d 20 74 61 62  l2 * 97 FROM tab
190b0 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
190c0 0a 2d 31 34 30 30 36 38 0d 0a 2d 36 35 35 37 32  .-140068..-65572
190d0 0d 0a 2d 37 30 37 31 33 0d 0a 0d 0a 6f 6e 6c 79  ..-70713....only
190e0 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f  if mysql # suppo
190f0 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65  rt for MySQL spe
19100 63 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70  cific system typ
19110 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71  es and syntax..q
19120 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
19130 61 62 65 6c 2d 37 32 37 0d 0a 53 45 4c 45 43 54  abel-727..SELECT
19140 20 63 6f 6c 32 20 2a 20 63 6f 6c 31 20 2b 20 2b   col2 * col1 + +
19150 20 43 41 53 54 28 20 4e 55 4c 4c 20 41 53 20 44   CAST( NULL AS D
19160 45 43 49 4d 41 4c 20 29 20 2a 20 2d 20 63 6f 6c  ECIMAL ) * - col
19170 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  1 FROM tab0 AS c
19180 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d  or0..----..NULL.
19190 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73  .NULL..NULL....s
191a0 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
191b0 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
191c0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
191d0 62 65 6c 2d 37 32 37 0d 0a 53 45 4c 45 43 54 20  bel-727..SELECT 
191e0 63 6f 6c 32 20 2a 20 63 6f 6c 31 20 2b 20 2b 20  col2 * col1 + + 
191f0 43 41 53 54 20 28 20 4e 55 4c 4c 20 41 53 20 52  CAST ( NULL AS R
19200 45 41 4c 20 29 20 2a 20 2d 20 63 6f 6c 31 20 46  EAL ) * - col1 F
19210 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
19220 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55  ..----..NULL..NU
19230 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75 65 72  LL..NULL....quer
19240 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
19250 45 43 54 20 2d 20 39 36 20 2b 20 37 36 20 41 53  ECT - 96 + 76 AS
19260 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 0d   col2 FROM tab2.
19270 0a 2d 2d 2d 2d 0d 0a 2d 32 30 0d 0a 2d 32 30 0d  .----..-20..-20.
19280 0a 2d 32 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .-20....query I 
19290 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
192a0 41 4c 4c 20 74 61 62 30 2e 63 6f 6c 31 20 41 53  ALL tab0.col1 AS
192b0 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 2c   col2 FROM tab0,
192c0 20 74 61 62 31 2c 20 74 61 62 31 20 63 6f 72 30   tab1, tab1 cor0
192d0 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75 65  ..----..27 value
192e0 73 20 68 61 73 68 69 6e 67 20 74 6f 20 32 64 36  s hashing to 2d6
192f0 64 33 30 33 31 64 66 65 39 30 65 30 63 30 32 64  d3031dfe90e0c02d
19300 62 31 33 61 61 36 33 39 39 33 62 66 64 0d 0a 0d  b13aa63993bfd...
19310 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
19320 0d 0a 53 45 4c 45 43 54 20 2d 20 38 30 20 41 53  ..SELECT - 80 AS
19330 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 2c   col1 FROM tab2,
19340 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
19350 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61  ---..9 values ha
19360 73 68 69 6e 67 20 74 6f 20 34 64 64 65 33 62 64  shing to 4dde3bd
19370 35 36 35 32 64 33 30 33 39 36 62 39 63 61 64 64  5652d30396b9cadd
19380 30 65 32 63 66 62 36 38 30 0d 0a 0d 0a 71 75 65  0e2cfb680....que
19390 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
193a0 4c 45 43 54 20 2d 20 31 34 20 2b 20 2b 20 63 6f  LECT - 14 + + co
193b0 6c 31 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d  l1 FROM tab1..--
193c0 2d 2d 0d 0a 2d 31 0d 0a 2d 34 0d 0a 31 32 0d 0a  --..-1..-4..12..
193d0 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
193e0 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f   use DIV operato
193f0 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69  r for integer di
19400 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20  vision..query I 
19410 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 37 33  rowsort label-73
19420 32 0d 0a 53 45 4c 45 43 54 20 2d 20 2b 20 63 6f  2..SELECT - + co
19430 6c 30 20 44 49 56 20 63 6f 6c 31 20 46 52 4f 4d  l0 DIV col1 FROM
19440 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab1 cor0..----
19450 0d 0a 2d 36 0d 0a 2d 36 0d 0a 30 0d 0a 0d 0a 73  ..-6..-6..0....s
19460 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
19470 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
19480 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
19490 62 65 6c 2d 37 33 32 0d 0a 53 45 4c 45 43 54 20  bel-732..SELECT 
194a0 2d 20 2b 20 63 6f 6c 30 20 2f 20 63 6f 6c 31 20  - + col0 / col1 
194b0 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a  FROM tab1 cor0..
194c0 2d 2d 2d 2d 0d 0a 2d 36 0d 0a 2d 36 0d 0a 30 0d  ----..-6..-6..0.
194d0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
194e0 72 74 0d 0a 53 45 4c 45 43 54 20 35 39 20 2a 20  rt..SELECT 59 * 
194f0 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 63  col1 FROM tab1 c
19500 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 35 33 34 0d  or0..----..1534.
19510 0a 35 39 30 0d 0a 37 36 37 0d 0a 0d 0a 6f 6e 6c  .590..767....onl
19520 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20  yif mysql # use 
19530 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72  DIV operator for
19540 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f   integer divisio
19550 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  n..query I rowso
19560 72 74 20 6c 61 62 65 6c 2d 37 33 34 0d 0a 53 45  rt label-734..SE
19570 4c 45 43 54 20 63 6f 6c 30 20 44 49 56 20 2b 20  LECT col0 DIV + 
19580 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46 52 4f  col1 AS col2 FRO
19590 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab1 cor0..---
195a0 2d 0d 0a 30 0d 0a 36 0d 0a 36 0d 0a 0d 0a 73 6b  -..0..6..6....sk
195b0 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
195c0 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
195d0 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
195e0 65 6c 2d 37 33 34 0d 0a 53 45 4c 45 43 54 20 63  el-734..SELECT c
195f0 6f 6c 30 20 2f 20 2b 20 63 6f 6c 31 20 41 53 20  ol0 / + col1 AS 
19600 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 63  col2 FROM tab1 c
19610 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 36 0d  or0..----..0..6.
19620 0a 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  .6....query I ro
19630 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
19640 4c 20 2d 20 31 38 20 46 52 4f 4d 20 74 61 62 31  L - 18 FROM tab1
19650 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 38 0d 0a 2d 31 38  ..----..-18..-18
19660 0d 0a 2d 31 38 0d 0a 0d 0a 71 75 65 72 79 20 49  ..-18....query I
19670 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
19680 20 41 4c 4c 20 63 6f 6c 32 20 2a 20 63 6f 6c 30   ALL col2 * col0
19690 20 2a 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20   * col0 AS col0 
196a0 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d  FROM tab0..----.
196b0 0a 31 32 32 35 0d 0a 31 39 30 30 38 0d 0a 36 34  .1225..19008..64
196c0 39 35 32 32 0d 0a 0d 0a 73 6b 69 70 69 66 20 70  9522....skipif p
196d0 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74  ostgresql # Post
196e0 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20  greSQL requires 
196f0 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67  AS when renaming
19700 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d   output columns.
19710 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
19720 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 31 20  ..SELECT + col1 
19730 2b 20 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c 30 20  + col1 * + col0 
19740 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41  col0 FROM tab1 A
19750 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30  S cor0..----..10
19760 34 0d 0a 31 30 35 33 0d 0a 36 35 30 0d 0a 0d 0a  4..1053..650....
19770 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73  onlyif mysql # s
19780 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c  upport for MySQL
19790 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d   specific system
197a0 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61   types and synta
197b0 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  x..query I rowso
197c0 72 74 20 6c 61 62 65 6c 2d 37 33 38 0d 0a 53 45  rt label-738..SE
197d0 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20  LECT DISTINCT - 
197e0 63 6f 72 30 2e 63 6f 6c 32 20 2a 20 2d 20 43 41  cor0.col2 * - CA
197f0 53 54 28 20 4e 55 4c 4c 20 41 53 20 53 49 47 4e  ST( NULL AS SIGN
19800 45 44 20 29 20 2b 20 2b 20 63 6f 6c 30 20 2a 20  ED ) + + col0 * 
19810 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32  + col0 FROM tab2
19820 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
19830 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  NULL....skipif m
19840 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
19850 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
19860 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 37 33 38  owsort label-738
19870 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
19880 54 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 2a 20  T - cor0.col2 * 
19890 2d 20 43 41 53 54 20 28 20 4e 55 4c 4c 20 41 53  - CAST ( NULL AS
198a0 20 49 4e 54 45 47 45 52 20 29 20 2b 20 2b 20 63   INTEGER ) + + c
198b0 6f 6c 30 20 2a 20 2b 20 63 6f 6c 30 20 46 52 4f  ol0 * + col0 FRO
198c0 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
198d0 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75  ----..NULL....qu
198e0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
198f0 45 4c 45 43 54 20 2b 20 63 6f 6c 32 20 2a 20 2b  ELECT + col2 * +
19900 20 38 32 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d   82 AS col1 FROM
19910 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
19920 2d 2d 2d 0d 0a 34 34 32 38 0d 0a 34 36 37 34 0d  ---..4428..4674.
19930 0a 37 38 37 32 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  .7872....onlyif 
19940 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20  mysql # use DIV 
19950 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74  operator for int
19960 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71  eger division..q
19970 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
19980 61 62 65 6c 2d 37 34 30 0d 0a 53 45 4c 45 43 54  abel-740..SELECT
19990 20 2b 20 31 39 20 44 49 56 20 74 61 62 31 2e 63   + 19 DIV tab1.c
199a0 6f 6c 32 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61  ol2 col2 FROM ta
199b0 62 31 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a  b1..----..0..0..
199c0 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74  0....skipif post
199d0 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65  gresql # Postgre
199e0 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20  SQL requires AS 
199f0 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75  when renaming ou
19a00 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 73 6b  tput columns..sk
19a10 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
19a20 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
19a30 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
19a40 65 6c 2d 37 34 30 0d 0a 53 45 4c 45 43 54 20 2b  el-740..SELECT +
19a50 20 31 39 20 2f 20 74 61 62 31 2e 63 6f 6c 32 20   19 / tab1.col2 
19a60 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 0d 0a  col2 FROM tab1..
19a70 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d  ----..0..0..0...
19a80 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
19a90 0d 0a 53 45 4c 45 43 54 20 2d 20 35 32 20 2b 20  ..SELECT - 52 + 
19aa0 2b 20 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c 32 20  + col0 * + col2 
19ab0 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
19ac0 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 37 0d 0a 37 32  0..----..-17..72
19ad0 34 36 0d 0a 37 34 30 0d 0a 0d 0a 71 75 65 72 79  46..740....query
19ae0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
19af0 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 32 20 2b 20  CT ALL - col2 + 
19b00 33 33 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  33 FROM tab1 AS 
19b10 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 31 0d  cor0..----..-21.
19b20 0a 2d 32 34 0d 0a 2d 36 33 0d 0a 0d 0a 71 75 65  .-24..-63....que
19b30 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
19b40 4c 45 43 54 20 32 33 20 2b 20 2b 20 39 35 20 2a  LECT 23 + + 95 *
19b50 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20   col0 FROM tab0 
19b60 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32  AS cor0..----..2
19b70 33 30 33 0d 0a 33 33 34 38 0d 0a 38 34 37 38 0d  303..3348..8478.
19b80 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
19b90 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
19ba0 4e 43 54 20 2d 20 33 36 20 2a 20 2d 20 39 36 20  NCT - 36 * - 96 
19bb0 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
19bc0 30 0d 0a 2d 2d 2d 2d 0d 0a 33 34 35 36 0d 0a 0d  0..----..3456...
19bd0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
19be0 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 31 20  ..SELECT - col1 
19bf0 2b 20 2d 20 63 6f 6c 30 20 2a 20 63 6f 6c 32 20  + - col0 * col2 
19c00 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a  FROM tab0 cor0..
19c10 2d 2d 2d 2d 0d 0a 2d 31 33 32 0d 0a 2d 37 33 38  ----..-132..-738
19c20 39 0d 0a 2d 38 37 38 0d 0a 0d 0a 6f 6e 6c 79 69  9..-878....onlyi
19c30 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49  f mysql # use DI
19c40 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69  V operator for i
19c50 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d  nteger division.
19c60 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
19c70 20 6c 61 62 65 6c 2d 37 34 36 0d 0a 53 45 4c 45   label-746..SELE
19c80 43 54 20 43 41 53 54 28 20 2d 20 63 6f 6c 31 20  CT CAST( - col1 
19c90 41 53 20 53 49 47 4e 45 44 20 29 20 2b 20 2b 20  AS SIGNED ) + + 
19ca0 63 6f 6c 32 20 44 49 56 20 2b 20 63 6f 6c 32 20  col2 DIV + col2 
19cb0 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
19cc0 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 38 35 0d 0a 2d 39  0..----..-85..-9
19cd0 30 0d 0a 2d 39 36 0d 0a 0d 0a 73 6b 69 70 69 66  0..-96....skipif
19ce0 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
19cf0 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
19d00 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 37   rowsort label-7
19d10 34 36 0d 0a 53 45 4c 45 43 54 20 43 41 53 54 20  46..SELECT CAST 
19d20 28 20 2d 20 63 6f 6c 31 20 41 53 20 49 4e 54 45  ( - col1 AS INTE
19d30 47 45 52 20 29 20 2b 20 2b 20 63 6f 6c 32 20 2f  GER ) + + col2 /
19d40 20 2b 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62   + col2 FROM tab
19d50 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
19d60 0a 2d 38 35 0d 0a 2d 39 30 0d 0a 2d 39 36 0d 0a  .-85..-90..-96..
19d70 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65  ..skipif postgre
19d80 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c  sql # PostgreSQL
19d90 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65   requires AS whe
19da0 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75  n renaming outpu
19db0 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79  t columns..query
19dc0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
19dd0 43 54 20 2b 20 2b 20 31 38 20 63 6f 6c 30 20 46  CT + + 18 col0 F
19de0 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
19df0 0d 0a 2d 2d 2d 2d 0d 0a 31 38 0d 0a 31 38 0d 0a  ..----..18..18..
19e00 31 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  18....query I ro
19e10 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
19e20 63 6f 6c 30 20 2a 20 28 20 2d 20 63 6f 6c 30 20  col0 * ( - col0 
19e30 29 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  ) AS col2 FROM t
19e40 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 34 39 0d 0a 36  ab2..----..49..6
19e50 30 38 34 0d 0a 36 32 34 31 0d 0a 0d 0a 73 6b 69  084..6241....ski
19e60 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23  pif postgresql #
19e70 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75   PostgreSQL requ
19e80 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e  ires AS when ren
19e90 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c  aming output col
19ea0 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f  umns..query I ro
19eb0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
19ec0 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c 30 20 63 6f  col2 * - col0 co
19ed0 6c 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d  l1 FROM tab0..--
19ee0 2d 2d 0d 0a 33 35 0d 0a 37 32 39 38 0d 0a 37 39  --..35..7298..79
19ef0 32 0d 0a 0d 0a 71 75 65 72 79 20 49 49 49 49 49  2....query IIIII
19f00 49 49 49 49 49 49 49 20 72 6f 77 73 6f 72 74 0d  IIIIIII rowsort.
19f10 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
19f20 20 2a 20 46 52 4f 4d 20 74 61 62 31 2c 20 74 61   * FROM tab1, ta
19f30 62 30 20 41 53 20 63 6f 72 30 20 43 52 4f 53 53  b0 AS cor0 CROSS
19f40 20 4a 4f 49 4e 20 74 61 62 32 2c 20 74 61 62 30   JOIN tab2, tab0
19f50 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 39 37 32   cor1..----..972
19f60 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20   values hashing 
19f70 74 6f 20 39 33 34 35 33 32 35 31 35 35 64 39 66  to 9345325155d9f
19f80 34 64 37 64 63 34 39 38 36 36 39 30 63 36 33 31  4d7dc4986690c631
19f90 63 62 39 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f  cb9....skipif po
19fa0 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67  stgresql # Postg
19fb0 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41  reSQL requires A
19fc0 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20  S when renaming 
19fd0 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a  output columns..
19fe0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
19ff0 0a 53 45 4c 45 43 54 20 41 4c 4c 20 37 30 20 2a  .SELECT ALL 70 *
1a000 20 2b 20 35 30 20 63 6f 6c 30 20 46 52 4f 4d 20   + 50 col0 FROM 
1a010 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 33 35 30 30  tab1..----..3500
1a020 0d 0a 33 35 30 30 0d 0a 33 35 30 30 0d 0a 0d 0a  ..3500..3500....
1a030 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
1a040 0a 53 45 4c 45 43 54 20 2b 20 2b 20 28 20 2b 20  .SELECT + + ( + 
1a050 37 38 20 29 20 41 53 20 63 6f 6c 31 20 46 52 4f  78 ) AS col1 FRO
1a060 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
1a070 2d 2d 2d 2d 0d 0a 37 38 0d 0a 37 38 0d 0a 37 38  ----..78..78..78
1a080 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
1a090 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 30  ort..SELECT col0
1a0a0 20 2a 20 2d 20 63 6f 6c 30 20 2a 20 2b 20 63 6f   * - col0 * + co
1a0b0 72 30 2e 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20  r0.col1 AS col2 
1a0c0 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
1a0d0 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 38 38 32 35  0..----..-118825
1a0e0 0d 0a 2d 34 39 35 33 36 0d 0a 2d 37 32 30 38 31  ..-49536..-72081
1a0f0 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  1....query I row
1a100 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2d  sort..SELECT - -
1a110 20 33 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53   32 FROM tab2 AS
1a120 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 32 0d   cor0..----..32.
1a130 0a 33 32 0d 0a 33 32 0d 0a 0d 0a 71 75 65 72 79  .32..32....query
1a140 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
1a150 43 54 20 28 20 2d 20 31 35 20 29 20 46 52 4f 4d  CT ( - 15 ) FROM
1a160 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 35   tab0..----..-15
1a170 0d 0a 2d 31 35 0d 0a 2d 31 35 0d 0a 0d 0a 71 75  ..-15..-15....qu
1a180 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
1a190 45 4c 45 43 54 20 41 4c 4c 20 2d 20 28 20 2d 20  ELECT ALL - ( - 
1a1a0 63 6f 6c 30 20 29 20 46 52 4f 4d 20 74 61 62 32  col0 ) FROM tab2
1a1b0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 37 0d 0a   cor0..----..7..
1a1c0 37 38 0d 0a 37 39 0d 0a 0d 0a 71 75 65 72 79 20  78..79....query 
1a1d0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
1a1e0 54 20 41 4c 4c 20 2d 20 63 6f 72 30 2e 63 6f 6c  T ALL - cor0.col
1a1f0 32 20 2b 20 2d 20 63 6f 6c 30 20 46 52 4f 4d 20  2 + - col0 FROM 
1a200 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
1a210 2d 2d 0d 0a 2d 31 32 31 0d 0a 2d 31 37 36 0d 0a  --..-121..-176..
1a220 2d 35 37 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  -57....onlyif my
1a230 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f  sql # support fo
1a240 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63  r MySQL specific
1a250 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e   system types an
1a260 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20  d syntax..query 
1a270 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
1a280 37 35 38 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  758..SELECT ALL 
1a290 2d 20 2b 20 43 41 53 54 28 20 4e 55 4c 4c 20 41  - + CAST( NULL A
1a2a0 53 20 53 49 47 4e 45 44 20 29 20 2a 20 2d 20 36  S SIGNED ) * - 6
1a2b0 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
1a2c0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a  r0..----..NULL..
1a2d0 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b  NULL..NULL....sk
1a2e0 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
1a2f0 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
1a300 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
1a310 65 6c 2d 37 35 38 0d 0a 53 45 4c 45 43 54 20 41  el-758..SELECT A
1a320 4c 4c 20 2d 20 2b 20 43 41 53 54 20 28 20 4e 55  LL - + CAST ( NU
1a330 4c 4c 20 41 53 20 49 4e 54 45 47 45 52 20 29 20  LL AS INTEGER ) 
1a340 2a 20 2d 20 36 20 46 52 4f 4d 20 74 61 62 32 20  * - 6 FROM tab2 
1a350 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e  AS cor0..----..N
1a360 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d  ULL..NULL..NULL.
1a370 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
1a380 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c  rt..SELECT + col
1a390 30 20 2a 20 2d 20 39 38 20 41 53 20 63 6f 6c 32  0 * - 98 AS col2
1a3a0 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d   FROM tab1..----
1a3b0 0d 0a 2d 32 39 34 0d 0a 2d 36 32 37 32 0d 0a 2d  ..-294..-6272..-
1a3c0 37 38 34 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20  7840....query I 
1a3d0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
1a3e0 44 49 53 54 49 4e 43 54 20 63 6f 6c 30 20 2b 20  DISTINCT col0 + 
1a3f0 28 20 74 61 62 31 2e 63 6f 6c 30 20 29 20 46 52  ( tab1.col0 ) FR
1a400 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31  OM tab1..----..1
1a410 32 38 0d 0a 31 36 30 0d 0a 36 0d 0a 0d 0a 71 75  28..160..6....qu
1a420 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
1a430 45 4c 45 43 54 20 2b 20 31 34 20 2a 20 31 30 20  ELECT + 14 * 10 
1a440 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
1a450 32 2c 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  2, tab1 AS cor0.
1a460 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20  .----..9 values 
1a470 68 61 73 68 69 6e 67 20 74 6f 20 65 63 32 65 31  hashing to ec2e1
1a480 30 31 39 30 38 61 30 63 32 61 33 32 38 37 64 65  01908a0c2a3287de
1a490 37 32 39 32 63 61 62 61 61 35 37 0d 0a 0d 0a 73  7292cabaa57....s
1a4a0 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c  kipif postgresql
1a4b0 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65   # PostgreSQL re
1a4c0 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72  quires AS when r
1a4d0 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63  enaming output c
1a4e0 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20  olumns..query I 
1a4f0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
1a500 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c 30 20  DISTINCT - col0 
1a510 2b 20 2b 20 63 6f 6c 31 20 2a 20 63 6f 72 30 2e  + + col1 * cor0.
1a520 63 6f 6c 31 20 63 6f 6c 31 20 46 52 4f 4d 20 74  col1 col1 FROM t
1a530 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
1a540 2d 0d 0a 32 31 30 0d 0a 33 34 30 33 0d 0a 39 35  -..210..3403..95
1a550 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  4....query I row
1a560 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
1a570 20 2b 20 34 38 20 2a 20 2d 20 63 6f 6c 31 20 41   + 48 * - col1 A
1a580 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32  S col2 FROM tab2
1a590 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
1a5a0 2d 31 34 38 38 0d 0a 2d 32 38 33 32 0d 0a 2d 38  -1488..-2832..-8
1a5b0 31 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  16....query I ro
1a5c0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
1a5d0 63 6f 6c 30 20 2a 20 36 30 20 2b 20 2d 20 63 6f  col0 * 60 + - co
1a5e0 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l0 FROM tab2 AS 
1a5f0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 34 31 33 0d  cor0..----..413.
1a600 0a 34 36 30 32 0d 0a 34 36 36 31 0d 0a 0d 0a 71  .4602..4661....q
1a610 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
1a620 53 45 4c 45 43 54 20 28 20 63 6f 6c 30 20 29 20  SELECT ( col0 ) 
1a630 2a 20 63 6f 6c 32 20 2b 20 2d 20 34 31 20 41 53  * col2 + - 41 AS
1a640 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 0d   col2 FROM tab1.
1a650 0a 2d 2d 2d 2d 0d 0a 31 32 31 0d 0a 33 36 30 37  .----..121..3607
1a660 0d 0a 37 36 33 39 0d 0a 0d 0a 71 75 65 72 79 20  ..7639....query 
1a670 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
1a680 54 20 41 4c 4c 20 31 39 20 2b 20 2b 20 63 6f 6c  T ALL 19 + + col
1a690 31 20 2a 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61  1 * col1 FROM ta
1a6a0 62 32 0d 0a 2d 2d 2d 2d 0d 0a 33 30 38 0d 0a 33  b2..----..308..3
1a6b0 35 30 30 0d 0a 39 38 30 0d 0a 0d 0a 73 6b 69 70  500..980....skip
1a6c0 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20  if postgresql # 
1a6d0 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69  PostgreSQL requi
1a6e0 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61  res AS when rena
1a6f0 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75  ming output colu
1a700 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  mns..query I row
1a710 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
1a720 54 49 4e 43 54 20 74 61 62 31 2e 63 6f 6c 32 20  TINCT tab1.col2 
1a730 2b 20 2b 20 63 6f 6c 30 20 63 6f 6c 31 20 46 52  + + col0 col1 FR
1a740 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31  OM tab1..----..1
1a750 32 31 0d 0a 31 37 36 0d 0a 35 37 0d 0a 0d 0a 73  21..176..57....s
1a760 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c  kipif postgresql
1a770 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65   # PostgreSQL re
1a780 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72  quires AS when r
1a790 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63  enaming output c
1a7a0 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20  olumns..query I 
1a7b0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
1a7c0 34 35 20 2a 20 63 6f 6c 31 20 2b 20 2d 20 63 6f  45 * col1 + - co
1a7d0 6c 31 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  l1 col1 FROM tab
1a7e0 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
1a7f0 0a 31 33 36 34 0d 0a 32 35 39 36 0d 0a 37 34 38  .1364..2596..748
1a800 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
1a810 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
1a820 49 4e 43 54 20 63 6f 6c 31 20 2b 20 2d 20 35 39  INCT col1 + - 59
1a830 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d   FROM tab0..----
1a840 0d 0a 32 37 0d 0a 33 32 0d 0a 33 38 0d 0a 0d 0a  ..27..32..38....
1a850 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
1a860 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
1a870 20 2b 20 63 6f 6c 32 20 2b 20 2d 20 63 6f 6c 32   + col2 + - col2
1a880 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
1a890 62 31 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 0d 0a 71  b1..----..0....q
1a8a0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
1a8b0 53 45 4c 45 43 54 20 37 36 20 2b 20 2d 20 63 6f  SELECT 76 + - co
1a8c0 6c 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d  l1 FROM tab0..--
1a8d0 2d 2d 0d 0a 2d 31 30 0d 0a 2d 31 35 0d 0a 2d 32  --..-10..-15..-2
1a8e0 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  1....query I row
1a8f0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
1a900 54 49 4e 43 54 20 63 6f 6c 32 20 2a 20 63 6f 6c  TINCT col2 * col
1a910 31 20 2b 20 2b 20 74 61 62 31 2e 63 6f 6c 32 20  1 + + tab1.col2 
1a920 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
1a930 31 0d 0a 2d 2d 2d 2d 0d 0a 31 33 34 34 0d 0a 31  1..----..1344..1
1a940 34 35 38 0d 0a 36 32 37 0d 0a 0d 0a 6f 6e 6c 79  458..627....only
1a950 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f  if mysql # suppo
1a960 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65  rt for MySQL spe
1a970 63 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70  cific system typ
1a980 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71  es and syntax..q
1a990 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
1a9a0 61 62 65 6c 2d 37 37 33 0d 0a 53 45 4c 45 43 54  abel-773..SELECT
1a9b0 20 43 41 53 54 28 20 4e 55 4c 4c 20 41 53 20 53   CAST( NULL AS S
1a9c0 49 47 4e 45 44 20 29 20 2a 20 63 6f 6c 32 20 2a  IGNED ) * col2 *
1a9d0 20 2d 20 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20   - col2 AS col2 
1a9e0 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d  FROM tab0..----.
1a9f0 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c  .NULL..NULL..NUL
1aa00 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  L....skipif mysq
1aa10 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
1aa20 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
1aa30 6f 72 74 20 6c 61 62 65 6c 2d 37 37 33 0d 0a 53  ort label-773..S
1aa40 45 4c 45 43 54 20 43 41 53 54 20 28 20 4e 55 4c  ELECT CAST ( NUL
1aa50 4c 20 41 53 20 49 4e 54 45 47 45 52 20 29 20 2a  L AS INTEGER ) *
1aa60 20 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c 32 20 41   col2 * - col2 A
1aa70 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30  S col2 FROM tab0
1aa80 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55  ..----..NULL..NU
1aa90 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 6f 6e 6c 79  LL..NULL....only
1aaa0 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44  if mysql # use D
1aab0 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20  IV operator for 
1aac0 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e  integer division
1aad0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1aae0 74 20 6c 61 62 65 6c 2d 37 37 34 0d 0a 53 45 4c  t label-774..SEL
1aaf0 45 43 54 20 2d 20 28 20 63 6f 6c 31 20 2b 20 74  ECT - ( col1 + t
1ab00 61 62 31 2e 63 6f 6c 31 20 29 20 44 49 56 20 63  ab1.col1 ) DIV c
1ab10 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d  ol1 FROM tab1..-
1ab20 2d 2d 2d 0d 0a 2d 32 0d 0a 2d 32 0d 0a 2d 32 0d  ---..-2..-2..-2.
1ab30 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
1ab40 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
1ab50 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1ab60 74 20 6c 61 62 65 6c 2d 37 37 34 0d 0a 53 45 4c  t label-774..SEL
1ab70 45 43 54 20 2d 20 28 20 63 6f 6c 31 20 2b 20 74  ECT - ( col1 + t
1ab80 61 62 31 2e 63 6f 6c 31 20 29 20 2f 20 63 6f 6c  ab1.col1 ) / col
1ab90 31 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d  1 FROM tab1..---
1aba0 2d 0d 0a 2d 32 0d 0a 2d 32 0d 0a 2d 32 0d 0a 0d  -..-2..-2..-2...
1abb0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1abc0 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
1abd0 54 20 2b 20 63 6f 6c 32 20 2a 20 28 20 2d 20 35  T + col2 * ( - 5
1abe0 38 20 29 20 2d 20 63 6f 6c 32 20 41 53 20 63 6f  8 ) - col2 AS co
1abf0 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l2 FROM tab0 AS 
1ac00 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 39 34  cor0..----..-194
1ac10 37 0d 0a 2d 34 38 33 38 0d 0a 2d 35 39 0d 0a 0d  7..-4838..-59...
1ac20 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1ac30 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 30 20 2a 20  ..SELECT col0 * 
1ac40 63 6f 6c 30 20 2d 20 63 6f 6c 31 20 41 53 20 63  col0 - col1 AS c
1ac50 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol0 FROM tab1 AS
1ac60 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 37   cor0..----..-17
1ac70 0d 0a 34 30 38 36 0d 0a 36 33 38 37 0d 0a 0d 0a  ..4086..6387....
1ac80 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73  onlyif mysql # s
1ac90 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c  upport for MySQL
1aca0 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d   specific system
1acb0 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61   types and synta
1acc0 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  x..query I rowso
1acd0 72 74 20 6c 61 62 65 6c 2d 37 37 37 0d 0a 53 45  rt label-777..SE
1ace0 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 30 20 2b 20  LECT ALL col0 + 
1acf0 2b 20 43 41 53 54 28 20 4e 55 4c 4c 20 41 53 20  + CAST( NULL AS 
1ad00 53 49 47 4e 45 44 20 29 20 41 53 20 63 6f 6c 32  SIGNED ) AS col2
1ad10 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
1ad20 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a  r0..----..NULL..
1ad30 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b  NULL..NULL....sk
1ad40 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
1ad50 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
1ad60 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
1ad70 65 6c 2d 37 37 37 0d 0a 53 45 4c 45 43 54 20 41  el-777..SELECT A
1ad80 4c 4c 20 63 6f 6c 30 20 2b 20 2b 20 43 41 53 54  LL col0 + + CAST
1ad90 20 28 20 4e 55 4c 4c 20 41 53 20 49 4e 54 45 47   ( NULL AS INTEG
1ada0 45 52 20 29 20 41 53 20 63 6f 6c 32 20 46 52 4f  ER ) AS col2 FRO
1adb0 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
1adc0 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c  ----..NULL..NULL
1add0 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75 65 72 79 20  ..NULL....query 
1ade0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
1adf0 54 20 2d 20 2b 20 63 6f 6c 31 20 2a 20 28 20 31  T - + col1 * ( 1
1ae00 35 20 29 20 2d 20 63 6f 6c 30 20 2a 20 2d 20 36  5 ) - col0 * - 6
1ae10 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  0 FROM tab2 AS c
1ae20 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 35 0d 0a  or0..----..-45..
1ae30 33 37 39 35 0d 0a 34 34 38 35 0d 0a 0d 0a 71 75  3795..4485....qu
1ae40 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
1ae50 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 63  ELECT DISTINCT c
1ae60 6f 6c 32 20 2b 20 33 32 20 41 53 20 63 6f 6c 30  ol2 + 32 AS col0
1ae70 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
1ae80 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 38 0d 0a 38  r0..----..128..8
1ae90 36 0d 0a 38 39 0d 0a 0d 0a 71 75 65 72 79 20 49  6..89....query I
1aea0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
1aeb0 20 63 6f 6c 30 20 2d 20 2d 20 63 6f 72 30 2e 63   col0 - - cor0.c
1aec0 6f 6c 31 20 2a 20 39 35 20 41 53 20 63 6f 6c 31  ol1 * 95 AS col1
1aed0 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
1aee0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 31 34 0d 0a  r0..----..1014..
1aef0 31 33 31 35 0d 0a 32 34 37 33 0d 0a 0d 0a 71 75  1315..2473....qu
1af00 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
1af10 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 63  ELECT DISTINCT c
1af20 6f 6c 30 20 2d 20 2b 20 35 35 20 41 53 20 63 6f  ol0 - + 55 AS co
1af30 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l1 FROM tab1 AS 
1af40 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 32 0d  cor0..----..-52.
1af50 0a 32 35 0d 0a 39 0d 0a 0d 0a 71 75 65 72 79 20  .25..9....query 
1af60 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
1af70 54 20 44 49 53 54 49 4e 43 54 20 2b 20 36 31 20  T DISTINCT + 61 
1af80 2a 20 74 61 62 31 2e 63 6f 6c 30 20 46 52 4f 4d  * tab1.col0 FROM
1af90 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 38 33   tab1..----..183
1afa0 0d 0a 33 39 30 34 0d 0a 34 38 38 30 0d 0a 0d 0a  ..3904..4880....
1afb0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
1afc0 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 2b 20  .SELECT ALL - + 
1afd0 63 6f 6c 32 20 2a 20 63 6f 72 30 2e 63 6f 6c 31  col2 * cor0.col1
1afe0 20 2a 20 2d 20 63 6f 6c 30 20 2b 20 63 6f 6c 31   * - col0 + col1
1aff0 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
1b000 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 39 37 31 31  r0..----..119711
1b010 0d 0a 35 31 30 35 31 0d 0a 35 38 39 30 0d 0a 0d  ..51051..5890...
1b020 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
1b030 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72  use DIV operator
1b040 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76   for integer div
1b050 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72  ision..query I r
1b060 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 37 38 34  owsort label-784
1b070 0d 0a 53 45 4c 45 43 54 20 38 31 20 2b 20 2d 20  ..SELECT 81 + - 
1b080 74 61 62 30 2e 63 6f 6c 31 20 44 49 56 20 63 6f  tab0.col1 DIV co
1b090 6c 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  l2 AS col2 FROM 
1b0a0 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 36 0d  tab0..----..-16.
1b0b0 0a 37 39 0d 0a 38 30 0d 0a 0d 0a 73 6b 69 70 69  .79..80....skipi
1b0c0 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
1b0d0 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
1b0e0 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
1b0f0 37 38 34 0d 0a 53 45 4c 45 43 54 20 38 31 20 2b  784..SELECT 81 +
1b100 20 2d 20 74 61 62 30 2e 63 6f 6c 31 20 2f 20 63   - tab0.col1 / c
1b110 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  ol2 AS col2 FROM
1b120 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 36   tab0..----..-16
1b130 0d 0a 37 39 0d 0a 38 30 0d 0a 0d 0a 6f 6e 6c 79  ..79..80....only
1b140 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f  if mysql # suppo
1b150 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65  rt for MySQL spe
1b160 63 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70  cific system typ
1b170 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71  es and syntax..q
1b180 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
1b190 61 62 65 6c 2d 37 38 35 0d 0a 53 45 4c 45 43 54  abel-785..SELECT
1b1a0 20 2d 20 43 41 53 54 28 20 4e 55 4c 4c 20 41 53   - CAST( NULL AS
1b1b0 20 53 49 47 4e 45 44 20 29 20 2b 20 63 6f 72 31   SIGNED ) + cor1
1b1c0 2e 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20  .col1 FROM tab2 
1b1d0 41 53 20 63 6f 72 30 20 43 52 4f 53 53 20 4a 4f  AS cor0 CROSS JO
1b1e0 49 4e 20 74 61 62 32 2c 20 74 61 62 32 20 41 53  IN tab2, tab2 AS
1b1f0 20 63 6f 72 31 2c 20 74 61 62 30 20 41 53 20 63   cor1, tab0 AS c
1b200 6f 72 32 0d 0a 2d 2d 2d 2d 0d 0a 38 31 20 76 61  or2..----..81 va
1b210 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20  lues hashing to 
1b220 63 62 33 33 63 33 30 64 36 66 35 32 62 62 62 32  cb33c30d6f52bbb2
1b230 34 33 33 38 61 32 39 33 63 37 34 30 66 32 39 63  4338a293c740f29c
1b240 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
1b250 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
1b260 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
1b270 72 74 20 6c 61 62 65 6c 2d 37 38 35 0d 0a 53 45  rt label-785..SE
1b280 4c 45 43 54 20 2d 20 43 41 53 54 20 28 20 4e 55  LECT - CAST ( NU
1b290 4c 4c 20 41 53 20 49 4e 54 45 47 45 52 20 29 20  LL AS INTEGER ) 
1b2a0 2b 20 63 6f 72 31 2e 63 6f 6c 31 20 46 52 4f 4d  + cor1.col1 FROM
1b2b0 20 74 61 62 32 20 41 53 20 63 6f 72 30 20 43 52   tab2 AS cor0 CR
1b2c0 4f 53 53 20 4a 4f 49 4e 20 74 61 62 32 2c 20 74  OSS JOIN tab2, t
1b2d0 61 62 32 20 41 53 20 63 6f 72 31 2c 20 74 61 62  ab2 AS cor1, tab
1b2e0 30 20 41 53 20 63 6f 72 32 0d 0a 2d 2d 2d 2d 0d  0 AS cor2..----.
1b2f0 0a 38 31 20 76 61 6c 75 65 73 20 68 61 73 68 69  .81 values hashi
1b300 6e 67 20 74 6f 20 63 62 33 33 63 33 30 64 36 66  ng to cb33c30d6f
1b310 35 32 62 62 62 32 34 33 33 38 61 32 39 33 63 37  52bbb24338a293c7
1b320 34 30 66 32 39 63 0d 0a 0d 0a 71 75 65 72 79 20  40f29c....query 
1b330 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
1b340 54 20 2b 20 2b 20 63 6f 6c 32 20 2d 20 39 30 20  T + + col2 - 90 
1b350 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
1b360 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 37 0d 0a 2d 38  0..----..-57..-8
1b370 0d 0a 2d 38 39 0d 0a 0d 0a 71 75 65 72 79 20 49  ..-89....query I
1b380 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
1b390 20 2b 20 32 35 20 41 53 20 63 6f 6c 31 20 46 52   + 25 AS col1 FR
1b3a0 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 20  OM tab0 AS cor0 
1b3b0 43 52 4f 53 53 20 4a 4f 49 4e 20 74 61 62 32 2c  CROSS JOIN tab2,
1b3c0 20 74 61 62 32 20 41 53 20 63 6f 72 31 2c 20 74   tab2 AS cor1, t
1b3d0 61 62 32 20 41 53 20 63 6f 72 32 0d 0a 2d 2d 2d  ab2 AS cor2..---
1b3e0 2d 0d 0a 38 31 20 76 61 6c 75 65 73 20 68 61 73  -..81 values has
1b3f0 68 69 6e 67 20 74 6f 20 36 38 66 63 30 65 65 63  hing to 68fc0eec
1b400 64 34 66 34 33 34 35 38 39 66 33 65 63 35 37 36  d4f434589f3ec576
1b410 62 62 64 30 63 35 34 30 0d 0a 0d 0a 71 75 65 72  bbd0c540....quer
1b420 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
1b430 45 43 54 20 2b 20 63 6f 6c 30 20 2a 20 63 6f 6c  ECT + col0 * col
1b440 31 20 2b 20 2d 20 63 6f 6c 30 20 41 53 20 63 6f  1 + - col0 AS co
1b450 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l1 FROM tab2 AS 
1b460 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 36 34  cor0..----..1264
1b470 0d 0a 32 31 30 0d 0a 34 35 32 34 0d 0a 0d 0a 71  ..210..4524....q
1b480 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
1b490 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c  SELECT ALL - col
1b4a0 32 20 2d 20 28 20 63 6f 6c 32 20 29 20 41 53 20  2 - ( col2 ) AS 
1b4b0 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 63  col0 FROM tab1 c
1b4c0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 38 0d  or0..----..-108.
1b4d0 0a 2d 31 31 34 0d 0a 2d 31 39 32 0d 0a 0d 0a 71  .-114..-192....q
1b4e0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
1b4f0 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 30 20  SELECT ALL col0 
1b500 2a 20 63 6f 6c 30 20 2b 20 2d 20 38 32 20 2a 20  * col0 + - 82 * 
1b510 2d 20 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46  - col2 AS col1 F
1b520 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
1b530 0d 0a 2d 2d 2d 2d 0d 0a 32 32 36 33 0d 0a 38 32  ..----..2263..82
1b540 31 36 0d 0a 39 33 35 37 0d 0a 0d 0a 71 75 65 72  16..9357....quer
1b550 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
1b560 45 43 54 20 2d 20 63 6f 6c 30 20 2a 20 2b 20 34  ECT - col0 * + 4
1b570 20 2d 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62   - col0 FROM tab
1b580 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
1b590 0a 2d 31 35 0d 0a 2d 33 32 30 0d 0a 2d 34 30 30  .-15..-320..-400
1b5a0 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
1b5b0 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61   # use DIV opera
1b5c0 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20  tor for integer 
1b5d0 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20  division..query 
1b5e0 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
1b5f0 37 39 32 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  792..SELECT ALL 
1b600 63 6f 6c 31 20 2a 20 38 37 20 2b 20 2d 20 63 6f  col1 * 87 + - co
1b610 6c 30 20 44 49 56 20 2b 20 63 6f 6c 31 20 2b 20  l0 DIV + col1 + 
1b620 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31  + col1 FROM tab1
1b630 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 33   cor0..----..113
1b640 38 0d 0a 32 32 38 38 0d 0a 38 37 34 0d 0a 0d 0a  8..2288..874....
1b650 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
1b660 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
1b670 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
1b680 61 62 65 6c 2d 37 39 32 0d 0a 53 45 4c 45 43 54  abel-792..SELECT
1b690 20 41 4c 4c 20 63 6f 6c 31 20 2a 20 38 37 20 2b   ALL col1 * 87 +
1b6a0 20 2d 20 63 6f 6c 30 20 2f 20 2b 20 63 6f 6c 31   - col0 / + col1
1b6b0 20 2b 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74   + + col1 FROM t
1b6c0 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab1 cor0..----..
1b6d0 31 31 33 38 0d 0a 32 32 38 38 0d 0a 38 37 34 0d  1138..2288..874.
1b6e0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
1b6f0 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63  rt..SELECT ALL c
1b700 6f 6c 31 20 2a 20 30 20 2a 20 2d 20 28 20 2d 20  ol1 * 0 * - ( - 
1b710 63 6f 6c 31 20 2a 20 2d 20 38 39 20 29 20 2b 20  col1 * - 89 ) + 
1b720 2d 20 28 20 63 6f 6c 32 20 29 20 46 52 4f 4d 20  - ( col2 ) FROM 
1b730 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab1 cor0..----.
1b740 0a 2d 35 34 0d 0a 2d 35 37 0d 0a 2d 39 36 0d 0a  .-54..-57..-96..
1b750 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1b760 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
1b770 43 54 20 2d 20 2d 20 63 6f 72 30 2e 63 6f 6c 31  CT - - cor0.col1
1b780 20 2a 20 34 34 20 46 52 4f 4d 20 74 61 62 31 20   * 44 FROM tab1 
1b790 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
1b7a0 31 34 34 0d 0a 34 34 30 0d 0a 35 37 32 0d 0a 0d  144..440..572...
1b7b0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1b7c0 0d 0a 53 45 4c 45 43 54 20 2b 20 2b 20 63 6f 6c  ..SELECT + + col
1b7d0 31 20 2a 20 2b 20 28 20 63 6f 6c 31 20 29 20 2b  1 * + ( col1 ) +
1b7e0 20 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46 52   col2 AS col0 FR
1b7f0 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
1b800 0a 2d 2d 2d 2d 0d 0a 31 35 37 0d 0a 32 36 35 0d  .----..157..265.
1b810 0a 37 33 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  .730....onlyif m
1b820 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f  ysql # use DIV o
1b830 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65  perator for inte
1b840 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75  ger division..qu
1b850 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
1b860 62 65 6c 2d 37 39 36 0d 0a 53 45 4c 45 43 54 20  bel-796..SELECT 
1b870 44 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c 31 20  DISTINCT + col1 
1b880 44 49 56 20 2b 20 31 31 20 2b 20 63 6f 6c 31 20  DIV + 11 + col1 
1b890 2a 20 2b 20 63 6f 6c 32 20 41 53 20 63 6f 6c 30  * + col2 AS col0
1b8a0 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
1b8b0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 34 39 0d 0a  r0..----..1249..
1b8c0 31 34 30 36 0d 0a 35 37 30 0d 0a 0d 0a 73 6b 69  1406..570....ski
1b8d0 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
1b8e0 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
1b8f0 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
1b900 6c 2d 37 39 36 0d 0a 53 45 4c 45 43 54 20 44 49  l-796..SELECT DI
1b910 53 54 49 4e 43 54 20 2b 20 63 6f 6c 31 20 2f 20  STINCT + col1 / 
1b920 2b 20 31 31 20 2b 20 63 6f 6c 31 20 2a 20 2b 20  + 11 + col1 * + 
1b930 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46 52 4f  col2 AS col0 FRO
1b940 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
1b950 2d 2d 2d 2d 0d 0a 31 32 34 39 0d 0a 31 34 30 36  ----..1249..1406
1b960 0d 0a 35 37 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  ..570....onlyif 
1b970 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20  mysql # support 
1b980 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66  for MySQL specif
1b990 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20  ic system types 
1b9a0 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72  and syntax..quer
1b9b0 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
1b9c0 6c 2d 37 39 37 0d 0a 53 45 4c 45 43 54 20 44 49  l-797..SELECT DI
1b9d0 53 54 49 4e 43 54 20 63 6f 6c 32 20 2a 20 2d 20  STINCT col2 * - 
1b9e0 43 41 53 54 28 20 63 6f 6c 31 20 41 53 20 53 49  CAST( col1 AS SI
1b9f0 47 4e 45 44 20 29 20 2a 20 63 6f 72 30 2e 63 6f  GNED ) * cor0.co
1ba00 6c 30 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  l0 col0 FROM tab
1ba10 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
1ba20 0a 2d 31 31 39 36 35 32 0d 0a 2d 35 31 30 33 34  .-119652..-51034
1ba30 0d 0a 2d 35 38 35 39 0d 0a 0d 0a 73 6b 69 70 69  ..-5859....skipi
1ba40 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50  f postgresql # P
1ba50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72  ostgreSQL requir
1ba60 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d  es AS when renam
1ba70 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d  ing output colum
1ba80 6e 73 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ns..skipif mysql
1ba90 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
1baa0 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
1bab0 72 74 20 6c 61 62 65 6c 2d 37 39 37 0d 0a 53 45  rt label-797..SE
1bac0 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f  LECT DISTINCT co
1bad0 6c 32 20 2a 20 2d 20 43 41 53 54 20 28 20 63 6f  l2 * - CAST ( co
1bae0 6c 31 20 41 53 20 49 4e 54 45 47 45 52 20 29 20  l1 AS INTEGER ) 
1baf0 2a 20 63 6f 72 30 2e 63 6f 6c 30 20 63 6f 6c 30  * cor0.col0 col0
1bb00 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
1bb10 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 39 36 35  r0..----..-11965
1bb20 32 0d 0a 2d 35 31 30 33 34 0d 0a 2d 35 38 35 39  2..-51034..-5859
1bb30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
1bb40 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
1bb50 2b 20 63 6f 6c 30 20 2a 20 2d 20 63 6f 72 30 2e  + col0 * - cor0.
1bb60 63 6f 6c 31 20 2b 20 63 6f 6c 32 20 46 52 4f 4d  col1 + col2 FROM
1bb70 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
1bb80 2d 2d 2d 0d 0a 2d 31 33 30 35 0d 0a 2d 31 39 30  ---..-1305..-190
1bb90 0d 0a 2d 34 35 37 36 0d 0a 0d 0a 73 6b 69 70 69  ..-4576....skipi
1bba0 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50  f postgresql # P
1bbb0 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72  ostgreSQL requir
1bbc0 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d  es AS when renam
1bbd0 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d  ing output colum
1bbe0 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ns..query I rows
1bbf0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f  ort..SELECT - co
1bc00 72 30 2e 63 6f 6c 30 20 2b 20 63 6f 72 30 2e 63  r0.col0 + cor0.c
1bc10 6f 6c 31 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61  ol1 col1 FROM ta
1bc20 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
1bc30 0d 0a 2d 35 34 0d 0a 2d 36 37 0d 0a 32 33 0d 0a  ..-54..-67..23..
1bc40 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1bc50 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
1bc60 43 54 20 2d 20 63 6f 6c 30 20 2a 20 63 6f 6c 30  CT - col0 * col0
1bc70 20 2b 20 2b 20 32 31 20 41 53 20 63 6f 6c 32 20   + + 21 AS col2 
1bc80 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d  FROM tab2..----.
1bc90 0a 2d 32 38 0d 0a 2d 36 30 36 33 0d 0a 2d 36 32  .-28..-6063..-62
1bca0 32 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73  20....skipif pos
1bcb0 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72  tgresql # Postgr
1bcc0 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53  eSQL requires AS
1bcd0 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f   when renaming o
1bce0 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71  utput columns..q
1bcf0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
1bd00 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
1bd10 2d 20 74 61 62 32 2e 63 6f 6c 32 20 2b 20 2b 20  - tab2.col2 + + 
1bd20 63 6f 6c 32 20 2a 20 37 31 20 63 6f 6c 30 20 46  col2 * 71 col0 F
1bd30 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab2..----..
1bd40 31 38 32 30 0d 0a 31 38 39 30 0d 0a 32 36 36 30  1820..1890..2660
1bd50 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
1bd60 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
1bd70 2b 20 2b 20 63 6f 6c 31 20 2b 20 2b 20 63 6f 6c  + + col1 + + col
1bd80 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  0 AS col1 FROM t
1bd90 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
1bda0 2d 0d 0a 31 31 30 0d 0a 31 33 32 0d 0a 31 38 30  -..110..132..180
1bdb0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
1bdc0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
1bdd0 39 20 2a 20 2d 20 63 6f 72 31 2e 63 6f 6c 32 20  9 * - cor1.col2 
1bde0 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
1bdf0 31 2c 20 74 61 62 31 20 41 53 20 63 6f 72 30 2c  1, tab1 AS cor0,
1be00 20 74 61 62 31 20 41 53 20 63 6f 72 31 0d 0a 2d   tab1 AS cor1..-
1be10 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75 65 73 20 68  ---..27 values h
1be20 61 73 68 69 6e 67 20 74 6f 20 34 39 32 35 31 33  ashing to 492513
1be30 61 31 66 62 35 65 34 35 65 37 66 31 66 38 61 30  a1fb5e45e7f1f8a0
1be40 38 37 31 62 34 31 31 31 31 39 0d 0a 0d 0a 6f 6e  871b411119....on
1be50 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70  lyif mysql # sup
1be60 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73  port for MySQL s
1be70 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20 74  pecific system t
1be80 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d  ypes and syntax.
1be90 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1bea0 20 6c 61 62 65 6c 2d 38 30 34 0d 0a 53 45 4c 45   label-804..SELE
1beb0 43 54 20 41 4c 4c 20 2d 20 63 6f 72 30 2e 63 6f  CT ALL - cor0.co
1bec0 6c 32 20 2a 20 43 41 53 54 28 20 4e 55 4c 4c 20  l2 * CAST( NULL 
1bed0 41 53 20 53 49 47 4e 45 44 20 29 20 46 52 4f 4d  AS SIGNED ) FROM
1bee0 20 74 61 62 30 2c 20 74 61 62 32 20 41 53 20 63   tab0, tab2 AS c
1bef0 6f 72 30 2c 20 74 61 62 31 20 63 6f 72 31 2c 20  or0, tab1 cor1, 
1bf00 74 61 62 32 20 41 53 20 63 6f 72 32 0d 0a 2d 2d  tab2 AS cor2..--
1bf10 2d 2d 0d 0a 38 31 20 76 61 6c 75 65 73 20 68 61  --..81 values ha
1bf20 73 68 69 6e 67 20 74 6f 20 63 62 33 33 63 33 30  shing to cb33c30
1bf30 64 36 66 35 32 62 62 62 32 34 33 33 38 61 32 39  d6f52bbb24338a29
1bf40 33 63 37 34 30 66 32 39 63 0d 0a 0d 0a 73 6b 69  3c740f29c....ski
1bf50 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
1bf60 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
1bf70 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
1bf80 6c 2d 38 30 34 0d 0a 53 45 4c 45 43 54 20 41 4c  l-804..SELECT AL
1bf90 4c 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 2a 20  L - cor0.col2 * 
1bfa0 43 41 53 54 20 28 20 4e 55 4c 4c 20 41 53 20 49  CAST ( NULL AS I
1bfb0 4e 54 45 47 45 52 20 29 20 46 52 4f 4d 20 74 61  NTEGER ) FROM ta
1bfc0 62 30 2c 20 74 61 62 32 20 41 53 20 63 6f 72 30  b0, tab2 AS cor0
1bfd0 2c 20 74 61 62 31 20 63 6f 72 31 2c 20 74 61 62  , tab1 cor1, tab
1bfe0 32 20 41 53 20 63 6f 72 32 0d 0a 2d 2d 2d 2d 0d  2 AS cor2..----.
1bff0 0a 38 31 20 76 61 6c 75 65 73 20 68 61 73 68 69  .81 values hashi
1c000 6e 67 20 74 6f 20 63 62 33 33 63 33 30 64 36 66  ng to cb33c30d6f
1c010 35 32 62 62 62 32 34 33 33 38 61 32 39 33 63 37  52bbb24338a293c7
1c020 34 30 66 32 39 63 0d 0a 0d 0a 71 75 65 72 79 20  40f29c....query 
1c030 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
1c040 54 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 41 53  T + cor0.col2 AS
1c050 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 2c   col1 FROM tab0,
1c060 20 74 61 62 32 20 41 53 20 63 6f 72 30 2c 20 74   tab2 AS cor0, t
1c070 61 62 31 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d  ab1 AS cor1..---
1c080 2d 0d 0a 32 37 20 76 61 6c 75 65 73 20 68 61 73  -..27 values has
1c090 68 69 6e 67 20 74 6f 20 34 30 66 64 38 63 63 30  hing to 40fd8cc0
1c0a0 64 65 39 32 65 61 36 38 64 37 33 36 33 34 63 32  de92ea68d73634c2
1c0b0 64 38 66 37 35 62 66 35 0d 0a 0d 0a 71 75 65 72  d8f75bf5....quer
1c0c0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
1c0d0 45 43 54 20 63 6f 6c 30 20 2a 20 2d 20 35 35 20  ECT col0 * - 55 
1c0e0 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
1c0f0 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 32 30 0d 0a  0..----..-1320..
1c100 2d 31 39 32 35 0d 0a 2d 34 38 39 35 0d 0a 0d 0a  -1925..-4895....
1c110 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
1c120 0a 53 45 4c 45 43 54 20 2b 20 35 35 20 2a 20 34  .SELECT + 55 * 4
1c130 33 20 46 52 4f 4d 20 74 61 62 30 2c 20 74 61 62  3 FROM tab0, tab
1c140 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
1c150 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e  .9 values hashin
1c160 67 20 74 6f 20 36 33 30 33 35 63 62 38 37 34 63  g to 63035cb874c
1c170 65 63 37 30 37 33 31 31 32 36 32 63 63 61 62 63  ec707311262ccabc
1c180 61 34 65 35 36 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  a4e56....onlyif 
1c190 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20  mysql # support 
1c1a0 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66  for MySQL specif
1c1b0 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20  ic system types 
1c1c0 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72  and syntax..quer
1c1d0 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
1c1e0 6c 2d 38 30 38 0d 0a 53 45 4c 45 43 54 20 44 49  l-808..SELECT DI
1c1f0 53 54 49 4e 43 54 20 2d 20 2d 20 43 41 53 54 28  STINCT - - CAST(
1c200 20 4e 55 4c 4c 20 41 53 20 53 49 47 4e 45 44 20   NULL AS SIGNED 
1c210 29 20 2a 20 2b 20 39 33 20 2a 20 63 6f 6c 30 20  ) * + 93 * col0 
1c220 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41  col2 FROM tab0 A
1c230 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55  S cor0..----..NU
1c240 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73  LL....skipif pos
1c250 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72  tgresql # Postgr
1c260 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53  eSQL requires AS
1c270 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f   when renaming o
1c280 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 73  utput columns..s
1c290 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
1c2a0 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
1c2b0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
1c2c0 62 65 6c 2d 38 30 38 0d 0a 53 45 4c 45 43 54 20  bel-808..SELECT 
1c2d0 44 49 53 54 49 4e 43 54 20 2d 20 2d 20 43 41 53  DISTINCT - - CAS
1c2e0 54 20 28 20 4e 55 4c 4c 20 41 53 20 49 4e 54 45  T ( NULL AS INTE
1c2f0 47 45 52 20 29 20 2a 20 2b 20 39 33 20 2a 20 63  GER ) * + 93 * c
1c300 6f 6c 30 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61  ol0 col2 FROM ta
1c310 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
1c320 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75 65 72 79 20  ..NULL....query 
1c330 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
1c340 54 20 41 4c 4c 20 63 6f 6c 30 20 2b 20 2d 20 63  T ALL col0 + - c
1c350 6f 6c 32 20 2b 20 2b 20 63 6f 6c 30 20 41 53 20  ol2 + + col0 AS 
1c360 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 63  col0 FROM tab2 c
1c370 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 0d 0a  or0..----..-13..
1c380 31 32 30 0d 0a 31 33 30 0d 0a 0d 0a 6f 6e 6c 79  120..130....only
1c390 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f  if mysql # suppo
1c3a0 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65  rt for MySQL spe
1c3b0 63 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70  cific system typ
1c3c0 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71  es and syntax..q
1c3d0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
1c3e0 61 62 65 6c 2d 38 31 30 0d 0a 53 45 4c 45 43 54  abel-810..SELECT
1c3f0 20 43 41 53 54 28 20 2b 20 39 39 20 41 53 20 53   CAST( + 99 AS S
1c400 49 47 4e 45 44 20 29 20 2b 20 63 6f 6c 31 20 46  IGNED ) + col1 F
1c410 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
1c420 0d 0a 2d 2d 2d 2d 0d 0a 31 30 39 0d 0a 31 31 32  ..----..109..112
1c430 0d 0a 31 32 35 0d 0a 0d 0a 73 6b 69 70 69 66 20  ..125....skipif 
1c440 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
1c450 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
1c460 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 38 31  rowsort label-81
1c470 30 0d 0a 53 45 4c 45 43 54 20 43 41 53 54 20 28  0..SELECT CAST (
1c480 20 2b 20 39 39 20 41 53 20 49 4e 54 45 47 45 52   + 99 AS INTEGER
1c490 20 29 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74   ) + col1 FROM t
1c4a0 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
1c4b0 2d 0d 0a 31 30 39 0d 0a 31 31 32 0d 0a 31 32 35  -..109..112..125
1c4c0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
1c4d0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
1c4e0 2d 20 2d 20 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c  - - col0 + - col
1c4f0 32 20 2a 20 2d 20 63 6f 6c 31 20 46 52 4f 4d 20  2 * - col1 FROM 
1c500 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
1c510 2d 2d 0d 0a 31 33 32 38 0d 0a 31 34 30 37 0d 0a  --..1328..1407..
1c520 36 33 34 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  634....onlyif my
1c530 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f  sql # support fo
1c540 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63  r MySQL specific
1c550 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e   system types an
1c560 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20  d syntax..query 
1c570 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
1c580 38 31 32 0d 0a 53 45 4c 45 43 54 20 2d 20 28 20  812..SELECT - ( 
1c590 2d 20 63 6f 72 30 2e 63 6f 6c 30 20 29 20 2a 20  - cor0.col0 ) * 
1c5a0 63 6f 6c 31 20 2d 20 2d 20 43 41 53 54 28 20 63  col1 - - CAST( c
1c5b0 6f 6c 30 20 41 53 20 53 49 47 4e 45 44 20 29 20  ol0 AS SIGNED ) 
1c5c0 2a 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c 32  * + col1 AS col2
1c5d0 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
1c5e0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 36 31 39 38 0d  r0..----..16198.
1c5f0 0a 34 31 32 38 0d 0a 36 37 39 30 0d 0a 0d 0a 73  .4128..6790....s
1c600 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
1c610 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
1c620 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
1c630 62 65 6c 2d 38 31 32 0d 0a 53 45 4c 45 43 54 20  bel-812..SELECT 
1c640 2d 20 28 20 2d 20 63 6f 72 30 2e 63 6f 6c 30 20  - ( - cor0.col0 
1c650 29 20 2a 20 63 6f 6c 31 20 2d 20 2d 20 43 41 53  ) * col1 - - CAS
1c660 54 20 28 20 63 6f 6c 30 20 41 53 20 49 4e 54 45  T ( col0 AS INTE
1c670 47 45 52 20 29 20 2a 20 2b 20 63 6f 6c 31 20 41  GER ) * + col1 A
1c680 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30  S col2 FROM tab0
1c690 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
1c6a0 31 36 31 39 38 0d 0a 34 31 32 38 0d 0a 36 37 39  16198..4128..679
1c6b0 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  0....query I row
1c6c0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
1c6d0 20 2b 20 63 6f 6c 31 20 2a 20 63 6f 6c 32 20 2b   + col1 * col2 +
1c6e0 20 63 6f 72 30 2e 63 6f 6c 31 20 46 52 4f 4d 20   cor0.col1 FROM 
1c6f0 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
1c700 2d 2d 0d 0a 31 32 36 31 0d 0a 31 34 33 30 0d 0a  --..1261..1430..
1c710 35 38 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  580....query I r
1c720 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
1c730 4c 4c 20 2d 20 2d 20 63 6f 6c 31 20 41 53 20 63  LL - - col1 AS c
1c740 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 63 6f  ol1 FROM tab0 co
1c750 72 30 0d 0a 2d 2d 2d 2d 0d 0a 38 36 0d 0a 39 31  r0..----..86..91
1c760 0d 0a 39 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..97....query I 
1c770 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
1c780 33 33 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  33 AS col0 FROM 
1c790 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 33 33 0d 0a  tab1..----..33..
1c7a0 33 33 0d 0a 33 33 0d 0a 0d 0a 71 75 65 72 79 20  33..33....query 
1c7b0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
1c7c0 54 20 41 4c 4c 20 2b 20 2b 20 28 20 63 6f 6c 31  T ALL + + ( col1
1c7d0 20 29 20 2a 20 2b 20 63 6f 6c 30 20 46 52 4f 4d   ) * + col0 FROM
1c7e0 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
1c7f0 2d 2d 2d 0d 0a 31 33 34 33 0d 0a 32 31 37 0d 0a  ---..1343..217..
1c800 34 36 30 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20  4602....query I 
1c810 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
1c820 2d 20 63 6f 6c 31 20 2b 20 63 6f 6c 30 20 2b 20  - col1 + col0 + 
1c830 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46 52 4f  col2 AS col0 FRO
1c840 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
1c850 2d 2d 2d 2d 0d 0a 31 31 31 0d 0a 31 36 33 0d 0a  ----..111..163..
1c860 33 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  31....query I ro
1c870 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
1c880 53 54 49 4e 43 54 20 2b 20 39 37 20 2a 20 63 6f  STINCT + 97 * co
1c890 6c 30 20 2b 20 2b 20 63 6f 6c 31 20 46 52 4f 4d  l0 + + col1 FROM
1c8a0 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
1c8b0 2d 2d 2d 0d 0a 32 34 31 34 0d 0a 33 34 39 32 0d  ---..2414..3492.
1c8c0 0a 38 37 32 34 0d 0a 0d 0a 71 75 65 72 79 20 49  .8724....query I
1c8d0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
1c8e0 20 63 6f 6c 32 20 2b 20 39 33 20 41 53 20 63 6f   col2 + 93 AS co
1c8f0 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l0 FROM tab1 AS 
1c900 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 34 37 0d  cor0..----..147.
1c910 0a 31 35 30 0d 0a 31 38 39 0d 0a 0d 0a 71 75 65  .150..189....que
1c920 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
1c930 4c 45 43 54 20 2d 20 2b 20 38 38 20 46 52 4f 4d  LECT - + 88 FROM
1c940 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab2 cor0..----
1c950 0d 0a 2d 38 38 0d 0a 2d 38 38 0d 0a 2d 38 38 0d  ..-88..-88..-88.
1c960 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
1c970 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79  # support for My
1c980 53 51 4c 20 73 70 65 63 69 66 69 63 20 73 79 73  SQL specific sys
1c990 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79  tem types and sy
1c9a0 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f  ntax..query I ro
1c9b0 77 73 6f 72 74 20 6c 61 62 65 6c 2d 38 32 31 0d  wsort label-821.
1c9c0 0a 53 45 4c 45 43 54 20 2d 20 43 41 53 54 28 20  .SELECT - CAST( 
1c9d0 63 6f 6c 32 20 41 53 20 53 49 47 4e 45 44 20 29  col2 AS SIGNED )
1c9e0 20 2b 20 2b 20 63 6f 6c 32 20 2a 20 2d 20 43 41   + + col2 * - CA
1c9f0 53 54 28 20 4e 55 4c 4c 20 41 53 20 44 45 43 49  ST( NULL AS DECI
1ca00 4d 41 4c 20 29 20 46 52 4f 4d 20 74 61 62 30 20  MAL ) FROM tab0 
1ca10 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e  AS cor0..----..N
1ca20 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d  ULL..NULL..NULL.
1ca30 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
1ca40 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
1ca50 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1ca60 74 20 6c 61 62 65 6c 2d 38 32 31 0d 0a 53 45 4c  t label-821..SEL
1ca70 45 43 54 20 2d 20 43 41 53 54 20 28 20 63 6f 6c  ECT - CAST ( col
1ca80 32 20 41 53 20 49 4e 54 45 47 45 52 20 29 20 2b  2 AS INTEGER ) +
1ca90 20 2b 20 63 6f 6c 32 20 2a 20 2d 20 43 41 53 54   + col2 * - CAST
1caa0 20 28 20 4e 55 4c 4c 20 41 53 20 52 45 41 4c 20   ( NULL AS REAL 
1cab0 29 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  ) FROM tab0 AS c
1cac0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d  or0..----..NULL.
1cad0 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71  .NULL..NULL....q
1cae0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
1caf0 53 45 4c 45 43 54 20 2d 20 2b 20 38 31 20 2a 20  SELECT - + 81 * 
1cb00 2b 20 63 6f 6c 31 20 2d 20 2d 20 63 6f 6c 31 20  + col1 - - col1 
1cb10 2a 20 2b 20 35 39 20 41 53 20 63 6f 6c 31 20 46  * + 59 AS col1 F
1cb20 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
1cb30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 32 30 0d 0a 2d 32  ..----..-220..-2
1cb40 38 36 0d 0a 2d 35 37 32 0d 0a 0d 0a 71 75 65 72  86..-572....quer
1cb50 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
1cb60 45 43 54 20 41 4c 4c 20 2b 20 2b 20 63 6f 6c 30  ECT ALL + + col0
1cb70 20 2a 20 2d 20 63 6f 6c 31 20 2a 20 63 6f 72 30   * - col1 * cor0
1cb80 2e 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20  .col1 FROM tab0 
1cb90 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
1cba0 31 37 37 35 30 34 0d 0a 2d 33 32 39 33 31 35 0d  177504..-329315.
1cbb0 0a 2d 37 33 37 30 30 39 0d 0a 0d 0a 71 75 65 72  .-737009....quer
1cbc0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
1cbd0 45 43 54 20 2b 20 2b 20 63 6f 6c 32 20 2b 20 2b  ECT + + col2 + +
1cbe0 20 63 6f 6c 30 20 2a 20 38 39 20 41 53 20 63 6f   col0 * 89 AS co
1cbf0 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72  l2 FROM tab0 cor
1cc00 30 0d 0a 2d 2d 2d 2d 0d 0a 32 31 36 39 0d 0a 33  0..----..2169..3
1cc10 31 31 36 0d 0a 38 30 30 33 0d 0a 0d 0a 71 75 65  116..8003....que
1cc20 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
1cc30 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20  LECT DISTINCT - 
1cc40 2b 20 36 37 20 2b 20 2d 20 63 6f 72 30 2e 63 6f  + 67 + - cor0.co
1cc50 6c 32 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  l2 AS col0 FROM 
1cc60 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab2 cor0..----.
1cc70 0a 2d 31 30 35 0d 0a 2d 39 33 0d 0a 2d 39 34 0d  .-105..-93..-94.
1cc80 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72  ...skipif postgr
1cc90 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51  esql # PostgreSQ
1cca0 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68  L requires AS wh
1ccb0 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70  en renaming outp
1ccc0 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72  ut columns..quer
1ccd0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
1cce0 45 43 54 20 41 4c 4c 20 2d 20 34 20 63 6f 6c 32  ECT ALL - 4 col2
1ccf0 20 46 52 4f 4d 20 74 61 62 30 2c 20 74 61 62 30   FROM tab0, tab0
1cd00 20 41 53 20 63 6f 72 30 2c 20 74 61 62 31 20 41   AS cor0, tab1 A
1cd10 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 32 37  S cor1..----..27
1cd20 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20   values hashing 
1cd30 74 6f 20 33 39 65 64 32 33 34 37 35 34 31 32 63  to 39ed23475412c
1cd40 33 63 62 62 61 30 32 65 63 64 64 32 64 37 30 31  3cbba02ecdd2d701
1cd50 38 65 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  8e6....query I r
1cd60 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
1cd70 4c 4c 20 2d 20 2b 20 39 30 20 41 53 20 63 6f 6c  LL - + 90 AS col
1cd80 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  0 FROM tab2 AS c
1cd90 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 39 30 0d 0a  or0..----..-90..
1cda0 2d 39 30 0d 0a 2d 39 30 0d 0a 0d 0a 6f 6e 6c 79  -90..-90....only
1cdb0 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f  if mysql # suppo
1cdc0 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65  rt for MySQL spe
1cdd0 63 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70  cific system typ
1cde0 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71  es and syntax..q
1cdf0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
1ce00 61 62 65 6c 2d 38 32 38 0d 0a 53 45 4c 45 43 54  abel-828..SELECT
1ce10 20 41 4c 4c 20 35 33 20 2b 20 63 6f 6c 30 20 2b   ALL 53 + col0 +
1ce20 20 43 41 53 54 28 20 4e 55 4c 4c 20 41 53 20 53   CAST( NULL AS S
1ce30 49 47 4e 45 44 20 29 20 41 53 20 63 6f 6c 31 20  IGNED ) AS col1 
1ce40 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
1ce50 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e  0..----..NULL..N
1ce60 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69  ULL..NULL....ski
1ce70 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
1ce80 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
1ce90 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
1cea0 6c 2d 38 32 38 0d 0a 53 45 4c 45 43 54 20 41 4c  l-828..SELECT AL
1ceb0 4c 20 35 33 20 2b 20 63 6f 6c 30 20 2b 20 43 41  L 53 + col0 + CA
1cec0 53 54 20 28 20 4e 55 4c 4c 20 41 53 20 49 4e 54  ST ( NULL AS INT
1ced0 45 47 45 52 20 29 20 41 53 20 63 6f 6c 31 20 46  EGER ) AS col1 F
1cee0 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
1cef0 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55  ..----..NULL..NU
1cf00 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75 65 72  LL..NULL....quer
1cf10 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
1cf20 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 2b  ECT DISTINCT + +
1cf30 20 31 34 20 2b 20 2d 20 63 6f 6c 32 20 46 52 4f   14 + - col2 FRO
1cf40 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
1cf50 2d 2d 2d 2d 0d 0a 2d 31 39 0d 0a 2d 36 38 0d 0a  ----..-19..-68..
1cf60 31 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  13....query I ro
1cf70 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
1cf80 4c 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 2a 20  L + cor0.col1 * 
1cf90 2d 20 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46  - col1 AS col2 F
1cfa0 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
1cfb0 0d 0a 2d 2d 2d 2d 0d 0a 2d 37 33 39 36 0d 0a 2d  ..----..-7396..-
1cfc0 38 32 38 31 0d 0a 2d 39 34 30 39 0d 0a 0d 0a 6f  8281..-9409....o
1cfd0 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73  nlyif mysql # us
1cfe0 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66  e DIV operator f
1cff0 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73  or integer divis
1d000 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ion..query I row
1d010 73 6f 72 74 20 6c 61 62 65 6c 2d 38 33 31 0d 0a  sort label-831..
1d020 53 45 4c 45 43 54 20 2b 20 63 6f 6c 30 20 44 49  SELECT + col0 DI
1d030 56 20 63 6f 72 30 2e 63 6f 6c 32 20 46 52 4f 4d  V cor0.col2 FROM
1d040 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab0 cor0..----
1d050 0d 0a 30 0d 0a 31 0d 0a 33 35 0d 0a 0d 0a 73 6b  ..0..1..35....sk
1d060 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
1d070 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
1d080 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
1d090 65 6c 2d 38 33 31 0d 0a 53 45 4c 45 43 54 20 2b  el-831..SELECT +
1d0a0 20 63 6f 6c 30 20 2f 20 63 6f 72 30 2e 63 6f 6c   col0 / cor0.col
1d0b0 32 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30  2 FROM tab0 cor0
1d0c0 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 31 0d 0a 33 35  ..----..0..1..35
1d0d0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
1d0e0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
1d0f0 49 4e 43 54 20 2b 20 39 32 20 2a 20 2b 20 63 6f  INCT + 92 * + co
1d100 6c 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  l0 AS col2 FROM 
1d110 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
1d120 2d 2d 0d 0a 36 34 34 0d 0a 37 31 37 36 0d 0a 37  --..644..7176..7
1d130 32 36 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  268....query I r
1d140 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
1d150 20 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c 32 20 2a   col0 * - col2 *
1d160 20 34 38 20 46 52 4f 4d 20 74 61 62 32 20 41 53   48 FROM tab2 AS
1d170 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 34   cor0..----..-14
1d180 34 30 39 36 0d 0a 2d 39 30 37 32 0d 0a 2d 39 37  4096..-9072..-97
1d190 33 34 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  344....query I r
1d1a0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 28  owsort..SELECT (
1d1b0 20 63 6f 6c 30 20 29 20 2b 20 2b 20 63 6f 72 30   col0 ) + + cor0
1d1c0 2e 63 6f 6c 31 20 2a 20 2d 20 31 30 20 46 52 4f  .col1 * - 10 FRO
1d1d0 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab0 cor0..---
1d1e0 2d 0d 0a 2d 38 32 31 0d 0a 2d 38 33 36 0d 0a 2d  -..-821..-836..-
1d1f0 39 33 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  935....query I r
1d200 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
1d210 4c 4c 20 2b 20 2d 20 37 37 20 2a 20 2d 20 63 6f  LL + - 77 * - co
1d220 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l2 FROM tab2 AS 
1d230 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 30 30 32  cor0..----..2002
1d240 0d 0a 32 30 37 39 0d 0a 32 39 32 36 0d 0a 0d 0a  ..2079..2926....
1d250 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
1d260 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
1d270 20 2b 20 28 20 63 6f 72 30 2e 63 6f 6c 30 20 29   + ( cor0.col0 )
1d280 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
1d290 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 34 0d 0a 33 35  r0..----..24..35
1d2a0 0d 0a 38 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..89....query I 
1d2b0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
1d2c0 2d 20 63 6f 6c 32 20 2b 20 2b 20 28 20 32 38 20  - col2 + + ( 28 
1d2d0 29 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30  ) FROM tab0 cor0
1d2e0 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 0d 0a 2d 35 34 0d  ..----..-5..-54.
1d2f0 0a 32 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .27....query I r
1d300 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
1d310 49 53 54 49 4e 43 54 20 2b 20 2b 20 63 6f 6c 32  ISTINCT + + col2
1d320 20 2a 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 46   * + cor0.col1 F
1d330 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
1d340 0d 0a 2d 2d 2d 2d 0d 0a 31 32 34 38 0d 0a 31 34  ..----..1248..14
1d350 30 34 0d 0a 35 37 30 0d 0a 0d 0a 71 75 65 72 79  04..570....query
1d360 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
1d370 43 54 20 2b 20 63 6f 6c 32 20 2a 20 2b 20 35 38  CT + col2 * + 58
1d380 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
1d390 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
1d3a0 0d 0a 31 39 31 34 0d 0a 34 37 35 36 0d 0a 35 38  ..1914..4756..58
1d3b0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
1d3c0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 72 30  ort..SELECT cor0
1d3d0 2e 63 6f 6c 30 20 2a 20 63 6f 6c 31 20 2a 20 33  .col0 * col1 * 3
1d3e0 39 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  9 AS col1 FROM t
1d3f0 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
1d400 2d 0d 0a 31 37 39 34 37 38 0d 0a 35 32 33 37 37  -..179478..52377
1d410 0d 0a 38 34 36 33 0d 0a 0d 0a 71 75 65 72 79 20  ..8463....query 
1d420 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
1d430 54 20 2b 20 2d 20 63 6f 6c 31 20 2a 20 63 6f 6c  T + - col1 * col
1d440 31 20 2a 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61  1 * col1 FROM ta
1d450 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
1d460 0d 0a 2d 32 30 35 33 37 39 0d 0a 2d 32 39 37 39  ..-205379..-2979
1d470 31 0d 0a 2d 34 39 31 33 0d 0a 0d 0a 6f 6e 6c 79  1..-4913....only
1d480 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44  if mysql # use D
1d490 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20  IV operator for 
1d4a0 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e  integer division
1d4b0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1d4c0 74 20 6c 61 62 65 6c 2d 38 34 32 0d 0a 53 45 4c  t label-842..SEL
1d4d0 45 43 54 20 2b 20 63 6f 6c 32 20 2d 20 2d 20 63  ECT + col2 - - c
1d4e0 6f 6c 31 20 44 49 56 20 63 6f 72 30 2e 63 6f 6c  ol1 DIV cor0.col
1d4f0 31 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  1 AS col1 FROM t
1d500 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
1d510 2d 0d 0a 32 0d 0a 33 34 0d 0a 38 33 0d 0a 0d 0a  -..2..34..83....
1d520 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
1d530 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
1d540 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
1d550 61 62 65 6c 2d 38 34 32 0d 0a 53 45 4c 45 43 54  abel-842..SELECT
1d560 20 2b 20 63 6f 6c 32 20 2d 20 2d 20 63 6f 6c 31   + col2 - - col1
1d570 20 2f 20 63 6f 72 30 2e 63 6f 6c 31 20 41 53 20   / cor0.col1 AS 
1d580 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41  col1 FROM tab0 A
1d590 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 0d  S cor0..----..2.
1d5a0 0a 33 34 0d 0a 38 33 0d 0a 0d 0a 6f 6e 6c 79 69  .34..83....onlyi
1d5b0 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49  f mysql # use DI
1d5c0 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69  V operator for i
1d5d0 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d  nteger division.
1d5e0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1d5f0 20 6c 61 62 65 6c 2d 38 34 33 0d 0a 53 45 4c 45   label-843..SELE
1d600 43 54 20 2d 20 63 6f 6c 32 20 2b 20 63 6f 72 30  CT - col2 + cor0
1d610 2e 63 6f 6c 31 20 44 49 56 20 2b 20 63 6f 72 30  .col1 DIV + cor0
1d620 2e 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20  .col1 FROM tab2 
1d630 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
1d640 32 35 0d 0a 2d 32 36 0d 0a 2d 33 37 0d 0a 0d 0a  25..-26..-37....
1d650 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
1d660 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
1d670 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
1d680 61 62 65 6c 2d 38 34 33 0d 0a 53 45 4c 45 43 54  abel-843..SELECT
1d690 20 2d 20 63 6f 6c 32 20 2b 20 63 6f 72 30 2e 63   - col2 + cor0.c
1d6a0 6f 6c 31 20 2f 20 2b 20 63 6f 72 30 2e 63 6f 6c  ol1 / + cor0.col
1d6b0 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  1 FROM tab2 AS c
1d6c0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 35 0d 0a  or0..----..-25..
1d6d0 2d 32 36 0d 0a 2d 33 37 0d 0a 0d 0a 71 75 65 72  -26..-37....quer
1d6e0 79 20 49 49 49 20 72 6f 77 73 6f 72 74 0d 0a 53  y III rowsort..S
1d6f0 45 4c 45 43 54 20 41 4c 4c 20 2a 20 46 52 4f 4d  ELECT ALL * FROM
1d700 20 74 61 62 31 20 57 48 45 52 45 20 4e 4f 54 20   tab1 WHERE NOT 
1d710 28 20 63 6f 6c 32 20 29 20 3e 20 28 20 63 6f 6c  ( col2 ) > ( col
1d720 32 20 29 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c  2 )..----..9 val
1d730 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 38  ues hashing to 8
1d740 64 36 36 39 32 65 36 64 34 31 35 30 35 63 33 61  d6692e6d41505c3a
1d750 64 34 32 64 39 31 39 62 64 39 65 63 64 30 64 0d  d42d919bd9ecd0d.
1d760 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
1d770 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 74  rt..SELECT ALL t
1d780 61 62 30 2e 63 6f 6c 32 20 2a 20 2d 20 74 61 62  ab0.col2 * - tab
1d790 30 2e 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30  0.col0 FROM tab0
1d7a0 20 57 48 45 52 45 20 4e 4f 54 20 2d 20 63 6f 6c   WHERE NOT - col
1d7b0 32 20 2d 20 2d 20 63 6f 6c 32 20 42 45 54 57 45  2 - - col2 BETWE
1d7c0 45 4e 20 63 6f 6c 30 20 41 4e 44 20 4e 55 4c 4c  EN col0 AND NULL
1d7d0 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 35 0d 0a 2d 37 32  ..----..-35..-72
1d7e0 39 38 0d 0a 2d 37 39 32 0d 0a 0d 0a 71 75 65 72  98..-792....quer
1d7f0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
1d800 45 43 54 20 2d 20 63 6f 6c 30 20 2d 20 2b 20 63  ECT - col0 - + c
1d810 6f 72 30 2e 63 6f 6c 31 20 41 53 20 63 6f 6c 31  or0.col1 AS col1
1d820 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
1d830 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 39 0d 0a 2d  r0..----..-29..-
1d840 37 34 0d 0a 2d 39 33 0d 0a 0d 0a 6f 6e 6c 79 69  74..-93....onlyi
1d850 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49  f mysql # use DI
1d860 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69  V operator for i
1d870 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d  nteger division.
1d880 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1d890 20 6c 61 62 65 6c 2d 38 34 37 0d 0a 53 45 4c 45   label-847..SELE
1d8a0 43 54 20 2b 20 63 6f 6c 31 20 44 49 56 20 2d 20  CT + col1 DIV - 
1d8b0 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a  col0 FROM tab0..
1d8c0 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 2d 32 0d 0a 2d 33  ----..-1..-2..-3
1d8d0 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
1d8e0 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
1d8f0 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
1d900 72 74 20 6c 61 62 65 6c 2d 38 34 37 0d 0a 53 45  rt label-847..SE
1d910 4c 45 43 54 20 2b 20 63 6f 6c 31 20 2f 20 2d 20  LECT + col1 / - 
1d920 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a  col0 FROM tab0..
1d930 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 2d 32 0d 0a 2d 33  ----..-1..-2..-3
1d940 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67  ....skipif postg
1d950 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53  resql # PostgreS
1d960 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77  QL requires AS w
1d970 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74  hen renaming out
1d980 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65  put columns..que
1d990 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
1d9a0 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20  LECT DISTINCT - 
1d9b0 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c 32 20 2d 20  col2 * + col2 - 
1d9c0 74 61 62 30 2e 63 6f 6c 30 20 63 6f 6c 30 20 46  tab0.col0 col0 F
1d9d0 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab0..----..
1d9e0 2d 31 31 31 33 0d 0a 2d 33 36 0d 0a 2d 36 38 31  -1113..-36..-681
1d9f0 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  3....query I row
1da00 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2d  sort..SELECT + -
1da10 20 63 6f 6c 30 20 2a 20 63 6f 6c 30 20 2b 20 63   col0 * col0 + c
1da20 6f 72 30 2e 63 6f 6c 32 20 41 53 20 63 6f 6c 32  or0.col2 AS col2
1da30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
1da40 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 30 33 39 0d  r0..----..-4039.
1da50 0a 2d 36 33 30 34 0d 0a 34 35 0d 0a 0d 0a 6f 6e  .-6304..45....on
1da60 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
1da70 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
1da80 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
1da90 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
1daa0 6f 72 74 20 6c 61 62 65 6c 2d 38 35 30 0d 0a 53  ort label-850..S
1dab0 45 4c 45 43 54 20 2d 20 63 6f 6c 31 20 44 49 56  ELECT - col1 DIV
1dac0 20 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46 52   col0 AS col1 FR
1dad0 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
1dae0 0a 2d 2d 2d 2d 0d 0a 2d 38 0d 0a 30 0d 0a 30 0d  .----..-8..0..0.
1daf0 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
1db00 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
1db10 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1db20 74 20 6c 61 62 65 6c 2d 38 35 30 0d 0a 53 45 4c  t label-850..SEL
1db30 45 43 54 20 2d 20 63 6f 6c 31 20 2f 20 63 6f 6c  ECT - col1 / col
1db40 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  0 AS col1 FROM t
1db50 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
1db60 2d 0d 0a 2d 38 0d 0a 30 0d 0a 30 0d 0a 0d 0a 71  -..-8..0..0....q
1db70 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
1db80 53 45 4c 45 43 54 20 63 6f 6c 32 20 2a 20 2d 20  SELECT col2 * - 
1db90 63 6f 6c 31 20 2b 20 2d 20 63 6f 6c 31 20 2a 20  col1 + - col1 * 
1dba0 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41  col1 FROM tab2 A
1dbb0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
1dbc0 37 39 38 0d 0a 2d 35 30 31 35 0d 0a 2d 39 33 35  798..-5015..-935
1dbd0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
1dbe0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
1dbf0 49 4e 43 54 20 2d 20 63 6f 6c 30 20 2a 20 63 6f  INCT - col0 * co
1dc00 6c 30 20 2b 20 2d 20 63 6f 72 30 2e 63 6f 6c 32  l0 + - cor0.col2
1dc10 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
1dc20 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  b1 cor0..----..-
1dc30 34 31 35 33 0d 0a 2d 36 33 0d 0a 2d 36 34 39 36  4153..-63..-6496
1dc40 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
1dc50 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
1dc60 2b 20 28 20 2d 20 63 6f 6c 30 20 29 20 2a 20 63  + ( - col0 ) * c
1dc70 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  ol1 AS col0 FROM
1dc80 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
1dc90 2d 2d 2d 0d 0a 2d 31 33 34 33 0d 0a 2d 32 31 37  ---..-1343..-217
1dca0 0d 0a 2d 34 36 30 32 0d 0a 0d 0a 71 75 65 72 79  ..-4602....query
1dcb0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
1dcc0 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63 6f  CT DISTINCT + co
1dcd0 6c 31 20 2a 20 63 6f 72 30 2e 63 6f 6c 31 20 2b  l1 * cor0.col1 +
1dce0 20 2d 20 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20   - col1 AS col0 
1dcf0 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
1dd00 30 0d 0a 2d 2d 2d 2d 0d 0a 32 37 32 0d 0a 33 34  0..----..272..34
1dd10 32 32 0d 0a 39 33 30 0d 0a 0d 0a 71 75 65 72 79  22..930....query
1dd20 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
1dd30 43 54 20 2d 20 2d 20 63 6f 72 30 2e 63 6f 6c 31  CT - - cor0.col1
1dd40 20 2a 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20   * col0 AS col0 
1dd50 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
1dd60 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 34 30 0d 0a 36  0..----..1040..6
1dd70 34 30 0d 0a 37 38 0d 0a 0d 0a 71 75 65 72 79 20  40..78....query 
1dd80 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
1dd90 54 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 2b 20  T - cor0.col2 + 
1dda0 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46  + col1 AS col1 F
1ddb0 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
1ddc0 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 38 0d 0a 2d 34 37  ..----..-28..-47
1ddd0 0d 0a 2d 38 33 0d 0a 0d 0a 71 75 65 72 79 20 49  ..-83....query I
1dde0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
1ddf0 20 41 4c 4c 20 2d 20 63 6f 6c 32 20 2b 20 63 6f   ALL - col2 + co
1de00 6c 30 20 2a 20 63 6f 6c 31 20 2a 20 63 6f 6c 32  l0 * col1 * col2
1de10 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d   FROM tab2..----
1de20 0d 0a 31 31 39 36 32 36 0d 0a 35 30 39 39 36 0d  ..119626..50996.
1de30 0a 35 38 33 32 0d 0a 0d 0a 71 75 65 72 79 20 49  .5832....query I
1de40 49 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45  II rowsort..SELE
1de50 43 54 20 2a 20 46 52 4f 4d 20 74 61 62 31 20 57  CT * FROM tab1 W
1de60 48 45 52 45 20 4e 55 4c 4c 20 4e 4f 54 20 49 4e  HERE NULL NOT IN
1de70 20 28 20 2b 20 63 6f 6c 32 20 2b 20 2b 20 63 6f   ( + col2 + + co
1de80 6c 31 20 2b 20 63 6f 6c 32 20 2a 20 63 6f 6c 32  l1 + col2 * col2
1de90 20 29 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a 71 75 65 72   )..----....quer
1dea0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
1deb0 45 43 54 20 2d 20 63 6f 6c 30 20 2b 20 2d 20 63  ECT - col0 + - c
1dec0 6f 6c 31 20 2a 20 63 6f 6c 30 20 46 52 4f 4d 20  ol1 * col0 FROM 
1ded0 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 34 32  tab2..----..-142
1dee0 32 0d 0a 2d 32 32 34 0d 0a 2d 34 36 38 30 0d 0a  2..-224..-4680..
1def0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1df00 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 74 61  t..SELECT ALL ta
1df10 62 31 2e 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20  b1.col1 AS col2 
1df20 46 52 4f 4d 20 74 61 62 31 20 57 48 45 52 45 20  FROM tab1 WHERE 
1df30 4e 4f 54 20 63 6f 6c 31 20 2a 20 2d 20 74 61 62  NOT col1 * - tab
1df40 31 2e 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c 31 20  1.col2 * - col1 
1df50 4e 4f 54 20 42 45 54 57 45 45 4e 20 4e 55 4c 4c  NOT BETWEEN NULL
1df60 20 41 4e 44 20 4e 55 4c 4c 0d 0a 2d 2d 2d 2d 0d   AND NULL..----.
1df70 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
1df80 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63  rt..SELECT ALL c
1df90 6f 6c 31 20 2a 20 63 6f 6c 32 20 2b 20 63 6f 6c  ol1 * col2 + col
1dfa0 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  2 AS col2 FROM t
1dfb0 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 32 38 37 31 0d  ab0..----..2871.
1dfc0 0a 37 35 34 34 0d 0a 39 38 0d 0a 0d 0a 71 75 65  .7544..98....que
1dfd0 72 79 20 49 49 49 20 72 6f 77 73 6f 72 74 0d 0a  ry III rowsort..
1dfe0 53 45 4c 45 43 54 20 2a 20 46 52 4f 4d 20 74 61  SELECT * FROM ta
1dff0 62 31 20 57 48 45 52 45 20 4e 4f 54 20 4e 55 4c  b1 WHERE NOT NUL
1e000 4c 20 3c 3d 20 2d 20 63 6f 6c 32 20 2a 20 2d 20  L <= - col2 * - 
1e010 63 6f 6c 30 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a 6f 6e  col0..----....on
1e020 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
1e030 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
1e040 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
1e050 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
1e060 6f 72 74 20 6c 61 62 65 6c 2d 38 36 33 0d 0a 53  ort label-863..S
1e070 45 4c 45 43 54 20 63 6f 6c 30 20 2b 20 63 6f 6c  ELECT col0 + col
1e080 30 20 44 49 56 20 2b 20 74 61 62 31 2e 63 6f 6c  0 DIV + tab1.col
1e090 32 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d  2 FROM tab1..---
1e0a0 2d 0d 0a 33 0d 0a 36 35 0d 0a 38 30 0d 0a 0d 0a  -..3..65..80....
1e0b0 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
1e0c0 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
1e0d0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
1e0e0 61 62 65 6c 2d 38 36 33 0d 0a 53 45 4c 45 43 54  abel-863..SELECT
1e0f0 20 63 6f 6c 30 20 2b 20 63 6f 6c 30 20 2f 20 2b   col0 + col0 / +
1e100 20 74 61 62 31 2e 63 6f 6c 32 20 46 52 4f 4d 20   tab1.col2 FROM 
1e110 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 33 0d 0a 36  tab1..----..3..6
1e120 35 0d 0a 38 30 0d 0a 0d 0a 71 75 65 72 79 20 49  5..80....query I
1e130 49 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45  II rowsort..SELE
1e140 43 54 20 44 49 53 54 49 4e 43 54 20 2a 20 46 52  CT DISTINCT * FR
1e150 4f 4d 20 74 61 62 32 20 57 48 45 52 45 20 28 20  OM tab2 WHERE ( 
1e160 63 6f 6c 31 20 29 20 49 4e 20 28 20 2b 20 63 6f  col1 ) IN ( + co
1e170 6c 30 20 29 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a 71 75  l0 )..----....qu
1e180 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
1e190 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 32 20 2d  ELECT ALL col2 -
1e1a0 20 2d 20 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c 30   - col2 * + col0
1e1b0 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d   FROM tab0..----
1e1c0 0d 0a 33 36 0d 0a 37 33 38 30 0d 0a 38 32 35 0d  ..36..7380..825.
1e1d0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
1e1e0 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c  rt..SELECT - col
1e1f0 32 20 2a 20 2b 20 63 6f 6c 32 20 41 53 20 63 6f  2 * + col2 AS co
1e200 6c 32 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d  l2 FROM tab0..--
1e210 2d 2d 0d 0a 2d 31 0d 0a 2d 31 30 38 39 0d 0a 2d  --..-1..-1089..-
1e220 36 37 32 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20  6724....query I 
1e230 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
1e240 41 4c 4c 20 63 6f 6c 31 20 2b 20 63 6f 6c 32 20  ALL col1 + col2 
1e250 2a 20 74 61 62 31 2e 63 6f 6c 31 20 46 52 4f 4d  * tab1.col1 FROM
1e260 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 32 36   tab1..----..126
1e270 31 0d 0a 31 34 33 30 0d 0a 35 38 30 0d 0a 0d 0a  1..1430..580....
1e280 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
1e290 0a 53 45 4c 45 43 54 20 63 6f 6c 31 20 2b 20 63  .SELECT col1 + c
1e2a0 6f 6c 30 20 2a 20 74 61 62 31 2e 63 6f 6c 32 20  ol0 * tab1.col2 
1e2b0 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d  FROM tab1..----.
1e2c0 0a 31 38 38 0d 0a 33 36 35 38 0d 0a 37 36 39 33  .188..3658..7693
1e2d0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
1e2e0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f  ort..SELECT + co
1e2f0 6c 32 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  l2 AS col1 FROM 
1e300 74 61 62 32 20 57 48 45 52 45 20 4e 4f 54 20 28  tab2 WHERE NOT (
1e310 20 4e 55 4c 4c 20 29 20 3c 3e 20 63 6f 6c 31 20   NULL ) <> col1 
1e320 2a 20 63 6f 6c 30 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a  * col0..----....
1e330 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
1e340 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 74 61  .SELECT ALL + ta
1e350 62 30 2e 63 6f 6c 32 20 2b 20 74 61 62 30 2e 63  b0.col2 + tab0.c
1e360 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d  ol0 FROM tab0..-
1e370 2d 2d 2d 0d 0a 31 37 31 0d 0a 33 36 0d 0a 35 37  ---..171..36..57
1e380 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
1e390 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61   # use DIV opera
1e3a0 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20  tor for integer 
1e3b0 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20  division..query 
1e3c0 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
1e3d0 38 37 31 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  871..SELECT DIST
1e3e0 49 4e 43 54 20 2b 20 63 6f 6c 32 20 2b 20 2d 20  INCT + col2 + - 
1e3f0 63 6f 6c 31 20 44 49 56 20 2d 20 63 6f 6c 31 20  col1 DIV - col1 
1e400 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
1e410 30 0d 0a 2d 2d 2d 2d 0d 0a 35 35 0d 0a 35 38 0d  0..----..55..58.
1e420 0a 39 37 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  .97....skipif my
1e430 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
1e440 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
1e450 77 73 6f 72 74 20 6c 61 62 65 6c 2d 38 37 31 0d  wsort label-871.
1e460 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
1e470 20 2b 20 63 6f 6c 32 20 2b 20 2d 20 63 6f 6c 31   + col2 + - col1
1e480 20 2f 20 2d 20 63 6f 6c 31 20 46 52 4f 4d 20 74   / - col1 FROM t
1e490 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
1e4a0 2d 0d 0a 35 35 0d 0a 35 38 0d 0a 39 37 0d 0a 0d  -..55..58..97...
1e4b0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1e4c0 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
1e4d0 54 20 2b 20 31 20 2b 20 63 6f 6c 32 20 41 53 20  T + 1 + col2 AS 
1e4e0 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41  col2 FROM tab2 A
1e4f0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 37  S cor0..----..27
1e500 0d 0a 32 38 0d 0a 33 39 0d 0a 0d 0a 71 75 65 72  ..28..39....quer
1e510 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
1e520 45 43 54 20 2d 20 31 38 20 2a 20 2d 20 36 30 20  ECT - 18 * - 60 
1e530 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 46 52 4f 4d  + cor0.col0 FROM
1e540 20 74 61 62 30 2c 20 74 61 62 30 20 41 53 20 63   tab0, tab0 AS c
1e550 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c  or0..----..9 val
1e560 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 37  ues hashing to 7
1e570 30 39 62 31 65 66 39 31 63 66 61 35 36 65 31 64  09b1ef91cfa56e1d
1e580 66 65 37 32 37 31 39 32 63 36 30 64 64 34 66 0d  fe727192c60dd4f.
1e590 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
1e5a0 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c  rt..SELECT - col
1e5b0 32 20 2a 20 63 6f 72 30 2e 63 6f 6c 30 20 41 53  2 * cor0.col0 AS
1e5c0 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20   col1 FROM tab1 
1e5d0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
1e5e0 31 36 32 0d 0a 2d 33 36 34 38 0d 0a 2d 37 36 38  162..-3648..-768
1e5f0 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74  0....skipif post
1e600 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65  gresql # Postgre
1e610 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20  SQL requires AS 
1e620 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75  when renaming ou
1e630 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75  tput columns..qu
1e640 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
1e650 45 4c 45 43 54 20 2d 20 34 20 2a 20 2b 20 63 6f  ELECT - 4 * + co
1e660 6c 30 20 2b 20 2d 20 35 37 20 63 6f 6c 31 20 46  l0 + - 57 col1 F
1e670 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
1e680 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 31 33 0d 0a 2d 33  ..----..-313..-3
1e690 37 37 0d 0a 2d 36 39 0d 0a 0d 0a 71 75 65 72 79  77..-69....query
1e6a0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
1e6b0 43 54 20 41 4c 4c 20 63 6f 6c 32 20 2a 20 2d 20  CT ALL col2 * - 
1e6c0 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c 31 20 2d 20  col1 * + col1 - 
1e6d0 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41  col0 FROM tab0 A
1e6e0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32  S cor0..----..-2
1e6f0 34 34 30 39 32 0d 0a 2d 36 37 39 31 33 31 0d 0a  44092..-679131..
1e700 2d 39 34 34 34 0d 0a 0d 0a 71 75 65 72 79 20 49  -9444....query I
1e710 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
1e720 20 44 49 53 54 49 4e 43 54 20 2b 20 74 61 62 32   DISTINCT + tab2
1e730 2e 63 6f 6c 32 20 2b 20 63 6f 6c 31 20 46 52 4f  .col2 + col1 FRO
1e740 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 35 35  M tab2..----..55
1e750 0d 0a 35 38 0d 0a 38 35 0d 0a 0d 0a 6f 6e 6c 79  ..58..85....only
1e760 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44  if mysql # use D
1e770 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20  IV operator for 
1e780 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e  integer division
1e790 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1e7a0 74 20 6c 61 62 65 6c 2d 38 37 38 0d 0a 53 45 4c  t label-878..SEL
1e7b0 45 43 54 20 63 6f 6c 31 20 2d 20 63 6f 6c 32 20  ECT col1 - col2 
1e7c0 44 49 56 20 2d 20 63 6f 6c 32 20 46 52 4f 4d 20  DIV - col2 FROM 
1e7d0 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 38 37 0d 0a  tab0..----..87..
1e7e0 39 32 0d 0a 39 38 0d 0a 0d 0a 73 6b 69 70 69 66  92..98....skipif
1e7f0 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
1e800 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
1e810 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 38   rowsort label-8
1e820 37 38 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 31 20  78..SELECT col1 
1e830 2d 20 63 6f 6c 32 20 2f 20 2d 20 63 6f 6c 32 20  - col2 / - col2 
1e840 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d  FROM tab0..----.
1e850 0a 38 37 0d 0a 39 32 0d 0a 39 38 0d 0a 0d 0a 71  .87..92..98....q
1e860 75 65 72 79 20 49 49 49 20 72 6f 77 73 6f 72 74  uery III rowsort
1e870 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
1e880 54 20 2a 20 46 52 4f 4d 20 74 61 62 32 20 41 53  T * FROM tab2 AS
1e890 20 63 6f 72 30 20 57 48 45 52 45 20 28 20 63 6f   cor0 WHERE ( co
1e8a0 6c 31 20 2d 20 63 6f 72 30 2e 63 6f 6c 30 20 29  l1 - cor0.col0 )
1e8b0 20 3d 20 28 20 4e 55 4c 4c 20 29 0d 0a 2d 2d 2d   = ( NULL )..---
1e8c0 2d 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74  -....skipif post
1e8d0 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65  gresql # Postgre
1e8e0 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20  SQL requires AS 
1e8f0 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75  when renaming ou
1e900 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75  tput columns..qu
1e910 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
1e920 45 4c 45 43 54 20 63 6f 6c 31 20 2a 20 2b 20 63  ELECT col1 * + c
1e930 6f 6c 32 20 2b 20 63 6f 6c 32 20 2b 20 63 6f 6c  ol2 + col2 + col
1e940 32 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32  2 col1 FROM tab2
1e950 0d 0a 2d 2d 2d 2d 0d 0a 31 35 38 36 0d 0a 37 32  ..----..1586..72
1e960 32 0d 0a 38 39 31 0d 0a 0d 0a 6f 6e 6c 79 69 66  2..891....onlyif
1e970 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56   mysql # use DIV
1e980 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e   operator for in
1e990 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a  teger division..
1e9a0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
1e9b0 6c 61 62 65 6c 2d 38 38 31 0d 0a 53 45 4c 45 43  label-881..SELEC
1e9c0 54 20 63 6f 6c 31 20 2b 20 2d 20 74 61 62 31 2e  T col1 + - tab1.
1e9d0 63 6f 6c 32 20 2d 20 63 6f 6c 31 20 44 49 56 20  col2 - col1 DIV 
1e9e0 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31  + col0 FROM tab1
1e9f0 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 36 0d 0a 2d 34 37  ..----..-36..-47
1ea00 0d 0a 2d 38 33 0d 0a 0d 0a 73 6b 69 70 69 66 20  ..-83....skipif 
1ea10 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
1ea20 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
1ea30 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 38 38  rowsort label-88
1ea40 31 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 31 20 2b  1..SELECT col1 +
1ea50 20 2d 20 74 61 62 31 2e 63 6f 6c 32 20 2d 20 63   - tab1.col2 - c
1ea60 6f 6c 31 20 2f 20 2b 20 63 6f 6c 30 20 46 52 4f  ol1 / + col0 FRO
1ea70 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 33  M tab1..----..-3
1ea80 36 0d 0a 2d 34 37 0d 0a 2d 38 33 0d 0a 0d 0a 71  6..-47..-83....q
1ea90 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
1eaa0 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
1eab0 2b 20 63 6f 6c 30 20 2a 20 63 6f 6c 32 20 2a 20  + col0 * col2 * 
1eac0 2d 20 74 61 62 30 2e 63 6f 6c 32 20 46 52 4f 4d  - tab0.col2 FROM
1ead0 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 36   tab0..----..-26
1eae0 31 33 36 0d 0a 2d 33 35 0d 0a 2d 35 39 38 34 33  136..-35..-59843
1eaf0 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  6....query I row
1eb00 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
1eb10 20 63 6f 6c 32 20 2b 20 63 6f 72 30 2e 63 6f 6c   col2 + cor0.col
1eb20 32 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  2 AS col1 FROM t
1eb30 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab1 cor0..----..
1eb40 31 30 38 0d 0a 31 31 34 0d 0a 31 39 32 0d 0a 0d  108..114..192...
1eb50 0a 71 75 65 72 79 20 49 49 49 20 72 6f 77 73 6f  .query III rowso
1eb60 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2a  rt..SELECT ALL *
1eb70 20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 20   FROM tab1 cor0 
1eb80 57 48 45 52 45 20 4e 55 4c 4c 20 42 45 54 57 45  WHERE NULL BETWE
1eb90 45 4e 20 4e 55 4c 4c 20 41 4e 44 20 4e 55 4c 4c  EN NULL AND NULL
1eba0 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a 6f 6e 6c 79 69 66  ..----....onlyif
1ebb0 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56   mysql # use DIV
1ebc0 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e   operator for in
1ebd0 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a  teger division..
1ebe0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
1ebf0 6c 61 62 65 6c 2d 38 38 35 0d 0a 53 45 4c 45 43  label-885..SELEC
1ec00 54 20 2b 20 63 6f 6c 31 20 44 49 56 20 2b 20 63  T + col1 DIV + c
1ec10 6f 72 30 2e 63 6f 6c 32 20 46 52 4f 4d 20 74 61  or0.col2 FROM ta
1ec20 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
1ec30 0d 0a 31 0d 0a 32 0d 0a 39 37 0d 0a 0d 0a 73 6b  ..1..2..97....sk
1ec40 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
1ec50 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
1ec60 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
1ec70 65 6c 2d 38 38 35 0d 0a 53 45 4c 45 43 54 20 2b  el-885..SELECT +
1ec80 20 63 6f 6c 31 20 2f 20 2b 20 63 6f 72 30 2e 63   col1 / + cor0.c
1ec90 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol2 FROM tab0 AS
1eca0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 0d 0a   cor0..----..1..
1ecb0 32 0d 0a 39 37 0d 0a 0d 0a 71 75 65 72 79 20 49  2..97....query I
1ecc0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
1ecd0 20 41 4c 4c 20 63 6f 6c 32 20 2a 20 63 6f 6c 32   ALL col2 * col2
1ece0 20 2b 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74   + + col0 FROM t
1ecf0 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 35 32 33 0d  ab2..----..1523.
1ed00 0a 37 33 36 0d 0a 37 35 34 0d 0a 0d 0a 71 75 65  .736..754....que
1ed10 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
1ed20 4c 45 43 54 20 2d 20 74 61 62 30 2e 63 6f 6c 30  LECT - tab0.col0
1ed30 20 46 52 4f 4d 20 74 61 62 30 20 57 48 45 52 45   FROM tab0 WHERE
1ed40 20 63 6f 6c 30 20 49 4e 20 28 20 63 6f 6c 30 20   col0 IN ( col0 
1ed50 29 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 34 0d 0a 2d 33  )..----..-24..-3
1ed60 35 0d 0a 2d 38 39 0d 0a 0d 0a 71 75 65 72 79 20  5..-89....query 
1ed70 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
1ed80 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c  T DISTINCT + col
1ed90 31 20 2d 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61  1 - col0 FROM ta
1eda0 62 30 0d 0a 2d 2d 2d 2d 0d 0a 32 0d 0a 36 32 0d  b0..----..2..62.
1edb0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
1edc0 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63  rt..SELECT ALL c
1edd0 6f 6c 31 20 2b 20 63 6f 6c 31 20 2a 20 63 6f 6c  ol1 + col1 * col
1ede0 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  2 AS col2 FROM t
1edf0 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 32 36 31 0d  ab1..----..1261.
1ee00 0a 31 34 33 30 0d 0a 35 38 30 0d 0a 0d 0a 71 75  .1430..580....qu
1ee10 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
1ee20 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 32 20 2d  ELECT ALL col2 -
1ee30 20 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c 30 20 41   col0 * - col0 A
1ee40 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32  S col0 FROM tab2
1ee50 0d 0a 2d 2d 2d 2d 0d 0a 36 31 31 30 0d 0a 36 32  ..----..6110..62
1ee60 37 39 0d 0a 37 36 0d 0a 0d 0a 71 75 65 72 79 20  79..76....query 
1ee70 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
1ee80 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 31 20  T DISTINCT col1 
1ee90 2b 20 74 61 62 31 2e 63 6f 6c 32 20 2b 20 2d 20  + tab1.col2 + - 
1eea0 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 0d 0a  col2 FROM tab1..
1eeb0 2d 2d 2d 2d 0d 0a 31 30 0d 0a 31 33 0d 0a 32 36  ----..10..13..26
1eec0 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67  ....skipif postg
1eed0 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53  resql # PostgreS
1eee0 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77  QL requires AS w
1eef0 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74  hen renaming out
1ef00 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65  put columns..que
1ef10 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
1ef20 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f  LECT DISTINCT co
1ef30 6c 31 20 2b 20 2d 20 74 61 62 32 2e 63 6f 6c 30  l1 + - tab2.col0
1ef40 20 2d 20 63 6f 6c 31 20 2a 20 2b 20 74 61 62 32   - col1 * + tab2
1ef50 2e 63 6f 6c 32 20 63 6f 6c 30 20 46 52 4f 4d 20  .col2 col0 FROM 
1ef60 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 35 35  tab2..----..-155
1ef70 33 0d 0a 2d 37 30 38 0d 0a 2d 38 31 33 0d 0a 0d  3..-708..-813...
1ef80 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1ef90 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63  ..SELECT ALL - c
1efa0 6f 6c 30 20 2a 20 2b 20 63 6f 6c 32 20 2a 20 63  ol0 * + col2 * c
1efb0 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d  ol2 FROM tab0..-
1efc0 2d 2d 2d 0d 0a 2d 32 36 31 33 36 0d 0a 2d 33 35  ---..-26136..-35
1efd0 0d 0a 2d 35 39 38 34 33 36 0d 0a 0d 0a 71 75 65  ..-598436....que
1efe0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
1eff0 4c 45 43 54 20 63 6f 6c 30 20 2a 20 2b 20 63 6f  LECT col0 * + co
1f000 6c 32 20 2b 20 2b 20 63 6f 6c 30 20 46 52 4f 4d  l2 + + col0 FROM
1f010 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 36 35   tab1..----..165
1f020 0d 0a 33 37 31 32 0d 0a 37 37 36 30 0d 0a 0d 0a  ..3712..7760....
1f030 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73  onlyif mysql # s
1f040 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c  upport for MySQL
1f050 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d   specific system
1f060 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61   types and synta
1f070 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  x..query I rowso
1f080 72 74 20 6c 61 62 65 6c 2d 38 39 35 0d 0a 53 45  rt label-895..SE
1f090 4c 45 43 54 20 2b 20 63 6f 72 30 2e 63 6f 6c 30  LECT + cor0.col0
1f0a0 20 2f 20 2d 20 63 6f 6c 31 20 2d 20 2b 20 43 41   / - col1 - + CA
1f0b0 53 54 28 20 4e 55 4c 4c 20 41 53 20 53 49 47 4e  ST( NULL AS SIGN
1f0c0 45 44 20 29 20 41 53 20 63 6f 6c 30 20 46 52 4f  ED ) AS col0 FRO
1f0d0 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
1f0e0 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c  ----..NULL..NULL
1f0f0 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66  ..NULL....skipif
1f100 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
1f110 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
1f120 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 38   rowsort label-8
1f130 39 35 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 72  95..SELECT + cor
1f140 30 2e 63 6f 6c 30 20 2f 20 2d 20 63 6f 6c 31 20  0.col0 / - col1 
1f150 2d 20 2b 20 43 41 53 54 20 28 20 4e 55 4c 4c 20  - + CAST ( NULL 
1f160 41 53 20 49 4e 54 45 47 45 52 20 29 20 41 53 20  AS INTEGER ) AS 
1f170 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41  col0 FROM tab1 A
1f180 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55  S cor0..----..NU
1f190 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a  LL..NULL..NULL..
1f1a0 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65  ..skipif postgre
1f1b0 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c  sql # PostgreSQL
1f1c0 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65   requires AS whe
1f1d0 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75  n renaming outpu
1f1e0 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79  t columns..query
1f1f0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
1f200 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 37 30  CT DISTINCT - 70
1f210 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20   col2 FROM tab2 
1f220 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
1f230 37 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  70....onlyif mys
1f240 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72  ql # support for
1f250 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63 20   MySQL specific 
1f260 73 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64  system types and
1f270 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49   syntax..query I
1f280 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 38   rowsort label-8
1f290 39 37 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 28  97..SELECT ALL (
1f2a0 20 63 6f 6c 32 20 29 20 2a 20 2b 20 43 41 53 54   col2 ) * + CAST
1f2b0 28 20 36 30 20 41 53 20 53 49 47 4e 45 44 20 29  ( 60 AS SIGNED )
1f2c0 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
1f2d0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 39 38 30 0d 0a  r0..----..1980..
1f2e0 34 39 32 30 0d 0a 36 30 0d 0a 0d 0a 73 6b 69 70  4920..60....skip
1f2f0 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
1f300 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
1f310 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
1f320 2d 38 39 37 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  -897..SELECT ALL
1f330 20 28 20 63 6f 6c 32 20 29 20 2a 20 2b 20 43 41   ( col2 ) * + CA
1f340 53 54 20 28 20 36 30 20 41 53 20 49 4e 54 45 47  ST ( 60 AS INTEG
1f350 45 52 20 29 20 46 52 4f 4d 20 74 61 62 30 20 41  ER ) FROM tab0 A
1f360 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 39  S cor0..----..19
1f370 38 30 0d 0a 34 39 32 30 0d 0a 36 30 0d 0a 0d 0a  80..4920..60....
1f380 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
1f390 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 2b 20  .SELECT ALL - + 
1f3a0 37 38 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  78 AS col0 FROM 
1f3b0 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
1f3c0 2d 2d 0d 0a 2d 37 38 0d 0a 2d 37 38 0d 0a 2d 37  --..-78..-78..-7
1f3d0 38 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  8....onlyif mysq
1f3e0 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72  l # use DIV oper
1f3f0 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72  ator for integer
1f400 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79   division..query
1f410 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
1f420 2d 38 39 39 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  -899..SELECT ALL
1f430 20 2d 20 63 6f 6c 32 20 2b 20 2d 20 63 6f 6c 31   - col2 + - col1
1f440 20 44 49 56 20 2b 20 63 6f 6c 31 20 46 52 4f 4d   DIV + col1 FROM
1f450 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab2 cor0..----
1f460 0d 0a 2d 32 37 0d 0a 2d 32 38 0d 0a 2d 33 39 0d  ..-27..-28..-39.
1f470 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
1f480 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
1f490 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1f4a0 74 20 6c 61 62 65 6c 2d 38 39 39 0d 0a 53 45 4c  t label-899..SEL
1f4b0 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 32 20 2b  ECT ALL - col2 +
1f4c0 20 2d 20 63 6f 6c 31 20 2f 20 2b 20 63 6f 6c 31   - col1 / + col1
1f4d0 20 46 52 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d   FROM tab2 cor0.
1f4e0 0a 2d 2d 2d 2d 0d 0a 2d 32 37 0d 0a 2d 32 38 0d  .----..-27..-28.
1f4f0 0a 2d 33 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .-39....query I 
1f500 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
1f510 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c 30 20  DISTINCT - col0 
1f520 2b 20 2d 20 63 6f 6c 32 20 2b 20 74 61 62 31 2e  + - col2 + tab1.
1f530 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46 52 4f  col2 AS col2 FRO
1f540 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 33  M tab1..----..-3
1f550 0d 0a 2d 36 34 0d 0a 2d 38 30 0d 0a 0d 0a 73 6b  ..-64..-80....sk
1f560 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20  ipif postgresql 
1f570 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71  # PostgreSQL req
1f580 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65  uires AS when re
1f590 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f  naming output co
1f5a0 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72  lumns..query I r
1f5b0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
1f5c0 49 53 54 49 4e 43 54 20 28 20 2b 20 74 61 62 31  ISTINCT ( + tab1
1f5d0 2e 63 6f 6c 31 20 29 20 2b 20 2d 20 63 6f 6c 32  .col1 ) + - col2
1f5e0 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 0d   col0 FROM tab1.
1f5f0 0a 2d 2d 2d 2d 0d 0a 2d 32 38 0d 0a 2d 34 37 0d  .----..-28..-47.
1f600 0a 2d 38 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .-83....query I 
1f610 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
1f620 44 49 53 54 49 4e 43 54 20 63 6f 6c 30 20 2a 20  DISTINCT col0 * 
1f630 2b 20 63 6f 6c 31 20 2b 20 2b 20 35 37 20 2a 20  + col1 + + 57 * 
1f640 2d 20 39 31 20 46 52 4f 4d 20 74 61 62 32 0d 0a  - 91 FROM tab2..
1f650 2d 2d 2d 2d 0d 0a 2d 33 38 34 34 0d 0a 2d 34 39  ----..-3844..-49
1f660 37 30 0d 0a 2d 35 38 35 0d 0a 0d 0a 71 75 65 72  70..-585....quer
1f670 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
1f680 45 43 54 20 28 20 2d 20 74 61 62 30 2e 63 6f 6c  ECT ( - tab0.col
1f690 30 20 2b 20 34 30 20 29 20 41 53 20 63 6f 6c 31  0 + 40 ) AS col1
1f6a0 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d   FROM tab0..----
1f6b0 0d 0a 2d 34 39 0d 0a 31 36 0d 0a 35 0d 0a 0d 0a  ..-49..16..5....
1f6c0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
1f6d0 0a 53 45 4c 45 43 54 20 2d 20 2d 20 63 6f 6c 30  .SELECT - - col0
1f6e0 20 2a 20 63 6f 72 30 2e 63 6f 6c 30 20 41 53 20   * cor0.col0 AS 
1f6f0 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41  col0 FROM tab2 A
1f700 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 34 39  S cor0..----..49
1f710 0d 0a 36 30 38 34 0d 0a 36 32 34 31 0d 0a 0d 0a  ..6084..6241....
1f720 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
1f730 0a 53 45 4c 45 43 54 20 2d 20 39 34 20 2a 20 63  .SELECT - 94 * c
1f740 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol1 FROM tab0 AS
1f750 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 38 30   cor0..----..-80
1f760 38 34 0d 0a 2d 38 35 35 34 0d 0a 2d 39 31 31 38  84..-8554..-9118
1f770 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
1f780 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61   # use DIV opera
1f790 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20  tor for integer 
1f7a0 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20  division..query 
1f7b0 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
1f7c0 39 30 36 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  906..SELECT DIST
1f7d0 49 4e 43 54 20 2b 20 38 36 20 2a 20 63 6f 6c 31  INCT + 86 * col1
1f7e0 20 44 49 56 20 2d 20 63 6f 6c 32 20 41 53 20 63   DIV - col2 AS c
1f7f0 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol1 FROM tab1 AS
1f800 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31   cor0..----..-11
1f810 0d 0a 2d 31 35 0d 0a 2d 34 31 0d 0a 0d 0a 73 6b  ..-15..-41....sk
1f820 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
1f830 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
1f840 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
1f850 65 6c 2d 39 30 36 0d 0a 53 45 4c 45 43 54 20 44  el-906..SELECT D
1f860 49 53 54 49 4e 43 54 20 2b 20 38 36 20 2a 20 63  ISTINCT + 86 * c
1f870 6f 6c 31 20 2f 20 2d 20 63 6f 6c 32 20 41 53 20  ol1 / - col2 AS 
1f880 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41  col1 FROM tab1 A
1f890 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
1f8a0 31 0d 0a 2d 31 35 0d 0a 2d 34 31 0d 0a 0d 0a 73  1..-15..-41....s
1f8b0 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c  kipif postgresql
1f8c0 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65   # PostgreSQL re
1f8d0 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72  quires AS when r
1f8e0 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63  enaming output c
1f8f0 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20  olumns..query I 
1f900 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
1f910 44 49 53 54 49 4e 43 54 20 2d 20 2d 20 63 6f 6c  DISTINCT - - col
1f920 32 20 2b 20 33 31 20 63 6f 6c 30 20 46 52 4f 4d  2 + 31 col0 FROM
1f930 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
1f940 2d 2d 2d 0d 0a 35 37 0d 0a 35 38 0d 0a 36 39 0d  ---..57..58..69.
1f950 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72  ...skipif postgr
1f960 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51  esql # PostgreSQ
1f970 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68  L requires AS wh
1f980 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70  en renaming outp
1f990 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72  ut columns..quer
1f9a0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
1f9b0 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 32 20 2a  ECT ALL - col2 *
1f9c0 20 2b 20 63 6f 6c 32 20 2d 20 2d 20 63 6f 6c 31   + col2 - - col1
1f9d0 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 0d   col2 FROM tab0.
1f9e0 0a 2d 2d 2d 2d 0d 0a 2d 31 30 30 33 0d 0a 2d 36  .----..-1003..-6
1f9f0 36 33 33 0d 0a 39 36 0d 0a 0d 0a 71 75 65 72 79  633..96....query
1fa00 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
1fa10 43 54 20 63 6f 6c 32 20 2b 20 2d 20 30 20 46 52  CT col2 + - 0 FR
1fa20 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d  OM tab0 cor0..--
1fa30 2d 2d 0d 0a 31 0d 0a 33 33 0d 0a 38 32 0d 0a 0d  --..1..33..82...
1fa40 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1fa50 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 30 20  ..SELECT - col0 
1fa60 2b 20 2b 20 39 33 20 41 53 20 63 6f 6c 30 20 46  + + 93 AS col0 F
1fa70 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
1fa80 0d 0a 2d 2d 2d 2d 0d 0a 31 33 0d 0a 32 39 0d 0a  ..----..13..29..
1fa90 39 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  90....onlyif mys
1faa0 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65  ql # use DIV ope
1fab0 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65  rator for intege
1fac0 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72  r division..quer
1fad0 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
1fae0 6c 2d 39 31 31 0d 0a 53 45 4c 45 43 54 20 2d 20  l-911..SELECT - 
1faf0 63 6f 72 30 2e 63 6f 6c 32 20 44 49 56 20 2d 20  cor0.col2 DIV - 
1fb00 35 38 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  58 AS col0 FROM 
1fb10 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
1fb20 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a 73  --..0..0..0....s
1fb30 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
1fb40 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
1fb50 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
1fb60 62 65 6c 2d 39 31 31 0d 0a 53 45 4c 45 43 54 20  bel-911..SELECT 
1fb70 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 2f 20 2d 20  - cor0.col2 / - 
1fb80 35 38 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  58 AS col0 FROM 
1fb90 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
1fba0 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a 6f  --..0..0..0....o
1fbb0 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73  nlyif mysql # us
1fbc0 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66  e DIV operator f
1fbd0 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73  or integer divis
1fbe0 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ion..query I row
1fbf0 73 6f 72 74 20 6c 61 62 65 6c 2d 39 31 32 0d 0a  sort label-912..
1fc00 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c  SELECT ALL - col
1fc10 31 20 2b 20 63 6f 6c 31 20 44 49 56 20 2d 20 63  1 + col1 DIV - c
1fc20 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol1 FROM tab0 AS
1fc30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 38 37   cor0..----..-87
1fc40 0d 0a 2d 39 32 0d 0a 2d 39 38 0d 0a 0d 0a 73 6b  ..-92..-98....sk
1fc50 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
1fc60 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
1fc70 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
1fc80 65 6c 2d 39 31 32 0d 0a 53 45 4c 45 43 54 20 41  el-912..SELECT A
1fc90 4c 4c 20 2d 20 63 6f 6c 31 20 2b 20 63 6f 6c 31  LL - col1 + col1
1fca0 20 2f 20 2d 20 63 6f 6c 31 20 46 52 4f 4d 20 74   / - col1 FROM t
1fcb0 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
1fcc0 2d 0d 0a 2d 38 37 0d 0a 2d 39 32 0d 0a 2d 39 38  -..-87..-92..-98
1fcd0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
1fce0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
1fcf0 49 4e 43 54 20 2d 20 63 6f 6c 31 20 2b 20 2d 20  INCT - col1 + - 
1fd00 34 39 20 2a 20 2b 20 63 6f 6c 32 20 2d 20 63 6f  49 * + col2 - co
1fd10 6c 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  l0 AS col1 FROM 
1fd20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
1fd30 2d 2d 0d 0a 2d 31 37 32 37 0d 0a 2d 31 38 31 0d  --..-1727..-181.
1fd40 0a 2d 34 31 39 38 0d 0a 0d 0a 71 75 65 72 79 20  .-4198....query 
1fd50 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
1fd60 54 20 2b 20 63 6f 6c 31 20 2b 20 63 6f 72 30 2e  T + col1 + cor0.
1fd70 63 6f 6c 30 20 2a 20 63 6f 6c 31 20 46 52 4f 4d  col0 * col1 FROM
1fd80 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
1fd90 2d 2d 2d 0d 0a 31 33 36 30 0d 0a 32 34 38 0d 0a  ---..1360..248..
1fda0 34 36 36 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20  4661....query I 
1fdb0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
1fdc0 44 49 53 54 49 4e 43 54 20 63 6f 72 30 2e 63 6f  DISTINCT cor0.co
1fdd0 6c 30 20 2a 20 2b 20 28 20 2b 20 63 6f 6c 30 20  l0 * + ( + col0 
1fde0 29 20 2b 20 2b 20 63 6f 6c 31 20 2a 20 2b 20 33  ) + + col1 * + 3
1fdf0 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  0 FROM tab0 AS c
1fe00 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 36 35 31  or0..----..10651
1fe10 0d 0a 33 31 35 36 0d 0a 34 31 33 35 0d 0a 0d 0a  ..3156..4135....
1fe20 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73  onlyif mysql # s
1fe30 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c  upport for MySQL
1fe40 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d   specific system
1fe50 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61   types and synta
1fe60 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  x..query I rowso
1fe70 72 74 20 6c 61 62 65 6c 2d 39 31 36 0d 0a 53 45  rt label-916..SE
1fe80 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f  LECT DISTINCT co
1fe90 6c 30 20 2a 20 2d 20 74 61 62 30 2e 63 6f 6c 31  l0 * - tab0.col1
1fea0 20 2b 20 43 41 53 54 28 20 63 6f 6c 31 20 2a 20   + CAST( col1 * 
1feb0 63 6f 6c 31 20 41 53 20 53 49 47 4e 45 44 20 29  col1 AS SIGNED )
1fec0 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62   + col1 FROM tab
1fed0 30 0d 0a 2d 2d 2d 2d 0d 0a 32 37 33 0d 0a 35 34  0..----..273..54
1fee0 31 38 0d 0a 36 31 31 31 0d 0a 0d 0a 73 6b 69 70  18..6111....skip
1fef0 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
1ff00 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
1ff10 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
1ff20 2d 39 31 36 0d 0a 53 45 4c 45 43 54 20 44 49 53  -916..SELECT DIS
1ff30 54 49 4e 43 54 20 63 6f 6c 30 20 2a 20 2d 20 74  TINCT col0 * - t
1ff40 61 62 30 2e 63 6f 6c 31 20 2b 20 43 41 53 54 20  ab0.col1 + CAST 
1ff50 28 20 63 6f 6c 31 20 2a 20 63 6f 6c 31 20 41 53  ( col1 * col1 AS
1ff60 20 49 4e 54 45 47 45 52 20 29 20 2b 20 63 6f 6c   INTEGER ) + col
1ff70 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d  1 FROM tab0..---
1ff80 2d 0d 0a 32 37 33 0d 0a 35 34 31 38 0d 0a 36 31  -..273..5418..61
1ff90 31 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  11....query I ro
1ffa0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 34 38  wsort..SELECT 48
1ffb0 20 2b 20 74 61 62 32 2e 63 6f 6c 30 20 41 53 20   + tab2.col0 AS 
1ffc0 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 0d 0a  col0 FROM tab2..
1ffd0 2d 2d 2d 2d 0d 0a 31 32 36 0d 0a 31 32 37 0d 0a  ----..126..127..
1ffe0 35 35 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  55....onlyif mys
1fff0 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65  ql # use DIV ope
20000 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65  rator for intege
20010 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72  r division..quer
20020 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
20030 6c 2d 39 31 38 0d 0a 53 45 4c 45 43 54 20 44 49  l-918..SELECT DI
20040 53 54 49 4e 43 54 20 2d 20 28 20 2b 20 63 6f 6c  STINCT - ( + col
20050 31 20 29 20 44 49 56 20 2d 20 63 6f 6c 31 20 2b  1 ) DIV - col1 +
20060 20 2b 20 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c 32   + col2 * + col2
20070 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
20080 62 31 0d 0a 2d 2d 2d 2d 0d 0a 32 39 31 37 0d 0a  b1..----..2917..
20090 33 32 35 30 0d 0a 39 32 31 37 0d 0a 0d 0a 73 6b  3250..9217....sk
200a0 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
200b0 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
200c0 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
200d0 65 6c 2d 39 31 38 0d 0a 53 45 4c 45 43 54 20 44  el-918..SELECT D
200e0 49 53 54 49 4e 43 54 20 2d 20 28 20 2b 20 63 6f  ISTINCT - ( + co
200f0 6c 31 20 29 20 2f 20 2d 20 63 6f 6c 31 20 2b 20  l1 ) / - col1 + 
20100 2b 20 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c 32 20  + col2 * + col2 
20110 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
20120 31 0d 0a 2d 2d 2d 2d 0d 0a 32 39 31 37 0d 0a 33  1..----..2917..3
20130 32 35 30 0d 0a 39 32 31 37 0d 0a 0d 0a 71 75 65  250..9217....que
20140 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
20150 4c 45 43 54 20 74 61 62 30 2e 63 6f 6c 30 20 2a  LECT tab0.col0 *
20160 20 2d 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20   - col0 AS col0 
20170 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d  FROM tab0..----.
20180 0a 2d 31 32 32 35 0d 0a 2d 35 37 36 0d 0a 2d 37  .-1225..-576..-7
20190 39 32 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  921....query I r
201a0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 28  owsort..SELECT (
201b0 20 2d 20 63 6f 6c 30 20 2a 20 36 38 20 29 20 2b   - col0 * 68 ) +
201c0 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 0d   col1 FROM tab2.
201d0 0a 2d 2d 2d 2d 0d 0a 2d 34 34 35 0d 0a 2d 35 32  .----..-445..-52
201e0 34 35 0d 0a 2d 35 33 35 35 0d 0a 0d 0a 71 75 65  45..-5355....que
201f0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
20200 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f  LECT DISTINCT co
20210 6c 30 20 2d 20 2b 20 63 6f 6c 31 20 46 52 4f 4d  l0 - + col1 FROM
20220 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 33   tab1..----..-23
20230 0d 0a 35 34 0d 0a 36 37 0d 0a 0d 0a 71 75 65 72  ..54..67....quer
20240 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
20250 45 43 54 20 41 4c 4c 20 2d 20 74 61 62 31 2e 63  ECT ALL - tab1.c
20260 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  ol1 AS col0 FROM
20270 20 74 61 62 31 2c 20 74 61 62 32 2c 20 74 61 62   tab1, tab2, tab
20280 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
20290 0a 32 37 20 76 61 6c 75 65 73 20 68 61 73 68 69  .27 values hashi
202a0 6e 67 20 74 6f 20 63 37 38 39 30 34 36 39 65 61  ng to c7890469ea
202b0 62 62 32 63 36 66 63 38 31 34 35 34 62 33 35 64  bb2c6fc81454b35d
202c0 32 33 33 33 62 36 0d 0a 0d 0a 71 75 65 72 79 20  2333b6....query 
202d0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
202e0 54 20 2b 20 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c  T + col0 + + col
202f0 31 20 2a 20 63 6f 6c 31 20 41 53 20 63 6f 6c 31  1 * col1 AS col1
20300 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d   FROM tab2..----
20310 0d 0a 33 35 35 39 0d 0a 33 36 38 0d 0a 39 36 38  ..3559..368..968
20320 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
20330 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
20340 2d 20 63 6f 6c 30 20 2b 20 63 6f 6c 30 20 2a 20  - col0 + col0 * 
20350 2b 20 38 30 20 2b 20 63 6f 6c 30 20 46 52 4f 4d  + 80 + col0 FROM
20360 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 35 36 30   tab2..----..560
20370 0d 0a 36 32 34 30 0d 0a 36 33 32 30 0d 0a 0d 0a  ..6240..6320....
20380 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73  onlyif mysql # s
20390 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c  upport for MySQL
203a0 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d   specific system
203b0 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61   types and synta
203c0 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  x..query I rowso
203d0 72 74 20 6c 61 62 65 6c 2d 39 32 35 0d 0a 53 45  rt label-925..SE
203e0 4c 45 43 54 20 2b 20 43 41 53 54 28 20 4e 55 4c  LECT + CAST( NUL
203f0 4c 20 41 53 20 53 49 47 4e 45 44 20 29 20 2b 20  L AS SIGNED ) + 
20400 2d 20 63 6f 6c 30 20 2f 20 2d 20 63 6f 6c 30 20  - col0 / - col0 
20410 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
20420 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e  0..----..NULL..N
20430 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69  ULL..NULL....ski
20440 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
20450 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
20460 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
20470 6c 2d 39 32 35 0d 0a 53 45 4c 45 43 54 20 2b 20  l-925..SELECT + 
20480 43 41 53 54 20 28 20 4e 55 4c 4c 20 41 53 20 49  CAST ( NULL AS I
20490 4e 54 45 47 45 52 20 29 20 2b 20 2d 20 63 6f 6c  NTEGER ) + - col
204a0 30 20 2f 20 2d 20 63 6f 6c 30 20 46 52 4f 4d 20  0 / - col0 FROM 
204b0 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
204c0 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a  --..NULL..NULL..
204d0 4e 55 4c 4c 0d 0a 0d 0a 71 75 65 72 79 20 49 20  NULL....query I 
204e0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
204f0 41 4c 4c 20 63 6f 6c 31 20 2b 20 63 6f 6c 32 20  ALL col1 + col2 
20500 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
20510 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 35 35  2 cor0..----..55
20520 0d 0a 35 38 0d 0a 38 35 0d 0a 0d 0a 71 75 65 72  ..58..85....quer
20530 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
20540 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 2d  ECT DISTINCT - -
20550 20 35 35 20 46 52 4f 4d 20 74 61 62 30 20 63 6f   55 FROM tab0 co
20560 72 30 0d 0a 2d 2d 2d 2d 0d 0a 35 35 0d 0a 0d 0a  r0..----..55....
20570 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73  onlyif mysql # s
20580 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c  upport for MySQL
20590 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d   specific system
205a0 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61   types and synta
205b0 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  x..query I rowso
205c0 72 74 20 6c 61 62 65 6c 2d 39 32 38 0d 0a 53 45  rt label-928..SE
205d0 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20  LECT DISTINCT + 
205e0 43 41 53 54 28 20 2d 20 63 6f 6c 31 20 41 53 20  CAST( - col1 AS 
205f0 53 49 47 4e 45 44 20 29 20 2a 20 2d 20 63 6f 6c  SIGNED ) * - col
20600 32 20 2b 20 63 6f 6c 32 20 41 53 20 63 6f 6c 32  2 + col2 AS col2
20610 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
20620 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 38 37 31 0d 0a  r0..----..2871..
20630 37 35 34 34 0d 0a 39 38 0d 0a 0d 0a 73 6b 69 70  7544..98....skip
20640 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
20650 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
20660 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
20670 2d 39 32 38 0d 0a 53 45 4c 45 43 54 20 44 49 53  -928..SELECT DIS
20680 54 49 4e 43 54 20 2b 20 43 41 53 54 20 28 20 2d  TINCT + CAST ( -
20690 20 63 6f 6c 31 20 41 53 20 49 4e 54 45 47 45 52   col1 AS INTEGER
206a0 20 29 20 2a 20 2d 20 63 6f 6c 32 20 2b 20 63 6f   ) * - col2 + co
206b0 6c 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  l2 AS col2 FROM 
206c0 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
206d0 2d 2d 0d 0a 32 38 37 31 0d 0a 37 35 34 34 0d 0a  --..2871..7544..
206e0 39 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  98....query I ro
206f0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
20700 4c 20 2b 20 2b 20 35 38 20 2a 20 37 30 20 2b 20  L + + 58 * 70 + 
20710 2d 20 63 6f 72 30 2e 63 6f 6c 31 20 46 52 4f 4d  - cor0.col1 FROM
20720 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
20730 2d 2d 2d 0d 0a 34 30 33 34 0d 0a 34 30 34 37 0d  ---..4034..4047.
20740 0a 34 30 35 30 0d 0a 0d 0a 71 75 65 72 79 20 49  .4050....query I
20750 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
20760 20 44 49 53 54 49 4e 43 54 20 2d 20 2b 20 28 20   DISTINCT - + ( 
20770 63 6f 6c 32 20 29 20 2a 20 2d 20 63 6f 6c 31 20  col2 ) * - col1 
20780 2b 20 2b 20 63 6f 6c 30 20 2a 20 63 6f 6c 30 20  + + col0 * col0 
20790 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32  + col0 FROM tab2
207a0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
207b0 36 39 36 36 0d 0a 37 36 39 36 0d 0a 38 39 33 0d  6966..7696..893.
207c0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
207d0 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
207e0 4e 43 54 20 39 39 20 2a 20 2b 20 63 6f 6c 30 20  NCT 99 * + col0 
207f0 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
20800 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
20810 0a 32 33 37 36 0d 0a 33 34 36 35 0d 0a 38 38 31  .2376..3465..881
20820 31 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  1....onlyif mysq
20830 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20  l # support for 
20840 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63 20 73  MySQL specific s
20850 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20  ystem types and 
20860 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20  syntax..query I 
20870 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 39 33  rowsort label-93
20880 32 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  2..SELECT DISTIN
20890 43 54 20 2d 20 43 41 53 54 28 20 4e 55 4c 4c 20  CT - CAST( NULL 
208a0 41 53 20 53 49 47 4e 45 44 20 29 20 2a 20 2d 20  AS SIGNED ) * - 
208b0 63 6f 6c 31 20 2a 20 63 6f 6c 32 20 46 52 4f 4d  col1 * col2 FROM
208c0 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
208d0 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69  ---..NULL....ski
208e0 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
208f0 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
20900 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
20910 6c 2d 39 33 32 0d 0a 53 45 4c 45 43 54 20 44 49  l-932..SELECT DI
20920 53 54 49 4e 43 54 20 2d 20 43 41 53 54 20 28 20  STINCT - CAST ( 
20930 4e 55 4c 4c 20 41 53 20 49 4e 54 45 47 45 52 20  NULL AS INTEGER 
20940 29 20 2a 20 2d 20 63 6f 6c 31 20 2a 20 63 6f 6c  ) * - col1 * col
20950 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  2 FROM tab0 AS c
20960 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d  or0..----..NULL.
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 41 4c 4c 20 31  rt..SELECT ALL 1
20990 39 20 2b 20 2d 20 30 20 2b 20 2b 20 63 6f 6c 30  9 + - 0 + + col0
209a0 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
209b0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 32 0d 0a 38 33  r0..----..22..83
209c0 0d 0a 39 39 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  ..99....onlyif m
209d0 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66  ysql # support f
209e0 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69  or MySQL specifi
209f0 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61  c system types a
20a00 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79  nd syntax..query
20a10 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
20a20 2d 39 33 34 0d 0a 53 45 4c 45 43 54 20 44 49 53  -934..SELECT DIS
20a30 54 49 4e 43 54 20 43 41 53 54 28 20 4e 55 4c 4c  TINCT CAST( NULL
20a40 20 41 53 20 53 49 47 4e 45 44 20 29 20 2a 20 33   AS SIGNED ) * 3
20a50 39 20 46 52 4f 4d 20 74 61 62 30 2c 20 74 61 62  9 FROM tab0, tab
20a60 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
20a70 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20  .NULL....skipif 
20a80 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
20a90 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
20aa0 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 39 33  rowsort label-93
20ab0 34 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  4..SELECT DISTIN
20ac0 43 54 20 43 41 53 54 20 28 20 4e 55 4c 4c 20 41  CT CAST ( NULL A
20ad0 53 20 49 4e 54 45 47 45 52 20 29 20 2a 20 33 39  S INTEGER ) * 39
20ae0 20 46 52 4f 4d 20 74 61 62 30 2c 20 74 61 62 31   FROM tab0, tab1
20af0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
20b00 4e 55 4c 4c 0d 0a 0d 0a 71 75 65 72 79 20 49 20  NULL....query I 
20b10 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
20b20 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c 32 20 2a 20  col0 + - col2 * 
20b30 2b 20 63 6f 6c 31 20 2a 20 63 6f 6c 31 20 46 52  + col1 * col1 FR
20b40 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d  OM tab2..----..-
20b50 31 30 39 30 33 0d 0a 2d 32 35 39 34 30 0d 0a 2d  10903..-25940..-
20b60 39 30 34 32 38 0d 0a 0d 0a 71 75 65 72 79 20 49  90428....query I
20b70 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
20b80 20 2d 20 74 61 62 32 2e 63 6f 6c 31 20 2a 20 63   - tab2.col1 * c
20b90 6f 6c 31 20 2a 20 2d 20 63 6f 6c 30 20 2d 20 63  ol1 * - col0 - c
20ba0 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  ol2 AS col2 FROM
20bb0 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 32 32 37   tab2..----..227
20bc0 39 33 0d 0a 32 37 31 34 39 32 0d 0a 36 37 30 30  93..271492..6700
20bd0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
20be0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 31 20  ort..SELECT + 1 
20bf0 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
20c00 31 2c 20 74 61 62 30 20 41 53 20 63 6f 72 30 20  1, tab0 AS cor0 
20c10 43 52 4f 53 53 20 4a 4f 49 4e 20 74 61 62 30 0d  CROSS JOIN tab0.
20c20 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75 65 73  .----..27 values
20c30 20 68 61 73 68 69 6e 67 20 74 6f 20 64 61 38 61   hashing to da8a
20c40 37 32 61 37 39 36 37 63 30 63 37 33 64 39 31 32  72a7967c0c73d912
20c50 33 39 32 37 35 32 33 30 61 65 64 39 0d 0a 0d 0a  39275230aed9....
20c60 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71  skipif postgresq
20c70 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72  l # PostgreSQL r
20c80 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20  equires AS when 
20c90 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20  renaming output 
20ca0 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49  columns..query I
20cb0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
20cc0 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 63 6f 6c   + cor0.col1 col
20cd0 31 20 46 52 4f 4d 20 74 61 62 31 2c 20 74 61 62  1 FROM tab1, tab
20ce0 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
20cf0 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e  .9 values hashin
20d00 67 20 74 6f 20 33 36 36 65 63 35 33 39 61 66 30  g to 366ec539af0
20d10 66 33 37 62 64 31 35 31 39 62 63 35 36 38 66 33  f37bd1519bc568f3
20d20 64 36 37 37 35 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  d6775....onlyif 
20d30 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20  mysql # support 
20d40 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66  for MySQL specif
20d50 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20  ic system types 
20d60 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72  and syntax..quer
20d70 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
20d80 6c 2d 39 33 39 0d 0a 53 45 4c 45 43 54 20 43 41  l-939..SELECT CA
20d90 53 54 28 20 2d 20 63 6f 6c 31 20 2a 20 63 6f 6c  ST( - col1 * col
20da0 32 20 41 53 20 53 49 47 4e 45 44 20 29 20 2b 20  2 AS SIGNED ) + 
20db0 2b 20 63 6f 6c 31 20 2a 20 2b 20 28 20 63 6f 6c  + col1 * + ( col
20dc0 31 20 29 20 2a 20 37 37 20 46 52 4f 4d 20 74 61  1 ) * 77 FROM ta
20dd0 62 32 0d 0a 2d 2d 2d 2d 0d 0a 32 31 36 30 37 0d  b2..----..21607.
20de0 0a 32 36 36 35 30 33 0d 0a 37 33 31 36 30 0d 0a  .266503..73160..
20df0 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
20e00 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
20e10 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
20e20 20 6c 61 62 65 6c 2d 39 33 39 0d 0a 53 45 4c 45   label-939..SELE
20e30 43 54 20 43 41 53 54 20 28 20 2d 20 63 6f 6c 31  CT CAST ( - col1
20e40 20 2a 20 63 6f 6c 32 20 41 53 20 49 4e 54 45 47   * col2 AS INTEG
20e50 45 52 20 29 20 2b 20 2b 20 63 6f 6c 31 20 2a 20  ER ) + + col1 * 
20e60 2b 20 28 20 63 6f 6c 31 20 29 20 2a 20 37 37 20  + ( col1 ) * 77 
20e70 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d  FROM tab2..----.
20e80 0a 32 31 36 30 37 0d 0a 32 36 36 35 30 33 0d 0a  .21607..266503..
20e90 37 33 31 36 30 0d 0a 0d 0a 71 75 65 72 79 20 49  73160....query I
20ea0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
20eb0 20 41 4c 4c 20 74 61 62 31 2e 63 6f 6c 32 20 2a   ALL tab1.col2 *
20ec0 20 2b 20 28 20 63 6f 6c 31 20 29 20 46 52 4f 4d   + ( col1 ) FROM
20ed0 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 32 34   tab1..----..124
20ee0 38 0d 0a 31 34 30 34 0d 0a 35 37 30 0d 0a 0d 0a  8..1404..570....
20ef0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
20f00 0a 53 45 4c 45 43 54 20 33 37 20 41 53 20 63 6f  .SELECT 37 AS co
20f10 6c 32 20 46 52 4f 4d 20 74 61 62 32 2c 20 74 61  l2 FROM tab2, ta
20f20 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39  b1 cor0..----..9
20f30 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20   values hashing 
20f40 74 6f 20 61 31 30 62 30 33 65 37 32 38 36 30 62  to a10b03e72860b
20f50 39 34 39 62 64 66 66 35 33 38 32 37 37 30 30 61  949bdff53827700a
20f60 39 61 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  9a8....query I r
20f70 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
20f80 4c 4c 20 39 37 20 41 53 20 63 6f 6c 30 20 46 52  LL 97 AS col0 FR
20f90 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 39  OM tab1..----..9
20fa0 37 0d 0a 39 37 0d 0a 39 37 0d 0a 0d 0a 71 75 65  7..97..97....que
20fb0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
20fc0 4c 45 43 54 20 2b 20 28 20 36 32 20 29 20 46 52  LECT + ( 62 ) FR
20fd0 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 20  OM tab1 AS cor0 
20fe0 43 52 4f 53 53 20 4a 4f 49 4e 20 74 61 62 30 20  CROSS JOIN tab0 
20ff0 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 39  AS cor1..----..9
21000 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20   values hashing 
21010 74 6f 20 35 31 64 64 32 37 37 31 64 35 31 36 63  to 51dd2771d516c
21020 65 62 39 33 35 34 38 33 65 64 65 64 37 38 61 35  eb935483eded78a5
21030 66 61 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  fa0....query I r
21040 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
21050 4c 4c 20 2d 20 2b 20 33 34 20 2b 20 63 6f 6c 31  LL - + 34 + col1
21060 20 2a 20 2b 20 34 34 20 46 52 4f 4d 20 74 61 62   * + 44 FROM tab
21070 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
21080 0a 31 31 31 30 0d 0a 34 30 36 0d 0a 35 33 38 0d  .1110..406..538.
21090 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
210a0 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c  rt..SELECT + col
210b0 31 20 2b 20 2b 20 63 6f 6c 32 20 41 53 20 63 6f  1 + + col2 AS co
210c0 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l2 FROM tab0 AS 
210d0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 39 0d  cor0..----..119.
210e0 0a 31 37 33 0d 0a 39 38 0d 0a 0d 0a 71 75 65 72  .173..98....quer
210f0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
21100 45 43 54 20 41 4c 4c 20 2d 20 2d 20 39 35 20 2b  ECT ALL - - 95 +
21110 20 2d 20 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20   - col0 AS col1 
21120 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a  FROM tab1 cor0..
21130 2d 2d 2d 2d 0d 0a 31 35 0d 0a 33 31 0d 0a 39 32  ----..15..31..92
21140 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
21150 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
21160 2d 20 36 30 20 2b 20 2d 20 63 6f 6c 30 20 46 52  - 60 + - col0 FR
21170 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
21180 0a 2d 2d 2d 2d 0d 0a 2d 31 34 39 0d 0a 2d 38 34  .----..-149..-84
21190 0d 0a 2d 39 35 0d 0a 0d 0a 71 75 65 72 79 20 49  ..-95....query I
211a0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
211b0 20 44 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c 32   DISTINCT + col2
211c0 20 2d 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 46   - + cor0.col2 F
211d0 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
211e0 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 0d 0a 71 75 65  ..----..0....que
211f0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
21200 4c 45 43 54 20 2d 20 2b 20 32 34 20 46 52 4f 4d  LECT - + 24 FROM
21210 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
21220 2d 2d 2d 0d 0a 2d 32 34 0d 0a 2d 32 34 0d 0a 2d  ---..-24..-24..-
21230 32 34 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  24....onlyif mys
21240 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65  ql # use DIV ope
21250 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65  rator for intege
21260 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72  r division..quer
21270 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
21280 6c 2d 39 35 30 0d 0a 53 45 4c 45 43 54 20 41 4c  l-950..SELECT AL
21290 4c 20 2b 20 2b 20 35 38 20 2b 20 63 6f 6c 31 20  L + + 58 + col1 
212a0 2a 20 2b 20 63 6f 6c 32 20 44 49 56 20 2b 20 63  * + col2 DIV + c
212b0 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  ol2 AS col0 FROM
212c0 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
212d0 2d 2d 2d 0d 0a 31 34 34 0d 0a 31 34 39 0d 0a 31  ---..144..149..1
212e0 35 35 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  55....skipif mys
212f0 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
21300 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
21310 73 6f 72 74 20 6c 61 62 65 6c 2d 39 35 30 0d 0a  sort label-950..
21320 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 2b 20 35  SELECT ALL + + 5
21330 38 20 2b 20 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c  8 + col1 * + col
21340 32 20 2f 20 2b 20 63 6f 6c 32 20 41 53 20 63 6f  2 / + col2 AS co
21350 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l0 FROM tab0 AS 
21360 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 34 34 0d  cor0..----..144.
21370 0a 31 34 39 0d 0a 31 35 35 0d 0a 0d 0a 6f 6e 6c  .149..155....onl
21380 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20  yif mysql # use 
21390 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72  DIV operator for
213a0 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f   integer divisio
213b0 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  n..query I rowso
213c0 72 74 20 6c 61 62 65 6c 2d 39 35 31 0d 0a 53 45  rt label-951..SE
213d0 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f  LECT DISTINCT co
213e0 6c 32 20 44 49 56 20 63 6f 6c 32 20 2b 20 2d 20  l2 DIV col2 + - 
213f0 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41  col1 FROM tab1 A
21400 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
21410 32 0d 0a 2d 32 35 0d 0a 2d 39 0d 0a 0d 0a 73 6b  2..-25..-9....sk
21420 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
21430 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
21440 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
21450 65 6c 2d 39 35 31 0d 0a 53 45 4c 45 43 54 20 44  el-951..SELECT D
21460 49 53 54 49 4e 43 54 20 63 6f 6c 32 20 2f 20 63  ISTINCT col2 / c
21470 6f 6c 32 20 2b 20 2d 20 63 6f 6c 31 20 46 52 4f  ol2 + - col1 FRO
21480 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
21490 2d 2d 2d 2d 0d 0a 2d 31 32 0d 0a 2d 32 35 0d 0a  ----..-12..-25..
214a0 2d 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  -9....query I ro
214b0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
214c0 36 31 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  61 AS col2 FROM 
214d0 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
214e0 2d 2d 0d 0a 36 31 0d 0a 36 31 0d 0a 36 31 0d 0a  --..61..61..61..
214f0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
21500 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20  t..SELECT ALL + 
21510 63 6f 72 30 2e 63 6f 6c 30 20 2b 20 63 6f 6c 32  cor0.col0 + col2
21520 20 2b 20 2d 20 32 30 20 41 53 20 63 6f 6c 31 20   + - 20 AS col1 
21530 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
21540 30 0d 0a 2d 2d 2d 2d 0d 0a 31 35 31 0d 0a 31 36  0..----..151..16
21550 0d 0a 33 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..37....query I 
21560 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
21570 63 6f 6c 31 20 2b 20 2d 20 63 6f 6c 30 20 2a 20  col1 + - col0 * 
21580 35 38 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d  58 FROM tab0..--
21590 2d 2d 0d 0a 2d 31 33 30 36 0d 0a 2d 31 39 33 33  --..-1306..-1933
215a0 0d 0a 2d 35 30 37 31 0d 0a 0d 0a 71 75 65 72 79  ..-5071....query
215b0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
215c0 43 54 20 63 6f 6c 30 20 2b 20 2b 20 28 20 2b 20  CT col0 + + ( + 
215d0 32 38 20 29 20 2a 20 63 6f 6c 31 20 46 52 4f 4d  28 ) * col1 FROM
215e0 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
215f0 2d 2d 2d 0d 0a 31 37 33 30 0d 0a 35 35 35 0d 0a  ---..1730..555..
21600 38 37 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  875....query I r
21610 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
21620 20 2d 20 63 6f 6c 32 20 2b 20 28 20 2b 20 63 6f   - col2 + ( + co
21630 6c 30 20 29 20 46 52 4f 4d 20 74 61 62 31 20 41  l0 ) FROM tab1 A
21640 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
21650 36 0d 0a 2d 35 31 0d 0a 37 0d 0a 0d 0a 71 75 65  6..-51..7....que
21660 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
21670 4c 45 43 54 20 41 4c 4c 20 2d 20 2b 20 63 6f 72  LECT ALL - + cor
21680 30 2e 63 6f 6c 32 20 2b 20 63 6f 6c 30 20 41 53  0.col2 + col0 AS
21690 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20   col1 FROM tab0 
216a0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
216b0 39 0d 0a 33 34 0d 0a 37 0d 0a 0d 0a 71 75 65 72  9..34..7....quer
216c0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
216d0 45 43 54 20 2b 20 63 6f 6c 31 20 2a 20 2d 20 63  ECT + col1 * - c
216e0 6f 6c 30 20 2b 20 2b 20 63 6f 6c 30 20 41 53 20  ol0 + + col0 AS 
216f0 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 63  col0 FROM tab0 c
21700 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 30 34 30  or0..----..-2040
21710 0d 0a 2d 33 33 36 30 0d 0a 2d 38 30 31 30 0d 0a  ..-3360..-8010..
21720 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
21730 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20  t..SELECT ALL - 
21740 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c 31 20 2a 20  col2 * - col1 * 
21750 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41  col1 FROM tab0 A
21760 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 34  S cor0..----..24
21770 34 30 36 38 0d 0a 36 37 39 30 34 32 0d 0a 39 34  4068..679042..94
21780 30 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  09....query I ro
21790 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
217a0 63 6f 6c 31 20 2b 20 2d 20 74 61 62 32 2e 63 6f  col1 + - tab2.co
217b0 6c 31 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  l1 AS col2 FROM 
217c0 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 38  tab2..----..-118
217d0 0d 0a 2d 33 34 0d 0a 2d 36 32 0d 0a 0d 0a 71 75  ..-34..-62....qu
217e0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
217f0 45 4c 45 43 54 20 2d 20 2b 20 63 6f 6c 32 20 2a  ELECT - + col2 *
21800 20 2d 20 63 6f 6c 32 20 2a 20 63 6f 6c 32 20 46   - col2 * col2 F
21810 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d  ROM tab0 cor0..-
21820 2d 2d 2d 0d 0a 31 0d 0a 33 35 39 33 37 0d 0a 35  ---..1..35937..5
21830 35 31 33 36 38 0d 0a 0d 0a 73 6b 69 70 69 66 20  51368....skipif 
21840 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73  postgresql # Pos
21850 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73  tgreSQL requires
21860 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e   AS when renamin
21870 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73  g output columns
21880 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
21890 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
218a0 43 54 20 2d 20 63 6f 72 30 2e 63 6f 6c 31 20 63  CT - cor0.col1 c
218b0 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 63 6f  ol0 FROM tab2 co
218c0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 37 0d 0a 2d  r0..----..-17..-
218d0 33 31 0d 0a 2d 35 39 0d 0a 0d 0a 71 75 65 72 79  31..-59....query
218e0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
218f0 43 54 20 41 4c 4c 20 63 6f 6c 32 20 2a 20 2d 20  CT ALL col2 * - 
21900 63 6f 72 30 2e 63 6f 6c 30 20 41 53 20 63 6f 6c  cor0.col0 AS col
21910 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  2 FROM tab0 AS c
21920 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 35 0d 0a  or0..----..-35..
21930 2d 37 32 39 38 0d 0a 2d 37 39 32 0d 0a 0d 0a 71  -7298..-792....q
21940 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
21950 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
21960 2b 20 63 6f 6c 30 20 2b 20 33 30 20 46 52 4f 4d  + col0 + 30 FROM
21970 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab0 cor0..----
21980 0d 0a 31 31 39 0d 0a 35 34 0d 0a 36 35 0d 0a 0d  ..119..54..65...
21990 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
219a0 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
219b0 54 20 2b 20 39 30 20 41 53 20 63 6f 6c 32 20 46  T + 90 AS col2 F
219c0 52 4f 4d 20 74 61 62 30 2c 20 74 61 62 31 20 41  ROM tab0, tab1 A
219d0 53 20 63 6f 72 30 2c 20 74 61 62 32 20 63 6f 72  S cor0, tab2 cor
219e0 31 2c 20 74 61 62 30 20 41 53 20 63 6f 72 32 0d  1, tab0 AS cor2.
219f0 0a 2d 2d 2d 2d 0d 0a 39 30 0d 0a 0d 0a 71 75 65  .----..90....que
21a00 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
21a10 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20  LECT DISTINCT - 
21a20 63 6f 6c 30 20 2b 20 63 6f 72 30 2e 63 6f 6c 31  col0 + cor0.col1
21a30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
21a40 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
21a50 0d 0a 2d 35 34 0d 0a 2d 36 37 0d 0a 32 33 0d 0a  ..-54..-67..23..
21a60 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
21a70 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20  t..SELECT ALL + 
21a80 2b 20 63 6f 6c 31 20 2d 20 2d 20 63 6f 72 30 2e  + col1 - - cor0.
21a90 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52 4f  col1 AS col0 FRO
21aa0 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
21ab0 2d 2d 2d 2d 0d 0a 32 30 0d 0a 32 36 0d 0a 35 32  ----..20..26..52
21ac0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
21ad0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2d 20  ort..SELECT + - 
21ae0 31 38 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  18 AS col0 FROM 
21af0 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
21b00 2d 2d 0d 0a 2d 31 38 0d 0a 2d 31 38 0d 0a 2d 31  --..-18..-18..-1
21b10 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  8....query I row
21b20 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
21b30 54 49 4e 43 54 20 2b 20 63 6f 6c 32 20 2b 20 2b  TINCT + col2 + +
21b40 20 63 6f 72 30 2e 63 6f 6c 30 20 46 52 4f 4d 20   cor0.col0 FROM 
21b50 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab0 cor0..----.
21b60 0a 31 37 31 0d 0a 33 36 0d 0a 35 37 0d 0a 0d 0a  .171..36..57....
21b70 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
21b80 0a 53 45 4c 45 43 54 20 2b 20 2b 20 63 6f 6c 31  .SELECT + + col1
21b90 20 2b 20 2d 20 36 37 20 2a 20 2d 20 63 6f 6c 30   + - 67 * - col0
21ba0 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
21bb0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 36 39 34 0d 0a  r0..----..1694..
21bc0 32 34 34 32 0d 0a 36 30 35 34 0d 0a 0d 0a 71 75  2442..6054....qu
21bd0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
21be0 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 35  ELECT DISTINCT 5
21bf0 36 20 2a 20 2b 20 63 6f 6c 32 20 41 53 20 63 6f  6 * + col2 AS co
21c00 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l2 FROM tab2 AS 
21c10 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 34 35 36  cor0..----..1456
21c20 0d 0a 31 35 31 32 0d 0a 32 31 32 38 0d 0a 0d 0a  ..1512..2128....
21c30 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
21c40 0a 53 45 4c 45 43 54 20 2b 20 36 34 20 41 53 20  .SELECT + 64 AS 
21c50 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41  col1 FROM tab0 A
21c60 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 36 34  S cor0..----..64
21c70 0d 0a 36 34 0d 0a 36 34 0d 0a 0d 0a 71 75 65 72  ..64..64....quer
21c80 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
21c90 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 36  ECT DISTINCT + 6
21ca0 20 2b 20 37 39 20 2a 20 63 6f 6c 31 20 46 52 4f   + 79 * col1 FRO
21cb0 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
21cc0 2d 2d 2d 2d 0d 0a 31 30 33 33 0d 0a 32 30 36 30  ----..1033..2060
21cd0 0d 0a 37 39 36 0d 0a 0d 0a 71 75 65 72 79 20 49  ..796....query I
21ce0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
21cf0 20 41 4c 4c 20 2b 20 74 61 62 30 2e 63 6f 6c 31   ALL + tab0.col1
21d00 20 2b 20 74 61 62 30 2e 63 6f 6c 31 20 2a 20 63   + tab0.col1 * c
21d10 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d  ol2 FROM tab0..-
21d20 2d 2d 2d 0d 0a 31 39 34 0d 0a 32 39 32 34 0d 0a  ---..194..2924..
21d30 37 35 35 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20  7553....query I 
21d40 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
21d50 2d 20 36 39 20 41 53 20 63 6f 6c 31 20 46 52 4f  - 69 AS col1 FRO
21d60 4d 20 74 61 62 31 20 63 6f 72 30 20 43 52 4f 53  M tab1 cor0 CROS
21d70 53 20 4a 4f 49 4e 20 74 61 62 31 2c 20 74 61 62  S JOIN tab1, tab
21d80 31 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d  1 AS cor1..----.
21d90 0a 32 37 20 76 61 6c 75 65 73 20 68 61 73 68 69  .27 values hashi
21da0 6e 67 20 74 6f 20 63 61 35 66 34 62 63 33 36 35  ng to ca5f4bc365
21db0 64 63 32 63 36 62 31 34 31 38 37 64 36 66 66 63  dc2c6b14187d6ffc
21dc0 38 33 61 30 31 64 0d 0a 0d 0a 71 75 65 72 79 20  83a01d....query 
21dd0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
21de0 54 20 31 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  T 1 AS col1 FROM
21df0 20 74 61 62 32 2c 20 74 61 62 30 20 63 6f 72 30   tab2, tab0 cor0
21e00 2c 20 74 61 62 31 20 41 53 20 63 6f 72 31 0d 0a  , tab1 AS cor1..
21e10 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75 65 73 20  ----..27 values 
21e20 68 61 73 68 69 6e 67 20 74 6f 20 64 61 38 61 37  hashing to da8a7
21e30 32 61 37 39 36 37 63 30 63 37 33 64 39 31 32 33  2a7967c0c73d9123
21e40 39 32 37 35 32 33 30 61 65 64 39 0d 0a 0d 0a 71  9275230aed9....q
21e50 75 65 72 79 20 49 49 49 49 49 49 49 49 49 49 49  uery IIIIIIIIIII
21e60 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
21e70 54 20 44 49 53 54 49 4e 43 54 20 2a 20 46 52 4f  T DISTINCT * FRO
21e80 4d 20 74 61 62 32 2c 20 74 61 62 31 20 63 6f 72  M tab2, tab1 cor
21e90 30 2c 20 74 61 62 31 20 41 53 20 63 6f 72 31 2c  0, tab1 AS cor1,
21ea0 20 74 61 62 31 20 63 6f 72 32 0d 0a 2d 2d 2d 2d   tab1 cor2..----
21eb0 0d 0a 39 37 32 20 76 61 6c 75 65 73 20 68 61 73  ..972 values has
21ec0 68 69 6e 67 20 74 6f 20 61 38 34 38 31 62 66 62  hing to a8481bfb
21ed0 66 63 62 33 33 30 38 32 35 39 37 36 63 35 38 39  fcb330825976c589
21ee0 36 65 35 34 62 63 31 39 0d 0a 0d 0a 71 75 65 72  6e54bc19....quer
21ef0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
21f00 45 43 54 20 41 4c 4c 20 33 33 20 2d 20 63 6f 6c  ECT ALL 33 - col
21f10 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  0 AS col2 FROM t
21f20 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab1 cor0..----..
21f30 2d 33 31 0d 0a 2d 34 37 0d 0a 33 30 0d 0a 0d 0a  -31..-47..30....
21f40 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73  onlyif mysql # s
21f50 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c  upport for MySQL
21f60 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d   specific system
21f70 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61   types and synta
21f80 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  x..query I rowso
21f90 72 74 20 6c 61 62 65 6c 2d 39 37 39 0d 0a 53 45  rt label-979..SE
21fa0 4c 45 43 54 20 2b 20 2d 20 63 6f 6c 31 20 2a 20  LECT + - col1 * 
21fb0 43 41 53 54 28 20 63 6f 6c 32 20 41 53 20 53 49  CAST( col2 AS SI
21fc0 47 4e 45 44 20 29 20 46 52 4f 4d 20 74 61 62 30  GNED ) FROM tab0
21fd0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 38   cor0..----..-28
21fe0 33 38 0d 0a 2d 37 34 36 32 0d 0a 2d 39 37 0d 0a  38..-7462..-97..
21ff0 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
22000 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
22010 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
22020 20 6c 61 62 65 6c 2d 39 37 39 0d 0a 53 45 4c 45   label-979..SELE
22030 43 54 20 2b 20 2d 20 63 6f 6c 31 20 2a 20 43 41  CT + - col1 * CA
22040 53 54 20 28 20 63 6f 6c 32 20 41 53 20 49 4e 54  ST ( col2 AS INT
22050 45 47 45 52 20 29 20 46 52 4f 4d 20 74 61 62 30  EGER ) FROM tab0
22060 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 38   cor0..----..-28
22070 33 38 0d 0a 2d 37 34 36 32 0d 0a 2d 39 37 0d 0a  38..-7462..-97..
22080 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65  ..skipif postgre
22090 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c  sql # PostgreSQL
220a0 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65   requires AS whe
220b0 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75  n renaming outpu
220c0 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79  t columns..query
220d0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
220e0 43 54 20 2b 20 63 6f 6c 31 20 2a 20 2d 20 63 6f  CT + col1 * - co
220f0 6c 31 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  l1 col0 FROM tab
22100 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
22110 0a 2d 32 38 39 0d 0a 2d 33 34 38 31 0d 0a 2d 39  .-289..-3481..-9
22120 36 31 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  61....onlyif mys
22130 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65  ql # use DIV ope
22140 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65  rator for intege
22150 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72  r division..quer
22160 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
22170 6c 2d 39 38 31 0d 0a 53 45 4c 45 43 54 20 2d 20  l-981..SELECT - 
22180 63 6f 6c 32 20 44 49 56 20 2d 20 28 20 63 6f 6c  col2 DIV - ( col
22190 31 20 29 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  1 ) AS col2 FROM
221a0 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
221b0 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 32 0d 0a 0d 0a  ---..0..0..2....
221c0 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
221d0 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
221e0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
221f0 61 62 65 6c 2d 39 38 31 0d 0a 53 45 4c 45 43 54  abel-981..SELECT
22200 20 2d 20 63 6f 6c 32 20 2f 20 2d 20 28 20 63 6f   - col2 / - ( co
22210 6c 31 20 29 20 41 53 20 63 6f 6c 32 20 46 52 4f  l1 ) AS col2 FRO
22220 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
22230 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 32 0d 0a 0d  ----..0..0..2...
22240 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
22250 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 32 37 20  ..SELECT ALL 27 
22260 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
22270 32 0d 0a 2d 2d 2d 2d 0d 0a 32 37 0d 0a 32 37 0d  2..----..27..27.
22280 0a 32 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .27....query I r
22290 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
222a0 4c 4c 20 2b 20 37 36 20 41 53 20 63 6f 6c 32 20  LL + 76 AS col2 
222b0 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
222c0 30 20 43 52 4f 53 53 20 4a 4f 49 4e 20 74 61 62  0 CROSS JOIN tab
222d0 31 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d  1 AS cor1..----.
222e0 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e  .9 values hashin
222f0 67 20 74 6f 20 33 30 62 38 39 34 31 61 37 30 30  g to 30b8941a700
22300 63 66 66 64 35 62 39 38 33 31 31 36 33 38 33 62  cffd5b983116383b
22310 64 34 32 64 35 0d 0a 0d 0a 71 75 65 72 79 20 49  d42d5....query I
22320 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
22330 20 2b 20 39 38 20 2a 20 2d 20 63 6f 6c 30 20 46   + 98 * - col0 F
22340 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
22350 0d 0a 2d 2d 2d 2d 0d 0a 2d 36 38 36 0d 0a 2d 37  ..----..-686..-7
22360 36 34 34 0d 0a 2d 37 37 34 32 0d 0a 0d 0a 73 6b  644..-7742....sk
22370 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20  ipif postgresql 
22380 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71  # PostgreSQL req
22390 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65  uires AS when re
223a0 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f  naming output co
223b0 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72  lumns..query I r
223c0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
223d0 20 33 30 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   30 col2 FROM ta
223e0 62 30 2c 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d  b0, tab0 cor0..-
223f0 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61  ---..9 values ha
22400 73 68 69 6e 67 20 74 6f 20 35 36 66 61 32 35 66  shing to 56fa25f
22410 39 66 62 38 30 34 30 34 36 30 66 65 33 63 38 39  9fb8040460fe3c89
22420 34 30 30 30 65 61 38 66 62 0d 0a 0d 0a 71 75 65  4000ea8fb....que
22430 72 79 20 49 49 49 49 49 49 49 49 49 49 49 49 49  ry IIIIIIIIIIIII
22440 49 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45  II rowsort..SELE
22450 43 54 20 44 49 53 54 49 4e 43 54 20 2a 20 46 52  CT DISTINCT * FR
22460 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 20  OM tab2 AS cor0 
22470 43 52 4f 53 53 20 4a 4f 49 4e 20 74 61 62 30 2c  CROSS JOIN tab0,
22480 20 74 61 62 31 20 41 53 20 63 6f 72 31 2c 20 74   tab1 AS cor1, t
22490 61 62 32 2c 20 74 61 62 32 20 41 53 20 63 6f 72  ab2, tab2 AS cor
224a0 32 0d 0a 2d 2d 2d 2d 0d 0a 33 36 34 35 20 76 61  2..----..3645 va
224b0 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20  lues hashing to 
224c0 61 30 35 63 30 30 34 36 39 35 64 36 34 34 62 64  a05c004695d644bd
224d0 63 37 64 30 37 35 34 32 64 32 39 65 32 30 31 30  c7d07542d29e2010
224e0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
224f0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
22500 2d 20 63 6f 6c 31 20 2a 20 34 35 20 46 52 4f 4d  - col1 * 45 FROM
22510 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31   tab1..----..-11
22520 37 30 0d 0a 2d 34 35 30 0d 0a 2d 35 38 35 0d 0a  70..-450..-585..
22530 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
22540 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f  t..SELECT ALL co
22550 6c 31 20 2a 20 38 30 20 2b 20 63 6f 6c 31 20 41  l1 * 80 + col1 A
22560 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30  S col2 FROM tab0
22570 0d 0a 2d 2d 2d 2d 0d 0a 36 39 36 36 0d 0a 37 33  ..----..6966..73
22580 37 31 0d 0a 37 38 35 37 0d 0a 0d 0a 71 75 65 72  71..7857....quer
22590 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
225a0 45 43 54 20 32 39 20 2b 20 63 6f 6c 32 20 41 53  ECT 29 + col2 AS
225b0 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20   col2 FROM tab2 
225c0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 35  AS cor0..----..5
225d0 35 0d 0a 35 36 0d 0a 36 37 0d 0a 0d 0a 71 75 65  5..56..67....que
225e0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
225f0 4c 45 43 54 20 2b 20 63 6f 6c 32 20 2b 20 63 6f  LECT + col2 + co
22600 6c 31 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c  l1 + col1 AS col
22610 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  1 FROM tab2 AS c
22620 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 34 34 0d 0a  or0..----..144..
22630 37 32 0d 0a 38 39 0d 0a 0d 0a 71 75 65 72 79 20  72..89....query 
22640 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
22650 54 20 41 4c 4c 20 38 34 20 41 53 20 63 6f 6c 31  T ALL 84 AS col1
22660 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d   FROM tab2..----
22670 0d 0a 38 34 0d 0a 38 34 0d 0a 38 34 0d 0a 0d 0a  ..84..84..84....
22680 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71  skipif postgresq
22690 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72  l # PostgreSQL r
226a0 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20  equires AS when 
226b0 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20  renaming output 
226c0 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49  columns..query I
226d0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
226e0 20 32 35 20 2a 20 63 6f 6c 30 20 2a 20 2d 20 37   25 * col0 * - 7
226f0 37 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31  7 col2 FROM tab1
22700 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32 33 32 30 30 0d  ..----..-123200.
22710 0a 2d 31 35 34 30 30 30 0d 0a 2d 35 37 37 35 0d  .-154000..-5775.
22720 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
22730 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 33  rt..SELECT ALL 3
22740 39 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  9 AS col2 FROM t
22750 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 33 39 0d 0a 33  ab1..----..39..3
22760 39 0d 0a 33 39 0d 0a 0d 0a 71 75 65 72 79 20 49  9..39....query I
22770 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
22780 20 63 6f 72 31 2e 63 6f 6c 32 20 41 53 20 63 6f   cor1.col2 AS co
22790 6c 31 20 46 52 4f 4d 20 74 61 62 31 2c 20 74 61  l1 FROM tab1, ta
227a0 62 30 20 41 53 20 63 6f 72 30 2c 20 74 61 62 30  b0 AS cor0, tab0
227b0 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a   AS cor1..----..
227c0 32 37 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e  27 values hashin
227d0 67 20 74 6f 20 37 37 38 36 37 31 38 62 64 38 30  g to 7786718bd80
227e0 34 32 30 32 32 35 33 37 33 37 38 64 34 30 65 63  42022537378d40ec
227f0 38 37 34 37 35 0d 0a 0d 0a 71 75 65 72 79 20 49  87475....query I
22800 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
22810 20 44 49 53 54 49 4e 43 54 20 2d 20 35 34 20 2b   DISTINCT - 54 +
22820 20 63 6f 6c 32 20 2a 20 2b 20 63 6f 72 30 2e 63   col2 * + cor0.c
22830 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 63 6f  ol0 FROM tab2 co
22840 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33 35 0d 0a 31  r0..----..135..1
22850 39 37 34 0d 0a 32 39 34 38 0d 0a 0d 0a 71 75 65  974..2948....que
22860 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
22870 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 30 20 2b 20  LECT ALL col0 + 
22880 63 6f 6c 30 20 2a 20 28 20 63 6f 6c 32 20 29 20  col0 * ( col2 ) 
22890 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
228a0 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
228b0 0a 31 39 36 0d 0a 32 31 30 36 0d 0a 33 30 38 31  .196..2106..3081
228c0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
228d0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f  ort..SELECT + co
228e0 6c 30 20 2a 20 2d 20 63 6f 6c 31 20 2b 20 2b 20  l0 * - col1 + + 
228f0 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c 32 20 41 53  col0 * - col2 AS
22900 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20   col0 FROM tab0 
22910 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 35 33  cor0..----..-153
22920 39 37 0d 0a 2d 32 38 35 36 0d 0a 2d 33 34 33 30  97..-2856..-3430
22930 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
22940 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2d 20  ort..SELECT - - 
22950 63 6f 6c 31 20 2a 20 2d 20 28 20 2d 20 34 38 20  col1 * - ( - 48 
22960 29 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  ) AS col2 FROM t
22970 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
22980 2d 0d 0a 31 32 34 38 0d 0a 34 38 30 0d 0a 36 32  -..1248..480..62
22990 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  4....query I row
229a0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63  sort..SELECT - c
229b0 6f 6c 31 20 2b 20 36 36 20 46 52 4f 4d 20 74 61  ol1 + 66 FROM ta
229c0 62 32 0d 0a 2d 2d 2d 2d 0d 0a 33 35 0d 0a 34 39  b2..----..35..49
229d0 0d 0a 37 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f  ..7....skipif po
229e0 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67  stgresql # Postg
229f0 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41  reSQL requires A
22a00 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20  S when renaming 
22a10 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a  output columns..
22a20 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
22a30 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
22a40 20 2d 20 63 6f 72 30 2e 63 6f 6c 30 20 2a 20 2b   - cor0.col0 * +
22a50 20 63 6f 6c 32 20 2d 20 63 6f 6c 31 20 2a 20 63   col2 - col1 * c
22a60 6f 6c 31 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61  ol1 col1 FROM ta
22a70 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
22a80 0d 0a 2d 33 37 34 38 0d 0a 2d 37 38 34 39 0d 0a  ..-3748..-7849..
22a90 2d 38 33 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20  -838....query I 
22aa0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
22ab0 63 6f 6c 32 20 2b 20 36 20 46 52 4f 4d 20 74 61  col2 + 6 FROM ta
22ac0 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33  b0 cor0..----..3
22ad0 39 0d 0a 37 0d 0a 38 38 0d 0a 0d 0a 6f 6e 6c 79  9..7..88....only
22ae0 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44  if mysql # use D
22af0 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20  IV operator for 
22b00 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e  integer division
22b10 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
22b20 74 20 6c 61 62 65 6c 2d 31 30 30 32 0d 0a 53 45  t label-1002..SE
22b30 4c 45 43 54 20 2b 20 2b 20 63 6f 72 30 2e 63 6f  LECT + + cor0.co
22b40 6c 30 20 2b 20 2b 20 63 6f 6c 30 20 44 49 56 20  l0 + + col0 DIV 
22b50 31 34 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72  14 FROM tab0 cor
22b60 30 0d 0a 2d 2d 2d 2d 0d 0a 32 35 0d 0a 33 37 0d  0..----..25..37.
22b70 0a 39 35 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  .95....skipif my
22b80 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
22b90 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
22ba0 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 30 30 32  wsort label-1002
22bb0 0d 0a 53 45 4c 45 43 54 20 2b 20 2b 20 63 6f 72  ..SELECT + + cor
22bc0 30 2e 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c 30 20  0.col0 + + col0 
22bd0 2f 20 31 34 20 46 52 4f 4d 20 74 61 62 30 20 63  / 14 FROM tab0 c
22be0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 35 0d 0a 33  or0..----..25..3
22bf0 37 0d 0a 39 35 0d 0a 0d 0a 71 75 65 72 79 20 49  7..95....query I
22c00 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
22c10 20 44 49 53 54 49 4e 43 54 20 2d 20 36 38 20 2b   DISTINCT - 68 +
22c20 20 37 30 20 46 52 4f 4d 20 74 61 62 32 2c 20 74   70 FROM tab2, t
22c30 61 62 31 2c 20 74 61 62 32 20 41 53 20 63 6f 72  ab1, tab2 AS cor
22c40 30 0d 0a 2d 2d 2d 2d 0d 0a 32 0d 0a 0d 0a 71 75  0..----..2....qu
22c50 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
22c60 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 32 20 2a  ELECT ALL col2 *
22c70 20 2d 20 33 39 20 41 53 20 63 6f 6c 32 20 46 52   - 39 AS col2 FR
22c80 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d  OM tab1..----..-
22c90 32 31 30 36 0d 0a 2d 32 32 32 33 0d 0a 2d 33 37  2106..-2223..-37
22ca0 34 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  44....query I ro
22cb0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 32 36  wsort..SELECT 26
22cc0 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
22cd0 62 31 2c 20 74 61 62 32 20 41 53 20 63 6f 72 30  b1, tab2 AS cor0
22ce0 2c 20 74 61 62 32 20 41 53 20 63 6f 72 31 2c 20  , tab2 AS cor1, 
22cf0 74 61 62 32 20 41 53 20 63 6f 72 32 0d 0a 2d 2d  tab2 AS cor2..--
22d00 2d 2d 0d 0a 38 31 20 76 61 6c 75 65 73 20 68 61  --..81 values ha
22d10 73 68 69 6e 67 20 74 6f 20 38 62 36 61 36 32 34  shing to 8b6a624
22d20 65 62 39 32 66 62 30 31 39 64 39 36 36 34 33 31  eb92fb019d966431
22d30 38 65 35 31 39 66 30 36 32 0d 0a 0d 0a 6f 6e 6c  8e519f062....onl
22d40 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70  yif mysql # supp
22d50 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70  ort for MySQL sp
22d60 65 63 69 66 69 63 20 73 79 73 74 65 6d 20 74 79  ecific system ty
22d70 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a  pes and syntax..
22d80 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
22d90 6c 61 62 65 6c 2d 31 30 30 36 0d 0a 53 45 4c 45  label-1006..SELE
22da0 43 54 20 43 41 53 54 28 20 2b 20 32 37 20 41 53  CT CAST( + 27 AS
22db0 20 53 49 47 4e 45 44 20 29 20 63 6f 6c 32 20 46   SIGNED ) col2 F
22dc0 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
22dd0 0d 0a 2d 2d 2d 2d 0d 0a 32 37 0d 0a 32 37 0d 0a  ..----..27..27..
22de0 32 37 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73  27....skipif pos
22df0 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72  tgresql # Postgr
22e00 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53  eSQL requires AS
22e10 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f   when renaming o
22e20 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 73  utput columns..s
22e30 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
22e40 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
22e50 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
22e60 62 65 6c 2d 31 30 30 36 0d 0a 53 45 4c 45 43 54  bel-1006..SELECT
22e70 20 43 41 53 54 20 28 20 2b 20 32 37 20 41 53 20   CAST ( + 27 AS 
22e80 49 4e 54 45 47 45 52 20 29 20 63 6f 6c 32 20 46  INTEGER ) col2 F
22e90 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
22ea0 0d 0a 2d 2d 2d 2d 0d 0a 32 37 0d 0a 32 37 0d 0a  ..----..27..27..
22eb0 32 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  27....query I ro
22ec0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
22ed0 2b 20 28 20 2d 20 63 6f 6c 30 20 29 20 2d 20 2b  + ( - col0 ) - +
22ee0 20 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46 52   col0 AS col1 FR
22ef0 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
22f00 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a  .----..0..0..0..
22f10 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
22f20 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f   use DIV operato
22f30 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69  r for integer di
22f40 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20  vision..query I 
22f50 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 30  rowsort label-10
22f60 30 38 0d 0a 53 45 4c 45 43 54 20 2d 20 36 37 20  08..SELECT - 67 
22f70 44 49 56 20 2b 20 63 6f 6c 31 20 2d 20 2b 20 63  DIV + col1 - + c
22f80 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  ol0 AS col0 FROM
22f90 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
22fa0 2d 2d 2d 0d 0a 2d 37 39 0d 0a 2d 38 32 0d 0a 2d  ---..-79..-82..-
22fb0 39 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  9....skipif mysq
22fc0 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
22fd0 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
22fe0 6f 72 74 20 6c 61 62 65 6c 2d 31 30 30 38 0d 0a  ort label-1008..
22ff0 53 45 4c 45 43 54 20 2d 20 36 37 20 2f 20 2b 20  SELECT - 67 / + 
23000 63 6f 6c 31 20 2d 20 2b 20 63 6f 6c 30 20 41 53  col1 - + col0 AS
23010 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20   col0 FROM tab2 
23020 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
23030 37 39 0d 0a 2d 38 32 0d 0a 2d 39 0d 0a 0d 0a 6f  79..-82..-9....o
23040 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73  nlyif mysql # us
23050 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66  e DIV operator f
23060 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73  or integer divis
23070 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ion..query I row
23080 73 6f 72 74 20 6c 61 62 65 6c 2d 31 30 30 39 0d  sort label-1009.
23090 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 32 20 44  .SELECT - col2 D
230a0 49 56 20 63 6f 6c 30 20 2b 20 63 6f 6c 31 20 41  IV col0 + col1 A
230b0 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32  S col0 FROM tab2
230c0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
230d0 31 37 0d 0a 32 38 0d 0a 35 39 0d 0a 0d 0a 73 6b  17..28..59....sk
230e0 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
230f0 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
23100 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
23110 65 6c 2d 31 30 30 39 0d 0a 53 45 4c 45 43 54 20  el-1009..SELECT 
23120 2d 20 63 6f 6c 32 20 2f 20 63 6f 6c 30 20 2b 20  - col2 / col0 + 
23130 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52 4f  col1 AS col0 FRO
23140 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
23150 2d 2d 2d 2d 0d 0a 31 37 0d 0a 32 38 0d 0a 35 39  ----..17..28..59
23160 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
23170 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2d 20  ort..SELECT + - 
23180 63 6f 6c 32 20 2b 20 2d 20 63 6f 6c 31 20 46 52  col2 + - col1 FR
23190 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
231a0 0a 2d 2d 2d 2d 0d 0a 2d 31 31 39 0d 0a 2d 31 37  .----..-119..-17
231b0 33 0d 0a 2d 39 38 0d 0a 0d 0a 71 75 65 72 79 20  3..-98....query 
231c0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
231d0 54 20 2b 20 2d 20 63 6f 72 30 2e 63 6f 6c 31 20  T + - cor0.col1 
231e0 2a 20 63 6f 6c 32 20 2b 20 2d 20 63 6f 72 30 2e  * col2 + - cor0.
231f0 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46 52 4f  col2 AS col2 FRO
23200 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
23210 2d 2d 2d 2d 0d 0a 2d 31 35 36 30 0d 0a 2d 36 38  ----..-1560..-68
23220 34 0d 0a 2d 38 36 34 0d 0a 0d 0a 73 6b 69 70 69  4..-864....skipi
23230 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50  f postgresql # P
23240 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72  ostgreSQL requir
23250 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d  es AS when renam
23260 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d  ing output colum
23270 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ns..query I rows
23280 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2b 20  ort..SELECT + + 
23290 36 34 20 2b 20 2b 20 63 6f 6c 31 20 2a 20 63 6f  64 + + col1 * co
232a0 6c 31 20 2a 20 2b 20 33 20 63 6f 6c 32 20 46 52  l1 * + 3 col2 FR
232b0 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
232c0 0a 2d 2d 2d 2d 0d 0a 32 32 32 35 32 0d 0a 32 34  .----..22252..24
232d0 39 30 37 0d 0a 32 38 32 39 31 0d 0a 0d 0a 71 75  907..28291....qu
232e0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
232f0 45 4c 45 43 54 20 2b 20 36 32 20 46 52 4f 4d 20  ELECT + 62 FROM 
23300 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab0 cor0..----.
23310 0a 36 32 0d 0a 36 32 0d 0a 36 32 0d 0a 0d 0a 71  .62..62..62....q
23320 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
23330 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
23340 2b 20 2d 20 63 6f 6c 31 20 2b 20 2d 20 63 6f 6c  + - col1 + - col
23350 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  1 FROM tab1 AS c
23360 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 30 0d 0a  or0..----..-20..
23370 2d 32 36 0d 0a 2d 35 32 0d 0a 0d 0a 73 6b 69 70  -26..-52....skip
23380 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20  if postgresql # 
23390 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69  PostgreSQL requi
233a0 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61  res AS when rena
233b0 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75  ming output colu
233c0 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  mns..query I row
233d0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63  sort..SELECT + c
233e0 6f 6c 31 20 2d 20 2d 20 63 6f 6c 31 20 63 6f 6c  ol1 - - col1 col
233f0 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  2 FROM tab1 AS c
23400 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 30 0d 0a 32  or0..----..20..2
23410 36 0d 0a 35 32 0d 0a 0d 0a 71 75 65 72 79 20 49  6..52....query I
23420 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
23430 20 41 4c 4c 20 2d 20 2b 20 63 6f 72 30 2e 63 6f   ALL - + cor0.co
23440 6c 30 20 2a 20 2b 20 63 6f 6c 32 20 46 52 4f 4d  l0 * + col2 FROM
23450 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
23460 2d 2d 2d 0d 0a 2d 33 35 0d 0a 2d 37 32 39 38 0d  ---..-35..-7298.
23470 0a 2d 37 39 32 0d 0a 0d 0a 71 75 65 72 79 20 49  .-792....query I
23480 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
23490 20 44 49 53 54 49 4e 43 54 20 2b 20 74 61 62 31   DISTINCT + tab1
234a0 2e 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c 32 20 2a  .col2 * + col2 *
234b0 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 0d   col2 FROM tab1.
234c0 0a 2d 2d 2d 2d 0d 0a 31 35 37 34 36 34 0d 0a 31  .----..157464..1
234d0 38 35 31 39 33 0d 0a 38 38 34 37 33 36 0d 0a 0d  85193..884736...
234e0 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
234f0 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51  support for MySQ
23500 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65  L specific syste
23510 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74  m types and synt
23520 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ax..query I rows
23530 6f 72 74 20 6c 61 62 65 6c 2d 31 30 31 38 0d 0a  ort label-1018..
23540 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 2d 20 63  SELECT ALL + - c
23550 6f 6c 32 20 2d 20 2d 20 43 41 53 54 28 20 33 39  ol2 - - CAST( 39
23560 20 2b 20 2b 20 63 6f 6c 30 20 41 53 20 53 49 47   + + col0 AS SIG
23570 4e 45 44 20 29 20 41 53 20 63 6f 6c 31 20 46 52  NED ) AS col1 FR
23580 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d  OM tab1 cor0..--
23590 2d 2d 0d 0a 2d 31 32 0d 0a 32 33 0d 0a 34 36 0d  --..-12..23..46.
235a0 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
235b0 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
235c0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
235d0 74 20 6c 61 62 65 6c 2d 31 30 31 38 0d 0a 53 45  t label-1018..SE
235e0 4c 45 43 54 20 41 4c 4c 20 2b 20 2d 20 63 6f 6c  LECT ALL + - col
235f0 32 20 2d 20 2d 20 43 41 53 54 20 28 20 33 39 20  2 - - CAST ( 39 
23600 2b 20 2b 20 63 6f 6c 30 20 41 53 20 49 4e 54 45  + + col0 AS INTE
23610 47 45 52 20 29 20 41 53 20 63 6f 6c 31 20 46 52  GER ) AS col1 FR
23620 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d  OM tab1 cor0..--
23630 2d 2d 0d 0a 2d 31 32 0d 0a 32 33 0d 0a 34 36 0d  --..-12..23..46.
23640 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
23650 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79  # support for My
23660 53 51 4c 20 73 70 65 63 69 66 69 63 20 73 79 73  SQL specific sys
23670 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79  tem types and sy
23680 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f  ntax..query I ro
23690 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 30 31 39  wsort label-1019
236a0 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c  ..SELECT ALL col
236b0 32 20 2a 20 2d 20 43 41 53 54 28 20 4e 55 4c 4c  2 * - CAST( NULL
236c0 20 41 53 20 44 45 43 49 4d 41 4c 20 29 20 2a 20   AS DECIMAL ) * 
236d0 2b 20 39 38 20 2b 20 63 6f 6c 30 20 2a 20 63 6f  + 98 + col0 * co
236e0 6c 31 20 2a 20 2b 20 63 6f 6c 31 20 41 53 20 63  l1 * + col1 AS c
236f0 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 63 6f  ol2 FROM tab1 co
23700 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a  r0..----..NULL..
23710 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b  NULL..NULL....sk
23720 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
23730 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
23740 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
23750 65 6c 2d 31 30 31 39 0d 0a 53 45 4c 45 43 54 20  el-1019..SELECT 
23760 41 4c 4c 20 63 6f 6c 32 20 2a 20 2d 20 43 41 53  ALL col2 * - CAS
23770 54 20 28 20 4e 55 4c 4c 20 41 53 20 52 45 41 4c  T ( NULL AS REAL
23780 20 29 20 2a 20 2b 20 39 38 20 2b 20 63 6f 6c 30   ) * + 98 + col0
23790 20 2a 20 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c 31   * col1 * + col1
237a0 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
237b0 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e  b1 cor0..----..N
237c0 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d  ULL..NULL..NULL.
237d0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
237e0 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2b 20 63  rt..SELECT - + c
237f0 6f 72 30 2e 63 6f 6c 30 20 2a 20 32 35 20 46 52  or0.col0 * 25 FR
23800 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
23810 0a 2d 2d 2d 2d 0d 0a 2d 31 36 30 30 0d 0a 2d 32  .----..-1600..-2
23820 30 30 30 0d 0a 2d 37 35 0d 0a 0d 0a 6f 6e 6c 79  000..-75....only
23830 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44  if mysql # use D
23840 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20  IV operator for 
23850 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e  integer division
23860 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
23870 74 20 6c 61 62 65 6c 2d 31 30 32 31 0d 0a 53 45  t label-1021..SE
23880 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f  LECT DISTINCT co
23890 6c 32 20 2d 20 2b 20 36 31 20 44 49 56 20 2d 20  l2 - + 61 DIV - 
238a0 32 33 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  23 AS col2 FROM 
238b0 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
238c0 2d 2d 0d 0a 32 38 0d 0a 32 39 0d 0a 34 30 0d 0a  --..28..29..40..
238d0 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
238e0 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
238f0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
23900 20 6c 61 62 65 6c 2d 31 30 32 31 0d 0a 53 45 4c   label-1021..SEL
23910 45 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c  ECT DISTINCT col
23920 32 20 2d 20 2b 20 36 31 20 2f 20 2d 20 32 33 20  2 - + 61 / - 23 
23930 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
23940 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
23950 0a 32 38 0d 0a 32 39 0d 0a 34 30 0d 0a 0d 0a 71  .28..29..40....q
23960 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
23970 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
23980 2b 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 2a 20  + + cor0.col1 * 
23990 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46  + col0 AS col0 F
239a0 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
239b0 0d 0a 2d 2d 2d 2d 0d 0a 31 30 34 30 0d 0a 36 34  ..----..1040..64
239c0 30 0d 0a 37 38 0d 0a 0d 0a 73 6b 69 70 69 66 20  0..78....skipif 
239d0 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73  postgresql # Pos
239e0 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73  tgreSQL requires
239f0 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e   AS when renamin
23a00 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73  g output columns
23a10 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
23a20 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 32 20 2a  t..SELECT col2 *
23a30 20 74 61 62 32 2e 63 6f 6c 31 20 2b 20 2d 20 63   tab2.col1 + - c
23a40 6f 6c 32 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61  ol2 col0 FROM ta
23a50 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 35 30 38 0d 0a  b2..----..1508..
23a60 36 30 38 0d 0a 38 31 30 0d 0a 0d 0a 71 75 65 72  608..810....quer
23a70 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
23a80 45 43 54 20 2b 20 63 6f 6c 30 20 2d 20 2b 20 33  ECT + col0 - + 3
23a90 35 20 2a 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20  5 * + col1 FROM 
23aa0 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
23ab0 2d 2d 0d 0a 2d 31 30 37 38 0d 0a 2d 31 39 38 37  --..-1078..-1987
23ac0 0d 0a 2d 35 31 36 0d 0a 0d 0a 71 75 65 72 79 20  ..-516....query 
23ad0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
23ae0 54 20 41 4c 4c 20 63 6f 72 30 2e 63 6f 6c 30 20  T ALL cor0.col0 
23af0 2d 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46  - col0 AS col0 F
23b00 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
23b10 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d  ..----..0..0..0.
23b20 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
23b30 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d  rt..SELECT ALL -
23b40 20 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c 30 20 41   col1 * - col0 A
23b50 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32  S col1 FROM tab2
23b60 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
23b70 31 33 34 33 0d 0a 32 31 37 0d 0a 34 36 30 32 0d  1343..217..4602.
23b80 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
23b90 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b  rt..SELECT ALL +
23ba0 20 63 6f 6c 30 20 2b 20 63 6f 6c 30 20 2a 20 63   col0 + col0 * c
23bb0 6f 72 30 2e 63 6f 6c 32 20 46 52 4f 4d 20 74 61  or0.col2 FROM ta
23bc0 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  b2 cor0..----..1
23bd0 39 36 0d 0a 32 31 30 36 0d 0a 33 30 38 31 0d 0a  96..2106..3081..
23be0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
23bf0 74 0d 0a 53 45 4c 45 43 54 20 2b 20 38 30 20 2d  t..SELECT + 80 -
23c00 20 63 6f 6c 31 20 2a 20 63 6f 6c 31 20 2a 20 2b   col1 * col1 * +
23c10 20 63 6f 72 30 2e 63 6f 6c 31 20 46 52 4f 4d 20   cor0.col1 FROM 
23c20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
23c30 2d 2d 0d 0a 2d 31 37 34 39 36 0d 0a 2d 32 31 31  --..-17496..-211
23c40 37 0d 0a 2d 39 32 30 0d 0a 0d 0a 71 75 65 72 79  7..-920....query
23c50 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
23c60 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63 6f  CT DISTINCT + co
23c70 6c 32 20 2a 20 63 6f 6c 32 20 2b 20 63 6f 6c 31  l2 * col2 + col1
23c80 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
23c90 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
23ca0 0d 0a 31 34 36 31 0d 0a 37 33 35 0d 0a 37 36 30  ..1461..735..760
23cb0 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67  ....skipif postg
23cc0 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53  resql # PostgreS
23cd0 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77  QL requires AS w
23ce0 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74  hen renaming out
23cf0 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65  put columns..que
23d00 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
23d10 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 31 20  LECT ALL + col1 
23d20 2b 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 2b 20  + + cor0.col0 + 
23d30 2b 20 63 6f 6c 31 20 63 6f 6c 30 20 46 52 4f 4d  + col1 col0 FROM
23d40 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
23d50 2d 2d 2d 0d 0a 31 39 36 0d 0a 32 32 39 0d 0a 32  ---..196..229..2
23d60 37 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  71....query I ro
23d70 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
23d80 4c 20 2d 20 74 61 62 30 2e 63 6f 6c 32 20 46 52  L - tab0.col2 FR
23d90 4f 4d 20 74 61 62 30 2c 20 74 61 62 30 20 41 53  OM tab0, tab0 AS
23da0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76   cor0..----..9 v
23db0 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f  alues hashing to
23dc0 20 62 35 61 34 31 30 32 31 30 37 65 35 65 62 64   b5a4102107e5ebd
23dd0 32 36 65 33 34 31 35 33 38 66 34 66 65 64 65 31  26e341538f4fede1
23de0 65 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  e....query I row
23df0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
23e00 54 49 4e 43 54 20 2b 20 63 6f 6c 31 20 2a 20 39  TINCT + col1 * 9
23e10 39 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c 31  9 + col0 AS col1
23e20 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
23e30 72 30 0d 0a 2d 2d 2d 2d 0d 0a 38 35 33 38 0d 0a  r0..----..8538..
23e40 39 30 39 38 0d 0a 39 36 33 38 0d 0a 0d 0a 71 75  9098..9638....qu
23e50 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
23e60 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b  ELECT DISTINCT +
23e70 20 63 6f 6c 32 20 2a 20 2b 20 32 36 20 46 52 4f   col2 * + 26 FRO
23e80 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
23e90 2d 2d 2d 2d 0d 0a 36 37 36 0d 0a 37 30 32 0d 0a  ----..676..702..
23ea0 39 38 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  988....query I r
23eb0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
23ec0 20 2b 20 30 20 41 53 20 63 6f 6c 31 20 46 52 4f   + 0 AS col1 FRO
23ed0 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
23ee0 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d  ----..0..0..0...
23ef0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
23f00 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 2b  ..SELECT ALL - +
23f10 20 63 6f 6c 32 20 2b 20 2d 20 63 6f 6c 30 20 41   col2 + - col0 A
23f20 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32  S col0 FROM tab2
23f30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
23f40 2d 31 30 34 0d 0a 2d 31 31 37 0d 0a 2d 33 34 0d  -104..-117..-34.
23f50 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72  ...skipif postgr
23f60 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51  esql # PostgreSQ
23f70 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68  L requires AS wh
23f80 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70  en renaming outp
23f90 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72  ut columns..quer
23fa0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
23fb0 45 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c  ECT DISTINCT col
23fc0 31 20 2b 20 63 6f 6c 30 20 63 6f 6c 31 20 46 52  1 + col0 col1 FR
23fd0 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
23fe0 0a 2d 2d 2d 2d 0d 0a 31 31 30 0d 0a 31 33 32 0d  .----..110..132.
23ff0 0a 31 38 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .180....query I 
24000 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
24010 41 4c 4c 20 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c  ALL col2 * + col
24020 30 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  0 AS col0 FROM t
24030 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 36 32 0d 0a  ab1..----..162..
24040 33 36 34 38 0d 0a 37 36 38 30 0d 0a 0d 0a 71 75  3648..7680....qu
24050 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
24060 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b  ELECT DISTINCT +
24070 20 32 34 20 2a 20 74 61 62 32 2e 63 6f 6c 31 20   24 * tab2.col1 
24080 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d  FROM tab2..----.
24090 0a 31 34 31 36 0d 0a 34 30 38 0d 0a 37 34 34 0d  .1416..408..744.
240a0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
240b0 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 30 20  rt..SELECT col0 
240c0 2b 20 2b 20 63 6f 6c 31 20 2a 20 28 20 63 6f 6c  + + col1 * ( col
240d0 32 20 29 20 2a 20 2b 20 63 6f 6c 30 20 41 53 20  2 ) * + col0 AS 
240e0 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41  col1 FROM tab0 A
240f0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 34  S cor0..----..34
24100 33 30 0d 0a 36 36 34 32 30 37 0d 0a 36 38 31 33  30..664207..6813
24110 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  6....query I row
24120 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
24130 20 28 20 63 6f 6c 30 20 29 20 2a 20 63 6f 6c 32   ( col0 ) * col2
24140 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
24150 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
24160 0d 0a 33 35 0d 0a 37 32 39 38 0d 0a 37 39 32 0d  ..35..7298..792.
24170 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
24180 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
24190 4e 43 54 20 2b 20 2b 20 36 32 20 41 53 20 63 6f  NCT + + 62 AS co
241a0 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l2 FROM tab0 AS 
241b0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 36 32 0d 0a  cor0..----..62..
241c0 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
241d0 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53   support for MyS
241e0 51 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74  QL specific syst
241f0 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e  em types and syn
24200 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  tax..query I row
24210 73 6f 72 74 20 6c 61 62 65 6c 2d 31 30 34 32 0d  sort label-1042.
24220 0a 53 45 4c 45 43 54 20 2b 20 2b 20 63 6f 72 30  .SELECT + + cor0
24230 2e 63 6f 6c 32 20 2a 20 63 6f 6c 31 20 2a 20 2b  .col2 * col1 * +
24240 20 43 41 53 54 28 20 2b 20 33 30 20 41 53 20 53   CAST( + 30 AS S
24250 49 47 4e 45 44 20 29 20 46 52 4f 4d 20 74 61 62  IGNED ) FROM tab
24260 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
24270 0a 31 37 31 30 30 0d 0a 33 37 34 34 30 0d 0a 34  .17100..37440..4
24280 32 31 32 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  2120....skipif m
24290 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
242a0 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
242b0 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 30 34  owsort label-104
242c0 32 0d 0a 53 45 4c 45 43 54 20 2b 20 2b 20 63 6f  2..SELECT + + co
242d0 72 30 2e 63 6f 6c 32 20 2a 20 63 6f 6c 31 20 2a  r0.col2 * col1 *
242e0 20 2b 20 43 41 53 54 20 28 20 2b 20 33 30 20 41   + CAST ( + 30 A
242f0 53 20 49 4e 54 45 47 45 52 20 29 20 46 52 4f 4d  S INTEGER ) FROM
24300 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
24310 2d 2d 2d 0d 0a 31 37 31 30 30 0d 0a 33 37 34 34  ---..17100..3744
24320 30 0d 0a 34 32 31 32 30 0d 0a 0d 0a 71 75 65 72  0..42120....quer
24330 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
24340 45 43 54 20 34 38 20 2a 20 63 6f 6c 32 20 46 52  ECT 48 * col2 FR
24350 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
24360 0a 2d 2d 2d 2d 0d 0a 32 35 39 32 0d 0a 32 37 33  .----..2592..273
24370 36 0d 0a 34 36 30 38 0d 0a 0d 0a 71 75 65 72 79  6..4608....query
24380 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
24390 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 37 30  CT DISTINCT + 70
243a0 20 2a 20 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20   * col2 AS col0 
243b0 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
243c0 30 0d 0a 2d 2d 2d 2d 0d 0a 32 33 31 30 0d 0a 35  0..----..2310..5
243d0 37 34 30 0d 0a 37 30 0d 0a 0d 0a 71 75 65 72 79  740..70....query
243e0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
243f0 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 2d 20  CT DISTINCT - - 
24400 63 6f 6c 31 20 2a 20 28 20 63 6f 72 30 2e 63 6f  col1 * ( cor0.co
24410 6c 30 20 29 20 41 53 20 63 6f 6c 31 20 46 52 4f  l0 ) AS col1 FRO
24420 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
24430 2d 2d 2d 2d 0d 0a 32 30 36 34 0d 0a 33 33 39 35  ----..2064..3395
24440 0d 0a 38 30 39 39 0d 0a 0d 0a 71 75 65 72 79 20  ..8099....query 
24450 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
24460 54 20 2d 20 63 6f 6c 30 20 2a 20 2b 20 31 32 20  T - col0 * + 12 
24470 2a 20 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46  * col0 AS col2 F
24480 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
24490 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 38 38 0d 0a 2d 37  ..----..-588..-7
244a0 33 30 30 38 0d 0a 2d 37 34 38 39 32 0d 0a 0d 0a  3008..-74892....
244b0 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73  onlyif mysql # s
244c0 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c  upport for MySQL
244d0 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d   specific system
244e0 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61   types and synta
244f0 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  x..query I rowso
24500 72 74 20 6c 61 62 65 6c 2d 31 30 34 37 0d 0a 53  rt label-1047..S
24510 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 30  ELECT ALL + col0
24520 20 2a 20 2b 20 43 41 53 54 28 20 2d 20 63 6f 6c   * + CAST( - col
24530 30 20 41 53 20 53 49 47 4e 45 44 20 29 20 2b 20  0 AS SIGNED ) + 
24540 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41  col2 FROM tab1 A
24550 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 34  S cor0..----..-4
24560 30 33 39 0d 0a 2d 36 33 30 34 0d 0a 34 35 0d 0a  039..-6304..45..
24570 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
24580 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
24590 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
245a0 20 6c 61 62 65 6c 2d 31 30 34 37 0d 0a 53 45 4c   label-1047..SEL
245b0 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 30 20 2a  ECT ALL + col0 *
245c0 20 2b 20 43 41 53 54 20 28 20 2d 20 63 6f 6c 30   + CAST ( - col0
245d0 20 41 53 20 49 4e 54 45 47 45 52 20 29 20 2b 20   AS INTEGER ) + 
245e0 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41  col2 FROM tab1 A
245f0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 34  S cor0..----..-4
24600 30 33 39 0d 0a 2d 36 33 30 34 0d 0a 34 35 0d 0a  039..-6304..45..
24610 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
24620 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f   use DIV operato
24630 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69  r for integer di
24640 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20  vision..query I 
24650 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 30  rowsort label-10
24660 34 38 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  48..SELECT DISTI
24670 4e 43 54 20 2b 20 2b 20 63 6f 6c 32 20 2b 20 2b  NCT + + col2 + +
24680 20 63 6f 6c 30 20 2b 20 2b 20 31 39 20 44 49 56   col0 + + 19 DIV
24690 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20   col1 FROM tab1 
246a0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
246b0 32 32 0d 0a 31 37 37 0d 0a 35 37 0d 0a 0d 0a 73  22..177..57....s
246c0 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
246d0 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
246e0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
246f0 62 65 6c 2d 31 30 34 38 0d 0a 53 45 4c 45 43 54  bel-1048..SELECT
24700 20 44 49 53 54 49 4e 43 54 20 2b 20 2b 20 63 6f   DISTINCT + + co
24710 6c 32 20 2b 20 2b 20 63 6f 6c 30 20 2b 20 2b 20  l2 + + col0 + + 
24720 31 39 20 2f 20 63 6f 6c 31 20 46 52 4f 4d 20 74  19 / col1 FROM t
24730 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
24740 2d 0d 0a 31 32 32 0d 0a 31 37 37 0d 0a 35 37 0d  -..122..177..57.
24750 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
24760 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
24770 4e 43 54 20 63 6f 6c 31 20 2d 20 2d 20 28 20 2b  NCT col1 - - ( +
24780 20 63 6f 6c 32 20 29 20 2a 20 63 6f 6c 30 20 46   col2 ) * col0 F
24790 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d  ROM tab1 cor0..-
247a0 2d 2d 2d 0d 0a 31 38 38 0d 0a 33 36 35 38 0d 0a  ---..188..3658..
247b0 37 36 39 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20  7693....query I 
247c0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
247d0 2b 20 63 6f 6c 30 20 2a 20 2d 20 31 20 2a 20 2d  + col0 * - 1 * -
247e0 20 37 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d   72 AS col2 FROM
247f0 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
24800 2d 2d 2d 0d 0a 35 30 34 0d 0a 35 36 31 36 0d 0a  ---..504..5616..
24810 35 36 38 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20  5688....query I 
24820 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
24830 2b 20 63 6f 6c 30 20 2b 20 63 6f 6c 32 20 2a 20  + col0 + col2 * 
24840 2d 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46  - col0 AS col0 F
24850 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab0..----..
24860 2d 37 32 30 39 0d 0a 2d 37 36 38 0d 0a 30 0d 0a  -7209..-768..0..
24870 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
24880 74 0d 0a 53 45 4c 45 43 54 20 33 31 20 2a 20 63  t..SELECT 31 * c
24890 6f 6c 30 20 2b 20 2d 20 63 6f 6c 31 20 2a 20 74  ol0 + - col1 * t
248a0 61 62 32 2e 63 6f 6c 31 20 46 52 4f 4d 20 74 61  ab2.col1 FROM ta
248b0 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 36 33 0d  b2..----..-1063.
248c0 0a 2d 37 34 34 0d 0a 32 31 36 30 0d 0a 0d 0a 71  .-744..2160....q
248d0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
248e0 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
248f0 63 6f 6c 31 20 2a 20 74 61 62 30 2e 63 6f 6c 32  col1 * tab0.col2
24900 20 2a 20 2d 20 36 20 2b 20 39 33 20 46 52 4f 4d   * - 6 + 93 FROM
24910 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 36   tab0..----..-16
24920 39 33 35 0d 0a 2d 34 34 36 37 39 0d 0a 2d 34 38  935..-44679..-48
24930 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  9....query I row
24940 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
24950 54 49 4e 43 54 20 2b 20 63 6f 72 30 2e 63 6f 6c  TINCT + cor0.col
24960 31 20 2b 20 2d 20 63 6f 6c 31 20 41 53 20 63 6f  1 + - col1 AS co
24970 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l1 FROM tab0 AS 
24980 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 0d  cor0..----..0...
24990 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
249a0 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c  ..SELECT ALL col
249b0 30 20 2b 20 74 61 62 31 2e 63 6f 6c 32 20 2a 20  0 + tab1.col2 * 
249c0 37 30 20 2a 20 2d 20 63 6f 6c 32 20 41 53 20 63  70 * - col2 AS c
249d0 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d  ol1 FROM tab1..-
249e0 2d 2d 2d 0d 0a 2d 32 30 34 31 31 37 0d 0a 2d 32  ---..-204117..-2
249f0 32 37 33 36 36 0d 0a 2d 36 34 35 30 34 30 0d 0a  27366..-645040..
24a00 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65  ..skipif postgre
24a10 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c  sql # PostgreSQL
24a20 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65   requires AS whe
24a30 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75  n renaming outpu
24a40 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79  t columns..query
24a50 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
24a60 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 2d 20  CT DISTINCT + - 
24a70 63 6f 6c 32 20 2a 20 31 34 20 2b 20 63 6f 72 30  col2 * 14 + cor0
24a80 2e 63 6f 6c 30 20 2b 20 63 6f 72 30 2e 63 6f 6c  .col0 + cor0.col
24a90 30 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32  0 col2 FROM tab2
24aa0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
24ab0 2d 32 30 38 0d 0a 2d 33 36 34 0d 0a 2d 33 37 34  -208..-364..-374
24ac0 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67  ....skipif postg
24ad0 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53  resql # PostgreS
24ae0 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77  QL requires AS w
24af0 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74  hen renaming out
24b00 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65  put columns..que
24b10 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
24b20 4c 45 43 54 20 2d 20 63 6f 72 30 2e 63 6f 6c 31  LECT - cor0.col1
24b30 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 2a 20 36   + cor0.col0 * 6
24b40 31 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30  1 col1 FROM tab0
24b50 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
24b60 31 33 37 38 0d 0a 32 30 33 38 0d 0a 35 33 33 38  1378..2038..5338
24b70 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
24b80 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d   # support for M
24b90 79 53 51 4c 20 73 70 65 63 69 66 69 63 20 73 79  ySQL specific sy
24ba0 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73  stem types and s
24bb0 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72  yntax..query I r
24bc0 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 30 35  owsort label-105
24bd0 38 0d 0a 53 45 4c 45 43 54 20 2b 20 2b 20 63 6f  8..SELECT + + co
24be0 6c 32 20 2b 20 2d 20 43 41 53 54 28 20 33 33 20  l2 + - CAST( 33 
24bf0 41 53 20 53 49 47 4e 45 44 20 29 20 41 53 20 63  AS SIGNED ) AS c
24c00 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol0 FROM tab1 AS
24c10 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 31 0d   cor0..----..21.
24c20 0a 32 34 0d 0a 36 33 0d 0a 0d 0a 73 6b 69 70 69  .24..63....skipi
24c30 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
24c40 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
24c50 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
24c60 31 30 35 38 0d 0a 53 45 4c 45 43 54 20 2b 20 2b  1058..SELECT + +
24c70 20 63 6f 6c 32 20 2b 20 2d 20 43 41 53 54 20 28   col2 + - CAST (
24c80 20 33 33 20 41 53 20 49 4e 54 45 47 45 52 20 29   33 AS INTEGER )
24c90 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
24ca0 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
24cb0 0d 0a 32 31 0d 0a 32 34 0d 0a 36 33 0d 0a 0d 0a  ..21..24..63....
24cc0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
24cd0 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
24ce0 20 35 32 20 2a 20 2d 20 28 20 2b 20 63 6f 72 30   52 * - ( + cor0
24cf0 2e 63 6f 6c 32 20 29 20 46 52 4f 4d 20 74 61 62  .col2 ) FROM tab
24d00 31 2c 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  1, tab1 AS cor0.
24d10 0a 2d 2d 2d 2d 0d 0a 2d 32 38 30 38 0d 0a 2d 32  .----..-2808..-2
24d20 39 36 34 0d 0a 2d 34 39 39 32 0d 0a 0d 0a 6f 6e  964..-4992....on
24d30 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70  lyif mysql # sup
24d40 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73  port for MySQL s
24d50 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20 74  pecific system t
24d60 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d  ypes and syntax.
24d70 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
24d80 20 6c 61 62 65 6c 2d 31 30 36 30 0d 0a 53 45 4c   label-1060..SEL
24d90 45 43 54 20 2d 20 63 6f 6c 32 20 2f 20 2d 20 43  ECT - col2 / - C
24da0 41 53 54 28 20 4e 55 4c 4c 20 41 53 20 53 49 47  AST( NULL AS SIG
24db0 4e 45 44 20 29 20 2b 20 2b 20 63 6f 6c 31 20 41  NED ) + + col1 A
24dc0 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30  S col2 FROM tab0
24dd0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
24de0 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c  NULL..NULL..NULL
24df0 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
24e00 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
24e10 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
24e20 72 74 20 6c 61 62 65 6c 2d 31 30 36 30 0d 0a 53  rt label-1060..S
24e30 45 4c 45 43 54 20 2d 20 63 6f 6c 32 20 2f 20 2d  ELECT - col2 / -
24e40 20 43 41 53 54 20 28 20 4e 55 4c 4c 20 41 53 20   CAST ( NULL AS 
24e50 49 4e 54 45 47 45 52 20 29 20 2b 20 2b 20 63 6f  INTEGER ) + + co
24e60 6c 31 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  l1 AS col2 FROM 
24e70 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
24e80 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a  --..NULL..NULL..
24e90 4e 55 4c 4c 0d 0a 0d 0a 71 75 65 72 79 20 49 20  NULL....query I 
24ea0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
24eb0 2d 20 2d 20 63 6f 6c 30 20 2a 20 2b 20 28 20 2b  - - col0 * + ( +
24ec0 20 63 6f 6c 32 20 2b 20 2b 20 63 6f 6c 31 20 29   col2 + + col1 )
24ed0 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
24ee0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 35 33 39 37 0d  r0..----..15397.
24ef0 0a 32 38 35 36 0d 0a 33 34 33 30 0d 0a 0d 0a 71  .2856..3430....q
24f00 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
24f10 53 45 4c 45 43 54 20 2d 20 28 20 2d 20 33 32 20  SELECT - ( - 32 
24f20 29 20 2a 20 2d 20 63 6f 6c 31 20 46 52 4f 4d 20  ) * - col1 FROM 
24f30 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
24f40 2d 2d 0d 0a 2d 32 37 35 32 0d 0a 2d 32 39 31 32  --..-2752..-2912
24f50 0d 0a 2d 33 31 30 34 0d 0a 0d 0a 71 75 65 72 79  ..-3104....query
24f60 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
24f70 43 54 20 2d 20 28 20 63 6f 6c 30 20 29 20 2b 20  CT - ( col0 ) + 
24f80 2d 20 63 6f 6c 32 20 2a 20 28 20 2d 20 31 30 20  - col2 * ( - 10 
24f90 29 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  ) AS col2 FROM t
24fa0 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
24fb0 2d 0d 0a 35 30 36 0d 0a 35 33 37 0d 0a 38 38 30  -..506..537..880
24fc0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
24fd0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f  ort..SELECT - co
24fe0 6c 30 20 2b 20 34 34 20 41 53 20 63 6f 6c 31 20  l0 + 44 AS col1 
24ff0 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
25000 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 30 0d 0a 2d 33  0..----..-20..-3
25010 36 0d 0a 34 31 0d 0a 0d 0a 73 6b 69 70 69 66 20  6..41....skipif 
25020 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73  postgresql # Pos
25030 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73  tgreSQL requires
25040 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e   AS when renamin
25050 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73  g output columns
25060 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
25070 74 0d 0a 53 45 4c 45 43 54 20 2d 20 28 20 2d 20  t..SELECT - ( - 
25080 32 31 20 29 20 2a 20 63 6f 6c 32 20 63 6f 6c 31  21 ) * col2 col1
25090 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
250a0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 37 32 32 0d 0a  r0..----..1722..
250b0 32 31 0d 0a 36 39 33 0d 0a 0d 0a 71 75 65 72 79  21..693....query
250c0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
250d0 43 54 20 2b 20 32 39 20 2a 20 2d 20 63 6f 6c 31  CT + 29 * - col1
250e0 20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d   FROM tab1 cor0.
250f0 0a 2d 2d 2d 2d 0d 0a 2d 32 39 30 0d 0a 2d 33 37  .----..-290..-37
25100 37 0d 0a 2d 37 35 34 0d 0a 0d 0a 73 6b 69 70 69  7..-754....skipi
25110 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50  f postgresql # P
25120 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72  ostgreSQL requir
25130 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d  es AS when renam
25140 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d  ing output colum
25150 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ns..query I rows
25160 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 30  ort..SELECT col0
25170 20 2a 20 39 37 20 2a 20 63 6f 6c 30 20 63 6f 6c   * 97 * col0 col
25180 30 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d  0 FROM tab1..---
25190 2d 0d 0a 33 39 37 33 31 32 0d 0a 36 32 30 38 30  -..397312..62080
251a0 30 0d 0a 38 37 33 0d 0a 0d 0a 71 75 65 72 79 20  0..873....query 
251b0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
251c0 54 20 63 6f 6c 30 20 2a 20 2b 20 63 6f 72 30 2e  T col0 * + cor0.
251d0 63 6f 6c 32 20 2b 20 63 6f 6c 32 20 46 52 4f 4d  col2 + col2 FROM
251e0 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab2 cor0..----
251f0 0d 0a 32 30 35 34 0d 0a 32 31 36 0d 0a 33 30 34  ..2054..216..304
25200 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  0....query I row
25210 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63  sort..SELECT - c
25220 6f 6c 31 20 2a 20 2d 20 63 6f 6c 32 20 2b 20 2b  ol1 * - col2 + +
25230 20 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46 52   col2 AS col2 FR
25240 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
25250 0a 2d 2d 2d 2d 0d 0a 31 35 36 30 0d 0a 36 38 34  .----..1560..684
25260 0d 0a 38 36 34 0d 0a 0d 0a 71 75 65 72 79 20 49  ..864....query I
25270 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
25280 20 2b 20 31 33 20 2a 20 2b 20 63 6f 6c 31 20 2a   + 13 * + col1 *
25290 20 31 38 20 2b 20 2b 20 63 6f 6c 31 20 2a 20 63   18 + + col1 * c
252a0 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol2 FROM tab0 AS
252b0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 32 37   cor0..----..227
252c0 39 35 0d 0a 32 32 39 36 32 0d 0a 32 38 37 35 36  95..22962..28756
252d0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
252e0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
252f0 2d 20 63 6f 6c 31 20 2b 20 2d 20 63 6f 6c 32 20  - col1 + - col2 
25300 2b 20 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c 32 20  + col2 * - col2 
25310 2a 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46  * col0 AS col0 F
25320 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab1..----..
25330 2d 32 30 38 30 30 33 0d 0a 2d 37 33 37 33 38 39  -208003..-737389
25340 0d 0a 2d 38 38 32 38 0d 0a 0d 0a 71 75 65 72 79  ..-8828....query
25350 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
25360 43 54 20 38 36 20 2a 20 33 20 41 53 20 63 6f 6c  CT 86 * 3 AS col
25370 31 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d  1 FROM tab2..---
25380 2d 0d 0a 32 35 38 0d 0a 32 35 38 0d 0a 32 35 38  -..258..258..258
25390 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
253a0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
253b0 49 4e 43 54 20 2b 20 63 6f 6c 31 20 2a 20 63 6f  INCT + col1 * co
253c0 6c 31 20 2b 20 2d 20 63 6f 6c 32 20 46 52 4f 4d  l1 + - col2 FROM
253d0 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
253e0 2d 2d 2d 0d 0a 32 35 31 0d 0a 33 34 35 35 0d 0a  ---..251..3455..
253f0 39 33 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  934....query I r
25400 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
25410 49 53 54 49 4e 43 54 20 2d 20 28 20 2b 20 63 6f  ISTINCT - ( + co
25420 6c 32 20 29 20 2b 20 63 6f 6c 32 20 2a 20 2d 20  l2 ) + col2 * - 
25430 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41  col1 FROM tab0 A
25440 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32  S cor0..----..-2
25450 38 37 31 0d 0a 2d 37 35 34 34 0d 0a 2d 39 38 0d  871..-7544..-98.
25460 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72  ...skipif postgr
25470 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51  esql # PostgreSQ
25480 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68  L requires AS wh
25490 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70  en renaming outp
254a0 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72  ut columns..quer
254b0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
254c0 45 43 54 20 41 4c 4c 20 63 6f 6c 31 20 2a 20 63  ECT ALL col1 * c
254d0 6f 6c 31 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61  ol1 col1 FROM ta
254e0 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
254f0 0d 0a 37 33 39 36 0d 0a 38 32 38 31 0d 0a 39 34  ..7396..8281..94
25500 30 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  09....query I ro
25510 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f  wsort..SELECT co
25520 6c 30 20 2a 20 63 6f 6c 32 20 2b 20 2d 20 63 6f  l0 * col2 + - co
25530 6c 31 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  l1 AS col0 FROM 
25540 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 35 38 0d  tab2..----..158.
25550 0a 31 39 36 39 0d 0a 32 39 38 35 0d 0a 0d 0a 71  .1969..2985....q
25560 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
25570 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
25580 2d 20 63 6f 6c 31 20 2b 20 2d 20 63 6f 6c 30 20  - col1 + - col0 
25590 2a 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31  * col0 FROM tab1
255a0 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 35 0d 0a 2d 34 31  ..----..-35..-41
255b0 30 36 0d 0a 2d 36 34 31 33 0d 0a 0d 0a 73 6b 69  06..-6413....ski
255c0 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23  pif postgresql #
255d0 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75   PostgreSQL requ
255e0 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e  ires AS when ren
255f0 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c  aming output col
25600 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f  umns..query I ro
25610 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
25620 4c 20 36 32 20 2b 20 38 31 20 63 6f 6c 31 20 46  L 62 + 81 col1 F
25630 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab2..----..
25640 31 34 33 0d 0a 31 34 33 0d 0a 31 34 33 0d 0a 0d  143..143..143...
25650 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
25660 0d 0a 53 45 4c 45 43 54 20 28 20 2d 20 63 6f 6c  ..SELECT ( - col
25670 32 20 29 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  2 ) AS col0 FROM
25680 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 36   tab2..----..-26
25690 0d 0a 2d 32 37 0d 0a 2d 33 38 0d 0a 0d 0a 6f 6e  ..-27..-38....on
256a0 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
256b0 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
256c0 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
256d0 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
256e0 6f 72 74 20 6c 61 62 65 6c 2d 31 30 38 30 0d 0a  ort label-1080..
256f0 53 45 4c 45 43 54 20 2d 20 31 31 20 44 49 56 20  SELECT - 11 DIV 
25700 2d 20 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46  - col0 AS col2 F
25710 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab1..----..
25720 30 0d 0a 30 0d 0a 33 0d 0a 0d 0a 73 6b 69 70 69  0..0..3....skipi
25730 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
25740 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
25750 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
25760 31 30 38 30 0d 0a 53 45 4c 45 43 54 20 2d 20 31  1080..SELECT - 1
25770 31 20 2f 20 2d 20 63 6f 6c 30 20 41 53 20 63 6f  1 / - col0 AS co
25780 6c 32 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d  l2 FROM tab1..--
25790 2d 2d 0d 0a 30 0d 0a 30 0d 0a 33 0d 0a 0d 0a 71  --..0..0..3....q
257a0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
257b0 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
257c0 32 31 20 2b 20 2b 20 63 6f 6c 31 20 46 52 4f 4d  21 + + col1 FROM
257d0 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 37   tab0..----..107
257e0 0d 0a 31 31 32 0d 0a 31 31 38 0d 0a 0d 0a 71 75  ..112..118....qu
257f0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
25800 45 4c 45 43 54 20 41 4c 4c 20 32 39 20 2a 20 63  ELECT ALL 29 * c
25810 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol2 FROM tab0 AS
25820 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 33 37   cor0..----..237
25830 38 0d 0a 32 39 0d 0a 39 35 37 0d 0a 0d 0a 6f 6e  8..29..957....on
25840 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
25850 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
25860 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
25870 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
25880 6f 72 74 20 6c 61 62 65 6c 2d 31 30 38 33 0d 0a  ort label-1083..
25890 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 37 33 20  SELECT ALL - 73 
258a0 2b 20 63 6f 6c 31 20 44 49 56 20 63 6f 6c 30 20  + col1 DIV col0 
258b0 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
258c0 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 37 30 0d 0a 2d 37  0..----..-70..-7
258d0 31 0d 0a 2d 37 32 0d 0a 0d 0a 73 6b 69 70 69 66  1..-72....skipif
258e0 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
258f0 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
25900 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
25910 30 38 33 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  083..SELECT ALL 
25920 2d 20 37 33 20 2b 20 63 6f 6c 31 20 2f 20 63 6f  - 73 + col1 / co
25930 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l0 FROM tab0 AS 
25940 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 37 30 0d  cor0..----..-70.
25950 0a 2d 37 31 0d 0a 2d 37 32 0d 0a 0d 0a 71 75 65  .-71..-72....que
25960 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
25970 4c 45 43 54 20 2b 20 28 20 2b 20 63 6f 72 30 2e  LECT + ( + cor0.
25980 63 6f 6c 31 20 29 20 2a 20 63 6f 6c 30 20 46 52  col1 ) * col0 FR
25990 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d  OM tab2 cor0..--
259a0 2d 2d 0d 0a 31 33 34 33 0d 0a 32 31 37 0d 0a 34  --..1343..217..4
259b0 36 30 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  602....query I r
259c0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
259d0 49 53 54 49 4e 43 54 20 63 6f 6c 31 20 2b 20 2d  ISTINCT col1 + -
259e0 20 63 6f 72 30 2e 63 6f 6c 32 20 41 53 20 63 6f   cor0.col2 AS co
259f0 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l1 FROM tab0 AS 
25a00 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 35 33 0d 0a  cor0..----..53..
25a10 39 0d 0a 39 36 0d 0a 0d 0a 73 6b 69 70 69 66 20  9..96....skipif 
25a20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73  postgresql # Pos
25a30 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73  tgreSQL requires
25a40 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e   AS when renamin
25a50 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73  g output columns
25a60 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
25a70 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20  t..SELECT ALL - 
25a80 28 20 63 6f 72 30 2e 63 6f 6c 30 20 29 20 63 6f  ( cor0.col0 ) co
25a90 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l2 FROM tab1 AS 
25aa0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 0d 0a  cor0..----..-3..
25ab0 2d 36 34 0d 0a 2d 38 30 0d 0a 0d 0a 71 75 65 72  -64..-80....quer
25ac0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
25ad0 45 43 54 20 41 4c 4c 20 2b 20 63 6f 72 30 2e 63  ECT ALL + cor0.c
25ae0 6f 6c 31 20 2b 20 35 36 20 41 53 20 63 6f 6c 31  ol1 + 56 AS col1
25af0 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
25b00 72 30 20 43 52 4f 53 53 20 4a 4f 49 4e 20 74 61  r0 CROSS JOIN ta
25b10 62 32 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d  b2 AS cor1..----
25b20 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68 69  ..9 values hashi
25b30 6e 67 20 74 6f 20 61 61 35 39 33 36 65 34 39 34  ng to aa5936e494
25b40 37 35 61 31 30 33 32 61 63 31 31 63 64 61 64 39  75a1032ac11cdad9
25b50 35 66 32 37 36 35 0d 0a 0d 0a 71 75 65 72 79 20  5f2765....query 
25b60 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
25b70 54 20 41 4c 4c 20 2d 20 38 32 20 2a 20 63 6f 6c  T ALL - 82 * col
25b80 30 20 2b 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61  0 + col2 FROM ta
25b90 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
25ba0 0d 0a 2d 35 34 37 0d 0a 2d 36 33 37 30 0d 0a 2d  ..-547..-6370..-
25bb0 36 34 34 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20  6440....query I 
25bc0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
25bd0 2d 20 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c 31 20  - col0 + + col1 
25be0 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 41 53 20 63  + cor0.col0 AS c
25bf0 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol2 FROM tab0 AS
25c00 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 38 36 0d   cor0..----..86.
25c10 0a 39 31 0d 0a 39 37 0d 0a 0d 0a 71 75 65 72 79  .91..97....query
25c20 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
25c30 43 54 20 41 4c 4c 20 2d 20 32 32 20 41 53 20 63  CT ALL - 22 AS c
25c40 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol0 FROM tab0 AS
25c50 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 32   cor0..----..-22
25c60 0d 0a 2d 32 32 0d 0a 2d 32 32 0d 0a 0d 0a 6f 6e  ..-22..-22....on
25c70 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70  lyif mysql # sup
25c80 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73  port for MySQL s
25c90 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20 74  pecific system t
25ca0 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d  ypes and syntax.
25cb0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
25cc0 20 6c 61 62 65 6c 2d 31 30 39 31 0d 0a 53 45 4c   label-1091..SEL
25cd0 45 43 54 20 2b 20 43 41 53 54 28 20 4e 55 4c 4c  ECT + CAST( NULL
25ce0 20 41 53 20 53 49 47 4e 45 44 20 29 20 2a 20 2d   AS SIGNED ) * -
25cf0 20 28 20 2d 20 63 6f 6c 30 20 2b 20 2d 20 28 20   ( - col0 + - ( 
25d00 63 6f 6c 31 20 29 20 29 20 41 53 20 63 6f 6c 32  col1 ) ) AS col2
25d10 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d   FROM tab1..----
25d20 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55  ..NULL..NULL..NU
25d30 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  LL....skipif mys
25d40 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
25d50 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
25d60 73 6f 72 74 20 6c 61 62 65 6c 2d 31 30 39 31 0d  sort label-1091.
25d70 0a 53 45 4c 45 43 54 20 2b 20 43 41 53 54 20 28  .SELECT + CAST (
25d80 20 4e 55 4c 4c 20 41 53 20 49 4e 54 45 47 45 52   NULL AS INTEGER
25d90 20 29 20 2a 20 2d 20 28 20 2d 20 63 6f 6c 30 20   ) * - ( - col0 
25da0 2b 20 2d 20 28 20 63 6f 6c 31 20 29 20 29 20 41  + - ( col1 ) ) A
25db0 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31  S col2 FROM tab1
25dc0 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55  ..----..NULL..NU
25dd0 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 6f 6e 6c 79  LL..NULL....only
25de0 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f  if mysql # suppo
25df0 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65  rt for MySQL spe
25e00 63 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70  cific system typ
25e10 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71  es and syntax..q
25e20 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
25e30 61 62 65 6c 2d 31 30 39 32 0d 0a 53 45 4c 45 43  abel-1092..SELEC
25e40 54 20 43 41 53 54 28 20 4e 55 4c 4c 20 41 53 20  T CAST( NULL AS 
25e50 53 49 47 4e 45 44 20 29 20 2a 20 63 6f 6c 30 20  SIGNED ) * col0 
25e60 46 52 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a  FROM tab2 cor0..
25e70 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c  ----..NULL..NULL
25e80 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66  ..NULL....skipif
25e90 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
25ea0 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
25eb0 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
25ec0 30 39 32 0d 0a 53 45 4c 45 43 54 20 43 41 53 54  092..SELECT CAST
25ed0 20 28 20 4e 55 4c 4c 20 41 53 20 49 4e 54 45 47   ( NULL AS INTEG
25ee0 45 52 20 29 20 2a 20 63 6f 6c 30 20 46 52 4f 4d  ER ) * col0 FROM
25ef0 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab2 cor0..----
25f00 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55  ..NULL..NULL..NU
25f10 4c 4c 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  LL....onlyif mys
25f20 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65  ql # use DIV ope
25f30 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65  rator for intege
25f40 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72  r division..quer
25f50 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
25f60 6c 2d 31 30 39 33 0d 0a 53 45 4c 45 43 54 20 37  l-1093..SELECT 7
25f70 36 20 2b 20 33 38 20 44 49 56 20 63 6f 6c 32 20  6 + 38 DIV col2 
25f80 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
25f90 31 0d 0a 2d 2d 2d 2d 0d 0a 37 36 0d 0a 37 36 0d  1..----..76..76.
25fa0 0a 37 36 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  .76....skipif my
25fb0 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
25fc0 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
25fd0 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 30 39 33  wsort label-1093
25fe0 0d 0a 53 45 4c 45 43 54 20 37 36 20 2b 20 33 38  ..SELECT 76 + 38
25ff0 20 2f 20 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20   / col2 AS col2 
26000 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d  FROM tab1..----.
26010 0a 37 36 0d 0a 37 36 0d 0a 37 36 0d 0a 0d 0a 71  .76..76..76....q
26020 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
26030 53 45 4c 45 43 54 20 2b 20 2d 20 38 36 20 2b 20  SELECT + - 86 + 
26040 2d 20 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46  - col2 AS col2 F
26050 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
26060 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 34 30 0d 0a 2d 31  ..----..-140..-1
26070 34 33 0d 0a 2d 31 38 32 0d 0a 0d 0a 71 75 65 72  43..-182....quer
26080 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
26090 45 43 54 20 32 30 20 2a 20 63 6f 72 30 2e 63 6f  ECT 20 * cor0.co
260a0 6c 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  l0 AS col1 FROM 
260b0 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
260c0 2d 2d 0d 0a 31 32 38 30 0d 0a 31 36 30 30 0d 0a  --..1280..1600..
260d0 36 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  60....query I ro
260e0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
260f0 38 33 20 2b 20 2b 20 63 6f 6c 32 20 46 52 4f 4d  83 + + col2 FROM
26100 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
26110 2d 2d 2d 0d 0a 31 30 39 0d 0a 31 31 30 0d 0a 31  ---..109..110..1
26120 32 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  21....query I ro
26130 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
26140 4c 20 63 6f 6c 32 20 2b 20 2b 20 63 6f 6c 32 20  L col2 + + col2 
26150 2a 20 2d 20 36 34 20 2b 20 2d 20 63 6f 6c 31 20  * - 64 + - col1 
26160 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
26170 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 36 30 0d 0a 2d  0..----..-160..-
26180 32 31 36 35 0d 0a 2d 35 32 35 37 0d 0a 0d 0a 71  2165..-5257....q
26190 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
261a0 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
261b0 2b 20 2d 20 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c  + - col1 * - col
261c0 32 20 2a 20 2b 20 38 32 20 2d 20 63 6f 72 30 2e  2 * + 82 - cor0.
261d0 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46 52 4f  col1 AS col2 FRO
261e0 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
261f0 2d 2d 2d 2d 0d 0a 31 30 32 33 32 33 0d 0a 31 31  ----..102323..11
26200 35 31 30 32 0d 0a 34 36 37 33 30 0d 0a 0d 0a 71  5102..46730....q
26210 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
26220 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
26230 2d 20 31 36 20 2a 20 33 34 20 41 53 20 63 6f 6c  - 16 * 34 AS col
26240 31 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d  1 FROM tab1..---
26250 2d 0d 0a 2d 35 34 34 0d 0a 0d 0a 71 75 65 72 79  -..-544....query
26260 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
26270 43 54 20 2b 20 2b 20 28 20 2b 20 63 6f 6c 30 20  CT + + ( + col0 
26280 29 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  ) AS col1 FROM t
26290 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
262a0 2d 0d 0a 32 34 0d 0a 33 35 0d 0a 38 39 0d 0a 0d  -..24..35..89...
262b0 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73  .skipif postgres
262c0 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20  ql # PostgreSQL 
262d0 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e  requires AS when
262e0 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74   renaming output
262f0 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20   columns..query 
26300 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
26310 54 20 41 4c 4c 20 2d 20 2d 20 63 6f 6c 31 20 2a  T ALL - - col1 *
26320 20 63 6f 6c 32 20 2b 20 2b 20 34 32 20 63 6f 6c   col2 + + 42 col
26330 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  2 FROM tab2 AS c
26340 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 35 37 36 0d  or0..----..1576.
26350 0a 36 38 38 0d 0a 38 37 39 0d 0a 0d 0a 71 75 65  .688..879....que
26360 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
26370 4c 45 43 54 20 2d 20 2b 20 63 6f 6c 31 20 2a 20  LECT - + col1 * 
26380 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 2a 20 2b 20  + cor0.col0 * + 
26390 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c 31 20 2d 20  col0 + + col1 - 
263a0 28 20 2d 20 63 6f 6c 32 20 29 20 2a 20 2b 20 63  ( - col2 ) * + c
263b0 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  ol0 AS col0 FROM
263c0 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab1 cor0..----
263d0 0d 0a 2d 33 37 33 30 32 0d 0a 2d 34 36 0d 0a 2d  ..-37302..-46..-
263e0 37 35 35 30 37 0d 0a 0d 0a 71 75 65 72 79 20 49  75507....query I
263f0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
26400 20 2d 20 2b 20 63 6f 6c 31 20 2a 20 2b 20 63 6f   - + col1 * + co
26410 72 30 2e 63 6f 6c 32 20 2b 20 2d 20 37 20 2a 20  r0.col2 + - 7 * 
26420 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46 52 4f  col1 AS col2 FRO
26430 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
26440 2d 2d 2d 2d 0d 0a 2d 31 33 33 39 0d 0a 2d 31 35  ----..-1339..-15
26450 38 36 0d 0a 2d 36 34 30 0d 0a 0d 0a 71 75 65 72  86..-640....quer
26460 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
26470 45 43 54 20 2b 20 63 6f 6c 30 20 2a 20 63 6f 72  ECT + col0 * cor
26480 30 2e 63 6f 6c 30 20 2b 20 63 6f 6c 30 20 2d 20  0.col0 + col0 - 
26490 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46 52 4f  col1 AS col1 FRO
264a0 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
264b0 2d 2d 2d 2d 0d 0a 2d 31 34 0d 0a 34 31 35 30 0d  ----..-14..4150.
264c0 0a 36 34 36 37 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  .6467....onlyif 
264d0 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20  mysql # use DIV 
264e0 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74  operator for int
264f0 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71  eger division..q
26500 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
26510 61 62 65 6c 2d 31 31 30 35 0d 0a 53 45 4c 45 43  abel-1105..SELEC
26520 54 20 63 6f 6c 30 20 2b 20 2b 20 28 20 2b 20 63  T col0 + + ( + c
26530 6f 6c 30 20 29 20 44 49 56 20 2d 20 63 6f 6c 32  ol0 ) DIV - col2
26540 20 2d 20 2b 20 43 41 53 54 28 20 2d 20 38 35 20   - + CAST( - 85 
26550 41 53 20 53 49 47 4e 45 44 20 29 20 2a 20 2b 20  AS SIGNED ) * + 
26560 63 6f 72 30 2e 63 6f 6c 30 20 46 52 4f 4d 20 74  cor0.col0 FROM t
26570 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
26580 2d 0d 0a 32 30 36 34 0d 0a 32 39 37 35 0d 0a 37  -..2064..2975..7
26590 36 35 33 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  653....skipif my
265a0 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
265b0 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
265c0 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 31 30 35  wsort label-1105
265d0 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 30 20 2b 20  ..SELECT col0 + 
265e0 2b 20 28 20 2b 20 63 6f 6c 30 20 29 20 2f 20 2d  + ( + col0 ) / -
265f0 20 63 6f 6c 32 20 2d 20 2b 20 43 41 53 54 20 28   col2 - + CAST (
26600 20 2d 20 38 35 20 41 53 20 49 4e 54 45 47 45 52   - 85 AS INTEGER
26610 20 29 20 2a 20 2b 20 63 6f 72 30 2e 63 6f 6c 30   ) * + cor0.col0
26620 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
26630 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 30 36 34 0d 0a  r0..----..2064..
26640 32 39 37 35 0d 0a 37 36 35 33 0d 0a 0d 0a 71 75  2975..7653....qu
26650 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
26660 45 4c 45 43 54 20 2d 20 2b 20 63 6f 6c 31 20 2b  ELECT - + col1 +
26670 20 2d 20 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20   - col1 AS col2 
26680 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
26690 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 30 0d 0a 2d 32  0..----..-20..-2
266a0 36 0d 0a 2d 35 32 0d 0a 0d 0a 71 75 65 72 79 20  6..-52....query 
266b0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
266c0 54 20 2b 20 2d 20 63 6f 6c 32 20 2b 20 63 6f 6c  T + - col2 + col
266d0 30 20 2a 20 31 35 20 46 52 4f 4d 20 74 61 62 31  0 * 15 FROM tab1
266e0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
266f0 2d 39 0d 0a 31 31 30 34 0d 0a 39 30 33 0d 0a 0d  -9..1104..903...
26700 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73  .skipif postgres
26710 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20  ql # PostgreSQL 
26720 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e  requires AS when
26730 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74   renaming output
26740 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20   columns..query 
26750 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
26760 54 20 2b 20 2d 20 63 6f 6c 31 20 2b 20 2b 20 63  T + - col1 + + c
26770 6f 6c 32 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20  ol2 - cor0.col2 
26780 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41  col0 FROM tab0 A
26790 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 38  S cor0..----..-8
267a0 36 0d 0a 2d 39 31 0d 0a 2d 39 37 0d 0a 0d 0a 71  6..-91..-97....q
267b0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
267c0 53 45 4c 45 43 54 20 63 6f 6c 31 20 2a 20 2b 20  SELECT col1 * + 
267d0 39 37 20 2b 20 63 6f 6c 32 20 41 53 20 63 6f 6c  97 + col2 AS col
267e0 32 20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30  2 FROM tab1 cor0
267f0 0d 0a 2d 2d 2d 2d 0d 0a 31 30 32 37 0d 0a 31 33  ..----..1027..13
26800 35 37 0d 0a 32 35 37 36 0d 0a 0d 0a 71 75 65 72  57..2576....quer
26810 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
26820 45 43 54 20 41 4c 4c 20 63 6f 6c 32 20 2a 20 2b  ECT ALL col2 * +
26830 20 63 6f 6c 31 20 2a 20 63 6f 6c 30 20 46 52 4f   col1 * col0 FRO
26840 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 33 33  M tab0..----..33
26850 39 35 0d 0a 36 36 34 31 31 38 0d 0a 36 38 31 31  95..664118..6811
26860 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  2....query I row
26870 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
26880 20 63 6f 72 30 2e 63 6f 6c 31 20 2b 20 28 20 2d   cor0.col1 + ( -
26890 20 63 6f 6c 30 20 2b 20 2b 20 30 20 29 20 2a 20   col0 + + 0 ) * 
268a0 2b 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30  + col2 FROM tab0
268b0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
268c0 2d 37 30 36 0d 0a 2d 37 32 30 37 0d 0a 36 32 0d  -706..-7207..62.
268d0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
268e0 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 72  rt..SELECT - cor
268f0 30 2e 63 6f 6c 31 20 2a 20 2d 20 38 35 20 2b 20  0.col1 * - 85 + 
26900 2d 20 63 6f 72 30 2e 63 6f 6c 30 20 2a 20 2b 20  - cor0.col0 * + 
26910 39 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  9 AS col0 FROM t
26920 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab1 cor0..----..
26930 32 31 38 33 0d 0a 32 37 34 0d 0a 33 38 35 0d 0a  2183..274..385..
26940 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
26950 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20  t..SELECT ALL + 
26960 63 6f 6c 31 20 2a 20 63 6f 6c 30 20 2a 20 63 6f  col1 * col0 * co
26970 6c 30 20 2b 20 63 6f 6c 30 20 2a 20 2b 20 37 32  l0 + col0 * + 72
26980 20 2a 20 2d 20 63 6f 6c 31 20 41 53 20 63 6f 6c   * - col1 AS col
26990 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  2 FROM tab0 AS c
269a0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32 35 36  or0..----..-1256
269b0 31 35 0d 0a 2d 39 39 30 37 32 0d 0a 31 33 37 36  15..-99072..1376
269c0 38 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  83....query I ro
269d0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
269e0 33 34 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  34 AS col0 FROM 
269f0 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab2 cor0..----.
26a00 0a 33 34 0d 0a 33 34 0d 0a 33 34 0d 0a 0d 0a 73  .34..34..34....s
26a10 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c  kipif postgresql
26a20 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65   # PostgreSQL re
26a30 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72  quires AS when r
26a40 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63  enaming output c
26a50 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20  olumns..query I 
26a60 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
26a70 2d 20 2d 20 63 6f 6c 30 20 2b 20 31 39 20 63 6f  - - col0 + 19 co
26a80 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l1 FROM tab2 AS 
26a90 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 36 0d 0a  cor0..----..26..
26aa0 39 37 0d 0a 39 38 0d 0a 0d 0a 71 75 65 72 79 20  97..98....query 
26ab0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
26ac0 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c  T DISTINCT + col
26ad0 32 20 2a 20 28 20 63 6f 6c 31 20 29 20 46 52 4f  2 * ( col1 ) FRO
26ae0 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
26af0 2d 2d 2d 2d 0d 0a 31 32 34 38 0d 0a 31 34 30 34  ----..1248..1404
26b00 0d 0a 35 37 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  ..570....onlyif 
26b10 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20  mysql # support 
26b20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66  for MySQL specif
26b30 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20  ic system types 
26b40 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72  and syntax..quer
26b50 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
26b60 6c 2d 31 31 31 37 0d 0a 53 45 4c 45 43 54 20 43  l-1117..SELECT C
26b70 41 53 54 28 20 63 6f 6c 31 20 41 53 20 53 49 47  AST( col1 AS SIG
26b80 4e 45 44 20 29 20 2b 20 2b 20 63 6f 72 30 2e 63  NED ) + + cor0.c
26b90 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  ol2 AS col0 FROM
26ba0 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
26bb0 2d 2d 2d 0d 0a 31 31 39 0d 0a 31 37 33 0d 0a 39  ---..119..173..9
26bc0 38 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  8....skipif mysq
26bd0 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
26be0 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
26bf0 6f 72 74 20 6c 61 62 65 6c 2d 31 31 31 37 0d 0a  ort label-1117..
26c00 53 45 4c 45 43 54 20 43 41 53 54 20 28 20 63 6f  SELECT CAST ( co
26c10 6c 31 20 41 53 20 49 4e 54 45 47 45 52 20 29 20  l1 AS INTEGER ) 
26c20 2b 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 41 53  + + cor0.col2 AS
26c30 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20   col0 FROM tab0 
26c40 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
26c50 31 39 0d 0a 31 37 33 0d 0a 39 38 0d 0a 0d 0a 71  19..173..98....q
26c60 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
26c70 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
26c80 33 36 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  36 AS col1 FROM 
26c90 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
26ca0 2d 2d 0d 0a 33 36 0d 0a 0d 0a 71 75 65 72 79 20  --..36....query 
26cb0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
26cc0 54 20 28 20 63 6f 6c 31 20 29 20 2a 20 2b 20 63  T ( col1 ) * + c
26cd0 6f 6c 32 20 2b 20 32 38 20 46 52 4f 4d 20 74 61  ol2 + 28 FROM ta
26ce0 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  b0 cor0..----..1
26cf0 32 35 0d 0a 32 38 36 36 0d 0a 37 34 39 30 0d 0a  25..2866..7490..
26d00 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
26d10 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f  t..SELECT ALL co
26d20 6c 32 20 2b 20 2b 20 38 20 46 52 4f 4d 20 74 61  l2 + + 8 FROM ta
26d30 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
26d40 0d 0a 33 34 0d 0a 33 35 0d 0a 34 36 0d 0a 0d 0a  ..34..35..46....
26d50 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73  onlyif mysql # s
26d60 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c  upport for MySQL
26d70 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d   specific system
26d80 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61   types and synta
26d90 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  x..query I rowso
26da0 72 74 20 6c 61 62 65 6c 2d 31 31 32 31 0d 0a 53  rt label-1121..S
26db0 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d  ELECT DISTINCT -
26dc0 20 43 41 53 54 28 20 63 6f 6c 32 20 41 53 20 53   CAST( col2 AS S
26dd0 49 47 4e 45 44 20 29 20 41 53 20 63 6f 6c 32 20  IGNED ) AS col2 
26de0 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
26df0 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 2d 33 33  0..----..-1..-33
26e00 0d 0a 2d 38 32 0d 0a 0d 0a 73 6b 69 70 69 66 20  ..-82....skipif 
26e10 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
26e20 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
26e30 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 31  rowsort label-11
26e40 32 31 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  21..SELECT DISTI
26e50 4e 43 54 20 2d 20 43 41 53 54 20 28 20 63 6f 6c  NCT - CAST ( col
26e60 32 20 41 53 20 49 4e 54 45 47 45 52 20 29 20 41  2 AS INTEGER ) A
26e70 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30  S col2 FROM tab0
26e80 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
26e90 2d 31 0d 0a 2d 33 33 0d 0a 2d 38 32 0d 0a 0d 0a  -1..-33..-82....
26ea0 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75  onlyif mysql # u
26eb0 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20  se DIV operator 
26ec0 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69  for integer divi
26ed0 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f  sion..query I ro
26ee0 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 31 32 32  wsort label-1122
26ef0 0d 0a 53 45 4c 45 43 54 20 2d 20 35 38 20 2b 20  ..SELECT - 58 + 
26f00 2b 20 63 6f 6c 30 20 44 49 56 20 2b 20 63 6f 72  + col0 DIV + cor
26f10 30 2e 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46  0.col2 AS col2 F
26f20 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
26f30 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 37 0d 0a 2d 35 38  ..----..-57..-58
26f40 0d 0a 2d 35 38 0d 0a 0d 0a 73 6b 69 70 69 66 20  ..-58....skipif 
26f50 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
26f60 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
26f70 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 31  rowsort label-11
26f80 32 32 0d 0a 53 45 4c 45 43 54 20 2d 20 35 38 20  22..SELECT - 58 
26f90 2b 20 2b 20 63 6f 6c 30 20 2f 20 2b 20 63 6f 72  + + col0 / + cor
26fa0 30 2e 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46  0.col2 AS col2 F
26fb0 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
26fc0 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 37 0d 0a 2d 35 38  ..----..-57..-58
26fd0 0d 0a 2d 35 38 0d 0a 0d 0a 71 75 65 72 79 20 49  ..-58....query I
26fe0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
26ff0 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 2b 20 63   + cor0.col0 + c
27000 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  ol0 AS col0 FROM
27010 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
27020 2d 2d 2d 0d 0a 31 34 0d 0a 31 35 36 0d 0a 31 35  ---..14..156..15
27030 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  8....query I row
27040 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
27050 54 49 4e 43 54 20 2d 20 63 6f 6c 31 20 2a 20 28  TINCT - col1 * (
27060 20 2b 20 63 6f 6c 30 20 29 20 46 52 4f 4d 20 74   + col0 ) FROM t
27070 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab0 cor0..----..
27080 2d 32 30 36 34 0d 0a 2d 33 33 39 35 0d 0a 2d 38  -2064..-3395..-8
27090 30 39 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  099....query I r
270a0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
270b0 4c 4c 20 2b 20 38 35 20 2a 20 63 6f 6c 32 20 2b  LL + 85 * col2 +
270c0 20 63 6f 72 30 2e 63 6f 6c 32 20 2a 20 31 32 20   cor0.col2 * 12 
270d0 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
270e0 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
270f0 0a 32 35 32 32 0d 0a 32 36 31 39 0d 0a 33 36 38  .2522..2619..368
27100 36 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  6....onlyif mysq
27110 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20  l # support for 
27120 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63 20 73  MySQL specific s
27130 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20  ystem types and 
27140 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20  syntax..query I 
27150 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 31  rowsort label-11
27160 32 36 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c  26..SELECT - col
27170 31 20 2b 20 2b 20 63 6f 6c 31 20 2a 20 43 41 53  1 + + col1 * CAS
27180 54 28 20 4e 55 4c 4c 20 41 53 20 53 49 47 4e 45  T( NULL AS SIGNE
27190 44 20 29 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  D ) AS col0 FROM
271a0 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
271b0 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d  ---..NULL..NULL.
271c0 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20  .NULL....skipif 
271d0 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
271e0 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
271f0 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 31  rowsort label-11
27200 32 36 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c  26..SELECT - col
27210 31 20 2b 20 2b 20 63 6f 6c 31 20 2a 20 43 41 53  1 + + col1 * CAS
27220 54 20 28 20 4e 55 4c 4c 20 41 53 20 49 4e 54 45  T ( NULL AS INTE
27230 47 45 52 20 29 20 41 53 20 63 6f 6c 30 20 46 52  GER ) AS col0 FR
27240 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
27250 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c  .----..NULL..NUL
27260 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75 65 72 79  L..NULL....query
27270 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
27280 43 54 20 35 20 2a 20 34 35 20 41 53 20 63 6f 6c  CT 5 * 45 AS col
27290 31 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d  1 FROM tab1..---
272a0 2d 0d 0a 32 32 35 0d 0a 32 32 35 0d 0a 32 32 35  -..225..225..225
272b0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
272c0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 28 20  ort..SELECT - ( 
272d0 2d 20 35 38 20 29 20 2b 20 2d 20 63 6f 6c 30 20  - 58 ) + - col0 
272e0 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a  FROM tab1 cor0..
272f0 2d 2d 2d 2d 0d 0a 2d 32 32 0d 0a 2d 36 0d 0a 35  ----..-22..-6..5
27300 35 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  5....onlyif mysq
27310 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72  l # use DIV oper
27320 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72  ator for integer
27330 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79   division..query
27340 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
27350 2d 31 31 32 39 0d 0a 53 45 4c 45 43 54 20 31 32  -1129..SELECT 12
27360 20 2d 20 2d 20 63 6f 6c 32 20 44 49 56 20 2d 20   - - col2 DIV - 
27370 74 61 62 31 2e 63 6f 6c 32 20 41 53 20 63 6f 6c  tab1.col2 AS col
27380 30 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d  0 FROM tab1..---
27390 2d 0d 0a 31 31 0d 0a 31 31 0d 0a 31 31 0d 0a 0d  -..11..11..11...
273a0 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
273b0 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
273c0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
273d0 6c 61 62 65 6c 2d 31 31 32 39 0d 0a 53 45 4c 45  label-1129..SELE
273e0 43 54 20 31 32 20 2d 20 2d 20 63 6f 6c 32 20 2f  CT 12 - - col2 /
273f0 20 2d 20 74 61 62 31 2e 63 6f 6c 32 20 41 53 20   - tab1.col2 AS 
27400 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 0d 0a  col0 FROM tab1..
27410 2d 2d 2d 2d 0d 0a 31 31 0d 0a 31 31 0d 0a 31 31  ----..11..11..11
27420 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
27430 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61   # use DIV opera
27440 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20  tor for integer 
27450 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20  division..query 
27460 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
27470 31 31 33 30 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  1130..SELECT ALL
27480 20 63 6f 6c 30 20 44 49 56 20 2b 20 74 61 62 30   col0 DIV + tab0
27490 2e 63 6f 6c 30 20 2b 20 63 6f 6c 30 20 46 52 4f  .col0 + col0 FRO
274a0 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 32 35  M tab0..----..25
274b0 0d 0a 33 36 0d 0a 39 30 0d 0a 0d 0a 73 6b 69 70  ..36..90....skip
274c0 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
274d0 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
274e0 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
274f0 2d 31 31 33 30 0d 0a 53 45 4c 45 43 54 20 41 4c  -1130..SELECT AL
27500 4c 20 63 6f 6c 30 20 2f 20 2b 20 74 61 62 30 2e  L col0 / + tab0.
27510 63 6f 6c 30 20 2b 20 63 6f 6c 30 20 46 52 4f 4d  col0 + col0 FROM
27520 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 32 35 0d   tab0..----..25.
27530 0a 33 36 0d 0a 39 30 0d 0a 0d 0a 6f 6e 6c 79 69  .36..90....onlyi
27540 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72  f mysql # suppor
27550 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63  t for MySQL spec
27560 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65  ific system type
27570 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75  s and syntax..qu
27580 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
27590 62 65 6c 2d 31 31 33 31 0d 0a 53 45 4c 45 43 54  bel-1131..SELECT
275a0 20 41 4c 4c 20 2b 20 2b 20 63 6f 72 30 2e 63 6f   ALL + + cor0.co
275b0 6c 30 20 2b 20 43 41 53 54 28 20 63 6f 6c 32 20  l0 + CAST( col2 
275c0 41 53 20 53 49 47 4e 45 44 20 29 20 41 53 20 63  AS SIGNED ) AS c
275d0 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 63 6f  ol2 FROM tab0 co
275e0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 37 31 0d 0a 33  r0..----..171..3
275f0 36 0d 0a 35 37 0d 0a 0d 0a 73 6b 69 70 69 66 20  6..57....skipif 
27600 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
27610 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
27620 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 31  rowsort label-11
27630 33 31 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b  31..SELECT ALL +
27640 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 2b 20 43   + cor0.col0 + C
27650 41 53 54 20 28 20 63 6f 6c 32 20 41 53 20 49 4e  AST ( col2 AS IN
27660 54 45 47 45 52 20 29 20 41 53 20 63 6f 6c 32 20  TEGER ) AS col2 
27670 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a  FROM tab0 cor0..
27680 2d 2d 2d 2d 0d 0a 31 37 31 0d 0a 33 36 0d 0a 35  ----..171..36..5
27690 37 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  7....onlyif mysq
276a0 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72  l # use DIV oper
276b0 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72  ator for integer
276c0 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79   division..query
276d0 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
276e0 2d 31 31 33 32 0d 0a 53 45 4c 45 43 54 20 41 4c  -1132..SELECT AL
276f0 4c 20 2d 20 63 6f 6c 32 20 44 49 56 20 63 6f 6c  L - col2 DIV col
27700 31 20 2b 20 2d 20 38 37 20 46 52 4f 4d 20 74 61  1 + - 87 FROM ta
27710 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
27720 0d 0a 2d 38 39 0d 0a 2d 39 32 0d 0a 2d 39 34 0d  ..-89..-92..-94.
27730 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
27740 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
27750 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
27760 74 20 6c 61 62 65 6c 2d 31 31 33 32 0d 0a 53 45  t label-1132..SE
27770 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 32 20  LECT ALL - col2 
27780 2f 20 63 6f 6c 31 20 2b 20 2d 20 38 37 20 46 52  / col1 + - 87 FR
27790 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
277a0 0a 2d 2d 2d 2d 0d 0a 2d 38 39 0d 0a 2d 39 32 0d  .----..-89..-92.
277b0 0a 2d 39 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .-94....query I 
277c0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
277d0 41 4c 4c 20 2b 20 2d 20 63 6f 6c 31 20 2a 20 2b  ALL + - col1 * +
277e0 20 63 6f 6c 30 20 2d 20 63 6f 6c 30 20 41 53 20   col0 - col0 AS 
277f0 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41  col2 FROM tab2 A
27800 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
27810 34 32 32 0d 0a 2d 32 32 34 0d 0a 2d 34 36 38 30  422..-224..-4680
27820 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
27830 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
27840 49 4e 43 54 20 2d 20 63 6f 6c 32 20 2b 20 37 37  INCT - col2 + 77
27850 20 2a 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62   * col0 FROM tab
27860 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
27870 0a 31 38 31 35 0d 0a 32 36 39 34 0d 0a 36 37 37  .1815..2694..677
27880 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  1....query I row
27890 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
278a0 20 35 31 20 2b 20 2b 20 63 6f 72 31 2e 63 6f 6c   51 + + cor1.col
278b0 31 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  1 AS col0 FROM t
278c0 61 62 32 2c 20 74 61 62 31 20 41 53 20 63 6f 72  ab2, tab1 AS cor
278d0 30 2c 20 74 61 62 31 20 41 53 20 63 6f 72 31 0d  0, tab1 AS cor1.
278e0 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75 65 73  .----..27 values
278f0 20 68 61 73 68 69 6e 67 20 74 6f 20 39 61 61 64   hashing to 9aad
27900 31 38 39 62 39 62 64 39 34 31 31 32 39 35 33 34  189b9bd941129534
27910 34 37 66 35 30 30 64 38 39 36 62 63 0d 0a 0d 0a  47f500d896bc....
27920 71 75 65 72 79 20 49 49 49 49 49 49 49 49 49 49  query IIIIIIIIII
27930 49 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45  II rowsort..SELE
27940 43 54 20 41 4c 4c 20 2a 20 46 52 4f 4d 20 74 61  CT ALL * FROM ta
27950 62 31 2c 20 74 61 62 30 2c 20 74 61 62 31 20 41  b1, tab0, tab1 A
27960 53 20 63 6f 72 30 2c 20 74 61 62 30 20 63 6f 72  S cor0, tab0 cor
27970 31 0d 0a 2d 2d 2d 2d 0d 0a 39 37 32 20 76 61 6c  1..----..972 val
27980 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 39  ues hashing to 9
27990 35 39 32 30 34 30 33 64 66 32 36 38 61 32 37 32  5920403df268a272
279a0 63 34 65 39 33 33 63 64 30 62 62 65 30 62 65 0d  c4e933cd0bbe0be.
279b0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
279c0 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c  rt..SELECT + col
279d0 32 20 2a 20 35 30 20 46 52 4f 4d 20 74 61 62 30  2 * 50 FROM tab0
279e0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
279f0 31 36 35 30 0d 0a 34 31 30 30 0d 0a 35 30 0d 0a  1650..4100..50..
27a00 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
27a10 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 31  t..SELECT - col1
27a20 20 2a 20 2b 20 63 6f 6c 31 20 2a 20 63 6f 6c 30   * + col1 * col0
27a30 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
27a40 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 32 38 33 31  r0..----..-22831
27a50 0d 0a 2d 32 37 31 35 31 38 0d 0a 2d 36 37 32 37  ..-271518..-6727
27a60 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
27a70 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
27a80 49 4e 43 54 20 2d 20 36 32 20 2d 20 63 6f 6c 31  INCT - 62 - col1
27a90 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d   FROM tab0 cor0.
27aa0 0a 2d 2d 2d 2d 0d 0a 2d 31 34 38 0d 0a 2d 31 35  .----..-148..-15
27ab0 33 0d 0a 2d 31 35 39 0d 0a 0d 0a 71 75 65 72 79  3..-159....query
27ac0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
27ad0 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 2d 20  CT DISTINCT - - 
27ae0 63 6f 6c 31 20 2b 20 2b 20 63 6f 6c 32 20 46 52  col1 + + col2 FR
27af0 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
27b00 0a 2d 2d 2d 2d 0d 0a 35 35 0d 0a 35 38 0d 0a 38  .----..55..58..8
27b10 35 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  5....onlyif mysq
27b20 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20  l # support for 
27b30 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63 20 73  MySQL specific s
27b40 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20  ystem types and 
27b50 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20  syntax..query I 
27b60 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 31  rowsort label-11
27b70 34 31 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d  41..SELECT ALL -
27b80 20 2b 20 37 20 2a 20 63 6f 6c 32 20 2d 20 2d 20   + 7 * col2 - - 
27b90 43 41 53 54 28 20 63 6f 6c 31 20 41 53 20 53 49  CAST( col1 AS SI
27ba0 47 4e 45 44 20 29 20 41 53 20 63 6f 6c 31 20 46  GNED ) AS col1 F
27bb0 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
27bc0 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32 33 0d 0a 2d 31  ..----..-123..-1
27bd0 35 38 0d 0a 2d 32 34 39 0d 0a 0d 0a 73 6b 69 70  58..-249....skip
27be0 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
27bf0 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
27c00 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
27c10 2d 31 31 34 31 0d 0a 53 45 4c 45 43 54 20 41 4c  -1141..SELECT AL
27c20 4c 20 2d 20 2b 20 37 20 2a 20 63 6f 6c 32 20 2d  L - + 7 * col2 -
27c30 20 2d 20 43 41 53 54 20 28 20 63 6f 6c 31 20 41   - CAST ( col1 A
27c40 53 20 49 4e 54 45 47 45 52 20 29 20 41 53 20 63  S INTEGER ) AS c
27c50 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol1 FROM tab2 AS
27c60 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32   cor0..----..-12
27c70 33 0d 0a 2d 31 35 38 0d 0a 2d 32 34 39 0d 0a 0d  3..-158..-249...
27c80 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
27c90 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 35 39 20  ..SELECT ALL 59 
27ca0 2a 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 46 52  * + cor0.col2 FR
27cb0 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d  OM tab0 cor0..--
27cc0 2d 2d 0d 0a 31 39 34 37 0d 0a 34 38 33 38 0d 0a  --..1947..4838..
27cd0 35 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  59....query I ro
27ce0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
27cf0 53 54 49 4e 43 54 20 2d 20 2d 20 63 6f 6c 30 20  STINCT - - col0 
27d00 2a 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61  * + col1 FROM ta
27d10 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
27d20 0d 0a 31 33 34 33 0d 0a 32 31 37 0d 0a 34 36 30  ..1343..217..460
27d30 32 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  2....onlyif mysq
27d40 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72  l # use DIV oper
27d50 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72  ator for integer
27d60 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79   division..query
27d70 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
27d80 2d 31 31 34 34 0d 0a 53 45 4c 45 43 54 20 44 49  -1144..SELECT DI
27d90 53 54 49 4e 43 54 20 2b 20 37 37 20 44 49 56 20  STINCT + 77 DIV 
27da0 2b 20 38 30 20 2b 20 63 6f 6c 32 20 46 52 4f 4d  + 80 + col2 FROM
27db0 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 0d 0a   tab0..----..1..
27dc0 33 33 0d 0a 38 32 0d 0a 0d 0a 73 6b 69 70 69 66  33..82....skipif
27dd0 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
27de0 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
27df0 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
27e00 31 34 34 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  144..SELECT DIST
27e10 49 4e 43 54 20 2b 20 37 37 20 2f 20 2b 20 38 30  INCT + 77 / + 80
27e20 20 2b 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62   + col2 FROM tab
27e30 30 0d 0a 2d 2d 2d 2d 0d 0a 31 0d 0a 33 33 0d 0a  0..----..1..33..
27e40 38 32 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73  82....skipif pos
27e50 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72  tgresql # Postgr
27e60 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53  eSQL requires AS
27e70 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f   when renaming o
27e80 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71  utput columns..q
27e90 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
27ea0 53 45 4c 45 43 54 20 63 6f 6c 30 20 2b 20 63 6f  SELECT col0 + co
27eb0 6c 30 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  l0 col2 FROM tab
27ec0 30 0d 0a 2d 2d 2d 2d 0d 0a 31 37 38 0d 0a 34 38  0..----..178..48
27ed0 0d 0a 37 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..70....query I 
27ee0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
27ef0 41 4c 4c 20 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c  ALL col0 * + col
27f00 31 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61  1 + col0 FROM ta
27f10 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 31 32 30 0d 0a  b1..----..1120..
27f20 37 30 34 0d 0a 38 31 0d 0a 0d 0a 73 6b 69 70 69  704..81....skipi
27f30 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50  f postgresql # P
27f40 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72  ostgreSQL requir
27f50 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d  es AS when renam
27f60 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d  ing output colum
27f70 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ns..query I rows
27f80 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
27f90 2d 20 63 6f 6c 30 20 2a 20 63 6f 6c 31 20 63 6f  - col0 * col1 co
27fa0 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d  l0 FROM tab0..--
27fb0 2d 2d 0d 0a 2d 32 30 36 34 0d 0a 2d 33 33 39 35  --..-2064..-3395
27fc0 0d 0a 2d 38 30 39 39 0d 0a 0d 0a 71 75 65 72 79  ..-8099....query
27fd0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
27fe0 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 2b 20  CT DISTINCT + + 
27ff0 63 6f 72 30 2e 63 6f 6c 32 20 2b 20 63 6f 6c 31  cor0.col2 + col1
28000 20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d   FROM tab1 cor0.
28010 0a 2d 2d 2d 2d 0d 0a 31 30 39 0d 0a 36 37 0d 0a  .----..109..67..
28020 38 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  80....onlyif mys
28030 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65  ql # use DIV ope
28040 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65  rator for intege
28050 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72  r division..quer
28060 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
28070 6c 2d 31 31 34 39 0d 0a 53 45 4c 45 43 54 20 44  l-1149..SELECT D
28080 49 53 54 49 4e 43 54 20 2b 20 2b 20 32 36 20 2b  ISTINCT + + 26 +
28090 20 63 6f 6c 30 20 44 49 56 20 2b 20 28 20 2b 20   col0 DIV + ( + 
280a0 63 6f 6c 32 20 29 20 41 53 20 63 6f 6c 31 20 46  col2 ) AS col1 F
280b0 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
280c0 0d 0a 2d 2d 2d 2d 0d 0a 32 36 0d 0a 32 37 0d 0a  ..----..26..27..
280d0 36 31 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  61....skipif mys
280e0 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
280f0 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
28100 73 6f 72 74 20 6c 61 62 65 6c 2d 31 31 34 39 0d  sort label-1149.
28110 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
28120 20 2b 20 2b 20 32 36 20 2b 20 63 6f 6c 30 20 2f   + + 26 + col0 /
28130 20 2b 20 28 20 2b 20 63 6f 6c 32 20 29 20 41 53   + ( + col2 ) AS
28140 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20   col1 FROM tab0 
28150 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32  AS cor0..----..2
28160 36 0d 0a 32 37 0d 0a 36 31 0d 0a 0d 0a 71 75 65  6..27..61....que
28170 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
28180 4c 45 43 54 20 41 4c 4c 20 2b 20 33 38 20 2b 20  LECT ALL + 38 + 
28190 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46 52 4f  col2 AS col1 FRO
281a0 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab1 cor0..---
281b0 2d 0d 0a 31 33 34 0d 0a 39 32 0d 0a 39 35 0d 0a  -..134..92..95..
281c0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
281d0 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f  t..SELECT ALL co
281e0 6c 31 20 2a 20 2d 20 63 6f 6c 32 20 41 53 20 63  l1 * - col2 AS c
281f0 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol2 FROM tab0 AS
28200 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 38   cor0..----..-28
28210 33 38 0d 0a 2d 37 34 36 32 0d 0a 2d 39 37 0d 0a  38..-7462..-97..
28220 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
28230 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
28240 43 54 20 2b 20 2d 20 63 6f 6c 30 20 2a 20 63 6f  CT + - col0 * co
28250 6c 30 20 2b 20 28 20 2d 20 28 20 63 6f 6c 30 20  l0 + ( - ( col0 
28260 29 20 29 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  ) ) AS col1 FROM
28270 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
28280 2d 2d 2d 0d 0a 2d 31 32 36 30 0d 0a 2d 36 30 30  ---..-1260..-600
28290 0d 0a 2d 38 30 31 30 0d 0a 0d 0a 71 75 65 72 79  ..-8010....query
282a0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
282b0 43 54 20 2b 20 63 6f 6c 31 20 2a 20 2b 20 32 37  CT + col1 * + 27
282c0 20 2a 20 2b 20 74 61 62 31 2e 63 6f 6c 30 20 41   * + tab1.col0 A
282d0 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31  S col2 FROM tab1
282e0 0d 0a 2d 2d 2d 2d 0d 0a 31 37 32 38 30 0d 0a 32  ..----..17280..2
282f0 31 30 36 0d 0a 32 38 30 38 30 0d 0a 0d 0a 6f 6e  106..28080....on
28300 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
28310 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
28320 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
28330 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
28340 6f 72 74 20 6c 61 62 65 6c 2d 31 31 35 34 0d 0a  ort label-1154..
28350 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c  SELECT ALL + col
28360 30 20 2b 20 2b 20 38 37 20 44 49 56 20 63 6f 6c  0 + + 87 DIV col
28370 32 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d  2 FROM tab1..---
28380 2d 0d 0a 34 0d 0a 36 35 0d 0a 38 30 0d 0a 0d 0a  -..4..65..80....
28390 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
283a0 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
283b0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
283c0 61 62 65 6c 2d 31 31 35 34 0d 0a 53 45 4c 45 43  abel-1154..SELEC
283d0 54 20 41 4c 4c 20 2b 20 63 6f 6c 30 20 2b 20 2b  T ALL + col0 + +
283e0 20 38 37 20 2f 20 63 6f 6c 32 20 46 52 4f 4d 20   87 / col2 FROM 
283f0 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 34 0d 0a 36  tab1..----..4..6
28400 35 0d 0a 38 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  5..80....onlyif 
28410 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20  mysql # support 
28420 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66  for MySQL specif
28430 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20  ic system types 
28440 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72  and syntax..quer
28450 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
28460 6c 2d 31 31 35 35 0d 0a 53 45 4c 45 43 54 20 44  l-1155..SELECT D
28470 49 53 54 49 4e 43 54 20 2d 20 74 61 62 30 2e 63  ISTINCT - tab0.c
28480 6f 6c 31 20 2b 20 2d 20 43 41 53 54 28 20 4e 55  ol1 + - CAST( NU
28490 4c 4c 20 41 53 20 53 49 47 4e 45 44 20 29 20 41  LL AS SIGNED ) A
284a0 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30  S col1 FROM tab0
284b0 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 0d 0a  ..----..NULL....
284c0 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
284d0 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
284e0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
284f0 61 62 65 6c 2d 31 31 35 35 0d 0a 53 45 4c 45 43  abel-1155..SELEC
28500 54 20 44 49 53 54 49 4e 43 54 20 2d 20 74 61 62  T DISTINCT - tab
28510 30 2e 63 6f 6c 31 20 2b 20 2d 20 43 41 53 54 20  0.col1 + - CAST 
28520 28 20 4e 55 4c 4c 20 41 53 20 49 4e 54 45 47 45  ( NULL AS INTEGE
28530 52 20 29 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  R ) AS col1 FROM
28540 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c   tab0..----..NUL
28550 4c 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  L....query I row
28560 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c  sort..SELECT col
28570 30 20 2a 20 74 61 62 31 2e 63 6f 6c 31 20 2a 20  0 * tab1.col1 * 
28580 2d 20 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46  - col2 AS col0 F
28590 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab1..----..
285a0 2d 33 36 34 38 30 0d 0a 2d 34 32 31 32 0d 0a 2d  -36480..-4212..-
285b0 39 39 38 34 30 0d 0a 0d 0a 73 6b 69 70 69 66 20  99840....skipif 
285c0 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73  postgresql # Pos
285d0 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73  tgreSQL requires
285e0 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e   AS when renamin
285f0 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73  g output columns
28600 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
28610 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20  t..SELECT ALL - 
28620 63 6f 6c 31 20 2d 20 28 20 2b 20 37 36 20 29 20  col1 - ( + 76 ) 
28630 2a 20 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c 30 20  * col2 * - col0 
28640 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 0d 0a  col0 FROM tab2..
28650 2d 2d 2d 2d 0d 0a 31 34 33 33 33 0d 0a 31 35 34  ----..14333..154
28660 30 36 39 0d 0a 32 32 38 31 33 35 0d 0a 0d 0a 71  069..228135....q
28670 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
28680 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
28690 74 61 62 30 2e 63 6f 6c 30 20 2b 20 33 34 20 46  tab0.col0 + 34 F
286a0 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab0..----..
286b0 31 32 33 0d 0a 35 38 0d 0a 36 39 0d 0a 0d 0a 71  123..58..69....q
286c0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
286d0 53 45 4c 45 43 54 20 63 6f 6c 32 20 2a 20 74 61  SELECT col2 * ta
286e0 62 31 2e 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20  b1.col0 AS col1 
286f0 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d  FROM tab1..----.
28700 0a 31 36 32 0d 0a 33 36 34 38 0d 0a 37 36 38 30  .162..3648..7680
28710 0d 0a 0d 0a 71 75 65 72 79 20 49 49 49 49 49 49  ....query IIIIII
28720 49 49 49 49 49 49 49 49 49 20 72 6f 77 73 6f 72  IIIIIIIII rowsor
28730 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
28740 43 54 20 2a 20 46 52 4f 4d 20 74 61 62 32 2c 20  CT * FROM tab2, 
28750 74 61 62 31 20 41 53 20 63 6f 72 30 2c 20 74 61  tab1 AS cor0, ta
28760 62 31 20 41 53 20 63 6f 72 31 2c 20 74 61 62 31  b1 AS cor1, tab1
28770 2c 20 74 61 62 32 20 63 6f 72 32 0d 0a 2d 2d 2d  , tab2 cor2..---
28780 2d 0d 0a 33 36 34 35 20 76 61 6c 75 65 73 20 68  -..3645 values h
28790 61 73 68 69 6e 67 20 74 6f 20 34 34 30 36 63 63  ashing to 4406cc
287a0 63 37 31 66 30 32 61 65 39 63 31 65 39 34 37 66  c71f02ae9c1e947f
287b0 66 63 64 38 39 62 30 64 62 37 0d 0a 0d 0a 6f 6e  fcd89b0db7....on
287c0 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
287d0 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
287e0 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
287f0 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
28800 6f 72 74 20 6c 61 62 65 6c 2d 31 31 36 31 0d 0a  ort label-1161..
28810 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
28820 63 6f 6c 32 20 2b 20 2d 20 63 6f 6c 32 20 44 49  col2 + - col2 DI
28830 56 20 74 61 62 32 2e 63 6f 6c 30 20 41 53 20 63  V tab2.col0 AS c
28840 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d  ol0 FROM tab2..-
28850 2d 2d 2d 0d 0a 32 34 0d 0a 32 36 0d 0a 33 38 0d  ---..24..26..38.
28860 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
28870 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
28880 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
28890 74 20 6c 61 62 65 6c 2d 31 31 36 31 0d 0a 53 45  t label-1161..SE
288a0 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f  LECT DISTINCT co
288b0 6c 32 20 2b 20 2d 20 63 6f 6c 32 20 2f 20 74 61  l2 + - col2 / ta
288c0 62 32 2e 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20  b2.col0 AS col0 
288d0 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d  FROM tab2..----.
288e0 0a 32 34 0d 0a 32 36 0d 0a 33 38 0d 0a 0d 0a 71  .24..26..38....q
288f0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
28900 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
28910 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c 31 20 2a 20  col1 * - col1 * 
28920 74 61 62 32 2e 63 6f 6c 32 20 2b 20 2d 20 63 6f  tab2.col2 + - co
28930 6c 31 20 2a 20 28 20 2d 20 63 6f 6c 30 20 29 20  l1 * ( - col0 ) 
28940 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d  FROM tab2..----.
28950 0a 2d 32 35 37 33 30 0d 0a 2d 38 35 39 30 34 0d  .-25730..-85904.
28960 0a 2d 39 36 33 39 0d 0a 0d 0a 71 75 65 72 79 20  .-9639....query 
28970 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
28980 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 32 20  T DISTINCT col2 
28990 2b 20 2b 20 28 20 63 6f 6c 31 20 29 20 46 52 4f  + + ( col1 ) FRO
289a0 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
289b0 2d 2d 2d 2d 0d 0a 35 35 0d 0a 35 38 0d 0a 38 35  ----..55..58..85
289c0 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
289d0 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d   # support for M
289e0 79 53 51 4c 20 73 70 65 63 69 66 69 63 20 73 79  ySQL specific sy
289f0 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73  stem types and s
28a00 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72  yntax..query I r
28a10 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 31 36  owsort label-116
28a20 34 0d 0a 53 45 4c 45 43 54 20 2d 20 2b 20 43 41  4..SELECT - + CA
28a30 53 54 28 20 63 6f 6c 30 20 41 53 20 53 49 47 4e  ST( col0 AS SIGN
28a40 45 44 20 29 20 2a 20 2b 20 63 6f 72 30 2e 63 6f  ED ) * + cor0.co
28a50 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l1 FROM tab2 AS 
28a60 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 34  cor0..----..-134
28a70 33 0d 0a 2d 32 31 37 0d 0a 2d 34 36 30 32 0d 0a  3..-217..-4602..
28a80 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
28a90 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
28aa0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
28ab0 20 6c 61 62 65 6c 2d 31 31 36 34 0d 0a 53 45 4c   label-1164..SEL
28ac0 45 43 54 20 2d 20 2b 20 43 41 53 54 20 28 20 63  ECT - + CAST ( c
28ad0 6f 6c 30 20 41 53 20 49 4e 54 45 47 45 52 20 29  ol0 AS INTEGER )
28ae0 20 2a 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 46   * + cor0.col1 F
28af0 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
28b00 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 34 33 0d 0a 2d  ..----..-1343..-
28b10 32 31 37 0d 0a 2d 34 36 30 32 0d 0a 0d 0a 71 75  217..-4602....qu
28b20 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
28b30 45 4c 45 43 54 20 41 4c 4c 20 34 38 20 2a 20 63  ELECT ALL 48 * c
28b40 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol0 FROM tab1 AS
28b50 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 34 34   cor0..----..144
28b60 0d 0a 33 30 37 32 0d 0a 33 38 34 30 0d 0a 0d 0a  ..3072..3840....
28b70 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
28b80 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 31  .SELECT ALL col1
28b90 20 2a 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 2b   * + cor0.col1 +
28ba0 20 2b 20 63 6f 6c 32 20 2a 20 2d 20 32 37 20 2a   + col2 * - 27 *
28bb0 20 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46 52   col0 AS col2 FR
28bc0 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
28bd0 0a 2d 2d 2d 2d 0d 0a 2d 32 30 37 31 39 31 0d 0a  .----..-207191..
28be0 2d 33 36 39 38 0d 0a 2d 39 38 33 39 36 0d 0a 0d  -3698..-98396...
28bf0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
28c00 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
28c10 54 20 2d 20 28 20 63 6f 6c 31 20 29 20 2b 20 63  T - ( col1 ) + c
28c20 6f 6c 32 20 2a 20 63 6f 6c 32 20 2a 20 63 6f 6c  ol2 * col2 * col
28c30 30 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  0 AS col0 FROM t
28c40 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
28c50 2d 0d 0a 31 31 34 30 35 39 0d 0a 35 30 37 32 0d  -..114059..5072.
28c60 0a 35 32 36 36 39 0d 0a 0d 0a 71 75 65 72 79 20  .52669....query 
28c70 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
28c80 54 20 2b 20 2b 20 30 20 46 52 4f 4d 20 74 61 62  T + + 0 FROM tab
28c90 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
28ca0 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a 71 75 65 72  .0..0..0....quer
28cb0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
28cc0 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 28  ECT DISTINCT + (
28cd0 20 35 37 20 29 20 2a 20 63 6f 72 30 2e 63 6f 6c   57 ) * cor0.col
28ce0 31 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  1 AS col1 FROM t
28cf0 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
28d00 2d 0d 0a 31 37 36 37 0d 0a 33 33 36 33 0d 0a 39  -..1767..3363..9
28d10 36 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  69....query I ro
28d20 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
28d30 53 54 49 4e 43 54 20 63 6f 6c 32 20 2a 20 2d 20  STINCT col2 * - 
28d40 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46 52 4f  col0 AS col0 FRO
28d50 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
28d60 2d 2d 2d 2d 0d 0a 2d 31 36 32 0d 0a 2d 33 36 34  ----..-162..-364
28d70 38 0d 0a 2d 37 36 38 30 0d 0a 0d 0a 71 75 65 72  8..-7680....quer
28d80 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
28d90 45 43 54 20 63 6f 6c 31 20 2b 20 2d 20 37 30 20  ECT col1 + - 70 
28da0 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
28db0 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 0d 0a 2d 33  0..----..-11..-3
28dc0 39 0d 0a 2d 35 33 0d 0a 0d 0a 6f 6e 6c 79 69 66  9..-53....onlyif
28dd0 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74   mysql # support
28de0 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69   for MySQL speci
28df0 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73  fic system types
28e00 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65   and syntax..que
28e10 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
28e20 65 6c 2d 31 31 37 32 0d 0a 53 45 4c 45 43 54 20  el-1172..SELECT 
28e30 41 4c 4c 20 2d 20 2d 20 63 6f 6c 32 20 2a 20 2b  ALL - - col2 * +
28e40 20 63 6f 6c 32 20 2b 20 2d 20 63 6f 6c 30 20 2a   col2 + - col0 *
28e50 20 43 41 53 54 28 20 2b 20 63 6f 6c 31 20 41 53   CAST( + col1 AS
28e60 20 53 49 47 4e 45 44 20 29 20 46 52 4f 4d 20 74   SIGNED ) FROM t
28e70 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
28e80 2d 0d 0a 2d 31 33 37 35 0d 0a 2d 33 33 39 34 0d  -..-1375..-3394.
28e90 0a 2d 39 37 35 0d 0a 0d 0a 73 6b 69 70 69 66 20  .-975....skipif 
28ea0 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
28eb0 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
28ec0 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 31  rowsort label-11
28ed0 37 32 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d  72..SELECT ALL -
28ee0 20 2d 20 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c 32   - col2 * + col2
28ef0 20 2b 20 2d 20 63 6f 6c 30 20 2a 20 43 41 53 54   + - col0 * CAST
28f00 20 28 20 2b 20 63 6f 6c 31 20 41 53 20 49 4e 54   ( + col1 AS INT
28f10 45 47 45 52 20 29 20 46 52 4f 4d 20 74 61 62 30  EGER ) FROM tab0
28f20 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
28f30 2d 31 33 37 35 0d 0a 2d 33 33 39 34 0d 0a 2d 39  -1375..-3394..-9
28f40 37 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  75....query I ro
28f50 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f  wsort..SELECT co
28f60 72 30 2e 63 6f 6c 32 20 2b 20 2b 20 63 6f 72 30  r0.col2 + + cor0
28f70 2e 63 6f 6c 31 20 2a 20 63 6f 6c 32 20 46 52 4f  .col1 * col2 FRO
28f80 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
28f90 2d 2d 2d 2d 0d 0a 31 33 34 34 0d 0a 31 34 35 38  ----..1344..1458
28fa0 0d 0a 36 32 37 0d 0a 0d 0a 73 6b 69 70 69 66 20  ..627....skipif 
28fb0 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73  postgresql # Pos
28fc0 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73  tgreSQL requires
28fd0 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e   AS when renamin
28fe0 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73  g output columns
28ff0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
29000 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20  t..SELECT ALL + 
29010 31 35 20 2b 20 2b 20 35 36 20 63 6f 6c 30 20 46  15 + + 56 col0 F
29020 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
29030 0d 0a 2d 2d 2d 2d 0d 0a 37 31 0d 0a 37 31 0d 0a  ..----..71..71..
29040 37 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  71....query I ro
29050 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
29060 28 20 63 6f 6c 30 20 29 20 2b 20 2b 20 63 6f 6c  ( col0 ) + + col
29070 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  0 AS col2 FROM t
29080 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
29090 2d 0d 0a 31 32 38 0d 0a 31 36 30 0d 0a 36 0d 0a  -..128..160..6..
290a0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
290b0 74 0d 0a 53 45 4c 45 43 54 20 2b 20 28 20 63 6f  t..SELECT + ( co
290c0 6c 31 20 29 20 2a 20 2d 20 63 6f 6c 30 20 2b 20  l1 ) * - col0 + 
290d0 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46  + col0 AS col0 F
290e0 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
290f0 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32 36 34 0d 0a 2d  ..----..-1264..-
29100 32 31 30 0d 0a 2d 34 35 32 34 0d 0a 0d 0a 71 75  210..-4524....qu
29110 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
29120 45 4c 45 43 54 20 41 4c 4c 20 2b 20 2d 20 36 36  ELECT ALL + - 66
29130 20 2a 20 63 6f 6c 32 20 2b 20 2d 20 63 6f 6c 30   * col2 + - col0
29140 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
29150 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  b1 cor0..----..-
29160 33 35 36 37 0d 0a 2d 33 38 32 36 0d 0a 2d 36 34  3567..-3826..-64
29170 31 36 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73  16....skipif pos
29180 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72  tgresql # Postgr
29190 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53  eSQL requires AS
291a0 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f   when renaming o
291b0 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71  utput columns..q
291c0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
291d0 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
291e0 63 6f 6c 32 20 2b 20 63 6f 6c 32 20 2d 20 63 6f  col2 + col2 - co
291f0 6c 32 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  l2 col2 FROM tab
29200 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
29210 0a 35 34 0d 0a 35 37 0d 0a 39 36 0d 0a 0d 0a 71  .54..57..96....q
29220 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
29230 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 72 30 2e  SELECT ALL cor0.
29240 63 6f 6c 32 20 2a 20 2b 20 32 36 20 2b 20 63 6f  col2 * + 26 + co
29250 6c 32 20 2b 20 2d 20 63 6f 6c 31 20 41 53 20 63  l2 + - col1 AS c
29260 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol0 FROM tab2 AS
29270 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 30   cor0..----..100
29280 39 0d 0a 36 34 33 0d 0a 36 39 38 0d 0a 0d 0a 71  9..643..698....q
29290 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
292a0 53 45 4c 45 43 54 20 2d 20 37 39 20 2a 20 2b 20  SELECT - 79 * + 
292b0 31 31 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  11 AS col1 FROM 
292c0 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
292d0 2d 2d 0d 0a 2d 38 36 39 0d 0a 2d 38 36 39 0d 0a  --..-869..-869..
292e0 2d 38 36 39 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  -869....onlyif m
292f0 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f  ysql # use DIV o
29300 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65  perator for inte
29310 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75  ger division..qu
29320 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
29330 62 65 6c 2d 31 31 38 31 0d 0a 53 45 4c 45 43 54  bel-1181..SELECT
29340 20 36 32 20 44 49 56 20 2b 20 63 6f 6c 31 20 2b   62 DIV + col1 +
29350 20 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46 52   col2 AS col1 FR
29360 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
29370 0a 2d 2d 2d 2d 0d 0a 32 37 0d 0a 32 39 0d 0a 34  .----..27..29..4
29380 31 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  1....skipif mysq
29390 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
293a0 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
293b0 6f 72 74 20 6c 61 62 65 6c 2d 31 31 38 31 0d 0a  ort label-1181..
293c0 53 45 4c 45 43 54 20 36 32 20 2f 20 2b 20 63 6f  SELECT 62 / + co
293d0 6c 31 20 2b 20 63 6f 6c 32 20 41 53 20 63 6f 6c  l1 + col2 AS col
293e0 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  1 FROM tab2 AS c
293f0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 37 0d 0a 32  or0..----..27..2
29400 39 0d 0a 34 31 0d 0a 0d 0a 71 75 65 72 79 20 49  9..41....query I
29410 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
29420 20 31 37 20 2b 20 2d 20 32 20 2a 20 2b 20 63 6f   17 + - 2 * + co
29430 6c 30 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  l0 AS col0 FROM 
29440 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
29450 2d 2d 0d 0a 2d 31 31 31 0d 0a 2d 31 34 33 0d 0a  --..-111..-143..
29460 31 31 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73  11....skipif pos
29470 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72  tgresql # Postgr
29480 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53  eSQL requires AS
29490 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f   when renaming o
294a0 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71  utput columns..q
294b0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
294c0 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
294d0 2d 20 63 6f 72 30 2e 63 6f 6c 31 20 2a 20 63 6f  - cor0.col1 * co
294e0 6c 32 20 2d 20 2d 20 63 6f 6c 30 20 63 6f 6c 31  l2 - - col0 col1
294f0 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
29500 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 36 38 0d  r0..----..-1168.
29510 0a 2d 31 34 30 31 0d 0a 2d 35 30 36 0d 0a 0d 0a  .-1401..-506....
29520 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
29530 0a 53 45 4c 45 43 54 20 41 4c 4c 20 28 20 2b 20  .SELECT ALL ( + 
29540 34 35 20 29 20 2a 20 2d 20 63 6f 6c 30 20 46 52  45 ) * - col0 FR
29550 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d  OM tab2..----..-
29560 33 31 35 0d 0a 2d 33 35 31 30 0d 0a 2d 33 35 35  315..-3510..-355
29570 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  5....query I row
29580 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 72  sort..SELECT cor
29590 30 2e 63 6f 6c 32 20 2a 20 2b 20 63 6f 72 30 2e  0.col2 * + cor0.
295a0 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 2c 20  col0 FROM tab1, 
295b0 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
295c0 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73  --..9 values has
295d0 68 69 6e 67 20 74 6f 20 63 66 31 33 38 33 64 33  hing to cf1383d3
295e0 31 30 65 35 65 33 65 31 39 34 37 30 65 30 62 38  10e5e3e19470e0b8
295f0 64 63 30 36 34 64 30 63 0d 0a 0d 0a 71 75 65 72  dc064d0c....quer
29600 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
29610 45 43 54 20 41 4c 4c 20 38 30 20 46 52 4f 4d 20  ECT ALL 80 FROM 
29620 74 61 62 32 2c 20 74 61 62 32 20 63 6f 72 30 0d  tab2, tab2 cor0.
29630 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20  .----..9 values 
29640 68 61 73 68 69 6e 67 20 74 6f 20 38 37 38 66 30  hashing to 878f0
29650 31 32 64 37 30 37 61 61 62 31 31 33 63 65 64 61  12d707aab113ceda
29660 66 35 36 65 36 63 35 32 65 39 34 0d 0a 0d 0a 71  f56e6c52e94....q
29670 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
29680 53 45 4c 45 43 54 20 41 4c 4c 20 28 20 38 33 20  SELECT ALL ( 83 
29690 29 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  ) AS col2 FROM t
296a0 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 38 33 0d 0a 38  ab1..----..83..8
296b0 33 0d 0a 38 33 0d 0a 0d 0a 71 75 65 72 79 20 49  3..83....query I
296c0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
296d0 20 41 4c 4c 20 2b 20 2b 20 39 32 20 41 53 20 63   ALL + + 92 AS c
296e0 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol0 FROM tab1 AS
296f0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 32 0d   cor0..----..92.
29700 0a 39 32 0d 0a 39 32 0d 0a 0d 0a 6f 6e 6c 79 69  .92..92....onlyi
29710 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72  f mysql # suppor
29720 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63  t for MySQL spec
29730 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65  ific system type
29740 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75  s and syntax..qu
29750 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
29760 62 65 6c 2d 31 31 38 39 0d 0a 53 45 4c 45 43 54  bel-1189..SELECT
29770 20 44 49 53 54 49 4e 43 54 20 43 41 53 54 28 20   DISTINCT CAST( 
29780 4e 55 4c 4c 20 41 53 20 53 49 47 4e 45 44 20 29  NULL AS SIGNED )
29790 20 2a 20 2d 20 63 6f 6c 32 20 46 52 4f 4d 20 74   * - col2 FROM t
297a0 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
297b0 2d 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69  -..NULL....skipi
297c0 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
297d0 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
297e0 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
297f0 31 31 38 39 0d 0a 53 45 4c 45 43 54 20 44 49 53  1189..SELECT DIS
29800 54 49 4e 43 54 20 43 41 53 54 20 28 20 4e 55 4c  TINCT CAST ( NUL
29810 4c 20 41 53 20 49 4e 54 45 47 45 52 20 29 20 2a  L AS INTEGER ) *
29820 20 2d 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62   - col2 FROM tab
29830 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
29840 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75 65 72 79 20 49  .NULL....query I
29850 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
29860 20 37 37 20 2b 20 2d 20 63 6f 6c 31 20 46 52 4f   77 + - col1 FRO
29870 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab0 cor0..---
29880 2d 0d 0a 2d 31 34 0d 0a 2d 32 30 0d 0a 2d 39 0d  -..-14..-20..-9.
29890 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
298a0 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74  # use DIV operat
298b0 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64  or for integer d
298c0 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49  ivision..query I
298d0 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
298e0 31 39 31 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  191..SELECT DIST
298f0 49 4e 43 54 20 2d 20 63 6f 6c 32 20 44 49 56 20  INCT - col2 DIV 
29900 34 33 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  43 AS col2 FROM 
29910 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
29920 2d 2d 0d 0a 2d 31 0d 0a 2d 32 0d 0a 0d 0a 73 6b  --..-1..-2....sk
29930 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
29940 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
29950 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
29960 65 6c 2d 31 31 39 31 0d 0a 53 45 4c 45 43 54 20  el-1191..SELECT 
29970 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c 32 20  DISTINCT - col2 
29980 2f 20 34 33 20 41 53 20 63 6f 6c 32 20 46 52 4f  / 43 AS col2 FRO
29990 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
299a0 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 2d 32 0d 0a 0d 0a  ----..-1..-2....
299b0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
299c0 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
299d0 20 28 20 35 34 20 29 20 46 52 4f 4d 20 74 61 62   ( 54 ) FROM tab
299e0 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 35 34  2 cor0..----..54
299f0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
29a00 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 34 37  ort..SELECT - 47
29a10 20 2b 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 41   + + cor0.col2 A
29a20 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31  S col0 FROM tab1
29a30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
29a40 31 30 0d 0a 34 39 0d 0a 37 0d 0a 0d 0a 71 75 65  10..49..7....que
29a50 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
29a60 4c 45 43 54 20 2b 20 2b 20 37 35 20 2a 20 2b 20  LECT + + 75 * + 
29a70 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41  col0 FROM tab0 A
29a80 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 38  S cor0..----..18
29a90 30 30 0d 0a 32 36 32 35 0d 0a 36 36 37 35 0d 0a  00..2625..6675..
29aa0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
29ab0 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2d 20 63 6f  t..SELECT - - co
29ac0 6c 31 20 2a 20 63 6f 6c 31 20 41 53 20 63 6f 6c  l1 * col1 AS col
29ad0 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  0 FROM tab0 AS c
29ae0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 37 33 39 36 0d  or0..----..7396.
29af0 0a 38 32 38 31 0d 0a 39 34 30 39 0d 0a 0d 0a 73  .8281..9409....s
29b00 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c  kipif postgresql
29b10 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65   # PostgreSQL re
29b20 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72  quires AS when r
29b30 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63  enaming output c
29b40 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20  olumns..query I 
29b50 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
29b60 44 49 53 54 49 4e 43 54 20 35 31 20 2a 20 63 6f  DISTINCT 51 * co
29b70 6c 31 20 2b 20 63 6f 6c 32 20 63 6f 6c 30 20 46  l1 + col2 col0 F
29b80 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab2..----..
29b90 31 36 30 38 0d 0a 33 30 33 35 0d 0a 39 30 35 0d  1608..3035..905.
29ba0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
29bb0 72 74 0d 0a 53 45 4c 45 43 54 20 28 20 2d 20 63  rt..SELECT ( - c
29bc0 6f 6c 32 20 29 20 2b 20 63 6f 6c 30 20 2a 20 2b  ol2 ) + col0 * +
29bd0 20 74 61 62 31 2e 63 6f 6c 30 20 46 52 4f 4d 20   tab1.col0 FROM 
29be0 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 35 0d  tab1..----..-45.
29bf0 0a 34 30 33 39 0d 0a 36 33 30 34 0d 0a 0d 0a 71  .4039..6304....q
29c00 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
29c10 53 45 4c 45 43 54 20 2b 20 2b 20 28 20 2d 20 63  SELECT + + ( - c
29c20 6f 6c 30 20 29 20 2b 20 2b 20 63 6f 72 30 2e 63  ol0 ) + + cor0.c
29c30 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol1 FROM tab1 AS
29c40 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 34   cor0..----..-54
29c50 0d 0a 2d 36 37 0d 0a 32 33 0d 0a 0d 0a 71 75 65  ..-67..23....que
29c60 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
29c70 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20  LECT DISTINCT - 
29c80 63 6f 6c 32 20 2a 20 63 6f 6c 31 20 2b 20 2d 20  col2 * col1 + - 
29c90 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a  col1 FROM tab0..
29ca0 2d 2d 2d 2d 0d 0a 2d 31 39 34 0d 0a 2d 32 39 32  ----..-194..-292
29cb0 34 0d 0a 2d 37 35 35 33 0d 0a 0d 0a 71 75 65 72  4..-7553....quer
29cc0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
29cd0 45 43 54 20 41 4c 4c 20 2d 20 63 6f 72 30 2e 63  ECT ALL - cor0.c
29ce0 6f 6c 31 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20  ol1 + cor0.col0 
29cf0 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
29d00 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
29d10 0a 2d 32 33 0d 0a 35 34 0d 0a 36 37 0d 0a 0d 0a  .-23..54..67....
29d20 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
29d30 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
29d40 20 63 6f 6c 30 20 2b 20 2d 20 63 6f 72 30 2e 63   col0 + - cor0.c
29d50 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  ol2 AS col2 FROM
29d60 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
29d70 2d 2d 2d 0d 0a 2d 32 30 0d 0a 34 31 0d 0a 35 32  ---..-20..41..52
29d80 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
29d90 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f  ort..SELECT + co
29da0 6c 31 20 2b 20 36 32 20 2a 20 2d 20 63 6f 6c 31  l1 + 62 * - col1
29db0 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
29dc0 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
29dd0 0d 0a 2d 35 32 34 36 0d 0a 2d 35 35 35 31 0d 0a  ..-5246..-5551..
29de0 2d 35 39 31 37 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  -5917....onlyif 
29df0 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20  mysql # support 
29e00 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66  for MySQL specif
29e10 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20  ic system types 
29e20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72  and syntax..quer
29e30 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
29e40 6c 2d 31 32 30 33 0d 0a 53 45 4c 45 43 54 20 44  l-1203..SELECT D
29e50 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c 31 20 2a  ISTINCT - col1 *
29e60 20 2d 20 43 41 53 54 28 20 4e 55 4c 4c 20 41 53   - CAST( NULL AS
29e70 20 53 49 47 4e 45 44 20 29 20 46 52 4f 4d 20 74   SIGNED ) FROM t
29e80 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
29e90 2d 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69  -..NULL....skipi
29ea0 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
29eb0 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
29ec0 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
29ed0 31 32 30 33 0d 0a 53 45 4c 45 43 54 20 44 49 53  1203..SELECT DIS
29ee0 54 49 4e 43 54 20 2d 20 63 6f 6c 31 20 2a 20 2d  TINCT - col1 * -
29ef0 20 43 41 53 54 20 28 20 4e 55 4c 4c 20 41 53 20   CAST ( NULL AS 
29f00 49 4e 54 45 47 45 52 20 29 20 46 52 4f 4d 20 74  INTEGER ) FROM t
29f10 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
29f20 2d 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75 65 72 79  -..NULL....query
29f30 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
29f40 43 54 20 63 6f 6c 32 20 2a 20 28 20 63 6f 6c 31  CT col2 * ( col1
29f50 20 29 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20   ) AS col1 FROM 
29f60 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
29f70 2d 2d 0d 0a 31 32 34 38 0d 0a 31 34 30 34 0d 0a  --..1248..1404..
29f80 35 37 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  570....query I r
29f90 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
29fa0 4c 4c 20 2b 20 63 6f 6c 31 20 2b 20 34 38 20 2a  LL + col1 + 48 *
29fb0 20 2b 20 37 32 20 46 52 4f 4d 20 74 61 62 32 20   + 72 FROM tab2 
29fc0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33  AS cor0..----..3
29fd0 34 37 33 0d 0a 33 34 38 37 0d 0a 33 35 31 35 0d  473..3487..3515.
29fe0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
29ff0 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2d 20 63  rt..SELECT + - c
2a000 6f 6c 31 20 2a 20 2b 20 28 20 2d 20 34 30 20 29  ol1 * + ( - 40 )
2a010 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
2a020 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  b2 cor0..----..1
2a030 32 34 30 0d 0a 32 33 36 30 0d 0a 36 38 30 0d 0a  240..2360..680..
2a040 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2a050 74 0d 0a 53 45 4c 45 43 54 20 39 36 20 2b 20 2d  t..SELECT 96 + -
2a060 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 0d   col0 FROM tab2.
2a070 0a 2d 2d 2d 2d 0d 0a 31 37 0d 0a 31 38 0d 0a 38  .----..17..18..8
2a080 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  9....query I row
2a090 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63  sort..SELECT + c
2a0a0 6f 6c 30 20 2a 20 2d 20 63 6f 72 30 2e 63 6f 6c  ol0 * - cor0.col
2a0b0 30 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  0 AS col0 FROM t
2a0c0 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
2a0d0 2d 0d 0a 2d 34 30 39 36 0d 0a 2d 36 34 30 30 0d  -..-4096..-6400.
2a0e0 0a 2d 39 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  .-9....onlyif my
2a0f0 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f  sql # support fo
2a100 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63  r MySQL specific
2a110 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e   system types an
2a120 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20  d syntax..query 
2a130 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
2a140 31 32 30 39 0d 0a 53 45 4c 45 43 54 20 2b 20 2b  1209..SELECT + +
2a150 20 63 6f 6c 32 20 2b 20 43 41 53 54 28 20 37 37   col2 + CAST( 77
2a160 20 41 53 20 53 49 47 4e 45 44 20 29 20 2a 20 2b   AS SIGNED ) * +
2a170 20 63 6f 72 30 2e 63 6f 6c 31 20 41 53 20 63 6f   cor0.col1 AS co
2a180 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l2 FROM tab2 AS 
2a190 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33 34 37  cor0..----..1347
2a1a0 0d 0a 32 34 31 34 0d 0a 34 35 36 39 0d 0a 0d 0a  ..2414..4569....
2a1b0 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
2a1c0 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
2a1d0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
2a1e0 61 62 65 6c 2d 31 32 30 39 0d 0a 53 45 4c 45 43  abel-1209..SELEC
2a1f0 54 20 2b 20 2b 20 63 6f 6c 32 20 2b 20 43 41 53  T + + col2 + CAS
2a200 54 20 28 20 37 37 20 41 53 20 49 4e 54 45 47 45  T ( 77 AS INTEGE
2a210 52 20 29 20 2a 20 2b 20 63 6f 72 30 2e 63 6f 6c  R ) * + cor0.col
2a220 31 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  1 AS col2 FROM t
2a230 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
2a240 2d 0d 0a 31 33 34 37 0d 0a 32 34 31 34 0d 0a 34  -..1347..2414..4
2a250 35 36 39 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  569....onlyif my
2a260 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70  sql # use DIV op
2a270 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67  erator for integ
2a280 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65  er division..que
2a290 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
2a2a0 65 6c 2d 31 32 31 30 0d 0a 53 45 4c 45 43 54 20  el-1210..SELECT 
2a2b0 2d 20 2b 20 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c  - + col0 + - col
2a2c0 31 20 44 49 56 20 63 6f 6c 31 20 63 6f 6c 30 20  1 DIV col1 col0 
2a2d0 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a  FROM tab0 cor0..
2a2e0 2d 2d 2d 2d 0d 0a 2d 32 35 0d 0a 2d 33 36 0d 0a  ----..-25..-36..
2a2f0 2d 39 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f  -90....skipif po
2a300 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67  stgresql # Postg
2a310 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41  reSQL requires A
2a320 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20  S when renaming 
2a330 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a  output columns..
2a340 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
2a350 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
2a360 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
2a370 61 62 65 6c 2d 31 32 31 30 0d 0a 53 45 4c 45 43  abel-1210..SELEC
2a380 54 20 2d 20 2b 20 63 6f 6c 30 20 2b 20 2d 20 63  T - + col0 + - c
2a390 6f 6c 31 20 2f 20 63 6f 6c 31 20 63 6f 6c 30 20  ol1 / col1 col0 
2a3a0 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a  FROM tab0 cor0..
2a3b0 2d 2d 2d 2d 0d 0a 2d 32 35 0d 0a 2d 33 36 0d 0a  ----..-25..-36..
2a3c0 2d 39 30 0d 0a 0d 0a 71 75 65 72 79 20 49 49 49  -90....query III
2a3d0 49 49 49 49 49 49 49 49 49 20 72 6f 77 73 6f 72  IIIIIIIII rowsor
2a3e0 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
2a3f0 43 54 20 2a 20 46 52 4f 4d 20 74 61 62 30 20 63  CT * FROM tab0 c
2a400 6f 72 30 20 43 52 4f 53 53 20 4a 4f 49 4e 20 74  or0 CROSS JOIN t
2a410 61 62 32 2c 20 74 61 62 31 20 63 6f 72 31 2c 20  ab2, tab1 cor1, 
2a420 74 61 62 31 20 41 53 20 63 6f 72 32 0d 0a 2d 2d  tab1 AS cor2..--
2a430 2d 2d 0d 0a 39 37 32 20 76 61 6c 75 65 73 20 68  --..972 values h
2a440 61 73 68 69 6e 67 20 74 6f 20 66 65 35 35 30 39  ashing to fe5509
2a450 35 66 66 66 33 61 35 65 63 63 32 66 31 31 33 64  5fff3a5ecc2f113d
2a460 31 34 61 38 63 36 66 38 32 33 0d 0a 0d 0a 71 75  14a8c6f823....qu
2a470 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
2a480 45 4c 45 43 54 20 2b 20 39 38 20 2b 20 63 6f 6c  ELECT + 98 + col
2a490 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  2 FROM tab2 AS c
2a4a0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 34 0d 0a  or0..----..124..
2a4b0 31 32 35 0d 0a 31 33 36 0d 0a 0d 0a 73 6b 69 70  125..136....skip
2a4c0 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20  if postgresql # 
2a4d0 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69  PostgreSQL requi
2a4e0 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61  res AS when rena
2a4f0 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75  ming output colu
2a500 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  mns..query I row
2a510 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c  sort..SELECT col
2a520 31 20 2a 20 2d 20 63 6f 6c 30 20 63 6f 6c 30 20  1 * - col0 col0 
2a530 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
2a540 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 30 36 34 0d 0a  0..----..-2064..
2a550 2d 33 33 39 35 0d 0a 2d 38 30 39 39 0d 0a 0d 0a  -3395..-8099....
2a560 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
2a570 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f  .SELECT ALL - co
2a580 6c 32 20 2b 20 63 6f 6c 32 20 2b 20 2b 20 63 6f  l2 + col2 + + co
2a590 6c 32 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  l2 AS col0 FROM 
2a5a0 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 32 36 0d 0a  tab2..----..26..
2a5b0 32 37 0d 0a 33 38 0d 0a 0d 0a 71 75 65 72 79 20  27..38....query 
2a5c0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
2a5d0 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c  T DISTINCT - col
2a5e0 32 20 2b 20 2d 20 28 20 2d 20 35 33 20 29 20 2a  2 + - ( - 53 ) *
2a5f0 20 2d 20 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20   - col1 AS col0 
2a600 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
2a610 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 35 39 31 0d 0a  0..----..-4591..
2a620 2d 34 39 30 35 0d 0a 2d 35 31 34 32 0d 0a 0d 0a  -4905..-5142....
2a630 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
2a640 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 34 31  .SELECT ALL + 41
2a650 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
2a660 62 32 2c 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d  b2, tab0 cor0..-
2a670 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61  ---..9 values ha
2a680 73 68 69 6e 67 20 74 6f 20 35 62 31 38 39 38 36  shing to 5b18986
2a690 62 62 32 39 34 34 31 32 62 33 64 39 66 30 37 62  bb294412b3d9f07b
2a6a0 37 65 36 66 63 38 32 31 65 0d 0a 0d 0a 6f 6e 6c  7e6fc821e....onl
2a6b0 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20  yif mysql # use 
2a6c0 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72  DIV operator for
2a6d0 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f   integer divisio
2a6e0 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  n..query I rowso
2a6f0 72 74 20 6c 61 62 65 6c 2d 31 32 31 37 0d 0a 53  rt label-1217..S
2a700 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 31  ELECT ALL + col1
2a710 20 44 49 56 20 36 39 20 2b 20 31 36 20 2b 20 74   DIV 69 + 16 + t
2a720 61 62 32 2e 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c  ab2.col2 * - col
2a730 30 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d  0 FROM tab2..---
2a740 2d 0d 0a 2d 31 37 33 0d 0a 2d 32 30 31 32 0d 0a  -..-173..-2012..
2a750 2d 32 39 38 36 0d 0a 0d 0a 73 6b 69 70 69 66 20  -2986....skipif 
2a760 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
2a770 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
2a780 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 32  rowsort label-12
2a790 31 37 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b  17..SELECT ALL +
2a7a0 20 63 6f 6c 31 20 2f 20 36 39 20 2b 20 31 36 20   col1 / 69 + 16 
2a7b0 2b 20 74 61 62 32 2e 63 6f 6c 32 20 2a 20 2d 20  + tab2.col2 * - 
2a7c0 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 0d 0a  col0 FROM tab2..
2a7d0 2d 2d 2d 2d 0d 0a 2d 31 37 33 0d 0a 2d 32 30 31  ----..-173..-201
2a7e0 32 0d 0a 2d 32 39 38 36 0d 0a 0d 0a 71 75 65 72  2..-2986....quer
2a7f0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
2a800 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 34  ECT DISTINCT + 4
2a810 31 20 2a 20 63 6f 6c 32 20 41 53 20 63 6f 6c 30  1 * col2 AS col0
2a820 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d   FROM tab0..----
2a830 0d 0a 31 33 35 33 0d 0a 33 33 36 32 0d 0a 34 31  ..1353..3362..41
2a840 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67  ....skipif postg
2a850 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53  resql # PostgreS
2a860 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77  QL requires AS w
2a870 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74  hen renaming out
2a880 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65  put columns..que
2a890 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
2a8a0 4c 45 43 54 20 2d 20 63 6f 72 30 2e 63 6f 6c 30  LECT - cor0.col0
2a8b0 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 2c   col2 FROM tab2,
2a8c0 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
2a8d0 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61  ---..9 values ha
2a8e0 73 68 69 6e 67 20 74 6f 20 34 65 63 33 30 34 62  shing to 4ec304b
2a8f0 38 63 65 39 33 35 66 32 32 32 36 65 37 35 34 38  8ce935f2226e7548
2a900 64 37 32 63 32 62 32 66 30 0d 0a 0d 0a 71 75 65  d72c2b2f0....que
2a910 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
2a920 4c 45 43 54 20 34 35 20 2a 20 74 61 62 30 2e 63  LECT 45 * tab0.c
2a930 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d  ol1 FROM tab0..-
2a940 2d 2d 2d 0d 0a 33 38 37 30 0d 0a 34 30 39 35 0d  ---..3870..4095.
2a950 0a 34 33 36 35 0d 0a 0d 0a 71 75 65 72 79 20 49  .4365....query I
2a960 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
2a970 20 41 4c 4c 20 2d 20 63 6f 6c 31 20 2b 20 39 37   ALL - col1 + 97
2a980 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
2a990 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
2a9a0 0d 0a 37 31 0d 0a 38 34 0d 0a 38 37 0d 0a 0d 0a  ..71..84..87....
2a9b0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
2a9c0 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 30  .SELECT ALL col0
2a9d0 20 2b 20 63 6f 6c 31 20 2a 20 35 37 20 46 52 4f   + col1 * 57 FRO
2a9e0 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
2a9f0 2d 2d 2d 2d 0d 0a 31 30 34 38 0d 0a 31 37 37 34  ----..1048..1774
2aa00 0d 0a 33 34 34 31 0d 0a 0d 0a 71 75 65 72 79 20  ..3441....query 
2aa10 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
2aa20 54 20 44 49 53 54 49 4e 43 54 20 2d 20 2b 20 63  T DISTINCT - + c
2aa30 6f 6c 31 20 2d 20 2d 20 63 6f 6c 32 20 41 53 20  ol1 - - col2 AS 
2aa40 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41  col2 FROM tab2 A
2aa50 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33  S cor0..----..-3
2aa60 33 0d 0a 2d 34 0d 0a 32 31 0d 0a 0d 0a 71 75 65  3..-4..21....que
2aa70 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
2aa80 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 30 20  LECT ALL - col0 
2aa90 2d 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31  - col2 FROM tab1
2aaa0 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32 31 0d 0a 2d 31  ..----..-121..-1
2aab0 37 36 0d 0a 2d 35 37 0d 0a 0d 0a 71 75 65 72 79  76..-57....query
2aac0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
2aad0 43 54 20 2d 20 74 61 62 30 2e 63 6f 6c 31 20 41  CT - tab0.col1 A
2aae0 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30  S col2 FROM tab0
2aaf0 2c 20 74 61 62 31 2c 20 74 61 62 30 20 41 53 20  , tab1, tab0 AS 
2ab00 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76  cor0..----..27 v
2ab10 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f  alues hashing to
2ab20 20 64 34 63 36 37 33 62 37 34 34 34 65 62 39 39   d4c673b7444eb99
2ab30 32 37 65 63 36 33 31 37 35 62 34 33 63 36 62 38  27ec63175b43c6b8
2ab40 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  4....query I row
2ab50 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
2ab60 54 49 4e 43 54 20 2d 20 39 36 20 41 53 20 63 6f  TINCT - 96 AS co
2ab70 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l2 FROM tab2 AS 
2ab80 63 6f 72 30 20 43 52 4f 53 53 20 4a 4f 49 4e 20  cor0 CROSS JOIN 
2ab90 74 61 62 30 2c 20 74 61 62 30 20 63 6f 72 31 0d  tab0, tab0 cor1.
2aba0 0a 2d 2d 2d 2d 0d 0a 2d 39 36 0d 0a 0d 0a 71 75  .----..-96....qu
2abb0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
2abc0 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d  ELECT DISTINCT -
2abd0 20 63 6f 6c 30 20 2b 20 63 6f 6c 31 20 2a 20 63   col0 + col1 * c
2abe0 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d  ol2 FROM tab1..-
2abf0 2d 2d 2d 0d 0a 31 31 36 38 0d 0a 31 34 30 31 0d  ---..1168..1401.
2ac00 0a 35 30 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .506....query I 
2ac10 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
2ac20 2d 20 63 6f 6c 31 20 2a 20 28 20 2b 20 63 6f 6c  - col1 * ( + col
2ac30 30 20 29 20 2b 20 2b 20 63 6f 6c 32 20 2a 20 2b  0 ) + + col2 * +
2ac40 20 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46 52   col2 AS col1 FR
2ac50 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d  OM tab2 cor0..--
2ac60 2d 2d 0d 0a 2d 33 39 32 36 0d 0a 31 30 31 0d 0a  --..-3926..101..
2ac70 35 31 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  512....query I r
2ac80 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
2ac90 20 63 6f 6c 32 20 2b 20 28 20 2b 20 63 6f 72 30   col2 + ( + cor0
2aca0 2e 63 6f 6c 31 20 29 20 41 53 20 63 6f 6c 32 20  .col1 ) AS col2 
2acb0 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
2acc0 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 39 0d 0a 31 37  0..----..119..17
2acd0 33 0d 0a 39 38 0d 0a 0d 0a 71 75 65 72 79 20 49  3..98....query I
2ace0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
2acf0 20 2b 20 63 6f 6c 31 20 2a 20 63 6f 6c 30 20 2b   + col1 * col0 +
2ad00 20 34 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20   4 FROM tab0 AS 
2ad10 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 30 36 38  cor0..----..2068
2ad20 0d 0a 33 33 39 39 0d 0a 38 31 30 33 0d 0a 0d 0a  ..3399..8103....
2ad30 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
2ad40 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
2ad50 20 36 39 20 46 52 4f 4d 20 74 61 62 32 2c 20 74   69 FROM tab2, t
2ad60 61 62 31 20 41 53 20 63 6f 72 30 20 43 52 4f 53  ab1 AS cor0 CROS
2ad70 53 20 4a 4f 49 4e 20 74 61 62 30 0d 0a 2d 2d 2d  S JOIN tab0..---
2ad80 2d 0d 0a 36 39 0d 0a 0d 0a 73 6b 69 70 69 66 20  -..69....skipif 
2ad90 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73  postgresql # Pos
2ada0 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73  tgreSQL requires
2adb0 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e   AS when renamin
2adc0 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73  g output columns
2add0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2ade0 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20  t..SELECT ALL - 
2adf0 35 31 20 2a 20 63 6f 6c 30 20 63 6f 6c 30 20 46  51 * col0 col0 F
2ae00 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab1..----..
2ae10 2d 31 35 33 0d 0a 2d 33 32 36 34 0d 0a 2d 34 30  -153..-3264..-40
2ae20 38 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  80....query I ro
2ae30 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
2ae40 2b 20 37 30 20 41 53 20 63 6f 6c 31 20 46 52 4f  + 70 AS col1 FRO
2ae50 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
2ae60 2d 2d 2d 2d 0d 0a 37 30 0d 0a 37 30 0d 0a 37 30  ----..70..70..70
2ae70 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
2ae80 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 31  ort..SELECT col1
2ae90 20 2b 20 2d 20 63 6f 72 30 2e 63 6f 6c 30 20 2a   + - cor0.col0 *
2aea0 20 2d 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62   - col2 FROM tab
2aeb0 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
2aec0 0a 31 33 32 0d 0a 37 33 38 39 0d 0a 38 37 38 0d  .132..7389..878.
2aed0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
2aee0 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
2aef0 4e 43 54 20 2d 20 2b 20 28 20 63 6f 6c 32 20 29  NCT - + ( col2 )
2af00 20 2d 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62   - col2 FROM tab
2af10 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
2af20 0a 2d 31 36 34 0d 0a 2d 32 0d 0a 2d 36 36 0d 0a  .-164..-2..-66..
2af30 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2af40 74 0d 0a 53 45 4c 45 43 54 20 2b 20 38 32 20 2a  t..SELECT + 82 *
2af50 20 2d 20 63 6f 6c 32 20 2d 20 63 6f 6c 32 20 46   - col2 - col2 F
2af60 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d  ROM tab1 cor0..-
2af70 2d 2d 2d 0d 0a 2d 34 34 38 32 0d 0a 2d 34 37 33  ---..-4482..-473
2af80 31 0d 0a 2d 37 39 36 38 0d 0a 0d 0a 71 75 65 72  1..-7968....quer
2af90 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
2afa0 45 43 54 20 2d 20 2d 20 63 6f 6c 31 20 2a 20 63  ECT - - col1 * c
2afb0 6f 6c 32 20 2d 20 2b 20 63 6f 6c 32 20 46 52 4f  ol2 - + col2 FRO
2afc0 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
2afd0 2d 2d 2d 2d 0d 0a 31 31 35 32 0d 0a 31 33 35 30  ----..1152..1350
2afe0 0d 0a 35 31 33 0d 0a 0d 0a 73 6b 69 70 69 66 20  ..513....skipif 
2aff0 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73  postgresql # Pos
2b000 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73  tgreSQL requires
2b010 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e   AS when renamin
2b020 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73  g output columns
2b030 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2b040 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 31 20 2a  t..SELECT col1 *
2b050 20 2b 20 63 6f 6c 31 20 2d 20 63 6f 6c 31 20 63   + col1 - col1 c
2b060 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol2 FROM tab2 AS
2b070 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 37 32   cor0..----..272
2b080 0d 0a 33 34 32 32 0d 0a 39 33 30 0d 0a 0d 0a 71  ..3422..930....q
2b090 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
2b0a0 53 45 4c 45 43 54 20 2d 20 39 31 20 2b 20 63 6f  SELECT - 91 + co
2b0b0 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 63 6f 72  l2 FROM tab2 cor
2b0c0 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 33 0d 0a 2d 36  0..----..-53..-6
2b0d0 34 0d 0a 2d 36 35 0d 0a 0d 0a 71 75 65 72 79 20  4..-65....query 
2b0e0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
2b0f0 54 20 41 4c 4c 20 37 39 20 41 53 20 63 6f 6c 32  T ALL 79 AS col2
2b100 20 46 52 4f 4d 20 74 61 62 32 2c 20 74 61 62 30   FROM tab2, tab0
2b110 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
2b120 39 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67  9 values hashing
2b130 20 74 6f 20 34 30 61 32 32 36 31 63 61 61 32 63   to 40a2261caa2c
2b140 35 63 64 62 66 64 38 30 39 36 35 64 37 64 66 31  5cdbfd80965d7df1
2b150 32 33 31 66 0d 0a 0d 0a 71 75 65 72 79 20 49 20  231f....query I 
2b160 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
2b170 44 49 53 54 49 4e 43 54 20 37 36 20 41 53 20 63  DISTINCT 76 AS c
2b180 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 2c 20 74  ol0 FROM tab1, t
2b190 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
2b1a0 2d 0d 0a 37 36 0d 0a 0d 0a 71 75 65 72 79 20 49  -..76....query I
2b1b0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
2b1c0 20 41 4c 4c 20 2b 20 38 34 20 41 53 20 63 6f 6c   ALL + 84 AS col
2b1d0 32 20 46 52 4f 4d 20 74 61 62 30 2c 20 74 61 62  2 FROM tab0, tab
2b1e0 32 20 41 53 20 63 6f 72 30 2c 20 74 61 62 30 20  2 AS cor0, tab0 
2b1f0 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 32  AS cor1..----..2
2b200 37 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67  7 values hashing
2b210 20 74 6f 20 65 38 63 64 36 38 33 66 65 38 63 65   to e8cd683fe8ce
2b220 61 37 37 62 34 33 32 36 64 39 62 38 30 66 32 31  a77b4326d9b80f21
2b230 63 37 34 61 0d 0a 0d 0a 71 75 65 72 79 20 49 20  c74a....query I 
2b240 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
2b250 2b 20 2b 20 28 20 2d 20 63 6f 6c 30 20 29 20 2a  + + ( - col0 ) *
2b260 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20   col2 FROM tab0 
2b270 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
2b280 33 35 0d 0a 2d 37 32 39 38 0d 0a 2d 37 39 32 0d  35..-7298..-792.
2b290 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
2b2a0 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
2b2b0 4e 43 54 20 34 37 20 2a 20 2d 20 63 6f 6c 32 20  NCT 47 * - col2 
2b2c0 2a 20 2d 20 63 6f 72 30 2e 63 6f 6c 31 20 41 53  * - cor0.col1 AS
2b2d0 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20   col0 FROM tab0 
2b2e0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
2b2f0 33 33 33 38 36 0d 0a 33 35 30 37 31 34 0d 0a 34  33386..350714..4
2b300 35 35 39 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  559....onlyif my
2b310 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70  sql # use DIV op
2b320 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67  erator for integ
2b330 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65  er division..que
2b340 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
2b350 65 6c 2d 31 32 34 35 0d 0a 53 45 4c 45 43 54 20  el-1245..SELECT 
2b360 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c 32 20  DISTINCT - col2 
2b370 44 49 56 20 2d 20 63 6f 6c 31 20 63 6f 6c 30 20  DIV - col1 col0 
2b380 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
2b390 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 32 0d 0a 0d  0..----..0..2...
2b3a0 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73  .skipif postgres
2b3b0 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20  ql # PostgreSQL 
2b3c0 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e  requires AS when
2b3d0 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74   renaming output
2b3e0 20 63 6f 6c 75 6d 6e 73 0d 0a 73 6b 69 70 69 66   columns..skipif
2b3f0 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
2b400 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
2b410 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
2b420 32 34 35 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  245..SELECT DIST
2b430 49 4e 43 54 20 2d 20 63 6f 6c 32 20 2f 20 2d 20  INCT - col2 / - 
2b440 63 6f 6c 31 20 63 6f 6c 30 20 46 52 4f 4d 20 74  col1 col0 FROM t
2b450 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
2b460 2d 0d 0a 30 0d 0a 32 0d 0a 0d 0a 71 75 65 72 79  -..0..2....query
2b470 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
2b480 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 35 32  CT DISTINCT - 52
2b490 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
2b4a0 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
2b4b0 0d 0a 2d 35 32 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  ..-52....onlyif 
2b4c0 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20  mysql # use DIV 
2b4d0 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74  operator for int
2b4e0 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71  eger division..q
2b4f0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
2b500 61 62 65 6c 2d 31 32 34 37 0d 0a 53 45 4c 45 43  abel-1247..SELEC
2b510 54 20 41 4c 4c 20 2b 20 63 6f 72 30 2e 63 6f 6c  T ALL + cor0.col
2b520 31 20 44 49 56 20 2b 20 63 6f 6c 32 20 41 53 20  1 DIV + col2 AS 
2b530 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41  col1 FROM tab0 A
2b540 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 0d  S cor0..----..1.
2b550 0a 32 0d 0a 39 37 0d 0a 0d 0a 73 6b 69 70 69 66  .2..97....skipif
2b560 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
2b570 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
2b580 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
2b590 32 34 37 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  247..SELECT ALL 
2b5a0 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 2f 20 2b 20  + cor0.col1 / + 
2b5b0 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46 52 4f  col2 AS col1 FRO
2b5c0 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
2b5d0 2d 2d 2d 2d 0d 0a 31 0d 0a 32 0d 0a 39 37 0d 0a  ----..1..2..97..
2b5e0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2b5f0 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
2b600 43 54 20 2d 20 63 6f 6c 31 20 2a 20 2d 20 63 6f  CT - col1 * - co
2b610 6c 32 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c  l2 + col1 AS col
2b620 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  0 FROM tab1 AS c
2b630 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 36 31 0d  or0..----..1261.
2b640 0a 31 34 33 30 0d 0a 35 38 30 0d 0a 0d 0a 73 6b  .1430..580....sk
2b650 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20  ipif postgresql 
2b660 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71  # PostgreSQL req
2b670 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65  uires AS when re
2b680 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f  naming output co
2b690 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72  lumns..query I r
2b6a0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
2b6b0 4c 4c 20 2d 20 2b 20 63 6f 6c 31 20 2b 20 63 6f  LL - + col1 + co
2b6c0 6c 31 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  l1 col0 FROM tab
2b6d0 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
2b6e0 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a 71 75 65 72  .0..0..0....quer
2b6f0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
2b700 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 2d  ECT DISTINCT - -
2b710 20 63 6f 72 30 2e 63 6f 6c 32 20 46 52 4f 4d 20   cor0.col2 FROM 
2b720 74 61 62 31 2c 20 74 61 62 31 20 41 53 20 63 6f  tab1, tab1 AS co
2b730 72 30 2c 20 74 61 62 30 20 41 53 20 63 6f 72 31  r0, tab0 AS cor1
2b740 2c 20 74 61 62 30 2c 20 74 61 62 32 20 63 6f 72  , tab0, tab2 cor
2b750 32 0d 0a 2d 2d 2d 2d 0d 0a 35 34 0d 0a 35 37 0d  2..----..54..57.
2b760 0a 39 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .96....query I r
2b770 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
2b780 20 74 61 62 31 2e 63 6f 6c 31 20 2a 20 63 6f 6c   tab1.col1 * col
2b790 31 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  1 AS col1 FROM t
2b7a0 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 30 30 0d 0a  ab1..----..100..
2b7b0 31 36 39 0d 0a 36 37 36 0d 0a 0d 0a 71 75 65 72  169..676....quer
2b7c0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
2b7d0 45 43 54 20 41 4c 4c 20 2d 20 74 61 62 31 2e 63  ECT ALL - tab1.c
2b7e0 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 2c 20 74  ol1 FROM tab1, t
2b7f0 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
2b800 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68  -..9 values hash
2b810 69 6e 67 20 74 6f 20 62 32 33 34 37 39 38 64 34  ing to b234798d4
2b820 37 30 36 33 31 34 62 61 31 34 65 61 61 64 35 33  706314ba14eaad53
2b830 39 64 30 61 61 38 38 0d 0a 0d 0a 73 6b 69 70 69  9d0aa88....skipi
2b840 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50  f postgresql # P
2b850 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72  ostgreSQL requir
2b860 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d  es AS when renam
2b870 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d  ing output colum
2b880 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ns..query I rows
2b890 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
2b8a0 49 4e 43 54 20 2d 20 28 20 74 61 62 32 2e 63 6f  INCT - ( tab2.co
2b8b0 6c 31 20 29 20 2a 20 2d 20 63 6f 6c 32 20 2a 20  l1 ) * - col2 * 
2b8c0 63 6f 6c 31 20 63 6f 6c 32 20 46 52 4f 4d 20 74  col1 col2 FROM t
2b8d0 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 30 39 38 32  ab2..----..10982
2b8e0 0d 0a 32 35 39 34 37 0d 0a 39 30 35 30 36 0d 0a  ..25947..90506..
2b8f0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2b900 74 0d 0a 53 45 4c 45 43 54 20 38 37 20 2a 20 2b  t..SELECT 87 * +
2b910 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 0d   col1 FROM tab1.
2b920 0a 2d 2d 2d 2d 0d 0a 31 31 33 31 0d 0a 32 32 36  .----..1131..226
2b930 32 0d 0a 38 37 30 0d 0a 0d 0a 6f 6e 6c 79 69 66  2..870....onlyif
2b940 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74   mysql # support
2b950 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69   for MySQL speci
2b960 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73  fic system types
2b970 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65   and syntax..que
2b980 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
2b990 65 6c 2d 31 32 35 35 0d 0a 53 45 4c 45 43 54 20  el-1255..SELECT 
2b9a0 41 4c 4c 20 2b 20 43 41 53 54 28 20 4e 55 4c 4c  ALL + CAST( NULL
2b9b0 20 41 53 20 53 49 47 4e 45 44 20 29 20 2a 20 32   AS SIGNED ) * 2
2b9c0 34 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  4 AS col0 FROM t
2b9d0 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
2b9e0 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e  -..NULL..NULL..N
2b9f0 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  ULL....skipif my
2ba00 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
2ba10 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
2ba20 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 32 35 35  wsort label-1255
2ba30 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 43  ..SELECT ALL + C
2ba40 41 53 54 20 28 20 4e 55 4c 4c 20 41 53 20 49 4e  AST ( NULL AS IN
2ba50 54 45 47 45 52 20 29 20 2a 20 32 34 20 41 53 20  TEGER ) * 24 AS 
2ba60 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41  col0 FROM tab1 A
2ba70 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55  S cor0..----..NU
2ba80 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a  LL..NULL..NULL..
2ba90 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2baa0 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
2bab0 43 54 20 2d 20 32 38 20 41 53 20 63 6f 6c 32 20  CT - 28 AS col2 
2bac0 46 52 4f 4d 20 74 61 62 30 2c 20 74 61 62 32 20  FROM tab0, tab2 
2bad0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
2bae0 32 38 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73  28....skipif pos
2baf0 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72  tgresql # Postgr
2bb00 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53  eSQL requires AS
2bb10 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f   when renaming o
2bb20 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71  utput columns..q
2bb30 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
2bb40 53 45 4c 45 43 54 20 41 4c 4c 20 32 30 20 63 6f  SELECT ALL 20 co
2bb50 6c 32 20 46 52 4f 4d 20 74 61 62 30 2c 20 74 61  l2 FROM tab0, ta
2bb60 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
2bb70 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68 69  ..9 values hashi
2bb80 6e 67 20 74 6f 20 32 66 64 64 39 34 32 66 65 30  ng to 2fdd942fe0
2bb90 33 30 37 61 36 66 66 36 36 62 36 33 30 30 34 65  307a6ff66b63004e
2bba0 66 31 30 32 63 34 0d 0a 0d 0a 6f 6e 6c 79 69 66  f102c4....onlyif
2bbb0 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56   mysql # use DIV
2bbc0 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e   operator for in
2bbd0 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a  teger division..
2bbe0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
2bbf0 6c 61 62 65 6c 2d 31 32 35 38 0d 0a 53 45 4c 45  label-1258..SELE
2bc00 43 54 20 2b 20 2b 20 28 20 31 34 20 29 20 44 49  CT + + ( 14 ) DI
2bc10 56 20 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46  V col2 AS col0 F
2bc20 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
2bc30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d  ..----..0..0..0.
2bc40 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
2bc50 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
2bc60 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2bc70 74 20 6c 61 62 65 6c 2d 31 32 35 38 0d 0a 53 45  t label-1258..SE
2bc80 4c 45 43 54 20 2b 20 2b 20 28 20 31 34 20 29 20  LECT + + ( 14 ) 
2bc90 2f 20 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46  / col2 AS col0 F
2bca0 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
2bcb0 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d  ..----..0..0..0.
2bcc0 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
2bcd0 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79  # support for My
2bce0 53 51 4c 20 73 70 65 63 69 66 69 63 20 73 79 73  SQL specific sys
2bcf0 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79  tem types and sy
2bd00 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f  ntax..query I ro
2bd10 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 32 35 39  wsort label-1259
2bd20 0d 0a 53 45 4c 45 43 54 20 2d 20 37 30 20 2b 20  ..SELECT - 70 + 
2bd30 39 35 20 2b 20 2b 20 63 6f 6c 31 20 2a 20 2d 20  95 + + col1 * - 
2bd40 43 41 53 54 28 20 4e 55 4c 4c 20 41 53 20 44 45  CAST( NULL AS DE
2bd50 43 49 4d 41 4c 20 29 20 46 52 4f 4d 20 74 61 62  CIMAL ) FROM tab
2bd60 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
2bd70 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c  .NULL..NULL..NUL
2bd80 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  L....skipif mysq
2bd90 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
2bda0 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
2bdb0 6f 72 74 20 6c 61 62 65 6c 2d 31 32 35 39 0d 0a  ort label-1259..
2bdc0 53 45 4c 45 43 54 20 2d 20 37 30 20 2b 20 39 35  SELECT - 70 + 95
2bdd0 20 2b 20 2b 20 63 6f 6c 31 20 2a 20 2d 20 43 41   + + col1 * - CA
2bde0 53 54 20 28 20 4e 55 4c 4c 20 41 53 20 52 45 41  ST ( NULL AS REA
2bdf0 4c 20 29 20 46 52 4f 4d 20 74 61 62 32 20 41 53  L ) FROM tab2 AS
2be00 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c   cor0..----..NUL
2be10 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d  L..NULL..NULL...
2be20 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73  .skipif postgres
2be30 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20  ql # PostgreSQL 
2be40 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e  requires AS when
2be50 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74   renaming output
2be60 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20   columns..query 
2be70 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
2be80 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 30 20  T DISTINCT col0 
2be90 2a 20 34 39 20 63 6f 6c 31 20 46 52 4f 4d 20 74  * 49 col1 FROM t
2bea0 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 33 34 33 0d 0a  ab2..----..343..
2beb0 33 38 32 32 0d 0a 33 38 37 31 0d 0a 0d 0a 71 75  3822..3871....qu
2bec0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
2bed0 45 4c 45 43 54 20 41 4c 4c 20 34 30 20 2a 20 63  ELECT ALL 40 * c
2bee0 6f 6c 30 20 2b 20 2d 20 63 6f 6c 31 20 46 52 4f  ol0 + - col1 FRO
2bef0 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab0 cor0..---
2bf00 2d 0d 0a 31 33 30 33 0d 0a 33 34 36 39 0d 0a 38  -..1303..3469..8
2bf10 37 34 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  74....onlyif mys
2bf20 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65  ql # use DIV ope
2bf30 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65  rator for intege
2bf40 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72  r division..quer
2bf50 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
2bf60 6c 2d 31 32 36 32 0d 0a 53 45 4c 45 43 54 20 41  l-1262..SELECT A
2bf70 4c 4c 20 2b 20 28 20 2b 20 63 6f 6c 31 20 29 20  LL + ( + col1 ) 
2bf80 44 49 56 20 2d 20 63 6f 6c 31 20 41 53 20 63 6f  DIV - col1 AS co
2bf90 6c 30 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d  l0 FROM tab2..--
2bfa0 2d 2d 0d 0a 2d 31 0d 0a 2d 31 0d 0a 2d 31 0d 0a  --..-1..-1..-1..
2bfb0 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
2bfc0 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
2bfd0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2bfe0 20 6c 61 62 65 6c 2d 31 32 36 32 0d 0a 53 45 4c   label-1262..SEL
2bff0 45 43 54 20 41 4c 4c 20 2b 20 28 20 2b 20 63 6f  ECT ALL + ( + co
2c000 6c 31 20 29 20 2f 20 2d 20 63 6f 6c 31 20 41 53  l1 ) / - col1 AS
2c010 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 0d   col0 FROM tab2.
2c020 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 2d 31 0d 0a 2d  .----..-1..-1..-
2c030 31 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  1....onlyif mysq
2c040 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72  l # use DIV oper
2c050 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72  ator for integer
2c060 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79   division..query
2c070 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
2c080 2d 31 32 36 33 0d 0a 53 45 4c 45 43 54 20 2d 20  -1263..SELECT - 
2c090 31 35 20 44 49 56 20 38 35 20 41 53 20 63 6f 6c  15 DIV 85 AS col
2c0a0 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  2 FROM tab0 AS c
2c0b0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d  or0..----..0..0.
2c0c0 0a 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  .0....skipif mys
2c0d0 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
2c0e0 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
2c0f0 73 6f 72 74 20 6c 61 62 65 6c 2d 31 32 36 33 0d  sort label-1263.
2c100 0a 53 45 4c 45 43 54 20 2d 20 31 35 20 2f 20 38  .SELECT - 15 / 8
2c110 35 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  5 AS col2 FROM t
2c120 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
2c130 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a 71 75  -..0..0..0....qu
2c140 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
2c150 45 4c 45 43 54 20 2b 20 63 6f 6c 31 20 2a 20 2d  ELECT + col1 * -
2c160 20 28 20 2d 20 63 6f 6c 32 20 29 20 41 53 20 63   ( - col2 ) AS c
2c170 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol1 FROM tab0 AS
2c180 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 38 33   cor0..----..283
2c190 38 0d 0a 37 34 36 32 0d 0a 39 37 0d 0a 0d 0a 71  8..7462..97....q
2c1a0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
2c1b0 53 45 4c 45 43 54 20 2d 20 63 6f 6c 31 20 2b 20  SELECT - col1 + 
2c1c0 2b 20 74 61 62 32 2e 63 6f 6c 32 20 41 53 20 63  + tab2.col2 AS c
2c1d0 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d  ol0 FROM tab2..-
2c1e0 2d 2d 2d 0d 0a 2d 33 33 0d 0a 2d 34 0d 0a 32 31  ---..-33..-4..21
2c1f0 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
2c200 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61   # use DIV opera
2c210 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20  tor for integer 
2c220 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20  division..query 
2c230 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
2c240 31 32 36 36 0d 0a 53 45 4c 45 43 54 20 74 61 62  1266..SELECT tab
2c250 30 2e 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c 30 20  0.col0 + - col0 
2c260 44 49 56 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20  DIV + col1 FROM 
2c270 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 32 34 0d 0a  tab0..----..24..
2c280 33 35 0d 0a 38 39 0d 0a 0d 0a 73 6b 69 70 69 66  35..89....skipif
2c290 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
2c2a0 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
2c2b0 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
2c2c0 32 36 36 0d 0a 53 45 4c 45 43 54 20 74 61 62 30  266..SELECT tab0
2c2d0 2e 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c 30 20 2f  .col0 + - col0 /
2c2e0 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62   + col1 FROM tab
2c2f0 30 0d 0a 2d 2d 2d 2d 0d 0a 32 34 0d 0a 33 35 0d  0..----..24..35.
2c300 0a 38 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .89....query I r
2c310 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
2c320 20 31 37 20 2d 20 2b 20 63 6f 6c 30 20 41 53 20   17 - + col0 AS 
2c330 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a  col0 FROM tab0..
2c340 2d 2d 2d 2d 0d 0a 2d 31 38 0d 0a 2d 37 0d 0a 2d  ----..-18..-7..-
2c350 37 32 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  72....onlyif mys
2c360 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65  ql # use DIV ope
2c370 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65  rator for intege
2c380 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72  r division..quer
2c390 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
2c3a0 6c 2d 31 32 36 38 0d 0a 53 45 4c 45 43 54 20 28  l-1268..SELECT (
2c3b0 20 2d 20 63 6f 6c 31 20 29 20 44 49 56 20 74 61   - col1 ) DIV ta
2c3c0 62 31 2e 63 6f 6c 32 20 2d 20 63 6f 6c 31 20 46  b1.col2 - col1 F
2c3d0 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab1..----..
2c3e0 2d 31 30 0d 0a 2d 31 33 0d 0a 2d 32 36 0d 0a 0d  -10..-13..-26...
2c3f0 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
2c400 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
2c410 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
2c420 6c 61 62 65 6c 2d 31 32 36 38 0d 0a 53 45 4c 45  label-1268..SELE
2c430 43 54 20 28 20 2d 20 63 6f 6c 31 20 29 20 2f 20  CT ( - col1 ) / 
2c440 74 61 62 31 2e 63 6f 6c 32 20 2d 20 63 6f 6c 31  tab1.col2 - col1
2c450 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d   FROM tab1..----
2c460 0d 0a 2d 31 30 0d 0a 2d 31 33 0d 0a 2d 32 36 0d  ..-10..-13..-26.
2c470 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
2c480 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 36 31 20  rt..SELECT - 61 
2c490 2b 20 2d 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61  + - col2 FROM ta
2c4a0 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 34 33 0d 0a  b0..----..-143..
2c4b0 2d 36 32 0d 0a 2d 39 34 0d 0a 0d 0a 71 75 65 72  -62..-94....quer
2c4c0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
2c4d0 45 43 54 20 2d 20 74 61 62 30 2e 63 6f 6c 30 20  ECT - tab0.col0 
2c4e0 2a 20 63 6f 6c 31 20 2d 20 63 6f 6c 31 20 46 52  * col1 - col1 FR
2c4f0 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  OM tab0..----..-
2c500 32 31 35 30 0d 0a 2d 33 34 39 32 0d 0a 2d 38 31  2150..-3492..-81
2c510 39 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  90....query I ro
2c520 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
2c530 53 54 49 4e 43 54 20 2d 20 38 32 20 2b 20 63 6f  STINCT - 82 + co
2c540 72 30 2e 63 6f 6c 31 20 2a 20 63 6f 6c 32 20 41  r0.col1 * col2 A
2c550 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32  S col2 FROM tab2
2c560 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
2c570 31 34 35 32 0d 0a 35 36 34 0d 0a 37 35 35 0d 0a  1452..564..755..
2c580 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2c590 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20  t..SELECT ALL + 
2c5a0 32 36 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  26 AS col0 FROM 
2c5b0 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
2c5c0 2d 2d 0d 0a 32 36 0d 0a 32 36 0d 0a 32 36 0d 0a  --..26..26..26..
2c5d0 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
2c5e0 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f   use DIV operato
2c5f0 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69  r for integer di
2c600 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20  vision..query I 
2c610 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 32  rowsort label-12
2c620 37 33 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c  73..SELECT + col
2c630 30 20 2a 20 63 6f 72 30 2e 63 6f 6c 32 20 44 49  0 * cor0.col2 DI
2c640 56 20 2d 20 63 6f 6c 31 20 41 53 20 63 6f 6c 31  V - col1 AS col1
2c650 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
2c660 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 36 34 0d 0a  r0..----..-364..
2c670 2d 35 39 30 0d 0a 2d 36 0d 0a 0d 0a 73 6b 69 70  -590..-6....skip
2c680 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
2c690 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
2c6a0 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
2c6b0 2d 31 32 37 33 0d 0a 53 45 4c 45 43 54 20 2b 20  -1273..SELECT + 
2c6c0 63 6f 6c 30 20 2a 20 63 6f 72 30 2e 63 6f 6c 32  col0 * cor0.col2
2c6d0 20 2f 20 2d 20 63 6f 6c 31 20 41 53 20 63 6f 6c   / - col1 AS col
2c6e0 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  1 FROM tab1 AS c
2c6f0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 36 34 0d  or0..----..-364.
2c700 0a 2d 35 39 30 0d 0a 2d 36 0d 0a 0d 0a 6f 6e 6c  .-590..-6....onl
2c710 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70  yif mysql # supp
2c720 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70  ort for MySQL sp
2c730 65 63 69 66 69 63 20 73 79 73 74 65 6d 20 74 79  ecific system ty
2c740 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a  pes and syntax..
2c750 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
2c760 6c 61 62 65 6c 2d 31 32 37 34 0d 0a 53 45 4c 45  label-1274..SELE
2c770 43 54 20 41 4c 4c 20 2b 20 43 41 53 54 28 20 4e  CT ALL + CAST( N
2c780 55 4c 4c 20 41 53 20 53 49 47 4e 45 44 20 29 20  ULL AS SIGNED ) 
2c790 2b 20 2b 20 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c  + + col0 * + col
2c7a0 30 20 2a 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61  0 * col0 FROM ta
2c7b0 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e  b2 cor0..----..N
2c7c0 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d  ULL..NULL..NULL.
2c7d0 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
2c7e0 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
2c7f0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2c800 74 20 6c 61 62 65 6c 2d 31 32 37 34 0d 0a 53 45  t label-1274..SE
2c810 4c 45 43 54 20 41 4c 4c 20 2b 20 43 41 53 54 20  LECT ALL + CAST 
2c820 28 20 4e 55 4c 4c 20 41 53 20 49 4e 54 45 47 45  ( NULL AS INTEGE
2c830 52 20 29 20 2b 20 2b 20 63 6f 6c 30 20 2a 20 2b  R ) + + col0 * +
2c840 20 63 6f 6c 30 20 2a 20 63 6f 6c 30 20 46 52 4f   col0 * col0 FRO
2c850 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab2 cor0..---
2c860 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e  -..NULL..NULL..N
2c870 55 4c 4c 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  ULL....query I r
2c880 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
2c890 49 53 54 49 4e 43 54 20 2b 20 28 20 2b 20 63 6f  ISTINCT + ( + co
2c8a0 6c 30 20 29 20 41 53 20 63 6f 6c 31 20 46 52 4f  l0 ) AS col1 FRO
2c8b0 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
2c8c0 2d 2d 2d 2d 0d 0a 33 0d 0a 36 34 0d 0a 38 30 0d  ----..3..64..80.
2c8d0 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72  ...skipif postgr
2c8e0 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51  esql # PostgreSQ
2c8f0 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68  L requires AS wh
2c900 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70  en renaming outp
2c910 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72  ut columns..quer
2c920 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
2c930 45 43 54 20 41 4c 4c 20 2b 20 33 31 20 63 6f 6c  ECT ALL + 31 col
2c940 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  2 FROM tab1 AS c
2c950 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 31 0d 0a 33  or0..----..31..3
2c960 31 0d 0a 33 31 0d 0a 0d 0a 71 75 65 72 79 20 49  1..31....query I
2c970 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
2c980 20 41 4c 4c 20 63 6f 6c 31 20 2d 20 36 37 20 46   ALL col1 - 67 F
2c990 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
2c9a0 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 31 0d 0a 2d 35 34  ..----..-41..-54
2c9b0 0d 0a 2d 35 37 0d 0a 0d 0a 71 75 65 72 79 20 49  ..-57....query I
2c9c0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
2c9d0 20 41 4c 4c 20 2d 20 2b 20 31 34 20 2a 20 63 6f   ALL - + 14 * co
2c9e0 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l2 FROM tab1 AS 
2c9f0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 34  cor0..----..-134
2ca00 34 0d 0a 2d 37 35 36 0d 0a 2d 37 39 38 0d 0a 0d  4..-756..-798...
2ca10 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73  .skipif postgres
2ca20 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20  ql # PostgreSQL 
2ca30 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e  requires AS when
2ca40 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74   renaming output
2ca50 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20   columns..query 
2ca60 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
2ca70 54 20 41 4c 4c 20 2b 20 28 20 2d 20 38 38 20 29  T ALL + ( - 88 )
2ca80 20 2a 20 2b 20 63 6f 6c 32 20 63 6f 6c 31 20 46   * + col2 col1 F
2ca90 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
2caa0 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 37 35 32 0d 0a 2d  ..----..-4752..-
2cab0 35 30 31 36 0d 0a 2d 38 34 34 38 0d 0a 0d 0a 73  5016..-8448....s
2cac0 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c  kipif postgresql
2cad0 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65   # PostgreSQL re
2cae0 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72  quires AS when r
2caf0 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63  enaming output c
2cb00 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20  olumns..query I 
2cb10 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
2cb20 2b 20 63 6f 6c 30 20 2a 20 63 6f 6c 32 20 2b 20  + col0 * col2 + 
2cb30 63 6f 6c 32 20 63 6f 6c 30 20 46 52 4f 4d 20 74  col2 col0 FROM t
2cb40 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
2cb50 2d 0d 0a 32 30 35 34 0d 0a 32 31 36 0d 0a 33 30  -..2054..216..30
2cb60 34 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  40....query I ro
2cb70 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
2cb80 37 37 20 2a 20 63 6f 6c 32 20 41 53 20 63 6f 6c  77 * col2 AS col
2cb90 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  2 FROM tab0 AS c
2cba0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 35 34 31  or0..----..-2541
2cbb0 0d 0a 2d 36 33 31 34 0d 0a 2d 37 37 0d 0a 0d 0a  ..-6314..-77....
2cbc0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
2cbd0 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 31 20 2d  .SELECT - col1 -
2cbe0 20 2d 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62   - col0 FROM tab
2cbf0 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
2cc00 0a 2d 32 33 0d 0a 35 34 0d 0a 36 37 0d 0a 0d 0a  .-23..54..67....
2cc10 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
2cc20 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
2cc30 20 28 20 2d 20 63 6f 6c 31 20 29 20 41 53 20 63   ( - col1 ) AS c
2cc40 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol1 FROM tab2 AS
2cc50 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 37   cor0..----..-17
2cc60 0d 0a 2d 33 31 0d 0a 2d 35 39 0d 0a 0d 0a 71 75  ..-31..-59....qu
2cc70 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
2cc80 45 4c 45 43 54 20 36 20 2a 20 2b 20 63 6f 6c 31  ELECT 6 * + col1
2cc90 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
2cca0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 35 36 0d 0a 36  r0..----..156..6
2ccb0 30 0d 0a 37 38 0d 0a 0d 0a 71 75 65 72 79 20 49  0..78....query I
2ccc0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
2ccd0 20 41 4c 4c 20 33 31 20 2a 20 63 6f 6c 32 20 41   ALL 31 * col2 A
2cce0 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30  S col2 FROM tab0
2ccf0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
2cd00 31 30 32 33 0d 0a 32 35 34 32 0d 0a 33 31 0d 0a  1023..2542..31..
2cd10 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
2cd20 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f   use DIV operato
2cd30 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69  r for integer di
2cd40 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20  vision..query I 
2cd50 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 32  rowsort label-12
2cd60 38 36 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  86..SELECT DISTI
2cd70 4e 43 54 20 36 39 20 2b 20 63 6f 6c 31 20 44 49  NCT 69 + col1 DI
2cd80 56 20 2d 20 63 6f 6c 32 20 41 53 20 63 6f 6c 31  V - col2 AS col1
2cd90 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
2cda0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 36 39 0d 0a 0d 0a  r0..----..69....
2cdb0 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
2cdc0 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
2cdd0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
2cde0 61 62 65 6c 2d 31 32 38 36 0d 0a 53 45 4c 45 43  abel-1286..SELEC
2cdf0 54 20 44 49 53 54 49 4e 43 54 20 36 39 20 2b 20  T DISTINCT 69 + 
2ce00 63 6f 6c 31 20 2f 20 2d 20 63 6f 6c 32 20 41 53  col1 / - col2 AS
2ce10 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20   col1 FROM tab1 
2ce20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 36  AS cor0..----..6
2ce30 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  9....query I row
2ce40 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 72  sort..SELECT cor
2ce50 30 2e 63 6f 6c 31 20 2b 20 2d 20 35 33 20 41 53  0.col1 + - 53 AS
2ce60 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20   col0 FROM tab1 
2ce70 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
2ce80 32 37 0d 0a 2d 34 30 0d 0a 2d 34 33 0d 0a 0d 0a  27..-40..-43....
2ce90 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
2cea0 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
2ceb0 20 2d 20 2d 20 63 6f 6c 32 20 2a 20 63 6f 6c 31   - - col2 * col1
2cec0 20 2a 20 2b 20 63 6f 6c 32 20 46 52 4f 4d 20 74   * + col2 FROM t
2ced0 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
2cee0 2d 0d 0a 36 31 31 38 38 34 0d 0a 39 33 36 35 34  -..611884..93654
2cef0 0d 0a 39 37 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  ..97....onlyif m
2cf00 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66  ysql # support f
2cf10 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69  or MySQL specifi
2cf20 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61  c system types a
2cf30 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79  nd syntax..query
2cf40 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
2cf50 2d 31 32 38 39 0d 0a 53 45 4c 45 43 54 20 2d 20  -1289..SELECT - 
2cf60 28 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 29 20  ( - cor0.col2 ) 
2cf70 2b 20 2d 20 63 6f 6c 31 20 2a 20 43 41 53 54 28  + - col1 * CAST(
2cf80 20 4e 55 4c 4c 20 41 53 20 44 45 43 49 4d 41 4c   NULL AS DECIMAL
2cf90 20 29 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20   ) AS col2 FROM 
2cfa0 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab0 cor0..----.
2cfb0 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c  .NULL..NULL..NUL
2cfc0 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  L....skipif mysq
2cfd0 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
2cfe0 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
2cff0 6f 72 74 20 6c 61 62 65 6c 2d 31 32 38 39 0d 0a  ort label-1289..
2d000 53 45 4c 45 43 54 20 2d 20 28 20 2d 20 63 6f 72  SELECT - ( - cor
2d010 30 2e 63 6f 6c 32 20 29 20 2b 20 2d 20 63 6f 6c  0.col2 ) + - col
2d020 31 20 2a 20 43 41 53 54 20 28 20 4e 55 4c 4c 20  1 * CAST ( NULL 
2d030 41 53 20 52 45 41 4c 20 29 20 41 53 20 63 6f 6c  AS REAL ) AS col
2d040 32 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30  2 FROM tab0 cor0
2d050 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55  ..----..NULL..NU
2d060 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75 65 72  LL..NULL....quer
2d070 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
2d080 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63  ECT DISTINCT - c
2d090 6f 6c 30 20 2a 20 28 20 2d 20 63 6f 6c 32 20 29  ol0 * ( - col2 )
2d0a0 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
2d0b0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 36 32 0d 0a 33  r0..----..162..3
2d0c0 36 34 38 0d 0a 37 36 38 30 0d 0a 0d 0a 71 75 65  648..7680....que
2d0d0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
2d0e0 4c 45 43 54 20 41 4c 4c 20 2b 20 28 20 63 6f 6c  LECT ALL + ( col
2d0f0 30 20 29 20 2a 20 63 6f 6c 30 20 2b 20 2b 20 63  0 ) * col0 + + c
2d100 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol0 FROM tab0 AS
2d110 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 36   cor0..----..126
2d120 30 0d 0a 36 30 30 0d 0a 38 30 31 30 0d 0a 0d 0a  0..600..8010....
2d130 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
2d140 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 30  .SELECT ALL col0
2d150 20 2a 20 63 6f 72 30 2e 63 6f 6c 31 20 2b 20 63   * cor0.col1 + c
2d160 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  ol0 AS col1 FROM
2d170 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
2d180 2d 2d 2d 0d 0a 31 34 32 32 0d 0a 32 32 34 0d 0a  ---..1422..224..
2d190 34 36 38 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  4680....onlyif m
2d1a0 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66  ysql # support f
2d1b0 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69  or MySQL specifi
2d1c0 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61  c system types a
2d1d0 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79  nd syntax..query
2d1e0 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
2d1f0 2d 31 32 39 33 0d 0a 53 45 4c 45 43 54 20 28 20  -1293..SELECT ( 
2d200 2b 20 63 6f 6c 32 20 29 20 2a 20 2d 20 43 41 53  + col2 ) * - CAS
2d210 54 28 20 2b 20 63 6f 6c 31 20 2a 20 63 6f 6c 30  T( + col1 * col0
2d220 20 41 53 20 53 49 47 4e 45 44 20 29 20 46 52 4f   AS SIGNED ) FRO
2d230 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
2d240 2d 2d 2d 2d 0d 0a 2d 31 31 39 36 35 32 0d 0a 2d  ----..-119652..-
2d250 35 31 30 33 34 0d 0a 2d 35 38 35 39 0d 0a 0d 0a  51034..-5859....
2d260 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
2d270 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
2d280 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
2d290 61 62 65 6c 2d 31 32 39 33 0d 0a 53 45 4c 45 43  abel-1293..SELEC
2d2a0 54 20 28 20 2b 20 63 6f 6c 32 20 29 20 2a 20 2d  T ( + col2 ) * -
2d2b0 20 43 41 53 54 20 28 20 2b 20 63 6f 6c 31 20 2a   CAST ( + col1 *
2d2c0 20 63 6f 6c 30 20 41 53 20 49 4e 54 45 47 45 52   col0 AS INTEGER
2d2d0 20 29 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20   ) FROM tab2 AS 
2d2e0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 39  cor0..----..-119
2d2f0 36 35 32 0d 0a 2d 35 31 30 33 34 0d 0a 2d 35 38  652..-51034..-58
2d300 35 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  59....query I ro
2d310 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
2d320 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 2a 20 63 6f  - cor0.col2 * co
2d330 6c 31 20 2b 20 2b 20 63 6f 6c 31 20 46 52 4f 4d  l1 + + col1 FROM
2d340 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
2d350 2d 2d 2d 0d 0a 31 35 39 33 0d 0a 36 36 33 0d 0a  ---..1593..663..
2d360 38 36 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  868....query I r
2d370 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63  owsort..SELECT c
2d380 6f 6c 31 20 2b 20 2b 20 28 20 2d 20 74 61 62 30  ol1 + + ( - tab0
2d390 2e 63 6f 6c 32 20 29 20 41 53 20 63 6f 6c 30 20  .col2 ) AS col0 
2d3a0 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d  FROM tab0..----.
2d3b0 0a 35 33 0d 0a 39 0d 0a 39 36 0d 0a 0d 0a 71 75  .53..9..96....qu
2d3c0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
2d3d0 45 4c 45 43 54 20 63 6f 72 31 2e 63 6f 6c 32 20  ELECT cor1.col2 
2d3e0 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
2d3f0 30 20 43 52 4f 53 53 20 4a 4f 49 4e 20 74 61 62  0 CROSS JOIN tab
2d400 31 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d  1 AS cor1..----.
2d410 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e  .9 values hashin
2d420 67 20 74 6f 20 38 30 63 61 30 61 31 63 63 33 33  g to 80ca0a1cc33
2d430 37 61 37 37 31 34 61 38 39 39 30 61 37 36 34 63  7a7714a8990a764c
2d440 66 64 62 31 37 0d 0a 0d 0a 71 75 65 72 79 20 49  fdb17....query I
2d450 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
2d460 20 44 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c 30   DISTINCT + col0
2d470 20 2a 20 28 20 37 33 20 29 20 41 53 20 63 6f 6c   * ( 73 ) AS col
2d480 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  1 FROM tab1 AS c
2d490 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 31 39 0d 0a  or0..----..219..
2d4a0 34 36 37 32 0d 0a 35 38 34 30 0d 0a 0d 0a 71 75  4672..5840....qu
2d4b0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
2d4c0 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d  ELECT DISTINCT -
2d4d0 20 2d 20 63 6f 6c 31 20 2a 20 28 20 63 6f 6c 32   - col1 * ( col2
2d4e0 20 29 20 2b 20 2d 20 63 6f 6c 32 20 46 52 4f 4d   ) + - col2 FROM
2d4f0 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
2d500 2d 2d 2d 0d 0a 31 31 35 32 0d 0a 31 33 35 30 0d  ---..1152..1350.
2d510 0a 35 31 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .513....query I 
2d520 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
2d530 63 6f 6c 32 20 2b 20 2d 20 63 6f 6c 31 20 2a 20  col2 + - col1 * 
2d540 2b 20 28 20 63 6f 6c 31 20 29 20 46 52 4f 4d 20  + ( col1 ) FROM 
2d550 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
2d560 2d 2d 0d 0a 2d 37 33 36 33 0d 0a 2d 38 31 39 39  --..-7363..-8199
2d570 0d 0a 2d 39 34 30 38 0d 0a 0d 0a 6f 6e 6c 79 69  ..-9408....onlyi
2d580 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49  f mysql # use DI
2d590 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69  V operator for i
2d5a0 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d  nteger division.
2d5b0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2d5c0 20 6c 61 62 65 6c 2d 31 33 30 30 0d 0a 53 45 4c   label-1300..SEL
2d5d0 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 30 20 44  ECT ALL - col0 D
2d5e0 49 56 20 2d 20 63 6f 6c 31 20 63 6f 6c 32 20 46  IV - col1 col2 F
2d5f0 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
2d600 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 31 0d 0a 34 0d  ..----..0..1..4.
2d610 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72  ...skipif postgr
2d620 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51  esql # PostgreSQ
2d630 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68  L requires AS wh
2d640 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70  en renaming outp
2d650 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 73 6b 69 70  ut columns..skip
2d660 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
2d670 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
2d680 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
2d690 2d 31 33 30 30 0d 0a 53 45 4c 45 43 54 20 41 4c  -1300..SELECT AL
2d6a0 4c 20 2d 20 63 6f 6c 30 20 2f 20 2d 20 63 6f 6c  L - col0 / - col
2d6b0 31 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32  1 col2 FROM tab2
2d6c0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
2d6d0 30 0d 0a 31 0d 0a 34 0d 0a 0d 0a 6f 6e 6c 79 69  0..1..4....onlyi
2d6e0 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49  f mysql # use DI
2d6f0 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69  V operator for i
2d700 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d  nteger division.
2d710 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2d720 20 6c 61 62 65 6c 2d 31 33 30 31 0d 0a 53 45 4c   label-1301..SEL
2d730 45 43 54 20 2d 20 36 37 20 2a 20 2b 20 63 6f 6c  ECT - 67 * + col
2d740 31 20 2b 20 2b 20 34 39 20 44 49 56 20 2b 20 63  1 + + 49 DIV + c
2d750 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d  ol1 FROM tab0..-
2d760 2d 2d 2d 0d 0a 2d 35 37 36 32 0d 0a 2d 36 30 39  ---..-5762..-609
2d770 37 0d 0a 2d 36 34 39 39 0d 0a 0d 0a 73 6b 69 70  7..-6499....skip
2d780 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
2d790 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
2d7a0 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
2d7b0 2d 31 33 30 31 0d 0a 53 45 4c 45 43 54 20 2d 20  -1301..SELECT - 
2d7c0 36 37 20 2a 20 2b 20 63 6f 6c 31 20 2b 20 2b 20  67 * + col1 + + 
2d7d0 34 39 20 2f 20 2b 20 63 6f 6c 31 20 46 52 4f 4d  49 / + col1 FROM
2d7e0 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 37   tab0..----..-57
2d7f0 36 32 0d 0a 2d 36 30 39 37 0d 0a 2d 36 34 39 39  62..-6097..-6499
2d800 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
2d810 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 32  ort..SELECT col2
2d820 20 2a 20 2b 20 31 35 20 46 52 4f 4d 20 74 61 62   * + 15 FROM tab
2d830 31 0d 0a 2d 2d 2d 2d 0d 0a 31 34 34 30 0d 0a 38  1..----..1440..8
2d840 31 30 0d 0a 38 35 35 0d 0a 0d 0a 6f 6e 6c 79 69  10..855....onlyi
2d850 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49  f mysql # use DI
2d860 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69  V operator for i
2d870 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d  nteger division.
2d880 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2d890 20 6c 61 62 65 6c 2d 31 33 30 33 0d 0a 53 45 4c   label-1303..SEL
2d8a0 45 43 54 20 74 61 62 31 2e 63 6f 6c 32 20 44 49  ECT tab1.col2 DI
2d8b0 56 20 2b 20 34 39 20 46 52 4f 4d 20 74 61 62 31  V + 49 FROM tab1
2d8c0 0d 0a 2d 2d 2d 2d 0d 0a 31 0d 0a 31 0d 0a 31 0d  ..----..1..1..1.
2d8d0 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
2d8e0 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
2d8f0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2d900 74 20 6c 61 62 65 6c 2d 31 33 30 33 0d 0a 53 45  t label-1303..SE
2d910 4c 45 43 54 20 74 61 62 31 2e 63 6f 6c 32 20 2f  LECT tab1.col2 /
2d920 20 2b 20 34 39 20 46 52 4f 4d 20 74 61 62 31 0d   + 49 FROM tab1.
2d930 0a 2d 2d 2d 2d 0d 0a 31 0d 0a 31 0d 0a 31 0d 0a  .----..1..1..1..
2d940 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2d950 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
2d960 43 54 20 63 6f 6c 30 20 2a 20 63 6f 6c 30 20 2a  CT col0 * col0 *
2d970 20 63 6f 6c 31 20 2b 20 2d 20 74 61 62 31 2e 63   col1 + - tab1.c
2d980 6f 6c 30 20 2a 20 2b 20 63 6f 6c 30 20 41 53 20  ol0 * + col0 AS 
2d990 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 0d 0a  col1 FROM tab1..
2d9a0 2d 2d 2d 2d 0d 0a 32 32 35 0d 0a 33 36 38 36 34  ----..225..36864
2d9b0 0d 0a 37 36 38 30 30 0d 0a 0d 0a 71 75 65 72 79  ..76800....query
2d9c0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
2d9d0 43 54 20 41 4c 4c 20 74 61 62 31 2e 63 6f 6c 31  CT ALL tab1.col1
2d9e0 20 2b 20 2b 20 63 6f 6c 30 20 2b 20 63 6f 6c 31   + + col0 + col1
2d9f0 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d   FROM tab1..----
2da00 0d 0a 31 30 36 0d 0a 35 35 0d 0a 38 34 0d 0a 0d  ..106..55..84...
2da10 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2da20 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 32 20 2a 20  ..SELECT col2 * 
2da30 2d 20 28 20 2b 20 63 6f 6c 30 20 29 20 46 52 4f  - ( + col0 ) FRO
2da40 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  M tab1..----..-1
2da50 36 32 0d 0a 2d 33 36 34 38 0d 0a 2d 37 36 38 30  62..-3648..-7680
2da60 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
2da70 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
2da80 63 6f 6c 30 20 2a 20 63 6f 6c 32 20 2a 20 2b 20  col0 * col2 * + 
2da90 63 6f 6c 30 20 2b 20 63 6f 6c 30 20 2b 20 28 20  col0 + col0 + ( 
2daa0 2d 20 63 6f 6c 32 20 29 20 41 53 20 63 6f 6c 30  - col2 ) AS col0
2dab0 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d   FROM tab2..----
2dac0 0d 0a 31 33 30 33 0d 0a 31 35 38 32 33 36 0d 0a  ..1303..158236..
2dad0 32 33 37 31 39 39 0d 0a 0d 0a 71 75 65 72 79 20  237199....query 
2dae0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
2daf0 54 20 2b 20 63 6f 6c 31 20 2b 20 2d 20 63 6f 6c  T + col1 + - col
2db00 31 20 2d 20 63 6f 6c 30 20 41 53 20 63 6f 6c 32  1 - col0 AS col2
2db10 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
2db20 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 37 0d 0a 2d 37  r0..----..-7..-7
2db30 38 0d 0a 2d 37 39 0d 0a 0d 0a 6f 6e 6c 79 69 66  8..-79....onlyif
2db40 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56   mysql # use DIV
2db50 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e   operator for in
2db60 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a  teger division..
2db70 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
2db80 6c 61 62 65 6c 2d 31 33 30 39 0d 0a 53 45 4c 45  label-1309..SELE
2db90 43 54 20 2b 20 2b 20 63 6f 72 30 2e 63 6f 6c 31  CT + + cor0.col1
2dba0 20 44 49 56 20 63 6f 72 30 2e 63 6f 6c 31 20 46   DIV cor0.col1 F
2dbb0 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d  ROM tab1 cor0..-
2dbc0 2d 2d 2d 0d 0a 31 0d 0a 31 0d 0a 31 0d 0a 0d 0a  ---..1..1..1....
2dbd0 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
2dbe0 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
2dbf0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
2dc00 61 62 65 6c 2d 31 33 30 39 0d 0a 53 45 4c 45 43  abel-1309..SELEC
2dc10 54 20 2b 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20  T + + cor0.col1 
2dc20 2f 20 63 6f 72 30 2e 63 6f 6c 31 20 46 52 4f 4d  / cor0.col1 FROM
2dc30 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab1 cor0..----
2dc40 0d 0a 31 0d 0a 31 0d 0a 31 0d 0a 0d 0a 6f 6e 6c  ..1..1..1....onl
2dc50 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20  yif mysql # use 
2dc60 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72  DIV operator for
2dc70 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f   integer divisio
2dc80 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  n..query I rowso
2dc90 72 74 20 6c 61 62 65 6c 2d 31 33 31 30 0d 0a 53  rt label-1310..S
2dca0 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 63  ELECT DISTINCT c
2dcb0 6f 6c 32 20 44 49 56 20 2b 20 63 6f 6c 32 20 46  ol2 DIV + col2 F
2dcc0 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d  ROM tab0 cor0..-
2dcd0 2d 2d 2d 0d 0a 31 0d 0a 0d 0a 73 6b 69 70 69 66  ---..1....skipif
2dce0 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
2dcf0 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
2dd00 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
2dd10 33 31 30 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  310..SELECT DIST
2dd20 49 4e 43 54 20 63 6f 6c 32 20 2f 20 2b 20 63 6f  INCT col2 / + co
2dd30 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72  l2 FROM tab0 cor
2dd40 30 0d 0a 2d 2d 2d 2d 0d 0a 31 0d 0a 0d 0a 71 75  0..----..1....qu
2dd50 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
2dd60 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b  ELECT DISTINCT +
2dd70 20 2b 20 63 6f 6c 31 20 2b 20 63 6f 6c 31 20 2a   + col1 + col1 *
2dd80 20 39 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d   92 AS col2 FROM
2dd90 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
2dda0 2d 2d 2d 0d 0a 31 32 30 39 0d 0a 32 34 31 38 0d  ---..1209..2418.
2ddb0 0a 39 33 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .930....query I 
2ddc0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
2ddd0 44 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c 31 20  DISTINCT + col1 
2dde0 2b 20 2d 20 36 37 20 2a 20 63 6f 6c 32 20 46 52  + - 67 * col2 FR
2ddf0 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d  OM tab2..----..-
2de00 31 36 38 33 0d 0a 2d 31 37 37 38 0d 0a 2d 32 35  1683..-1778..-25
2de10 32 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  29....query I ro
2de20 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f  wsort..SELECT co
2de30 6c 31 20 2a 20 2d 20 28 20 2b 20 63 6f 6c 30 20  l1 * - ( + col0 
2de40 29 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d  ) FROM tab0..---
2de50 2d 0d 0a 2d 32 30 36 34 0d 0a 2d 33 33 39 35 0d  -..-2064..-3395.
2de60 0a 2d 38 30 39 39 0d 0a 0d 0a 71 75 65 72 79 20  .-8099....query 
2de70 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
2de80 54 20 2b 20 63 6f 6c 31 20 2a 20 2b 20 39 35 20  T + col1 * + 95 
2de90 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
2dea0 30 0d 0a 2d 2d 2d 2d 0d 0a 38 31 37 30 0d 0a 38  0..----..8170..8
2deb0 36 34 35 0d 0a 39 32 31 35 0d 0a 0d 0a 71 75 65  645..9215....que
2dec0 72 79 20 49 49 49 49 49 49 49 49 49 49 49 49 20  ry IIIIIIIIIIII 
2ded0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
2dee0 2a 20 46 52 4f 4d 20 74 61 62 31 2c 20 74 61 62  * FROM tab1, tab
2def0 32 20 63 6f 72 30 2c 20 74 61 62 32 2c 20 74 61  2 cor0, tab2, ta
2df00 62 31 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d  b1 AS cor1..----
2df10 0d 0a 39 37 32 20 76 61 6c 75 65 73 20 68 61 73  ..972 values has
2df20 68 69 6e 67 20 74 6f 20 39 38 30 32 37 34 31 37  hing to 98027417
2df30 35 66 61 66 65 63 30 31 35 61 38 33 30 38 30 36  5fafec015a830806
2df40 37 32 34 38 36 61 39 61 0d 0a 0d 0a 71 75 65 72  72486a9a....quer
2df50 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
2df60 45 43 54 20 2d 20 74 61 62 31 2e 63 6f 6c 31 20  ECT - tab1.col1 
2df70 2a 20 2b 20 35 39 20 46 52 4f 4d 20 74 61 62 31  * + 59 FROM tab1
2df80 2c 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  , tab0 AS cor0..
2df90 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68  ----..9 values h
2dfa0 61 73 68 69 6e 67 20 74 6f 20 34 35 65 37 31 31  ashing to 45e711
2dfb0 65 35 65 61 30 30 31 61 34 62 33 37 61 31 39 38  e5ea001a4b37a198
2dfc0 32 65 61 39 36 35 38 37 34 33 0d 0a 0d 0a 71 75  2ea9658743....qu
2dfd0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
2dfe0 45 4c 45 43 54 20 2d 20 63 6f 6c 31 20 2b 20 63  ELECT - col1 + c
2dff0 6f 72 30 2e 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c  or0.col0 * + col
2e000 31 20 2a 20 63 6f 72 30 2e 63 6f 6c 32 20 41 53  1 * cor0.col2 AS
2e010 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20   col0 FROM tab2 
2e020 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
2e030 31 39 35 39 33 0d 0a 35 31 30 31 37 0d 0a 35 38  19593..51017..58
2e040 32 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  28....query I ro
2e050 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
2e060 4c 20 2d 20 35 36 20 2b 20 2d 20 31 20 41 53 20  L - 56 + - 1 AS 
2e070 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 2c 20  col1 FROM tab2, 
2e080 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
2e090 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73  --..9 values has
2e0a0 68 69 6e 67 20 74 6f 20 35 32 30 64 63 33 39 33  hing to 520dc393
2e0b0 38 39 36 39 36 39 65 30 32 61 37 32 61 62 36 63  896969e02a72ab6c
2e0c0 35 64 39 32 31 32 36 62 0d 0a 0d 0a 71 75 65 72  5d92126b....quer
2e0d0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
2e0e0 45 43 54 20 44 49 53 54 49 4e 43 54 20 34 39 20  ECT DISTINCT 49 
2e0f0 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
2e100 32 2c 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  2, tab2 AS cor0.
2e110 0a 2d 2d 2d 2d 0d 0a 34 39 0d 0a 0d 0a 71 75 65  .----..49....que
2e120 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
2e130 4c 45 43 54 20 2b 20 74 61 62 30 2e 63 6f 6c 32  LECT + tab0.col2
2e140 20 2a 20 28 20 2d 20 63 6f 6c 31 20 29 20 41 53   * ( - col1 ) AS
2e150 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 0d   col1 FROM tab0.
2e160 0a 2d 2d 2d 2d 0d 0a 2d 32 38 33 38 0d 0a 2d 37  .----..-2838..-7
2e170 34 36 32 0d 0a 2d 39 37 0d 0a 0d 0a 71 75 65 72  462..-97....quer
2e180 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
2e190 45 43 54 20 41 4c 4c 20 2d 20 28 20 2d 20 63 6f  ECT ALL - ( - co
2e1a0 72 30 2e 63 6f 6c 31 20 29 20 46 52 4f 4d 20 74  r0.col1 ) FROM t
2e1b0 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
2e1c0 2d 0d 0a 38 36 0d 0a 39 31 0d 0a 39 37 0d 0a 0d  -..86..91..97...
2e1d0 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
2e1e0 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
2e1f0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
2e200 0a 53 45 4c 45 43 54 20 41 4c 4c 20 43 41 53 54  .SELECT ALL CAST
2e210 20 28 20 2d 20 39 38 20 41 53 20 52 45 41 4c 20   ( - 98 AS REAL 
2e220 29 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  ) AS col2 FROM t
2e230 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 39 38 0d 0a  ab0..----..-98..
2e240 2d 39 38 0d 0a 2d 39 38 0d 0a 0d 0a 6f 6e 6c 79  -98..-98....only
2e250 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44  if mysql # use D
2e260 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20  IV operator for 
2e270 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e  integer division
2e280 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2e290 74 20 6c 61 62 65 6c 2d 31 33 32 33 0d 0a 53 45  t label-1323..SE
2e2a0 4c 45 43 54 20 63 6f 6c 31 20 44 49 56 20 37 33  LECT col1 DIV 73
2e2b0 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
2e2c0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a  r0..----..0..0..
2e2d0 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  0....skipif mysq
2e2e0 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
2e2f0 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
2e300 6f 72 74 20 6c 61 62 65 6c 2d 31 33 32 33 0d 0a  ort label-1323..
2e310 53 45 4c 45 43 54 20 63 6f 6c 31 20 2f 20 37 33  SELECT col1 / 73
2e320 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
2e330 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a  r0..----..0..0..
2e340 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  0....onlyif mysq
2e350 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72  l # use DIV oper
2e360 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72  ator for integer
2e370 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79   division..query
2e380 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
2e390 2d 31 33 32 34 0d 0a 53 45 4c 45 43 54 20 2b 20  -1324..SELECT + 
2e3a0 28 20 63 6f 6c 30 20 29 20 44 49 56 20 63 6f 6c  ( col0 ) DIV col
2e3b0 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  0 AS col2 FROM t
2e3c0 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
2e3d0 2d 0d 0a 31 0d 0a 31 0d 0a 31 0d 0a 0d 0a 73 6b  -..1..1..1....sk
2e3e0 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
2e3f0 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
2e400 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
2e410 65 6c 2d 31 33 32 34 0d 0a 53 45 4c 45 43 54 20  el-1324..SELECT 
2e420 2b 20 28 20 63 6f 6c 30 20 29 20 2f 20 63 6f 6c  + ( col0 ) / col
2e430 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  0 AS col2 FROM t
2e440 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
2e450 2d 0d 0a 31 0d 0a 31 0d 0a 31 0d 0a 0d 0a 6f 6e  -..1..1..1....on
2e460 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70  lyif mysql # sup
2e470 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73  port for MySQL s
2e480 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20 74  pecific system t
2e490 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d  ypes and syntax.
2e4a0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2e4b0 20 6c 61 62 65 6c 2d 31 33 32 35 0d 0a 53 45 4c   label-1325..SEL
2e4c0 45 43 54 20 41 4c 4c 20 43 41 53 54 28 20 4e 55  ECT ALL CAST( NU
2e4d0 4c 4c 20 41 53 20 53 49 47 4e 45 44 20 29 20 41  LL AS SIGNED ) A
2e4e0 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30  S col0 FROM tab0
2e4f0 2c 20 74 61 62 31 20 63 6f 72 30 2c 20 74 61 62  , tab1 cor0, tab
2e500 30 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d  0 AS cor1..----.
2e510 0a 32 37 20 76 61 6c 75 65 73 20 68 61 73 68 69  .27 values hashi
2e520 6e 67 20 74 6f 20 31 36 62 65 38 38 36 38 61 31  ng to 16be8868a1
2e530 65 36 66 34 65 38 38 35 30 35 30 39 66 39 33 32  e6f4e8850509f932
2e540 37 61 66 65 39 30 0d 0a 0d 0a 73 6b 69 70 69 66  7afe90....skipif
2e550 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
2e560 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
2e570 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
2e580 33 32 35 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  325..SELECT ALL 
2e590 43 41 53 54 20 28 20 4e 55 4c 4c 20 41 53 20 49  CAST ( NULL AS I
2e5a0 4e 54 45 47 45 52 20 29 20 41 53 20 63 6f 6c 30  NTEGER ) AS col0
2e5b0 20 46 52 4f 4d 20 74 61 62 30 2c 20 74 61 62 31   FROM tab0, tab1
2e5c0 20 63 6f 72 30 2c 20 74 61 62 30 20 41 53 20 63   cor0, tab0 AS c
2e5d0 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61  or1..----..27 va
2e5e0 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20  lues hashing to 
2e5f0 31 36 62 65 38 38 36 38 61 31 65 36 66 34 65 38  16be8868a1e6f4e8
2e600 38 35 30 35 30 39 66 39 33 32 37 61 66 65 39 30  850509f9327afe90
2e610 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67  ....skipif postg
2e620 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53  resql # PostgreS
2e630 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77  QL requires AS w
2e640 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74  hen renaming out
2e650 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65  put columns..que
2e660 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
2e670 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f  LECT DISTINCT co
2e680 6c 31 20 2a 20 2b 20 63 6f 6c 30 20 2a 20 39 31  l1 * + col0 * 91
2e690 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 0d   col2 FROM tab1.
2e6a0 0a 2d 2d 2d 2d 0d 0a 35 38 32 34 30 0d 0a 37 30  .----..58240..70
2e6b0 39 38 0d 0a 39 34 36 34 30 0d 0a 0d 0a 73 6b 69  98..94640....ski
2e6c0 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23  pif postgresql #
2e6d0 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75   PostgreSQL requ
2e6e0 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e  ires AS when ren
2e6f0 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c  aming output col
2e700 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f  umns..query I ro
2e710 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
2e720 4c 20 2d 20 2b 20 37 34 20 2b 20 2b 20 63 6f 6c  L - + 74 + + col
2e730 32 20 2a 20 2b 20 63 6f 6c 31 20 2b 20 63 6f 72  2 * + col1 + cor
2e740 30 2e 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c 31 20  0.col1 * + col1 
2e750 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41  col0 FROM tab2 A
2e760 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 37  S cor0..----..17
2e770 32 34 0d 0a 34 39 34 31 0d 0a 38 36 31 0d 0a 0d  24..4941..861...
2e780 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
2e790 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72  use DIV operator
2e7a0 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76   for integer div
2e7b0 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72  ision..query I r
2e7c0 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 33 32  owsort label-132
2e7d0 38 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 39 39  8..SELECT ALL 99
2e7e0 20 44 49 56 20 33 37 20 2b 20 2d 20 63 6f 72 31   DIV 37 + - cor1
2e7f0 2e 63 6f 6c 31 20 44 49 56 20 2b 20 38 31 20 46  .col1 DIV + 81 F
2e800 52 4f 4d 20 74 61 62 30 2c 20 74 61 62 32 20 41  ROM tab0, tab2 A
2e810 53 20 63 6f 72 30 2c 20 74 61 62 32 20 41 53 20  S cor0, tab2 AS 
2e820 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76  cor1..----..27 v
2e830 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f  alues hashing to
2e840 20 35 33 35 33 34 35 63 35 30 61 31 39 66 64 61   535345c50a19fda
2e850 62 39 37 63 65 30 35 64 31 38 33 37 62 31 66 30  b97ce05d1837b1f0
2e860 39 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  9....skipif mysq
2e870 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
2e880 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
2e890 6f 72 74 20 6c 61 62 65 6c 2d 31 33 32 38 0d 0a  ort label-1328..
2e8a0 53 45 4c 45 43 54 20 41 4c 4c 20 39 39 20 2f 20  SELECT ALL 99 / 
2e8b0 33 37 20 2b 20 2d 20 63 6f 72 31 2e 63 6f 6c 31  37 + - cor1.col1
2e8c0 20 2f 20 2b 20 38 31 20 46 52 4f 4d 20 74 61 62   / + 81 FROM tab
2e8d0 30 2c 20 74 61 62 32 20 41 53 20 63 6f 72 30 2c  0, tab2 AS cor0,
2e8e0 20 74 61 62 32 20 41 53 20 63 6f 72 31 0d 0a 2d   tab2 AS cor1..-
2e8f0 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75 65 73 20 68  ---..27 values h
2e900 61 73 68 69 6e 67 20 74 6f 20 35 33 35 33 34 35  ashing to 535345
2e910 63 35 30 61 31 39 66 64 61 62 39 37 63 65 30 35  c50a19fdab97ce05
2e920 64 31 38 33 37 62 31 66 30 39 0d 0a 0d 0a 6f 6e  d1837b1f09....on
2e930 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70  lyif mysql # sup
2e940 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73  port for MySQL s
2e950 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20 74  pecific system t
2e960 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d  ypes and syntax.
2e970 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2e980 20 6c 61 62 65 6c 2d 31 33 32 39 0d 0a 53 45 4c   label-1329..SEL
2e990 45 43 54 20 41 4c 4c 20 2b 20 38 32 20 2d 20 2b  ECT ALL + 82 - +
2e9a0 20 63 6f 6c 31 20 2a 20 2d 20 43 41 53 54 28 20   col1 * - CAST( 
2e9b0 4e 55 4c 4c 20 41 53 20 53 49 47 4e 45 44 20 29  NULL AS SIGNED )
2e9c0 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
2e9d0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a  r0..----..NULL..
2e9e0 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b  NULL..NULL....sk
2e9f0 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
2ea00 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
2ea10 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
2ea20 65 6c 2d 31 33 32 39 0d 0a 53 45 4c 45 43 54 20  el-1329..SELECT 
2ea30 41 4c 4c 20 2b 20 38 32 20 2d 20 2b 20 63 6f 6c  ALL + 82 - + col
2ea40 31 20 2a 20 2d 20 43 41 53 54 20 28 20 4e 55 4c  1 * - CAST ( NUL
2ea50 4c 20 41 53 20 49 4e 54 45 47 45 52 20 29 20 46  L AS INTEGER ) F
2ea60 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
2ea70 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55  ..----..NULL..NU
2ea80 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 6f 6e 6c 79  LL..NULL....only
2ea90 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f  if mysql # suppo
2eaa0 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65  rt for MySQL spe
2eab0 63 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70  cific system typ
2eac0 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71  es and syntax..q
2ead0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
2eae0 61 62 65 6c 2d 31 33 33 30 0d 0a 53 45 4c 45 43  abel-1330..SELEC
2eaf0 54 20 43 41 53 54 28 20 4e 55 4c 4c 20 41 53 20  T CAST( NULL AS 
2eb00 44 45 43 49 4d 41 4c 20 29 20 41 53 20 63 6f 6c  DECIMAL ) AS col
2eb10 31 20 46 52 4f 4d 20 74 61 62 31 2c 20 74 61 62  1 FROM tab1, tab
2eb20 30 20 41 53 20 63 6f 72 30 2c 20 74 61 62 30 20  0 AS cor0, tab0 
2eb30 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 32  AS cor1..----..2
2eb40 37 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67  7 values hashing
2eb50 20 74 6f 20 31 36 62 65 38 38 36 38 61 31 65 36   to 16be8868a1e6
2eb60 66 34 65 38 38 35 30 35 30 39 66 39 33 32 37 61  f4e8850509f9327a
2eb70 66 65 39 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  fe90....skipif m
2eb80 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
2eb90 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
2eba0 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 33 33  owsort label-133
2ebb0 30 0d 0a 53 45 4c 45 43 54 20 43 41 53 54 20 28  0..SELECT CAST (
2ebc0 20 4e 55 4c 4c 20 41 53 20 52 45 41 4c 20 29 20   NULL AS REAL ) 
2ebd0 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
2ebe0 31 2c 20 74 61 62 30 20 41 53 20 63 6f 72 30 2c  1, tab0 AS cor0,
2ebf0 20 74 61 62 30 20 41 53 20 63 6f 72 31 0d 0a 2d   tab0 AS cor1..-
2ec00 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75 65 73 20 68  ---..27 values h
2ec10 61 73 68 69 6e 67 20 74 6f 20 31 36 62 65 38 38  ashing to 16be88
2ec20 36 38 61 31 65 36 66 34 65 38 38 35 30 35 30 39  68a1e6f4e8850509
2ec30 66 39 33 32 37 61 66 65 39 30 0d 0a 0d 0a 71 75  f9327afe90....qu
2ec40 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
2ec50 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d  ELECT DISTINCT -
2ec60 20 63 6f 6c 31 20 2a 20 2d 20 63 6f 72 30 2e 63   col1 * - cor0.c
2ec70 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  ol2 AS col1 FROM
2ec80 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
2ec90 2d 2d 2d 0d 0a 31 35 33 34 0d 0a 36 34 36 0d 0a  ---..1534..646..
2eca0 38 33 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  837....query I r
2ecb0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
2ecc0 20 2b 20 28 20 2b 20 63 6f 6c 30 20 29 20 2b 20   + ( + col0 ) + 
2ecd0 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31  + col0 FROM tab1
2ece0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
2ecf0 31 32 38 0d 0a 31 36 30 0d 0a 36 0d 0a 0d 0a 71  128..160..6....q
2ed00 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
2ed10 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 32 20  SELECT ALL col2 
2ed20 2a 20 63 6f 6c 30 20 2d 20 28 20 63 6f 6c 31 20  * col0 - ( col1 
2ed30 29 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  ) FROM tab1 AS c
2ed40 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33 36 0d 0a  or0..----..136..
2ed50 33 36 33 38 0d 0a 37 36 36 37 0d 0a 0d 0a 6f 6e  3638..7667....on
2ed60 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
2ed70 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
2ed80 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
2ed90 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
2eda0 6f 72 74 20 6c 61 62 65 6c 2d 31 33 33 34 0d 0a  ort label-1334..
2edb0 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
2edc0 2b 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 44 49  + + cor0.col2 DI
2edd0 56 20 63 6f 6c 32 20 2b 20 63 6f 72 30 2e 63 6f  V col2 + cor0.co
2ede0 6c 30 20 2a 20 2d 20 63 6f 6c 32 20 46 52 4f 4d  l0 * - col2 FROM
2edf0 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
2ee00 2d 2d 2d 0d 0a 2d 31 36 31 0d 0a 2d 33 36 34 37  ---..-161..-3647
2ee10 0d 0a 2d 37 36 37 39 0d 0a 0d 0a 73 6b 69 70 69  ..-7679....skipi
2ee20 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
2ee30 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
2ee40 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
2ee50 31 33 33 34 0d 0a 53 45 4c 45 43 54 20 44 49 53  1334..SELECT DIS
2ee60 54 49 4e 43 54 20 2b 20 2b 20 63 6f 72 30 2e 63  TINCT + + cor0.c
2ee70 6f 6c 32 20 2f 20 63 6f 6c 32 20 2b 20 63 6f 72  ol2 / col2 + cor
2ee80 30 2e 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c 32 20  0.col0 * - col2 
2ee90 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
2eea0 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 36 31 0d 0a 2d  0..----..-161..-
2eeb0 33 36 34 37 0d 0a 2d 37 36 37 39 0d 0a 0d 0a 71  3647..-7679....q
2eec0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
2eed0 53 45 4c 45 43 54 20 2d 20 63 6f 6c 32 20 2a 20  SELECT - col2 * 
2eee0 34 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  40 FROM tab1 AS 
2eef0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 31 36  cor0..----..-216
2ef00 30 0d 0a 2d 32 32 38 30 0d 0a 2d 33 38 34 30 0d  0..-2280..-3840.
2ef10 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
2ef20 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 72 30 2e  rt..SELECT cor0.
2ef30 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c 30 20 2b 20  col0 * + col0 + 
2ef40 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46 52 4f  col2 AS col2 FRO
2ef50 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
2ef60 2d 2d 2d 2d 0d 0a 31 32 32 36 0d 0a 36 30 39 0d  ----..1226..609.
2ef70 0a 38 30 30 33 0d 0a 0d 0a 71 75 65 72 79 20 49  .8003....query I
2ef80 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
2ef90 20 44 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c 32   DISTINCT + col2
2efa0 20 2a 20 2b 20 28 20 2d 20 63 6f 72 30 2e 63 6f   * + ( - cor0.co
2efb0 6c 32 20 29 20 2d 20 63 6f 72 30 2e 63 6f 6c 30  l2 ) - cor0.col0
2efc0 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
2efd0 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
2efe0 0d 0a 2d 31 35 32 33 0d 0a 2d 37 33 36 0d 0a 2d  ..-1523..-736..-
2eff0 37 35 34 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  754....onlyif my
2f000 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f  sql # support fo
2f010 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63  r MySQL specific
2f020 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e   system types an
2f030 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20  d syntax..query 
2f040 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
2f050 31 33 33 38 0d 0a 53 45 4c 45 43 54 20 44 49 53  1338..SELECT DIS
2f060 54 49 4e 43 54 20 2b 20 63 6f 6c 30 20 2b 20 43  TINCT + col0 + C
2f070 41 53 54 28 20 63 6f 6c 30 20 41 53 20 53 49 47  AST( col0 AS SIG
2f080 4e 45 44 20 29 20 41 53 20 63 6f 6c 31 20 46 52  NED ) AS col1 FR
2f090 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
2f0a0 0a 2d 2d 2d 2d 0d 0a 31 34 0d 0a 31 35 36 0d 0a  .----..14..156..
2f0b0 31 35 38 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  158....skipif my
2f0c0 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
2f0d0 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
2f0e0 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 33 33 38  wsort label-1338
2f0f0 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
2f100 54 20 2b 20 63 6f 6c 30 20 2b 20 43 41 53 54 20  T + col0 + CAST 
2f110 28 20 63 6f 6c 30 20 41 53 20 49 4e 54 45 47 45  ( col0 AS INTEGE
2f120 52 20 29 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  R ) AS col1 FROM
2f130 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
2f140 2d 2d 2d 0d 0a 31 34 0d 0a 31 35 36 0d 0a 31 35  ---..14..156..15
2f150 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  8....query I row
2f160 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
2f170 54 49 4e 43 54 20 2b 20 2d 20 63 6f 72 30 2e 63  TINCT + - cor0.c
2f180 6f 6c 31 20 2b 20 2b 20 63 6f 6c 32 20 46 52 4f  ol1 + + col2 FRO
2f190 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
2f1a0 2d 2d 2d 2d 0d 0a 2d 33 33 0d 0a 2d 34 0d 0a 32  ----..-33..-4..2
2f1b0 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  1....query I row
2f1c0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63  sort..SELECT - c
2f1d0 6f 6c 30 20 2a 20 63 6f 72 30 2e 63 6f 6c 30 20  ol0 * cor0.col0 
2f1e0 46 52 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a  FROM tab2 cor0..
2f1f0 2d 2d 2d 2d 0d 0a 2d 34 39 0d 0a 2d 36 30 38 34  ----..-49..-6084
2f200 0d 0a 2d 36 32 34 31 0d 0a 0d 0a 73 6b 69 70 69  ..-6241....skipi
2f210 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
2f220 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
2f230 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
2f240 54 20 2b 20 31 31 20 2f 20 74 61 62 30 2e 63 6f  T + 11 / tab0.co
2f250 6c 32 20 2b 20 43 41 53 54 20 28 20 2d 20 32 20  l2 + CAST ( - 2 
2f260 41 53 20 52 45 41 4c 20 29 20 46 52 4f 4d 20 74  AS REAL ) FROM t
2f270 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 0d 0a 2d  ab0..----..-2..-
2f280 32 0d 0a 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20  2..9....query I 
2f290 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
2f2a0 44 49 53 54 49 4e 43 54 20 2b 20 31 32 20 41 53  DISTINCT + 12 AS
2f2b0 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 0d   col1 FROM tab0.
2f2c0 0a 2d 2d 2d 2d 0d 0a 31 32 0d 0a 0d 0a 71 75 65  .----..12....que
2f2d0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
2f2e0 4c 45 43 54 20 2b 20 63 6f 6c 30 20 2b 20 33 39  LECT + col0 + 39
2f2f0 20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d   FROM tab1 cor0.
2f300 0a 2d 2d 2d 2d 0d 0a 31 30 33 0d 0a 31 31 39 0d  .----..103..119.
2f310 0a 34 32 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f  .42....skipif po
2f320 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67  stgresql # Postg
2f330 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41  reSQL requires A
2f340 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20  S when renaming 
2f350 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a  output columns..
2f360 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
2f370 0a 53 45 4c 45 43 54 20 63 6f 6c 30 20 2a 20 2d  .SELECT col0 * -
2f380 20 63 6f 6c 32 20 63 6f 6c 30 20 46 52 4f 4d 20   col2 col0 FROM 
2f390 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab1 cor0..----.
2f3a0 0a 2d 31 36 32 0d 0a 2d 33 36 34 38 0d 0a 2d 37  .-162..-3648..-7
2f3b0 36 38 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  680....query I r
2f3c0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
2f3d0 20 31 32 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d   12 AS col1 FROM
2f3e0 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
2f3f0 2d 2d 2d 0d 0a 2d 31 32 0d 0a 2d 31 32 0d 0a 2d  ---..-12..-12..-
2f400 31 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  12....query I ro
2f410 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
2f420 4c 20 2b 20 28 20 2d 20 74 61 62 30 2e 63 6f 6c  L + ( - tab0.col
2f430 31 20 2b 20 63 6f 6c 31 20 29 20 41 53 20 63 6f  1 + col1 ) AS co
2f440 6c 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d  l1 FROM tab0..--
2f450 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a 71  --..0..0..0....q
2f460 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
2f470 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 31 20 46  SELECT ALL - 1 F
2f480 52 4f 4d 20 74 61 62 32 2c 20 74 61 62 32 20 63  ROM tab2, tab2 c
2f490 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c  or0..----..9 val
2f4a0 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 36  ues hashing to 6
2f4b0 30 66 64 64 36 39 32 34 62 62 37 36 33 64 36 61  0fdd6924bb763d6a
2f4c0 63 61 30 30 62 61 37 34 39 33 35 65 66 34 62 0d  ca00ba74935ef4b.
2f4d0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
2f4e0 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d  rt..SELECT ALL -
2f4f0 20 63 6f 72 30 2e 63 6f 6c 32 20 2b 20 2b 20 35   cor0.col2 + + 5
2f500 33 20 46 52 4f 4d 20 74 61 62 32 20 63 6f 72 30  3 FROM tab2 cor0
2f510 20 43 52 4f 53 53 20 4a 4f 49 4e 20 74 61 62 30   CROSS JOIN tab0
2f520 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76   cor1..----..9 v
2f530 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f  alues hashing to
2f540 20 38 33 32 35 30 38 33 38 33 65 34 33 63 30 63   832508383e43c0c
2f550 35 36 66 32 34 33 34 31 63 66 39 66 32 33 66 37  56f24341cf9f23f7
2f560 38 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74  8....skipif post
2f570 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65  gresql # Postgre
2f580 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20  SQL requires AS 
2f590 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75  when renaming ou
2f5a0 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75  tput columns..qu
2f5b0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
2f5c0 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d  ELECT DISTINCT -
2f5d0 20 63 6f 6c 30 20 2a 20 2b 20 39 33 20 63 6f 6c   col0 * + 93 col
2f5e0 32 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d  2 FROM tab0..---
2f5f0 2d 0d 0a 2d 32 32 33 32 0d 0a 2d 33 32 35 35 0d  -..-2232..-3255.
2f600 0a 2d 38 32 37 37 0d 0a 0d 0a 71 75 65 72 79 20  .-8277....query 
2f610 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
2f620 54 20 2b 20 63 6f 72 31 2e 63 6f 6c 32 20 2b 20  T + cor1.col2 + 
2f630 2d 20 28 20 2d 20 63 6f 72 30 2e 63 6f 6c 31 20  - ( - cor0.col1 
2f640 29 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  ) AS col0 FROM t
2f650 61 62 30 20 41 53 20 63 6f 72 30 20 43 52 4f 53  ab0 AS cor0 CROS
2f660 53 20 4a 4f 49 4e 20 74 61 62 30 20 41 53 20 63  S JOIN tab0 AS c
2f670 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c  or1..----..9 val
2f680 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 65  ues hashing to e
2f690 64 30 66 31 38 36 37 35 31 36 39 30 37 31 63 35  d0f18675169071c5
2f6a0 36 62 37 36 32 65 62 63 65 62 65 61 63 37 31 0d  6b762ebcebeac71.
2f6b0 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
2f6c0 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79  # support for My
2f6d0 53 51 4c 20 73 70 65 63 69 66 69 63 20 73 79 73  SQL specific sys
2f6e0 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79  tem types and sy
2f6f0 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f  ntax..query I ro
2f700 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 33 35 31  wsort label-1351
2f710 0d 0a 53 45 4c 45 43 54 20 2b 20 28 20 2b 20 63  ..SELECT + ( + c
2f720 6f 6c 32 20 29 20 2b 20 43 41 53 54 28 20 2b 20  ol2 ) + CAST( + 
2f730 63 6f 6c 30 20 41 53 20 53 49 47 4e 45 44 20 29  col0 AS SIGNED )
2f740 20 2a 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62   * col2 FROM tab
2f750 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
2f760 0a 32 31 36 0d 0a 33 37 30 35 0d 0a 37 37 37 36  .216..3705..7776
2f770 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
2f780 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
2f790 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
2f7a0 72 74 20 6c 61 62 65 6c 2d 31 33 35 31 0d 0a 53  rt label-1351..S
2f7b0 45 4c 45 43 54 20 2b 20 28 20 2b 20 63 6f 6c 32  ELECT + ( + col2
2f7c0 20 29 20 2b 20 43 41 53 54 20 28 20 2b 20 63 6f   ) + CAST ( + co
2f7d0 6c 30 20 41 53 20 49 4e 54 45 47 45 52 20 29 20  l0 AS INTEGER ) 
2f7e0 2a 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31  * col2 FROM tab1
2f7f0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
2f800 32 31 36 0d 0a 33 37 30 35 0d 0a 37 37 37 36 0d  216..3705..7776.
2f810 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
2f820 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b  rt..SELECT ALL +
2f830 20 35 32 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d   52 AS col0 FROM
2f840 20 74 61 62 32 2c 20 74 61 62 31 20 63 6f 72 30   tab2, tab1 cor0
2f850 2c 20 74 61 62 31 20 41 53 20 63 6f 72 31 0d 0a  , tab1 AS cor1..
2f860 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75 65 73 20  ----..27 values 
2f870 68 61 73 68 69 6e 67 20 74 6f 20 37 36 31 30 30  hashing to 76100
2f880 64 31 30 66 35 31 39 39 35 64 32 30 65 66 64 65  d10f51995d20efde
2f890 62 36 35 37 65 34 34 34 64 33 63 0d 0a 0d 0a 71  b657e444d3c....q
2f8a0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
2f8b0 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
2f8c0 2b 20 34 35 20 2a 20 2b 20 63 6f 6c 31 20 41 53  + 45 * + col1 AS
2f8d0 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 0d   col2 FROM tab0.
2f8e0 0a 2d 2d 2d 2d 0d 0a 33 38 37 30 0d 0a 34 30 39  .----..3870..409
2f8f0 35 0d 0a 34 33 36 35 0d 0a 0d 0a 6f 6e 6c 79 69  5..4365....onlyi
2f900 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49  f mysql # use DI
2f910 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69  V operator for i
2f920 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d  nteger division.
2f930 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2f940 20 6c 61 62 65 6c 2d 31 33 35 34 0d 0a 53 45 4c   label-1354..SEL
2f950 45 43 54 20 41 4c 4c 20 63 6f 6c 31 20 2a 20 63  ECT ALL col1 * c
2f960 6f 6c 30 20 44 49 56 20 63 6f 6c 32 20 46 52 4f  ol0 DIV col2 FRO
2f970 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 0d  M tab1..----..1.
2f980 0a 31 30 0d 0a 31 31 0d 0a 0d 0a 73 6b 69 70 69  .10..11....skipi
2f990 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
2f9a0 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
2f9b0 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
2f9c0 31 33 35 34 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  1354..SELECT ALL
2f9d0 20 63 6f 6c 31 20 2a 20 63 6f 6c 30 20 2f 20 63   col1 * col0 / c
2f9e0 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d  ol2 FROM tab1..-
2f9f0 2d 2d 2d 0d 0a 31 0d 0a 31 30 0d 0a 31 31 0d 0a  ---..1..10..11..
2fa00 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2fa10 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
2fa20 43 54 20 2b 20 63 6f 6c 30 20 2a 20 33 37 20 46  CT + col0 * 37 F
2fa30 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
2fa40 0d 0a 2d 2d 2d 2d 0d 0a 31 31 31 0d 0a 32 33 36  ..----..111..236
2fa50 38 0d 0a 32 39 36 30 0d 0a 0d 0a 71 75 65 72 79  8..2960....query
2fa60 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
2fa70 43 54 20 2b 20 2d 20 63 6f 6c 31 20 2a 20 63 6f  CT + - col1 * co
2fa80 6c 31 20 2b 20 2b 20 63 6f 6c 31 20 2a 20 63 6f  l1 + + col1 * co
2fa90 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l1 FROM tab2 AS 
2faa0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30  cor0..----..0..0
2fab0 0d 0a 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  ..0....query I r
2fac0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63  owsort..SELECT c
2fad0 6f 72 30 2e 63 6f 6c 31 20 2b 20 2d 20 36 39 20  or0.col1 + - 69 
2fae0 2a 20 34 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  * 4 AS col0 FROM
2faf0 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
2fb00 2d 2d 2d 0d 0a 2d 31 37 39 0d 0a 2d 31 38 35 0d  ---..-179..-185.
2fb10 0a 2d 31 39 30 0d 0a 0d 0a 71 75 65 72 79 20 49  .-190....query I
2fb20 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
2fb30 20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c 30   DISTINCT - col0
2fb40 20 2b 20 2b 20 37 34 20 2a 20 2d 20 63 6f 6c 30   + + 74 * - col0
2fb50 20 2a 20 2d 20 63 6f 6c 31 20 41 53 20 63 6f 6c   * - col1 AS col
2fb60 32 20 46 52 4f 4d 20 74 61 62 32 20 63 6f 72 30  2 FROM tab2 cor0
2fb70 0d 0a 2d 2d 2d 2d 0d 0a 31 36 30 35 31 0d 0a 33  ..----..16051..3
2fb80 34 30 34 37 30 0d 0a 39 39 33 30 33 0d 0a 0d 0a  40470..99303....
2fb90 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
2fba0 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 32 20 2a  .SELECT - col2 *
2fbb0 20 2d 20 30 20 46 52 4f 4d 20 74 61 62 31 20 41   - 0 FROM tab1 A
2fbc0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d  S cor0..----..0.
2fbd0 0a 30 0d 0a 30 0d 0a 0d 0a 71 75 65 72 79 20 49  .0..0....query I
2fbe0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
2fbf0 20 41 4c 4c 20 74 61 62 32 2e 63 6f 6c 30 20 41   ALL tab2.col0 A
2fc00 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32  S col1 FROM tab2
2fc10 2c 20 74 61 62 31 20 41 53 20 63 6f 72 30 2c 20  , tab1 AS cor0, 
2fc20 74 61 62 32 20 41 53 20 63 6f 72 31 0d 0a 2d 2d  tab2 AS cor1..--
2fc30 2d 2d 0d 0a 32 37 20 76 61 6c 75 65 73 20 68 61  --..27 values ha
2fc40 73 68 69 6e 67 20 74 6f 20 31 65 31 66 31 30 39  shing to 1e1f109
2fc50 35 33 65 62 38 65 66 66 65 39 62 32 30 65 37 34  53eb8effe9b20e74
2fc60 36 66 38 61 37 66 64 38 33 0d 0a 0d 0a 6f 6e 6c  6f8a7fd83....onl
2fc70 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70  yif mysql # supp
2fc80 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70  ort for MySQL sp
2fc90 65 63 69 66 69 63 20 73 79 73 74 65 6d 20 74 79  ecific system ty
2fca0 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a  pes and syntax..
2fcb0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
2fcc0 6c 61 62 65 6c 2d 31 33 36 31 0d 0a 53 45 4c 45  label-1361..SELE
2fcd0 43 54 20 2b 20 28 20 2b 20 63 6f 6c 30 20 29 20  CT + ( + col0 ) 
2fce0 2a 20 43 41 53 54 28 20 2d 20 28 20 2d 20 74 61  * CAST( - ( - ta
2fcf0 62 32 2e 63 6f 6c 30 20 29 20 41 53 20 53 49 47  b2.col0 ) AS SIG
2fd00 4e 45 44 20 29 20 2b 20 2b 20 63 6f 6c 31 20 2b  NED ) + + col1 +
2fd10 20 2b 20 28 20 63 6f 6c 30 20 29 20 41 53 20 63   + ( col0 ) AS c
2fd20 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d  ol0 FROM tab2..-
2fd30 2d 2d 2d 0d 0a 36 32 32 31 0d 0a 36 33 33 37 0d  ---..6221..6337.
2fd40 0a 38 37 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  .87....skipif my
2fd50 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
2fd60 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
2fd70 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 33 36 31  wsort label-1361
2fd80 0d 0a 53 45 4c 45 43 54 20 2b 20 28 20 2b 20 63  ..SELECT + ( + c
2fd90 6f 6c 30 20 29 20 2a 20 43 41 53 54 20 28 20 2d  ol0 ) * CAST ( -
2fda0 20 28 20 2d 20 74 61 62 32 2e 63 6f 6c 30 20 29   ( - tab2.col0 )
2fdb0 20 41 53 20 49 4e 54 45 47 45 52 20 29 20 2b 20   AS INTEGER ) + 
2fdc0 2b 20 63 6f 6c 31 20 2b 20 2b 20 28 20 63 6f 6c  + col1 + + ( col
2fdd0 30 20 29 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  0 ) AS col0 FROM
2fde0 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 36 32 32   tab2..----..622
2fdf0 31 0d 0a 36 33 33 37 0d 0a 38 37 0d 0a 0d 0a 71  1..6337..87....q
2fe00 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
2fe10 53 45 4c 45 43 54 20 41 4c 4c 20 28 20 63 6f 6c  SELECT ALL ( col
2fe20 32 20 29 20 2d 20 34 37 20 46 52 4f 4d 20 74 61  2 ) - 47 FROM ta
2fe30 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 30 0d 0a 34 39  b1..----..10..49
2fe40 0d 0a 37 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  ..7....onlyif my
2fe50 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f  sql # support fo
2fe60 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63  r MySQL specific
2fe70 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e   system types an
2fe80 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20  d syntax..query 
2fe90 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
2fea0 31 33 36 33 0d 0a 53 45 4c 45 43 54 20 2b 20 43  1363..SELECT + C
2feb0 41 53 54 28 20 4e 55 4c 4c 20 41 53 20 44 45 43  AST( NULL AS DEC
2fec0 49 4d 41 4c 20 29 20 41 53 20 63 6f 6c 30 20 46  IMAL ) AS col0 F
2fed0 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
2fee0 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55  ..----..NULL..NU
2fef0 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70  LL..NULL....skip
2ff00 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
2ff10 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
2ff20 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
2ff30 2d 31 33 36 33 0d 0a 53 45 4c 45 43 54 20 2b 20  -1363..SELECT + 
2ff40 43 41 53 54 20 28 20 4e 55 4c 4c 20 41 53 20 52  CAST ( NULL AS R
2ff50 45 41 4c 20 29 20 41 53 20 63 6f 6c 30 20 46 52  EAL ) AS col0 FR
2ff60 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
2ff70 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c  .----..NULL..NUL
2ff80 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75 65 72 79  L..NULL....query
2ff90 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
2ffa0 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 2b 20  CT DISTINCT + + 
2ffb0 38 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  81 FROM tab0 AS 
2ffc0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 38 31 0d 0a  cor0..----..81..
2ffd0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2ffe0 74 0d 0a 53 45 4c 45 43 54 20 33 32 20 46 52 4f  t..SELECT 32 FRO
2fff0 4d 20 74 61 62 30 2c 20 74 61 62 31 20 41 53 20  M tab0, tab1 AS 
30000 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61  cor0..----..9 va
30010 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20  lues hashing to 
30020 64 33 30 61 32 61 63 62 66 33 33 63 38 38 32 37  d30a2acbf33c8827
30030 34 34 37 34 33 30 36 39 33 36 64 33 32 32 37 62  4474306936d3227b
30040 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
30050 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
30060 2b 20 38 33 20 41 53 20 63 6f 6c 30 20 46 52 4f  + 83 AS col0 FRO
30070 4d 20 74 61 62 31 2c 20 74 61 62 30 20 41 53 20  M tab1, tab0 AS 
30080 63 6f 72 30 20 43 52 4f 53 53 20 4a 4f 49 4e 20  cor0 CROSS JOIN 
30090 74 61 62 32 2c 20 74 61 62 32 20 41 53 20 63 6f  tab2, tab2 AS co
300a0 72 31 0d 0a 2d 2d 2d 2d 0d 0a 38 31 20 76 61 6c  r1..----..81 val
300b0 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 35  ues hashing to 5
300c0 63 65 64 33 37 32 30 64 35 61 65 66 66 30 64 64  ced3720d5aeff0dd
300d0 37 37 64 35 30 35 39 61 33 38 30 30 31 62 36 0d  77d5059a38001b6.
300e0 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
300f0 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74  # use DIV operat
30100 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64  or for integer d
30110 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49  ivision..query I
30120 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
30130 33 36 37 0d 0a 53 45 4c 45 43 54 20 2b 20 28 20  367..SELECT + ( 
30140 2d 20 63 6f 6c 31 20 29 20 44 49 56 20 2b 20 63  - col1 ) DIV + c
30150 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  ol2 AS col1 FROM
30160 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
30170 2d 2d 2d 0d 0a 2d 31 0d 0a 2d 32 0d 0a 2d 39 37  ---..-1..-2..-97
30180 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
30190 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
301a0 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
301b0 72 74 20 6c 61 62 65 6c 2d 31 33 36 37 0d 0a 53  rt label-1367..S
301c0 45 4c 45 43 54 20 2b 20 28 20 2d 20 63 6f 6c 31  ELECT + ( - col1
301d0 20 29 20 2f 20 2b 20 63 6f 6c 32 20 41 53 20 63   ) / + col2 AS c
301e0 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol1 FROM tab0 AS
301f0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d   cor0..----..-1.
30200 0a 2d 32 0d 0a 2d 39 37 0d 0a 0d 0a 71 75 65 72  .-2..-97....quer
30210 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
30220 45 43 54 20 2b 20 2b 20 28 20 2b 20 37 33 20 29  ECT + + ( + 73 )
30230 20 2a 20 63 6f 72 30 2e 63 6f 6c 30 20 46 52 4f   * cor0.col0 FRO
30240 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
30250 2d 2d 2d 2d 0d 0a 32 31 39 0d 0a 34 36 37 32 0d  ----..219..4672.
30260 0a 35 38 34 30 0d 0a 0d 0a 71 75 65 72 79 20 49  .5840....query I
30270 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
30280 20 2d 20 2b 20 39 33 20 46 52 4f 4d 20 74 61 62   - + 93 FROM tab
30290 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
302a0 0a 2d 39 33 0d 0a 2d 39 33 0d 0a 2d 39 33 0d 0a  .-93..-93..-93..
302b0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
302c0 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2b 20 31 33  t..SELECT + + 13
302d0 20 46 52 4f 4d 20 74 61 62 31 2c 20 74 61 62 32   FROM tab1, tab2
302e0 2c 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  , tab0 AS cor0..
302f0 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75 65 73 20  ----..27 values 
30300 68 61 73 68 69 6e 67 20 74 6f 20 61 39 30 64 30  hashing to a90d0
30310 66 33 37 63 65 63 36 30 33 61 65 31 62 63 30 61  f37cec603ae1bc0a
30320 36 30 64 63 37 66 62 61 65 65 64 0d 0a 0d 0a 71  60dc7fbaeed....q
30330 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
30340 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
30350 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 41 53 20 63  + cor0.col0 AS c
30360 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 2c 20 74  ol2 FROM tab0, t
30370 61 62 32 2c 20 74 61 62 31 20 41 53 20 63 6f 72  ab2, tab1 AS cor
30380 30 0d 0a 2d 2d 2d 2d 0d 0a 33 0d 0a 36 34 0d 0a  0..----..3..64..
30390 38 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  80....query I ro
303a0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
303b0 53 54 49 4e 43 54 20 28 20 38 35 20 2b 20 2b 20  STINCT ( 85 + + 
303c0 63 6f 6c 32 20 29 20 2a 20 28 20 63 6f 6c 30 20  col2 ) * ( col0 
303d0 29 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d  ) FROM tab2..---
303e0 2d 0d 0a 37 38 34 0d 0a 38 36 35 38 0d 0a 39 37  -..784..8658..97
303f0 31 37 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  17....onlyif mys
30400 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72  ql # support for
30410 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63 20   MySQL specific 
30420 73 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64  system types and
30430 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49   syntax..query I
30440 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
30450 33 37 33 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  373..SELECT DIST
30460 49 4e 43 54 20 2b 20 2d 20 31 20 2b 20 63 6f 6c  INCT + - 1 + col
30470 31 20 2b 20 2b 20 43 41 53 54 28 20 4e 55 4c 4c  1 + + CAST( NULL
30480 20 41 53 20 53 49 47 4e 45 44 20 29 20 2a 20 2d   AS SIGNED ) * -
30490 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20   col0 FROM tab1 
304a0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e  AS cor0..----..N
304b0 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  ULL....skipif my
304c0 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
304d0 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
304e0 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 33 37 33  wsort label-1373
304f0 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
30500 54 20 2b 20 2d 20 31 20 2b 20 63 6f 6c 31 20 2b  T + - 1 + col1 +
30510 20 2b 20 43 41 53 54 20 28 20 4e 55 4c 4c 20 41   + CAST ( NULL A
30520 53 20 49 4e 54 45 47 45 52 20 29 20 2a 20 2d 20  S INTEGER ) * - 
30530 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41  col0 FROM tab1 A
30540 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55  S cor0..----..NU
30550 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73  LL....skipif pos
30560 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72  tgresql # Postgr
30570 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53  eSQL requires AS
30580 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f   when renaming o
30590 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71  utput columns..q
305a0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
305b0 53 45 4c 45 43 54 20 2b 20 2b 20 35 39 20 63 6f  SELECT + + 59 co
305c0 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l1 FROM tab0 AS 
305d0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 35 39 0d 0a  cor0..----..59..
305e0 35 39 0d 0a 35 39 0d 0a 0d 0a 71 75 65 72 79 20  59..59....query 
305f0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
30600 54 20 2d 20 33 31 20 46 52 4f 4d 20 74 61 62 31  T - 31 FROM tab1
30610 2c 20 74 61 62 30 2c 20 74 61 62 30 20 63 6f 72  , tab0, tab0 cor
30620 30 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75  0..----..27 valu
30630 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 63 36  es hashing to c6
30640 63 38 65 65 62 65 62 31 61 35 39 66 37 63 30 34  c8eebeb1a59f7c04
30650 36 34 30 32 65 32 35 36 33 30 63 30 61 63 0d 0a  6402e25630c0ac..
30660 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
30670 74 0d 0a 53 45 4c 45 43 54 20 2d 20 36 35 20 46  t..SELECT - 65 F
30680 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab0..----..
30690 2d 36 35 0d 0a 2d 36 35 0d 0a 2d 36 35 0d 0a 0d  -65..-65..-65...
306a0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
306b0 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 32 20  ..SELECT + col2 
306c0 2b 20 2b 20 39 38 20 41 53 20 63 6f 6c 32 20 46  + + 98 AS col2 F
306d0 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
306e0 0d 0a 2d 2d 2d 2d 0d 0a 31 32 34 0d 0a 31 32 35  ..----..124..125
306f0 0d 0a 31 33 36 0d 0a 0d 0a 71 75 65 72 79 20 49  ..136....query I
30700 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
30710 20 44 49 53 54 49 4e 43 54 20 28 20 2d 20 63 6f   DISTINCT ( - co
30720 6c 31 20 29 20 46 52 4f 4d 20 74 61 62 31 0d 0a  l1 ) FROM tab1..
30730 2d 2d 2d 2d 0d 0a 2d 31 30 0d 0a 2d 31 33 0d 0a  ----..-10..-13..
30740 2d 32 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  -26....query I r
30750 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63  owsort..SELECT c
30760 6f 6c 32 20 2a 20 2d 20 74 61 62 32 2e 63 6f 6c  ol2 * - tab2.col
30770 31 20 2b 20 2b 20 74 61 62 32 2e 63 6f 6c 32 20  1 + + tab2.col2 
30780 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d  FROM tab2..----.
30790 0a 2d 31 35 30 38 0d 0a 2d 36 30 38 0d 0a 2d 38  .-1508..-608..-8
307a0 31 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  10....query I ro
307b0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
307c0 4c 20 2b 20 34 34 20 2b 20 2d 20 63 6f 6c 32 20  L + 44 + - col2 
307d0 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
307e0 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
307f0 0a 2d 31 30 0d 0a 2d 31 33 0d 0a 2d 35 32 0d 0a  .-10..-13..-52..
30800 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
30810 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
30820 43 54 20 2d 20 2d 20 63 6f 6c 30 20 2a 20 63 6f  CT - - col0 * co
30830 6c 32 20 2d 20 63 6f 6c 31 20 2a 20 63 6f 6c 31  l2 - col1 * col1
30840 20 2a 20 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20   * col1 AS col0 
30850 46 52 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a  FROM tab2 cor0..
30860 2d 2d 2d 2d 0d 0a 2d 31 39 31 31 0d 0a 2d 32 30  ----..-1911..-20
30870 33 33 35 31 0d 0a 2d 32 39 36 30 32 0d 0a 0d 0a  3351..-29602....
30880 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71  skipif postgresq
30890 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72  l # PostgreSQL r
308a0 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20  equires AS when 
308b0 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20  renaming output 
308c0 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49  columns..query I
308d0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
308e0 20 44 49 53 54 49 4e 43 54 20 2d 20 2b 20 63 6f   DISTINCT - + co
308f0 6c 30 20 2b 20 63 6f 6c 32 20 63 6f 6c 32 20 46  l0 + col2 col2 F
30900 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
30910 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 34 0d 0a 2d 37 0d  ..----..-34..-7.
30920 0a 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  .9....query I ro
30930 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
30940 4c 20 63 6f 6c 32 20 2b 20 2b 20 63 6f 72 30 2e  L col2 + + cor0.
30950 63 6f 6c 31 20 2b 20 28 20 39 34 20 29 20 2a 20  col1 + ( 94 ) * 
30960 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30  + col1 FROM tab0
30970 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 38 32 30   cor0..----..820
30980 33 0d 0a 38 37 32 37 0d 0a 39 32 31 36 0d 0a 0d  3..8727..9216...
30990 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73  .skipif postgres
309a0 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20  ql # PostgreSQL 
309b0 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e  requires AS when
309c0 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74   renaming output
309d0 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20   columns..query 
309e0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
309f0 54 20 2d 20 28 20 63 6f 6c 30 20 29 20 2a 20 63  T - ( col0 ) * c
30a00 6f 6c 31 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61  ol1 col2 FROM ta
30a10 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
30a20 0d 0a 2d 32 30 36 34 0d 0a 2d 33 33 39 35 0d 0a  ..-2064..-3395..
30a30 2d 38 30 39 39 0d 0a 0d 0a 71 75 65 72 79 20 49  -8099....query I
30a40 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
30a50 20 41 4c 4c 20 2b 20 31 34 20 2a 20 2b 20 63 6f   ALL + 14 * + co
30a60 72 30 2e 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  r0.col2 FROM tab
30a70 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
30a80 0a 31 31 34 38 0d 0a 31 34 0d 0a 34 36 32 0d 0a  .1148..14..462..
30a90 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
30aa0 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
30ab0 43 54 20 2d 20 2d 20 63 6f 6c 30 20 2b 20 2d 20  CT - - col0 + - 
30ac0 63 6f 72 30 2e 63 6f 6c 32 20 2a 20 2d 20 63 6f  cor0.col2 * - co
30ad0 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l1 FROM tab0 AS 
30ae0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33 32 0d  cor0..----..132.
30af0 0a 32 38 36 32 0d 0a 37 35 35 31 0d 0a 0d 0a 71  .2862..7551....q
30b00 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
30b10 53 45 4c 45 43 54 20 2b 20 31 31 20 2a 20 63 6f  SELECT + 11 * co
30b20 72 30 2e 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20  r0.col1 AS col0 
30b30 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
30b40 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 30 31 0d 0a 31  0..----..1001..1
30b50 30 36 37 0d 0a 39 34 36 0d 0a 0d 0a 71 75 65 72  067..946....quer
30b60 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
30b70 45 43 54 20 41 4c 4c 20 2d 20 2d 20 28 20 63 6f  ECT ALL - - ( co
30b80 6c 30 20 29 20 2b 20 39 33 20 41 53 20 63 6f 6c  l0 ) + 93 AS col
30b90 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  2 FROM tab1 AS c
30ba0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 35 37 0d 0a  or0..----..157..
30bb0 31 37 33 0d 0a 39 36 0d 0a 0d 0a 6f 6e 6c 79 69  173..96....onlyi
30bc0 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49  f mysql # use DI
30bd0 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69  V operator for i
30be0 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d  nteger division.
30bf0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
30c00 20 6c 61 62 65 6c 2d 31 33 38 39 0d 0a 53 45 4c   label-1389..SEL
30c10 45 43 54 20 41 4c 4c 20 63 6f 6c 32 20 2b 20 63  ECT ALL col2 + c
30c20 6f 6c 31 20 44 49 56 20 63 6f 6c 32 20 41 53 20  ol1 DIV col2 AS 
30c30 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41  col0 FROM tab0 A
30c40 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 35  S cor0..----..35
30c50 0d 0a 38 33 0d 0a 39 38 0d 0a 0d 0a 73 6b 69 70  ..83..98....skip
30c60 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
30c70 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
30c80 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
30c90 2d 31 33 38 39 0d 0a 53 45 4c 45 43 54 20 41 4c  -1389..SELECT AL
30ca0 4c 20 63 6f 6c 32 20 2b 20 63 6f 6c 31 20 2f 20  L col2 + col1 / 
30cb0 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46 52 4f  col2 AS col0 FRO
30cc0 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
30cd0 2d 2d 2d 2d 0d 0a 33 35 0d 0a 38 33 0d 0a 39 38  ----..35..83..98
30ce0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
30cf0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 31 39  ort..SELECT - 19
30d00 20 2b 20 2b 20 63 6f 6c 30 20 2a 20 2d 20 63 6f   + + col0 * - co
30d10 72 30 2e 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  r0.col1 FROM tab
30d20 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
30d30 0a 2d 31 30 35 39 0d 0a 2d 36 35 39 0d 0a 2d 39  .-1059..-659..-9
30d40 37 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  7....onlyif mysq
30d50 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72  l # use DIV oper
30d60 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72  ator for integer
30d70 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79   division..query
30d80 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
30d90 2d 31 33 39 31 0d 0a 53 45 4c 45 43 54 20 44 49  -1391..SELECT DI
30da0 53 54 49 4e 43 54 20 2b 20 63 6f 6c 30 20 2b 20  STINCT + col0 + 
30db0 63 6f 6c 31 20 44 49 56 20 2b 20 43 41 53 54 28  col1 DIV + CAST(
30dc0 20 2d 20 63 6f 6c 30 20 2b 20 63 6f 6c 31 20 2a   - col0 + col1 *
30dd0 20 43 41 53 54 28 20 2b 20 63 6f 6c 31 20 41 53   CAST( + col1 AS
30de0 20 53 49 47 4e 45 44 20 29 20 41 53 20 53 49 47   SIGNED ) AS SIG
30df0 4e 45 44 20 29 20 46 52 4f 4d 20 74 61 62 31 20  NED ) FROM tab1 
30e00 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33  AS cor0..----..3
30e10 0d 0a 36 34 0d 0a 38 30 0d 0a 0d 0a 73 6b 69 70  ..64..80....skip
30e20 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
30e30 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
30e40 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
30e50 2d 31 33 39 31 0d 0a 53 45 4c 45 43 54 20 44 49  -1391..SELECT DI
30e60 53 54 49 4e 43 54 20 2b 20 63 6f 6c 30 20 2b 20  STINCT + col0 + 
30e70 63 6f 6c 31 20 2f 20 2b 20 43 41 53 54 20 28 20  col1 / + CAST ( 
30e80 2d 20 63 6f 6c 30 20 2b 20 63 6f 6c 31 20 2a 20  - col0 + col1 * 
30e90 43 41 53 54 20 28 20 2b 20 63 6f 6c 31 20 41 53  CAST ( + col1 AS
30ea0 20 49 4e 54 45 47 45 52 20 29 20 41 53 20 49 4e   INTEGER ) AS IN
30eb0 54 45 47 45 52 20 29 20 46 52 4f 4d 20 74 61 62  TEGER ) FROM tab
30ec0 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
30ed0 0a 33 0d 0a 36 34 0d 0a 38 30 0d 0a 0d 0a 71 75  .3..64..80....qu
30ee0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
30ef0 45 4c 45 43 54 20 2b 20 28 20 2b 20 63 6f 6c 32  ELECT + ( + col2
30f00 20 29 20 2b 20 2d 20 63 6f 6c 30 20 41 53 20 63   ) + - col0 AS c
30f10 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol0 FROM tab0 AS
30f20 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 34   cor0..----..-34
30f30 0d 0a 2d 37 0d 0a 39 0d 0a 0d 0a 71 75 65 72 79  ..-7..9....query
30f40 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
30f50 43 54 20 2b 20 63 6f 6c 30 20 2b 20 63 6f 6c 30  CT + col0 + col0
30f60 20 2d 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62   - col1 FROM tab
30f70 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
30f80 0a 2d 31 37 0d 0a 31 34 31 0d 0a 39 37 0d 0a 0d  .-17..141..97...
30f90 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
30fa0 0d 0a 53 45 4c 45 43 54 20 2d 20 2d 20 63 6f 6c  ..SELECT - - col
30fb0 32 20 2b 20 31 35 20 2a 20 28 20 63 6f 6c 32 20  2 + 15 * ( col2 
30fc0 2b 20 63 6f 6c 30 20 2a 20 35 39 20 29 20 41 53  + col0 * 59 ) AS
30fd0 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20   col0 FROM tab1 
30fe0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 35 31 39  cor0..----..3519
30ff0 0d 0a 35 37 35 35 32 0d 0a 37 32 33 33 36 0d 0a  ..57552..72336..
31000 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
31010 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20  t..SELECT ALL - 
31020 63 6f 6c 30 20 2a 20 2b 20 33 39 20 2a 20 2b 20  col0 * + 39 * + 
31030 32 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  2 AS col1 FROM t
31040 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
31050 2d 0d 0a 2d 32 33 34 0d 0a 2d 34 39 39 32 0d 0a  -..-234..-4992..
31060 2d 36 32 34 30 0d 0a 0d 0a 73 6b 69 70 69 66 20  -6240....skipif 
31070 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
31080 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
31090 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
310a0 44 49 53 54 49 4e 43 54 20 2b 20 63 6f 72 30 2e  DISTINCT + cor0.
310b0 63 6f 6c 30 20 2a 20 2b 20 43 41 53 54 20 28 20  col0 * + CAST ( 
310c0 63 6f 6c 30 20 41 53 20 52 45 41 4c 20 29 20 46  col0 AS REAL ) F
310d0 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
310e0 0d 0a 2d 2d 2d 2d 0d 0a 34 39 0d 0a 36 30 38 34  ..----..49..6084
310f0 0d 0a 36 32 34 31 0d 0a 0d 0a 71 75 65 72 79 20  ..6241....query 
31100 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
31110 54 20 2d 20 63 6f 72 31 2e 63 6f 6c 31 20 46 52  T - cor1.col1 FR
31120 4f 4d 20 74 61 62 31 2c 20 74 61 62 31 20 41 53  OM tab1, tab1 AS
31130 20 63 6f 72 30 2c 20 74 61 62 31 20 41 53 20 63   cor0, tab1 AS c
31140 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61  or1..----..27 va
31150 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20  lues hashing to 
31160 63 37 38 39 30 34 36 39 65 61 62 62 32 63 36 66  c7890469eabb2c6f
31170 63 38 31 34 35 34 62 33 35 64 32 33 33 33 62 36  c81454b35d2333b6
31180 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
31190 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 34 31  ort..SELECT + 41
311a0 20 2a 20 2b 20 63 6f 6c 31 20 2b 20 63 6f 6c 30   * + col1 + col0
311b0 20 2a 20 63 6f 72 30 2e 63 6f 6c 32 20 46 52 4f   * cor0.col2 FRO
311c0 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab1 cor0..---
311d0 2d 0d 0a 31 32 32 38 0d 0a 34 30 35 38 0d 0a 38  -..1228..4058..8
311e0 32 31 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  213....query I r
311f0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
31200 49 53 54 49 4e 43 54 20 2d 20 2b 20 63 6f 6c 31  ISTINCT - + col1
31210 20 2a 20 2d 20 63 6f 6c 31 20 41 53 20 63 6f 6c   * - col1 AS col
31220 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  0 FROM tab0 AS c
31230 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 37 33 39 36 0d  or0..----..7396.
31240 0a 38 32 38 31 0d 0a 39 34 30 39 0d 0a 0d 0a 71  .8281..9409....q
31250 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
31260 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c  SELECT ALL - col
31270 30 20 2a 20 63 6f 6c 31 20 2d 20 63 6f 72 30 2e  0 * col1 - cor0.
31280 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46 52 4f  col2 AS col1 FRO
31290 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
312a0 2d 2d 2d 2d 0d 0a 2d 32 30 39 37 0d 0a 2d 33 33  ----..-2097..-33
312b0 39 36 0d 0a 2d 38 31 38 31 0d 0a 0d 0a 71 75 65  96..-8181....que
312c0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
312d0 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20  LECT DISTINCT + 
312e0 2b 20 63 6f 6c 30 20 2b 20 2b 20 34 38 20 2a 20  + col0 + + 48 * 
312f0 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46 52 4f  col0 AS col0 FRO
31300 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
31310 2d 2d 2d 2d 0d 0a 31 34 37 0d 0a 33 31 33 36 0d  ----..147..3136.
31320 0a 33 39 32 30 0d 0a 0d 0a 73 6b 69 70 69 66 20  .3920....skipif 
31330 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73  postgresql # Pos
31340 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73  tgreSQL requires
31350 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e   AS when renamin
31360 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73  g output columns
31370 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
31380 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20  t..SELECT ALL + 
31390 63 6f 6c 30 20 2b 20 2d 20 28 20 63 6f 6c 32 20  col0 + - ( col2 
313a0 2a 20 2b 20 28 20 32 36 20 29 20 29 20 63 6f 6c  * + ( 26 ) ) col
313b0 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  0 FROM tab1 AS c
313c0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 34 30 31  or0..----..-1401
313d0 0d 0a 2d 31 34 31 38 0d 0a 2d 32 34 31 36 0d 0a  ..-1418..-2416..
313e0 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
313f0 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
31400 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
31410 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 43  ..SELECT ALL - C
31420 41 53 54 20 28 20 2b 20 38 38 20 41 53 20 52 45  AST ( + 88 AS RE
31430 41 4c 20 29 20 2a 20 2b 20 63 6f 72 30 2e 63 6f  AL ) * + cor0.co
31440 6c 30 20 2b 20 43 41 53 54 20 28 20 2d 20 63 6f  l0 + CAST ( - co
31450 6c 32 20 2a 20 63 6f 6c 30 20 41 53 20 52 45 41  l2 * col0 AS REA
31460 4c 20 29 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  L ) AS col2 FROM
31470 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
31480 2d 2d 2d 0d 0a 2d 31 35 31 33 30 0d 0a 2d 32 39  ---..-15130..-29
31490 30 34 0d 0a 2d 33 31 31 35 0d 0a 0d 0a 71 75 65  04..-3115....que
314a0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
314b0 4c 45 43 54 20 41 4c 4c 20 2b 20 28 20 63 6f 6c  LECT ALL + ( col
314c0 31 20 29 20 2a 20 2d 20 74 61 62 32 2e 63 6f 6c  1 ) * - tab2.col
314d0 31 20 2b 20 63 6f 6c 32 20 2b 20 63 6f 6c 30 20  1 + col2 + col0 
314e0 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
314f0 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 37 32 0d 0a 2d  2..----..-172..-
31500 33 33 37 37 0d 0a 2d 39 32 37 0d 0a 0d 0a 71 75  3377..-927....qu
31510 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
31520 45 4c 45 43 54 20 41 4c 4c 20 2b 20 2b 20 63 6f  ELECT ALL + + co
31530 6c 32 20 2b 20 2b 20 63 6f 6c 30 20 2a 20 28 20  l2 + + col0 * ( 
31540 2b 20 34 31 20 29 20 41 53 20 63 6f 6c 30 20 46  + 41 ) AS col0 F
31550 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
31560 0d 0a 2d 2d 2d 2d 0d 0a 31 30 31 37 0d 0a 31 34  ..----..1017..14
31570 33 36 0d 0a 33 37 33 31 0d 0a 0d 0a 71 75 65 72  36..3731....quer
31580 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
31590 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 39  ECT DISTINCT + 9
315a0 30 20 2a 20 2d 20 74 61 62 31 2e 63 6f 6c 31 20  0 * - tab1.col1 
315b0 2a 20 2d 20 63 6f 6c 30 20 2b 20 63 6f 6c 32 20  * - col0 + col2 
315c0 2a 20 63 6f 6c 32 20 2b 20 33 35 20 2a 20 2b 20  * col2 + 35 * + 
315d0 31 31 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  11 AS col1 FROM 
315e0 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 30 33 32  tab1..----..1032
315f0 30 31 0d 0a 31 30 33 32 31 0d 0a 36 31 32 33 34  01..10321..61234
31600 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
31610 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 30  ort..SELECT col0
31620 20 2a 20 2d 20 63 6f 6c 32 20 2b 20 63 6f 6c 31   * - col2 + col1
31630 20 2b 20 74 61 62 31 2e 63 6f 6c 31 20 41 53 20   + tab1.col1 AS 
31640 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 0d 0a  col1 FROM tab1..
31650 2d 2d 2d 2d 0d 0a 2d 31 31 30 0d 0a 2d 33 36 32  ----..-110..-362
31660 38 0d 0a 2d 37 36 35 34 0d 0a 0d 0a 71 75 65 72  8..-7654....quer
31670 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
31680 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 33  ECT DISTINCT - 3
31690 35 20 2b 20 2d 20 63 6f 6c 30 20 2a 20 63 6f 6c  5 + - col0 * col
316a0 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  1 FROM tab2 AS c
316b0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 37 38  or0..----..-1378
316c0 0d 0a 2d 32 35 32 0d 0a 2d 34 36 33 37 0d 0a 0d  ..-252..-4637...
316d0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
316e0 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 32 20  ..SELECT - col2 
316f0 2a 20 63 6f 6c 31 20 2b 20 63 6f 6c 32 20 2a 20  * col1 + col2 * 
31700 34 33 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  43 FROM tab1 AS 
31710 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 38 38 31  cor0..----..1881
31720 0d 0a 32 38 38 30 0d 0a 39 31 38 0d 0a 0d 0a 71  ..2880..918....q
31730 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
31740 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 37 38 20  SELECT ALL - 78 
31750 2a 20 63 6f 72 30 2e 63 6f 6c 31 20 41 53 20 63  * cor0.col1 AS c
31760 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol2 FROM tab0 AS
31770 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 36 37   cor0..----..-67
31780 30 38 0d 0a 2d 37 30 39 38 0d 0a 2d 37 35 36 36  08..-7098..-7566
31790 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
317a0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 32  ort..SELECT col2
317b0 20 2a 20 2d 20 63 6f 6c 30 20 2a 20 2d 20 63 6f   * - col0 * - co
317c0 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l2 FROM tab0 AS 
317d0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 36 31 33  cor0..----..2613
317e0 36 0d 0a 33 35 0d 0a 35 39 38 34 33 36 0d 0a 0d  6..35..598436...
317f0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
31800 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
31810 54 20 2b 20 2b 20 37 32 20 2b 20 2b 20 63 6f 6c  T + + 72 + + col
31820 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  1 FROM tab1 AS c
31830 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 38 32 0d 0a 38  or0..----..82..8
31840 35 0d 0a 39 38 0d 0a 0d 0a 71 75 65 72 79 20 49  5..98....query I
31850 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
31860 20 2b 20 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c 30   + col2 * + col0
31870 20 2a 20 2b 20 32 30 20 41 53 20 63 6f 6c 32 20   * + 20 AS col2 
31880 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
31890 30 0d 0a 2d 2d 2d 2d 0d 0a 31 35 33 36 30 30 0d  0..----..153600.
318a0 0a 33 32 34 30 0d 0a 37 32 39 36 30 0d 0a 0d 0a  .3240..72960....
318b0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
318c0 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
318d0 20 63 6f 6c 30 20 2d 20 2d 20 63 6f 6c 30 20 41   col0 - - col0 A
318e0 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31  S col0 FROM tab1
318f0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
31900 31 32 38 0d 0a 31 36 30 0d 0a 36 0d 0a 0d 0a 71  128..160..6....q
31910 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
31920 53 45 4c 45 43 54 20 41 4c 4c 20 36 39 20 2a 20  SELECT ALL 69 * 
31930 2b 20 63 6f 6c 31 20 2a 20 63 6f 72 30 2e 63 6f  + col1 * cor0.co
31940 6c 30 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  l0 AS col0 FROM 
31950 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab1 cor0..----.
31960 0a 34 34 31 36 30 0d 0a 35 33 38 32 0d 0a 37 31  .44160..5382..71
31970 37 36 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  760....query I r
31980 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
31990 49 53 54 49 4e 43 54 20 2d 20 2b 20 31 33 20 2b  ISTINCT - + 13 +
319a0 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20   col2 FROM tab2 
319b0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
319c0 33 0d 0a 31 34 0d 0a 32 35 0d 0a 0d 0a 71 75 65  3..14..25....que
319d0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
319e0 4c 45 43 54 20 2d 20 2b 20 63 6f 6c 30 20 2d 20  LECT - + col0 - 
319f0 2d 20 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c 32 20  - col2 * - col2 
31a00 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
31a10 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 31 33 0d 0a  0..----..-1113..
31a20 2d 33 36 0d 0a 2d 36 38 31 33 0d 0a 0d 0a 6f 6e  -36..-6813....on
31a30 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
31a40 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
31a50 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
31a60 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
31a70 6f 72 74 20 6c 61 62 65 6c 2d 31 34 31 38 0d 0a  ort label-1418..
31a80 53 45 4c 45 43 54 20 2d 20 2b 20 63 6f 6c 30 20  SELECT - + col0 
31a90 44 49 56 20 2d 20 63 6f 6c 31 20 2b 20 2b 20 63  DIV - col1 + + c
31aa0 6f 6c 32 20 2a 20 39 34 20 41 53 20 63 6f 6c 32  ol2 * 94 AS col2
31ab0 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
31ac0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 35 30 37 36 0d 0a  r0..----..5076..
31ad0 35 33 36 34 0d 0a 39 30 33 30 0d 0a 0d 0a 73 6b  5364..9030....sk
31ae0 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
31af0 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
31b00 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
31b10 65 6c 2d 31 34 31 38 0d 0a 53 45 4c 45 43 54 20  el-1418..SELECT 
31b20 2d 20 2b 20 63 6f 6c 30 20 2f 20 2d 20 63 6f 6c  - + col0 / - col
31b30 31 20 2b 20 2b 20 63 6f 6c 32 20 2a 20 39 34 20  1 + + col2 * 94 
31b40 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
31b50 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
31b60 0a 35 30 37 36 0d 0a 35 33 36 34 0d 0a 39 30 33  .5076..5364..903
31b70 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  0....onlyif mysq
31b80 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72  l # use DIV oper
31b90 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72  ator for integer
31ba0 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79   division..query
31bb0 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
31bc0 2d 31 34 31 39 0d 0a 53 45 4c 45 43 54 20 2b 20  -1419..SELECT + 
31bd0 2d 20 32 35 20 2d 20 63 6f 6c 30 20 2a 20 63 6f  - 25 - col0 * co
31be0 6c 32 20 44 49 56 20 63 6f 6c 30 20 46 52 4f 4d  l2 DIV col0 FROM
31bf0 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
31c00 2d 2d 2d 0d 0a 2d 31 30 37 0d 0a 2d 32 36 0d 0a  ---..-107..-26..
31c10 2d 35 38 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  -58....skipif my
31c20 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
31c30 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
31c40 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 34 31 39  wsort label-1419
31c50 0d 0a 53 45 4c 45 43 54 20 2b 20 2d 20 32 35 20  ..SELECT + - 25 
31c60 2d 20 63 6f 6c 30 20 2a 20 63 6f 6c 32 20 2f 20  - col0 * col2 / 
31c70 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41  col0 FROM tab0 A
31c80 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
31c90 30 37 0d 0a 2d 32 36 0d 0a 2d 35 38 0d 0a 0d 0a  07..-26..-58....
31ca0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
31cb0 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
31cc0 20 2d 20 37 34 20 2d 20 2b 20 63 6f 6c 31 20 41   - 74 - + col1 A
31cd0 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31  S col0 FROM tab1
31ce0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
31cf0 2d 31 30 30 0d 0a 2d 38 34 0d 0a 2d 38 37 0d 0a  -100..-84..-87..
31d00 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
31d10 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
31d20 43 54 20 2b 20 63 6f 6c 31 20 2a 20 36 36 20 41  CT + col1 * 66 A
31d30 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31  S col1 FROM tab1
31d40 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
31d50 31 37 31 36 0d 0a 36 36 30 0d 0a 38 35 38 0d 0a  1716..660..858..
31d60 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
31d70 74 0d 0a 53 45 4c 45 43 54 20 38 38 20 41 53 20  t..SELECT 88 AS 
31d80 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 2c 20  col1 FROM tab2, 
31d90 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
31da0 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73  --..9 values has
31db0 68 69 6e 67 20 74 6f 20 36 62 65 31 37 62 38 32  hing to 6be17b82
31dc0 65 63 62 33 65 38 62 32 36 38 66 63 62 34 62 61  ecb3e8b268fcb4ba
31dd0 36 31 30 64 64 62 33 37 0d 0a 0d 0a 6f 6e 6c 79  610ddb37....only
31de0 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44  if mysql # use D
31df0 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20  IV operator for 
31e00 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e  integer division
31e10 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
31e20 74 20 6c 61 62 65 6c 2d 31 34 32 33 0d 0a 53 45  t label-1423..SE
31e30 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20  LECT DISTINCT - 
31e40 38 32 20 44 49 56 20 36 20 41 53 20 63 6f 6c 31  82 DIV 6 AS col1
31e50 20 46 52 4f 4d 20 74 61 62 31 2c 20 74 61 62 31   FROM tab1, tab1
31e60 20 41 53 20 63 6f 72 30 2c 20 74 61 62 32 20 41   AS cor0, tab2 A
31e70 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor1..----..-1
31e80 33 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  3....skipif mysq
31e90 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
31ea0 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
31eb0 6f 72 74 20 6c 61 62 65 6c 2d 31 34 32 33 0d 0a  ort label-1423..
31ec0 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
31ed0 2d 20 38 32 20 2f 20 36 20 41 53 20 63 6f 6c 31  - 82 / 6 AS col1
31ee0 20 46 52 4f 4d 20 74 61 62 31 2c 20 74 61 62 31   FROM tab1, tab1
31ef0 20 41 53 20 63 6f 72 30 2c 20 74 61 62 32 20 41   AS cor0, tab2 A
31f00 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor1..----..-1
31f10 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  3....query I row
31f20 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 38  sort..SELECT - 8
31f30 34 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  4 AS col0 FROM t
31f40 61 62 30 2c 20 74 61 62 31 20 63 6f 72 30 2c 20  ab0, tab1 cor0, 
31f50 74 61 62 31 20 41 53 20 63 6f 72 31 2c 20 74 61  tab1 AS cor1, ta
31f60 62 31 2c 20 74 61 62 32 20 41 53 20 63 6f 72 32  b1, tab2 AS cor2
31f70 0d 0a 2d 2d 2d 2d 0d 0a 32 34 33 20 76 61 6c 75  ..----..243 valu
31f80 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 36 37  es hashing to 67
31f90 39 33 66 62 37 34 61 65 31 37 32 35 37 32 66 66  93fb74ae172572ff
31fa0 65 61 37 34 37 62 30 36 37 33 62 30 37 61 0d 0a  ea747b0673b07a..
31fb0 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
31fc0 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53   support for MyS
31fd0 51 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74  QL specific syst
31fe0 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e  em types and syn
31ff0 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  tax..query I row
32000 73 6f 72 74 20 6c 61 62 65 6c 2d 31 34 32 35 0d  sort label-1425.
32010 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
32020 20 2d 20 74 61 62 32 2e 63 6f 6c 30 20 2a 20 2b   - tab2.col0 * +
32030 20 43 41 53 54 28 20 4e 55 4c 4c 20 41 53 20 53   CAST( NULL AS S
32040 49 47 4e 45 44 20 29 20 2a 20 32 35 20 46 52 4f  IGNED ) * 25 FRO
32050 4d 20 74 61 62 32 2c 20 74 61 62 32 20 41 53 20  M tab2, tab2 AS 
32060 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c  cor0..----..NULL
32070 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
32080 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
32090 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
320a0 72 74 20 6c 61 62 65 6c 2d 31 34 32 35 0d 0a 53  rt label-1425..S
320b0 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d  ELECT DISTINCT -
320c0 20 74 61 62 32 2e 63 6f 6c 30 20 2a 20 2b 20 43   tab2.col0 * + C
320d0 41 53 54 20 28 20 4e 55 4c 4c 20 41 53 20 49 4e  AST ( NULL AS IN
320e0 54 45 47 45 52 20 29 20 2a 20 32 35 20 46 52 4f  TEGER ) * 25 FRO
320f0 4d 20 74 61 62 32 2c 20 74 61 62 32 20 41 53 20  M tab2, tab2 AS 
32100 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c  cor0..----..NULL
32110 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
32120 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
32130 2d 20 2b 20 28 20 2d 20 34 31 20 29 20 46 52 4f  - + ( - 41 ) FRO
32140 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
32150 2d 2d 2d 2d 0d 0a 34 31 0d 0a 34 31 0d 0a 34 31  ----..41..41..41
32160 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
32170 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
32180 49 4e 43 54 20 2b 20 2d 20 28 20 2b 20 63 6f 6c  INCT + - ( + col
32190 30 20 29 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20  0 ) + cor0.col0 
321a0 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
321b0 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
321c0 0a 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  .0....query I ro
321d0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
321e0 2d 20 33 30 20 2a 20 2b 20 28 20 63 6f 6c 32 20  - 30 * + ( col2 
321f0 29 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  ) FROM tab1 AS c
32200 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 36 32 30  or0..----..-1620
32210 0d 0a 2d 31 37 31 30 0d 0a 2d 32 38 38 30 0d 0a  ..-1710..-2880..
32220 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
32230 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20  t..SELECT ALL - 
32240 39 37 20 46 52 4f 4d 20 74 61 62 31 2c 20 74 61  97 FROM tab1, ta
32250 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
32260 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68 69  ..9 values hashi
32270 6e 67 20 74 6f 20 65 34 61 36 62 64 38 34 38 61  ng to e4a6bd848a
32280 36 39 32 32 36 63 62 62 37 61 64 33 64 31 35 34  69226cbb7ad3d154
32290 62 65 33 32 31 62 0d 0a 0d 0a 73 6b 69 70 69 66  be321b....skipif
322a0 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f   postgresql # Po
322b0 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65  stgreSQL require
322c0 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69  s AS when renami
322d0 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e  ng output column
322e0 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  s..query I rowso
322f0 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
32300 4e 43 54 20 2d 20 63 6f 72 30 2e 63 6f 6c 30 20  NCT - cor0.col0 
32310 2b 20 63 6f 6c 31 20 63 6f 6c 30 20 46 52 4f 4d  + col1 col0 FROM
32320 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
32330 2d 2d 2d 0d 0a 2d 35 34 0d 0a 2d 36 37 0d 0a 32  ---..-54..-67..2
32340 33 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  3....onlyif mysq
32350 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72  l # use DIV oper
32360 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72  ator for integer
32370 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79   division..query
32380 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
32390 2d 31 34 33 31 0d 0a 53 45 4c 45 43 54 20 44 49  -1431..SELECT DI
323a0 53 54 49 4e 43 54 20 2b 20 2b 20 63 6f 6c 30 20  STINCT + + col0 
323b0 44 49 56 20 28 20 2b 20 63 6f 6c 31 20 29 20 41  DIV ( + col1 ) A
323c0 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31  S col0 FROM tab1
323d0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
323e0 30 0d 0a 36 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  0..6....skipif m
323f0 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
32400 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
32410 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 34 33  owsort label-143
32420 31 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  1..SELECT DISTIN
32430 43 54 20 2b 20 2b 20 63 6f 6c 30 20 2f 20 28 20  CT + + col0 / ( 
32440 2b 20 63 6f 6c 31 20 29 20 41 53 20 63 6f 6c 30  + col1 ) AS col0
32450 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
32460 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 36 0d 0a  r0..----..0..6..
32470 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
32480 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53   support for MyS
32490 51 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74  QL specific syst
324a0 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e  em types and syn
324b0 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  tax..query I row
324c0 73 6f 72 74 20 6c 61 62 65 6c 2d 31 34 33 32 0d  sort label-1432.
324d0 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 2d 20  .SELECT ALL + - 
324e0 43 41 53 54 28 20 4e 55 4c 4c 20 41 53 20 53 49  CAST( NULL AS SI
324f0 47 4e 45 44 20 29 20 2a 20 37 31 20 46 52 4f 4d  GNED ) * 71 FROM
32500 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
32510 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d  ---..NULL..NULL.
32520 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20  .NULL....skipif 
32530 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
32540 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
32550 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 34  rowsort label-14
32560 33 32 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b  32..SELECT ALL +
32570 20 2d 20 43 41 53 54 20 28 20 4e 55 4c 4c 20 41   - CAST ( NULL A
32580 53 20 49 4e 54 45 47 45 52 20 29 20 2a 20 37 31  S INTEGER ) * 71
32590 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
325a0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a  r0..----..NULL..
325b0 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75  NULL..NULL....qu
325c0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
325d0 45 4c 45 43 54 20 34 35 20 2a 20 2d 20 28 20 2b  ELECT 45 * - ( +
325e0 20 63 6f 6c 32 20 29 20 46 52 4f 4d 20 74 61 62   col2 ) FROM tab
325f0 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
32600 0a 2d 31 34 38 35 0d 0a 2d 33 36 39 30 0d 0a 2d  .-1485..-3690..-
32610 34 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  45....query I ro
32620 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
32630 53 54 49 4e 43 54 20 2d 20 2b 20 63 6f 6c 32 20  STINCT - + col2 
32640 2a 20 63 6f 6c 31 20 2b 20 2b 20 63 6f 72 30 2e  * col1 + + cor0.
32650 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c 31 20 46 52  col2 * - col1 FR
32660 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
32670 0a 2d 2d 2d 2d 0d 0a 2d 31 31 34 30 0d 0a 2d 32  .----..-1140..-2
32680 34 39 36 0d 0a 2d 32 38 30 38 0d 0a 0d 0a 71 75  496..-2808....qu
32690 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
326a0 45 4c 45 43 54 20 41 4c 4c 20 2b 20 2d 20 28 20  ELECT ALL + - ( 
326b0 2b 20 63 6f 6c 30 20 29 20 2a 20 2d 20 63 6f 6c  + col0 ) * - col
326c0 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  2 AS col2 FROM t
326d0 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
326e0 2d 0d 0a 31 36 32 0d 0a 33 36 34 38 0d 0a 37 36  -..162..3648..76
326f0 38 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  80....query I ro
32700 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
32710 4c 20 2d 20 39 39 20 41 53 20 63 6f 6c 31 20 46  L - 99 AS col1 F
32720 52 4f 4d 20 74 61 62 30 2c 20 74 61 62 30 20 41  ROM tab0, tab0 A
32730 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20  S cor0..----..9 
32740 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74  values hashing t
32750 6f 20 36 34 64 30 36 35 31 33 38 35 30 61 32 36  o 64d06513850a26
32760 34 39 35 62 63 36 63 32 66 64 64 65 62 32 35 34  495bc6c2fddeb254
32770 62 37 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73  b7....skipif pos
32780 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72  tgresql # Postgr
32790 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53  eSQL requires AS
327a0 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f   when renaming o
327b0 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71  utput columns..q
327c0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
327d0 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
327e0 2d 20 74 61 62 32 2e 63 6f 6c 32 20 2b 20 2d 20  - tab2.col2 + - 
327f0 36 33 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  63 col0 FROM tab
32800 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 31 0d 0a 2d  2..----..-101..-
32810 38 39 0d 0a 2d 39 30 0d 0a 0d 0a 6f 6e 6c 79 69  89..-90....onlyi
32820 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72  f mysql # suppor
32830 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63  t for MySQL spec
32840 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65  ific system type
32850 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75  s and syntax..qu
32860 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
32870 62 65 6c 2d 31 34 33 38 0d 0a 53 45 4c 45 43 54  bel-1438..SELECT
32880 20 44 49 53 54 49 4e 43 54 20 43 41 53 54 28 20   DISTINCT CAST( 
32890 4e 55 4c 4c 20 41 53 20 53 49 47 4e 45 44 20 29  NULL AS SIGNED )
328a0 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
328b0 62 31 20 41 53 20 63 6f 72 30 20 43 52 4f 53 53  b1 AS cor0 CROSS
328c0 20 4a 4f 49 4e 20 74 61 62 31 2c 20 74 61 62 31   JOIN tab1, tab1
328d0 20 41 53 20 63 6f 72 31 2c 20 74 61 62 30 20 41   AS cor1, tab0 A
328e0 53 20 63 6f 72 32 0d 0a 2d 2d 2d 2d 0d 0a 4e 55  S cor2..----..NU
328f0 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  LL....skipif mys
32900 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
32910 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
32920 73 6f 72 74 20 6c 61 62 65 6c 2d 31 34 33 38 0d  sort label-1438.
32930 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
32940 20 43 41 53 54 20 28 20 4e 55 4c 4c 20 41 53 20   CAST ( NULL AS 
32950 49 4e 54 45 47 45 52 20 29 20 41 53 20 63 6f 6c  INTEGER ) AS col
32960 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  0 FROM tab1 AS c
32970 6f 72 30 20 43 52 4f 53 53 20 4a 4f 49 4e 20 74  or0 CROSS JOIN t
32980 61 62 31 2c 20 74 61 62 31 20 41 53 20 63 6f 72  ab1, tab1 AS cor
32990 31 2c 20 74 61 62 30 20 41 53 20 63 6f 72 32 0d  1, tab0 AS cor2.
329a0 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71  .----..NULL....q
329b0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
329c0 53 45 4c 45 43 54 20 28 20 31 38 20 29 20 2a 20  SELECT ( 18 ) * 
329d0 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41  col1 FROM tab1 A
329e0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 38  S cor0..----..18
329f0 30 0d 0a 32 33 34 0d 0a 34 36 38 0d 0a 0d 0a 71  0..234..468....q
32a00 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
32a10 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
32a20 2b 20 28 20 63 6f 6c 30 20 29 20 2a 20 63 6f 6c  + ( col0 ) * col
32a30 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  2 FROM tab1 AS c
32a40 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 36 32 0d 0a  or0..----..162..
32a50 33 36 34 38 0d 0a 37 36 38 30 0d 0a 0d 0a 6f 6e  3648..7680....on
32a60 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70  lyif mysql # sup
32a70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73  port for MySQL s
32a80 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20 74  pecific system t
32a90 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d  ypes and syntax.
32aa0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
32ab0 20 6c 61 62 65 6c 2d 31 34 34 31 0d 0a 53 45 4c   label-1441..SEL
32ac0 45 43 54 20 2b 20 43 41 53 54 28 20 4e 55 4c 4c  ECT + CAST( NULL
32ad0 20 41 53 20 53 49 47 4e 45 44 20 29 20 2f 20 36   AS SIGNED ) / 6
32ae0 33 20 46 52 4f 4d 20 74 61 62 32 2c 20 74 61 62  3 FROM tab2, tab
32af0 32 20 41 53 20 63 6f 72 30 2c 20 74 61 62 32 20  2 AS cor0, tab2 
32b00 63 6f 72 31 2c 20 74 61 62 30 20 41 53 20 63 6f  cor1, tab0 AS co
32b10 72 32 0d 0a 2d 2d 2d 2d 0d 0a 38 31 20 76 61 6c  r2..----..81 val
32b20 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 63  ues hashing to c
32b30 62 33 33 63 33 30 64 36 66 35 32 62 62 62 32 34  b33c30d6f52bbb24
32b40 33 33 38 61 32 39 33 63 37 34 30 66 32 39 63 0d  338a293c740f29c.
32b50 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
32b60 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
32b70 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
32b80 74 20 6c 61 62 65 6c 2d 31 34 34 31 0d 0a 53 45  t label-1441..SE
32b90 4c 45 43 54 20 2b 20 43 41 53 54 20 28 20 4e 55  LECT + CAST ( NU
32ba0 4c 4c 20 41 53 20 49 4e 54 45 47 45 52 20 29 20  LL AS INTEGER ) 
32bb0 2f 20 36 33 20 46 52 4f 4d 20 74 61 62 32 2c 20  / 63 FROM tab2, 
32bc0 74 61 62 32 20 41 53 20 63 6f 72 30 2c 20 74 61  tab2 AS cor0, ta
32bd0 62 32 20 63 6f 72 31 2c 20 74 61 62 30 20 41 53  b2 cor1, tab0 AS
32be0 20 63 6f 72 32 0d 0a 2d 2d 2d 2d 0d 0a 38 31 20   cor2..----..81 
32bf0 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74  values hashing t
32c00 6f 20 63 62 33 33 63 33 30 64 36 66 35 32 62 62  o cb33c30d6f52bb
32c10 62 32 34 33 33 38 61 32 39 33 63 37 34 30 66 32  b24338a293c740f2
32c20 39 63 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  9c....query I ro
32c30 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
32c40 53 54 49 4e 43 54 20 63 6f 72 30 2e 63 6f 6c 32  STINCT cor0.col2
32c50 20 2a 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 41   * + cor0.col1 A
32c60 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31  S col1 FROM tab1
32c70 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
32c80 31 32 34 38 0d 0a 31 34 30 34 0d 0a 35 37 30 0d  1248..1404..570.
32c90 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72  ...skipif postgr
32ca0 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51  esql # PostgreSQ
32cb0 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68  L requires AS wh
32cc0 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70  en renaming outp
32cd0 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72  ut columns..quer
32ce0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
32cf0 45 43 54 20 2d 20 63 6f 6c 32 20 2a 20 2b 20 63  ECT - col2 * + c
32d00 6f 6c 30 20 2a 20 2b 20 63 6f 6c 31 20 63 6f 6c  ol0 * + col1 col
32d10 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  0 FROM tab1 AS c
32d20 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 36 34 38  or0..----..-3648
32d30 30 0d 0a 2d 34 32 31 32 0d 0a 2d 39 39 38 34 30  0..-4212..-99840
32d40 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
32d50 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f  ort..SELECT + co
32d60 72 30 2e 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  r0.col2 FROM tab
32d70 32 2c 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d  2, tab0 cor0..--
32d80 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73  --..9 values has
32d90 68 69 6e 67 20 74 6f 20 63 38 66 39 66 61 39 65  hing to c8f9fa9e
32da0 66 30 66 38 37 30 32 62 64 33 38 32 65 38 32 31  f0f8702bd382e821
32db0 33 37 38 61 39 36 64 38 0d 0a 0d 0a 71 75 65 72  378a96d8....quer
32dc0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
32dd0 45 43 54 20 2d 20 63 6f 6c 30 20 2b 20 36 38 20  ECT - col0 + 68 
32de0 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d  FROM tab0..----.
32df0 0a 2d 32 31 0d 0a 33 33 0d 0a 34 34 0d 0a 0d 0a  .-21..33..44....
32e00 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71  skipif postgresq
32e10 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72  l # PostgreSQL r
32e20 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20  equires AS when 
32e30 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20  renaming output 
32e40 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49  columns..query I
32e50 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
32e60 20 63 6f 6c 30 20 2d 20 2b 20 63 6f 6c 30 20 63   col0 - + col0 c
32e70 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d  ol0 FROM tab2..-
32e80 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a  ---..0..0..0....
32e90 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
32ea0 0a 53 45 4c 45 43 54 20 2b 20 2d 20 63 6f 72 30  .SELECT + - cor0
32eb0 2e 63 6f 6c 31 20 2a 20 63 6f 72 30 2e 63 6f 6c  .col1 * cor0.col
32ec0 30 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30  0 FROM tab0 cor0
32ed0 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 30 36 34 0d 0a 2d  ..----..-2064..-
32ee0 33 33 39 35 0d 0a 2d 38 30 39 39 0d 0a 0d 0a 71  3395..-8099....q
32ef0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
32f00 53 45 4c 45 43 54 20 31 37 20 41 53 20 63 6f 6c  SELECT 17 AS col
32f10 30 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d  0 FROM tab1..---
32f20 2d 0d 0a 31 37 0d 0a 31 37 0d 0a 31 37 0d 0a 0d  -..17..17..17...
32f30 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
32f40 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
32f50 54 20 28 20 2d 20 63 6f 6c 31 20 29 20 2a 20 63  T ( - col1 ) * c
32f60 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  ol2 AS col1 FROM
32f70 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 35   tab2..----..-15
32f80 33 34 0d 0a 2d 36 34 36 0d 0a 2d 38 33 37 0d 0a  34..-646..-837..
32f90 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
32fa0 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
32fb0 43 54 20 2d 20 35 36 20 2a 20 63 6f 6c 32 20 2b  CT - 56 * col2 +
32fc0 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 46 52 4f   + cor0.col2 FRO
32fd0 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
32fe0 2d 2d 2d 2d 0d 0a 2d 31 34 33 30 0d 0a 2d 31 34  ----..-1430..-14
32ff0 38 35 0d 0a 2d 32 30 39 30 0d 0a 0d 0a 71 75 65  85..-2090....que
33000 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
33010 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 39 37  LECT DISTINCT 97
33020 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
33030 62 30 2c 20 74 61 62 32 20 41 53 20 63 6f 72 30  b0, tab2 AS cor0
33040 2c 20 74 61 62 31 20 41 53 20 63 6f 72 31 0d 0a  , tab1 AS cor1..
33050 2d 2d 2d 2d 0d 0a 39 37 0d 0a 0d 0a 71 75 65 72  ----..97....quer
33060 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
33070 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63  ECT DISTINCT - c
33080 6f 6c 32 20 2a 20 63 6f 6c 32 20 2b 20 2b 20 28  ol2 * col2 + + (
33090 20 33 36 20 2a 20 2d 20 63 6f 6c 32 20 29 20 46   36 * - col2 ) F
330a0 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
330b0 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 32 37 37 0d 0a 2d  ..----..-2277..-
330c0 33 37 0d 0a 2d 39 36 37 36 0d 0a 0d 0a 6f 6e 6c  37..-9676....onl
330d0 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20  yif mysql # use 
330e0 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72  DIV operator for
330f0 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f   integer divisio
33100 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  n..query I rowso
33110 72 74 20 6c 61 62 65 6c 2d 31 34 35 33 0d 0a 53  rt label-1453..S
33120 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d  ELECT DISTINCT -
33130 20 74 61 62 31 2e 63 6f 6c 31 20 44 49 56 20 63   tab1.col1 DIV c
33140 6f 6c 32 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61  ol2 col0 FROM ta
33150 62 31 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 0d 0a 73  b1..----..0....s
33160 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c  kipif postgresql
33170 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65   # PostgreSQL re
33180 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72  quires AS when r
33190 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63  enaming output c
331a0 6f 6c 75 6d 6e 73 0d 0a 73 6b 69 70 69 66 20 6d  olumns..skipif m
331b0 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
331c0 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
331d0 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 34 35  owsort label-145
331e0 33 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  3..SELECT DISTIN
331f0 43 54 20 2d 20 74 61 62 31 2e 63 6f 6c 31 20 2f  CT - tab1.col1 /
33200 20 63 6f 6c 32 20 63 6f 6c 30 20 46 52 4f 4d 20   col2 col0 FROM 
33210 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 0d  tab1..----..0...
33220 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
33230 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
33240 54 20 63 6f 6c 31 20 2a 20 2b 20 28 20 2d 20 37  T col1 * + ( - 7
33250 34 20 29 20 2b 20 63 6f 6c 32 20 46 52 4f 4d 20  4 ) + col2 FROM 
33260 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 38 37  tab1..----..-187
33270 30 0d 0a 2d 36 38 33 0d 0a 2d 38 36 36 0d 0a 0d  0..-683..-866...
33280 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
33290 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 31 20 2a 20  ..SELECT col1 * 
332a0 28 20 2b 20 35 35 20 29 20 41 53 20 63 6f 6c 31  ( + 55 ) AS col1
332b0 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d   FROM tab0..----
332c0 0d 0a 34 37 33 30 0d 0a 35 30 30 35 0d 0a 35 33  ..4730..5005..53
332d0 33 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  35....query I ro
332e0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
332f0 63 6f 6c 31 20 2b 20 34 33 20 41 53 20 63 6f 6c  col1 + 43 AS col
33300 31 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d  1 FROM tab2..---
33310 2d 0d 0a 31 30 32 0d 0a 36 30 0d 0a 37 34 0d 0a  -..102..60..74..
33320 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
33330 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53   support for MyS
33340 51 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74  QL specific syst
33350 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e  em types and syn
33360 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  tax..query I row
33370 73 6f 72 74 20 6c 61 62 65 6c 2d 31 34 35 37 0d  sort label-1457.
33380 0a 53 45 4c 45 43 54 20 2d 20 43 41 53 54 28 20  .SELECT - CAST( 
33390 63 6f 6c 32 20 41 53 20 53 49 47 4e 45 44 20 29  col2 AS SIGNED )
333a0 20 2b 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62   + col2 FROM tab
333b0 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d  2 cor0..----..0.
333c0 0a 30 0d 0a 30 0d 0a 0d 0a 73 6b 69 70 69 66 20  .0..0....skipif 
333d0 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
333e0 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
333f0 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 34  rowsort label-14
33400 35 37 0d 0a 53 45 4c 45 43 54 20 2d 20 43 41 53  57..SELECT - CAS
33410 54 20 28 20 63 6f 6c 32 20 41 53 20 49 4e 54 45  T ( col2 AS INTE
33420 47 45 52 20 29 20 2b 20 63 6f 6c 32 20 46 52 4f  GER ) + col2 FRO
33430 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab2 cor0..---
33440 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a 6f 6e  -..0..0..0....on
33450 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
33460 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
33470 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
33480 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
33490 6f 72 74 20 6c 61 62 65 6c 2d 31 34 35 38 0d 0a  ort label-1458..
334a0 53 45 4c 45 43 54 20 63 6f 6c 31 20 44 49 56 20  SELECT col1 DIV 
334b0 63 6f 6c 32 20 2b 20 63 6f 6c 31 20 44 49 56 20  col2 + col1 DIV 
334c0 2b 20 74 61 62 30 2e 63 6f 6c 32 20 46 52 4f 4d  + tab0.col2 FROM
334d0 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 39 34   tab0..----..194
334e0 0d 0a 32 0d 0a 34 0d 0a 0d 0a 73 6b 69 70 69 66  ..2..4....skipif
334f0 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
33500 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
33510 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
33520 34 35 38 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 31  458..SELECT col1
33530 20 2f 20 63 6f 6c 32 20 2b 20 63 6f 6c 31 20 2f   / col2 + col1 /
33540 20 2b 20 74 61 62 30 2e 63 6f 6c 32 20 46 52 4f   + tab0.col2 FRO
33550 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 39  M tab0..----..19
33560 34 0d 0a 32 0d 0a 34 0d 0a 0d 0a 71 75 65 72 79  4..2..4....query
33570 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
33580 43 54 20 2d 20 28 20 63 6f 72 30 2e 63 6f 6c 30  CT - ( cor0.col0
33590 20 29 20 46 52 4f 4d 20 74 61 62 32 2c 20 74 61   ) FROM tab2, ta
335a0 62 30 20 41 53 20 63 6f 72 30 2c 20 74 61 62 30  b0 AS cor0, tab0
335b0 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a   AS cor1..----..
335c0 32 37 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e  27 values hashin
335d0 67 20 74 6f 20 63 33 65 62 66 31 36 39 35 63 61  g to c3ebf1695ca
335e0 37 34 35 36 37 62 64 63 31 37 33 64 62 65 31 35  74567bdc173dbe15
335f0 31 38 36 61 38 0d 0a 0d 0a 71 75 65 72 79 20 49  186a8....query I
33600 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
33610 20 44 49 53 54 49 4e 43 54 20 2d 20 2d 20 63 6f   DISTINCT - - co
33620 6c 31 20 2a 20 35 35 20 2b 20 2b 20 63 6f 6c 30  l1 * 55 + + col0
33630 20 2a 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74   * + col0 FROM t
33640 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
33650 2d 0d 0a 31 32 39 32 36 0d 0a 35 33 30 36 0d 0a  -..12926..5306..
33660 36 35 36 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20  6560....query I 
33670 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
33680 36 33 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  63 AS col1 FROM 
33690 74 61 62 31 2c 20 74 61 62 32 20 41 53 20 63 6f  tab1, tab2 AS co
336a0 72 30 2c 20 74 61 62 30 20 41 53 20 63 6f 72 31  r0, tab0 AS cor1
336b0 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75 65  ..----..27 value
336c0 73 20 68 61 73 68 69 6e 67 20 74 6f 20 33 38 37  s hashing to 387
336d0 36 34 61 36 65 36 39 36 64 31 61 36 62 35 30 39  64a6e696d1a6b509
336e0 35 65 32 39 65 66 38 34 39 35 39 63 30 0d 0a 0d  5e29ef84959c0...
336f0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
33700 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 30 20 2a 20  ..SELECT col0 * 
33710 2b 20 35 36 20 46 52 4f 4d 20 74 61 62 30 0d 0a  + 56 FROM tab0..
33720 2d 2d 2d 2d 0d 0a 31 33 34 34 0d 0a 31 39 36 30  ----..1344..1960
33730 0d 0a 34 39 38 34 0d 0a 0d 0a 71 75 65 72 79 20  ..4984....query 
33740 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
33750 54 20 41 4c 4c 20 2d 20 2d 20 63 6f 72 30 2e 63  T ALL - - cor0.c
33760 6f 6c 30 20 2b 20 2b 20 63 6f 72 30 2e 63 6f 6c  ol0 + + cor0.col
33770 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  2 AS col2 FROM t
33780 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
33790 2d 0d 0a 31 30 34 0d 0a 31 31 37 0d 0a 33 34 0d  -..104..117..34.
337a0 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
337b0 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74  # use DIV operat
337c0 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64  or for integer d
337d0 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49  ivision..query I
337e0 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
337f0 34 36 34 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  464..SELECT DIST
33800 49 4e 43 54 20 38 38 20 2a 20 63 6f 6c 31 20 2d  INCT 88 * col1 -
33810 20 2d 20 63 6f 6c 30 20 44 49 56 20 2b 20 33 37   - col0 DIV + 37
33820 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
33830 72 30 0d 0a 2d 2d 2d 2d 0d 0a 37 35 36 38 0d 0a  r0..----..7568..
33840 38 30 31 30 0d 0a 38 35 33 36 0d 0a 0d 0a 73 6b  8010..8536....sk
33850 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
33860 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
33870 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
33880 65 6c 2d 31 34 36 34 0d 0a 53 45 4c 45 43 54 20  el-1464..SELECT 
33890 44 49 53 54 49 4e 43 54 20 38 38 20 2a 20 63 6f  DISTINCT 88 * co
338a0 6c 31 20 2d 20 2d 20 63 6f 6c 30 20 2f 20 2b 20  l1 - - col0 / + 
338b0 33 37 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  37 FROM tab0 AS 
338c0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 37 35 36 38  cor0..----..7568
338d0 0d 0a 38 30 31 30 0d 0a 38 35 33 36 0d 0a 0d 0a  ..8010..8536....
338e0 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75  onlyif mysql # u
338f0 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20  se DIV operator 
33900 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69  for integer divi
33910 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f  sion..query I ro
33920 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 34 36 35  wsort label-1465
33930 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
33940 54 20 2d 20 2d 20 35 32 20 2a 20 63 6f 6c 31 20  T - - 52 * col1 
33950 44 49 56 20 63 6f 6c 31 20 41 53 20 63 6f 6c 32  DIV col1 AS col2
33960 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
33970 72 30 0d 0a 2d 2d 2d 2d 0d 0a 35 32 0d 0a 0d 0a  r0..----..52....
33980 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
33990 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
339a0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
339b0 61 62 65 6c 2d 31 34 36 35 0d 0a 53 45 4c 45 43  abel-1465..SELEC
339c0 54 20 44 49 53 54 49 4e 43 54 20 2d 20 2d 20 35  T DISTINCT - - 5
339d0 32 20 2a 20 63 6f 6c 31 20 2f 20 63 6f 6c 31 20  2 * col1 / col1 
339e0 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
339f0 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
33a00 0a 35 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .52....query I r
33a10 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
33a20 20 63 6f 6c 31 20 2a 20 2b 20 32 32 20 41 53 20   col1 * + 22 AS 
33a30 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41  col1 FROM tab2 A
33a40 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
33a50 32 39 38 0d 0a 2d 33 37 34 0d 0a 2d 36 38 32 0d  298..-374..-682.
33a60 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
33a70 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79  # support for My
33a80 53 51 4c 20 73 70 65 63 69 66 69 63 20 73 79 73  SQL specific sys
33a90 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79  tem types and sy
33aa0 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f  ntax..query I ro
33ab0 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 34 36 37  wsort label-1467
33ac0 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63  ..SELECT ALL + c
33ad0 6f 6c 30 20 2a 20 28 20 2d 20 63 6f 6c 32 20 29  ol0 * ( - col2 )
33ae0 20 2b 20 43 41 53 54 28 20 33 32 20 41 53 20 53   + CAST( 32 AS S
33af0 49 47 4e 45 44 20 29 20 46 52 4f 4d 20 74 61 62  IGNED ) FROM tab
33b00 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
33b10 0a 2d 31 35 37 0d 0a 2d 31 39 39 36 0d 0a 2d 32  .-157..-1996..-2
33b20 39 37 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  970....skipif my
33b30 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
33b40 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
33b50 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 34 36 37  wsort label-1467
33b60 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63  ..SELECT ALL + c
33b70 6f 6c 30 20 2a 20 28 20 2d 20 63 6f 6c 32 20 29  ol0 * ( - col2 )
33b80 20 2b 20 43 41 53 54 20 28 20 33 32 20 41 53 20   + CAST ( 32 AS 
33b90 49 4e 54 45 47 45 52 20 29 20 46 52 4f 4d 20 74  INTEGER ) FROM t
33ba0 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
33bb0 2d 0d 0a 2d 31 35 37 0d 0a 2d 31 39 39 36 0d 0a  -..-157..-1996..
33bc0 2d 32 39 37 30 0d 0a 0d 0a 71 75 65 72 79 20 49  -2970....query I
33bd0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
33be0 20 44 49 53 54 49 4e 43 54 20 2d 20 28 20 37 34   DISTINCT - ( 74
33bf0 20 29 20 2b 20 2b 20 63 6f 6c 30 20 46 52 4f 4d   ) + + col0 FROM
33c00 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
33c10 2d 2d 2d 0d 0a 2d 36 37 0d 0a 34 0d 0a 35 0d 0a  ---..-67..4..5..
33c20 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
33c30 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
33c40 43 54 20 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c 30  CT col0 * - col0
33c50 20 2a 20 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c 30   * col0 + - col0
33c60 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d   FROM tab0 cor0.
33c70 0a 2d 2d 2d 2d 0d 0a 2d 31 33 38 34 38 0d 0a 2d  .----..-13848..-
33c80 34 32 39 31 30 0d 0a 2d 37 30 35 30 35 38 0d 0a  42910..-705058..
33c90 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
33ca0 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2b 20 63 6f  t..SELECT - + co
33cb0 6c 30 20 2a 20 33 38 20 2b 20 63 6f 6c 31 20 46  l0 * 38 + col1 F
33cc0 52 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d  ROM tab2 cor0..-
33cd0 2d 2d 2d 0d 0a 2d 32 33 35 0d 0a 2d 32 39 30 35  ---..-235..-2905
33ce0 0d 0a 2d 32 39 38 35 0d 0a 0d 0a 71 75 65 72 79  ..-2985....query
33cf0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
33d00 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 32 20 2a 20  CT ALL - col2 * 
33d10 28 20 2d 20 63 6f 6c 31 20 29 20 41 53 20 63 6f  ( - col1 ) AS co
33d20 6c 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d  l1 FROM tab0..--
33d30 2d 2d 0d 0a 32 38 33 38 0d 0a 37 34 36 32 0d 0a  --..2838..7462..
33d40 39 37 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73  97....skipif pos
33d50 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72  tgresql # Postgr
33d60 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53  eSQL requires AS
33d70 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f   when renaming o
33d80 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71  utput columns..q
33d90 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
33da0 53 45 4c 45 43 54 20 2d 20 63 6f 6c 31 20 2d 20  SELECT - col1 - 
33db0 2b 20 34 32 20 63 6f 6c 32 20 46 52 4f 4d 20 74  + 42 col2 FROM t
33dc0 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 31 0d  ab2..----..-101.
33dd0 0a 2d 35 39 0d 0a 2d 37 33 0d 0a 0d 0a 71 75 65  .-59..-73....que
33de0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
33df0 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 33 32  LECT DISTINCT 32
33e00 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
33e10 62 30 2c 20 74 61 62 30 20 41 53 20 63 6f 72 30  b0, tab0 AS cor0
33e20 0d 0a 2d 2d 2d 2d 0d 0a 33 32 0d 0a 0d 0a 71 75  ..----..32....qu
33e30 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
33e40 45 4c 45 43 54 20 2b 20 63 6f 6c 30 20 2b 20 2b  ELECT + col0 + +
33e50 20 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c 30 20 46   col2 * - col0 F
33e60 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
33e70 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 35 39 0d 0a 2d 33  ..----..-159..-3
33e80 35 38 34 0d 0a 2d 37 36 30 30 0d 0a 0d 0a 71 75  584..-7600....qu
33e90 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
33ea0 45 4c 45 43 54 20 2b 20 63 6f 6c 31 20 2b 20 63  ELECT + col1 + c
33eb0 6f 72 30 2e 63 6f 6c 32 20 46 52 4f 4d 20 74 61  or0.col2 FROM ta
33ec0 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
33ed0 0d 0a 35 35 0d 0a 35 38 0d 0a 38 35 0d 0a 0d 0a  ..55..58..85....
33ee0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
33ef0 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
33f00 20 2d 20 2b 20 63 6f 6c 31 20 2b 20 2b 20 63 6f   - + col1 + + co
33f10 6c 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  l2 AS col2 FROM 
33f20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
33f30 2d 2d 0d 0a 2d 33 33 0d 0a 2d 34 0d 0a 32 31 0d  --..-33..-4..21.
33f40 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
33f50 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
33f60 4e 43 54 20 2b 20 28 20 2b 20 39 34 20 29 20 46  NCT + ( + 94 ) F
33f70 52 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d  ROM tab2 cor0..-
33f80 2d 2d 2d 0d 0a 39 34 0d 0a 0d 0a 71 75 65 72 79  ---..94....query
33f90 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
33fa0 43 54 20 41 4c 4c 20 2d 20 37 36 20 2a 20 63 6f  CT ALL - 76 * co
33fb0 72 30 2e 63 6f 6c 31 20 2b 20 63 6f 6c 32 20 41  r0.col1 + col2 A
33fc0 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32  S col1 FROM tab2
33fd0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
33fe0 2d 31 32 35 34 0d 0a 2d 32 33 32 39 0d 0a 2d 34  -1254..-2329..-4
33ff0 34 35 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  458....query I r
34000 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
34010 20 37 20 2a 20 63 6f 6c 30 20 41 53 20 63 6f 6c   7 * col0 AS col
34020 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  2 FROM tab1 AS c
34030 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 31 0d 0a 34  or0..----..21..4
34040 34 38 0d 0a 35 36 30 0d 0a 0d 0a 71 75 65 72 79  48..560....query
34050 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
34060 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 2b 20  CT DISTINCT + + 
34070 63 6f 6c 31 20 2a 20 2b 20 38 32 20 2b 20 63 6f  col1 * + 82 + co
34080 6c 32 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  l2 AS col1 FROM 
34090 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
340a0 2d 2d 0d 0a 31 34 33 32 0d 0a 32 35 36 39 0d 0a  --..1432..2569..
340b0 34 38 36 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20  4864....query I 
340c0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
340d0 63 6f 6c 31 20 2a 20 2d 20 28 20 2b 20 63 6f 6c  col1 * - ( + col
340e0 31 20 29 20 2a 20 28 20 2b 20 63 6f 6c 31 20 29  1 ) * ( + col1 )
340f0 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
34100 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 30 35 33 37  r0..----..-20537
34110 39 0d 0a 2d 32 39 37 39 31 0d 0a 2d 34 39 31 33  9..-29791..-4913
34120 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
34130 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
34140 74 61 62 30 2e 63 6f 6c 30 20 41 53 20 63 6f 6c  tab0.col0 AS col
34150 31 20 46 52 4f 4d 20 74 61 62 30 2c 20 74 61 62  1 FROM tab0, tab
34160 32 20 41 53 20 63 6f 72 30 2c 20 74 61 62 30 20  2 AS cor0, tab0 
34170 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 32  AS cor1..----..2
34180 37 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67  7 values hashing
34190 20 74 6f 20 39 66 63 31 64 63 64 37 36 66 65 61   to 9fc1dcd76fea
341a0 66 34 33 65 35 63 35 64 63 30 36 30 61 30 32 30  f43e5c5dc060a020
341b0 31 34 63 64 0d 0a 0d 0a 71 75 65 72 79 20 49 20  14cd....query I 
341c0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
341d0 36 20 2b 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61  6 + col2 FROM ta
341e0 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
341f0 0d 0a 33 32 0d 0a 33 33 0d 0a 34 34 0d 0a 0d 0a  ..32..33..44....
34200 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
34210 0a 53 45 4c 45 43 54 20 2d 20 34 38 20 2b 20 63  .SELECT - 48 + c
34220 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol2 FROM tab1 AS
34230 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 34 38 0d   cor0..----..48.
34240 0a 36 0d 0a 39 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  .6..9....onlyif 
34250 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20  mysql # support 
34260 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66  for MySQL specif
34270 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20  ic system types 
34280 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72  and syntax..quer
34290 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
342a0 6c 2d 31 34 38 35 0d 0a 53 45 4c 45 43 54 20 2d  l-1485..SELECT -
342b0 20 63 6f 6c 31 20 2b 20 63 6f 6c 32 20 2a 20 43   col1 + col2 * C
342c0 41 53 54 28 20 2d 20 63 6f 6c 30 20 41 53 20 53  AST( - col0 AS S
342d0 49 47 4e 45 44 20 29 20 46 52 4f 4d 20 74 61 62  IGNED ) FROM tab
342e0 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
342f0 0a 2d 31 33 32 0d 0a 2d 37 33 38 39 0d 0a 2d 38  .-132..-7389..-8
34300 37 38 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  78....skipif mys
34310 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
34320 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
34330 73 6f 72 74 20 6c 61 62 65 6c 2d 31 34 38 35 0d  sort label-1485.
34340 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 31 20 2b  .SELECT - col1 +
34350 20 63 6f 6c 32 20 2a 20 43 41 53 54 20 28 20 2d   col2 * CAST ( -
34360 20 63 6f 6c 30 20 41 53 20 49 4e 54 45 47 45 52   col0 AS INTEGER
34370 20 29 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20   ) FROM tab0 AS 
34380 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 32  cor0..----..-132
34390 0d 0a 2d 37 33 38 39 0d 0a 2d 38 37 38 0d 0a 0d  ..-7389..-878...
343a0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
343b0 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 31 20  ..SELECT - col1 
343c0 2a 20 2b 20 63 6f 6c 31 20 2b 20 2b 20 37 31 20  * + col1 + + 71 
343d0 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
343e0 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 37 33 32 35 0d 0a  0..----..-7325..
343f0 2d 38 32 31 30 0d 0a 2d 39 33 33 38 0d 0a 0d 0a  -8210..-9338....
34400 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73  onlyif mysql # s
34410 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c  upport for MySQL
34420 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d   specific system
34430 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61   types and synta
34440 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  x..query I rowso
34450 72 74 20 6c 61 62 65 6c 2d 31 34 38 37 0d 0a 53  rt label-1487..S
34460 45 4c 45 43 54 20 2d 20 43 41 53 54 28 20 2b 20  ELECT - CAST( + 
34470 63 6f 6c 31 20 2a 20 63 6f 6c 30 20 41 53 20 53  col1 * col0 AS S
34480 49 47 4e 45 44 20 29 20 41 53 20 63 6f 6c 32 20  IGNED ) AS col2 
34490 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d  FROM tab1..----.
344a0 0a 2d 31 30 34 30 0d 0a 2d 36 34 30 0d 0a 2d 37  .-1040..-640..-7
344b0 38 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  8....skipif mysq
344c0 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
344d0 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
344e0 6f 72 74 20 6c 61 62 65 6c 2d 31 34 38 37 0d 0a  ort label-1487..
344f0 53 45 4c 45 43 54 20 2d 20 43 41 53 54 20 28 20  SELECT - CAST ( 
34500 2b 20 63 6f 6c 31 20 2a 20 63 6f 6c 30 20 41 53  + col1 * col0 AS
34510 20 49 4e 54 45 47 45 52 20 29 20 41 53 20 63 6f   INTEGER ) AS co
34520 6c 32 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d  l2 FROM tab1..--
34530 2d 2d 0d 0a 2d 31 30 34 30 0d 0a 2d 36 34 30 0d  --..-1040..-640.
34540 0a 2d 37 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .-78....query I 
34550 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
34560 44 49 53 54 49 4e 43 54 20 63 6f 6c 30 20 2a 20  DISTINCT col0 * 
34570 2d 20 74 61 62 32 2e 63 6f 6c 32 20 2a 20 2d 20  - tab2.col2 * - 
34580 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46 52 4f  col0 AS col1 FRO
34590 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 33  M tab2..----..13
345a0 32 33 0d 0a 31 35 38 31 38 34 0d 0a 32 33 37 31  23..158184..2371
345b0 35 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  58....query I ro
345c0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
345d0 53 54 49 4e 43 54 20 63 6f 72 30 2e 63 6f 6c 31  STINCT cor0.col1
345e0 20 2b 20 2b 20 74 61 62 32 2e 63 6f 6c 32 20 41   + + tab2.col2 A
345f0 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32  S col1 FROM tab2
34600 2c 20 74 61 62 31 2c 20 74 61 62 30 20 41 53 20  , tab1, tab0 AS 
34610 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 32 0d  cor0..----..112.
34620 0a 31 31 33 0d 0a 31 31 37 0d 0a 31 31 38 0d 0a  .113..117..118..
34630 31 32 33 0d 0a 31 32 34 0d 0a 31 32 39 0d 0a 31  123..124..129..1
34640 33 35 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  35....onlyif mys
34650 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72  ql # support for
34660 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63 20   MySQL specific 
34670 73 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64  system types and
34680 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49   syntax..query I
34690 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
346a0 34 39 30 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  490..SELECT DIST
346b0 49 4e 43 54 20 43 41 53 54 28 20 2b 20 38 39 20  INCT CAST( + 89 
346c0 41 53 20 53 49 47 4e 45 44 20 29 20 41 53 20 63  AS SIGNED ) AS c
346d0 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d  ol2 FROM tab2..-
346e0 2d 2d 2d 0d 0a 38 39 0d 0a 0d 0a 73 6b 69 70 69  ---..89....skipi
346f0 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
34700 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
34710 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
34720 31 34 39 30 0d 0a 53 45 4c 45 43 54 20 44 49 53  1490..SELECT DIS
34730 54 49 4e 43 54 20 43 41 53 54 20 28 20 2b 20 38  TINCT CAST ( + 8
34740 39 20 41 53 20 49 4e 54 45 47 45 52 20 29 20 41  9 AS INTEGER ) A
34750 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32  S col2 FROM tab2
34760 0d 0a 2d 2d 2d 2d 0d 0a 38 39 0d 0a 0d 0a 71 75  ..----..89....qu
34770 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
34780 45 4c 45 43 54 20 2b 20 34 36 20 2a 20 63 6f 72  ELECT + 46 * cor
34790 30 2e 63 6f 6c 31 20 2b 20 2d 20 63 6f 6c 30 20  0.col1 + - col0 
347a0 2b 20 32 32 20 41 53 20 63 6f 6c 30 20 46 52 4f  + 22 AS col0 FRO
347b0 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
347c0 2d 2d 2d 2d 0d 0a 31 32 31 35 0d 0a 34 31 38 0d  ----..1215..418.
347d0 0a 35 34 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 70  .540....skipif p
347e0 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74  ostgresql # Post
347f0 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20  greSQL requires 
34800 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67  AS when renaming
34810 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d   output columns.
34820 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
34830 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 31 20  ..SELECT + col1 
34840 2a 20 2b 20 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c  * + col1 * + col
34850 30 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30  0 col1 FROM tab0
34860 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
34870 31 37 37 35 30 34 0d 0a 33 32 39 33 31 35 0d 0a  177504..329315..
34880 37 33 37 30 30 39 0d 0a 0d 0a 71 75 65 72 79 20  737009....query 
34890 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
348a0 54 20 2d 20 2d 20 63 6f 6c 30 20 2a 20 63 6f 6c  T - - col0 * col
348b0 31 20 2b 20 36 30 20 46 52 4f 4d 20 74 61 62 30  1 + 60 FROM tab0
348c0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 31 32   cor0..----..212
348d0 34 0d 0a 33 34 35 35 0d 0a 38 31 35 39 0d 0a 0d  4..3455..8159...
348e0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
348f0 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
34900 54 20 2d 20 2b 20 63 6f 6c 32 20 2b 20 38 31 20  T - + col2 + 81 
34910 2a 20 2d 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61  * - col1 FROM ta
34920 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
34930 0d 0a 2d 31 31 34 39 0d 0a 2d 32 31 36 30 0d 0a  ..-1149..-2160..
34940 2d 38 36 37 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  -867....onlyif m
34950 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f  ysql # use DIV o
34960 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65  perator for inte
34970 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75  ger division..qu
34980 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
34990 62 65 6c 2d 31 34 39 35 0d 0a 53 45 4c 45 43 54  bel-1495..SELECT
349a0 20 2d 20 63 6f 72 30 2e 63 6f 6c 31 20 44 49 56   - cor0.col1 DIV
349b0 20 63 6f 6c 30 20 2b 20 28 20 2b 20 63 6f 6c 32   col0 + ( + col2
349c0 20 29 20 2a 20 2d 20 35 38 20 2b 20 36 31 20 46   ) * - 58 + 61 F
349d0 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
349e0 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 34 34 37 0d 0a 2d  ..----..-1447..-
349f0 31 35 30 39 0d 0a 2d 32 31 34 33 0d 0a 0d 0a 73  1509..-2143....s
34a00 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
34a10 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
34a20 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
34a30 62 65 6c 2d 31 34 39 35 0d 0a 53 45 4c 45 43 54  bel-1495..SELECT
34a40 20 2d 20 63 6f 72 30 2e 63 6f 6c 31 20 2f 20 63   - cor0.col1 / c
34a50 6f 6c 30 20 2b 20 28 20 2b 20 63 6f 6c 32 20 29  ol0 + ( + col2 )
34a60 20 2a 20 2d 20 35 38 20 2b 20 36 31 20 46 52 4f   * - 58 + 61 FRO
34a70 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
34a80 2d 2d 2d 2d 0d 0a 2d 31 34 34 37 0d 0a 2d 31 35  ----..-1447..-15
34a90 30 39 0d 0a 2d 32 31 34 33 0d 0a 0d 0a 73 6b 69  09..-2143....ski
34aa0 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23  pif postgresql #
34ab0 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75   PostgreSQL requ
34ac0 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e  ires AS when ren
34ad0 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c  aming output col
34ae0 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f  umns..query I ro
34af0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f  wsort..SELECT co
34b00 6c 30 20 2b 20 2b 20 63 6f 6c 32 20 2a 20 2b 20  l0 + + col2 * + 
34b10 32 37 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  27 col2 FROM tab
34b20 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
34b30 0a 31 34 36 31 0d 0a 31 36 30 33 0d 0a 32 36 37  .1461..1603..267
34b40 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  2....query I row
34b50 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
34b60 54 49 4e 43 54 20 63 6f 6c 32 20 2b 20 33 39 20  TINCT col2 + 39 
34b70 2a 20 28 20 63 6f 6c 30 20 29 20 41 53 20 63 6f  * ( col0 ) AS co
34b80 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l1 FROM tab1 AS 
34b90 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 37 31 0d  cor0..----..171.
34ba0 0a 32 35 35 33 0d 0a 33 32 31 36 0d 0a 0d 0a 6f  .2553..3216....o
34bb0 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75  nlyif mysql # su
34bc0 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20  pport for MySQL 
34bd0 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20  specific system 
34be0 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78  types and syntax
34bf0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
34c00 74 20 6c 61 62 65 6c 2d 31 34 39 38 0d 0a 53 45  t label-1498..SE
34c10 4c 45 43 54 20 2d 20 2b 20 63 6f 6c 32 20 2a 20  LECT - + col2 * 
34c20 43 41 53 54 28 20 34 30 20 41 53 20 53 49 47 4e  CAST( 40 AS SIGN
34c30 45 44 20 29 20 2b 20 63 6f 72 30 2e 63 6f 6c 32  ED ) + cor0.col2
34c40 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
34c50 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32 38 37 0d  r0..----..-1287.
34c60 0a 2d 33 31 39 38 0d 0a 2d 33 39 0d 0a 0d 0a 73  .-3198..-39....s
34c70 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
34c80 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
34c90 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
34ca0 62 65 6c 2d 31 34 39 38 0d 0a 53 45 4c 45 43 54  bel-1498..SELECT
34cb0 20 2d 20 2b 20 63 6f 6c 32 20 2a 20 43 41 53 54   - + col2 * CAST
34cc0 20 28 20 34 30 20 41 53 20 49 4e 54 45 47 45 52   ( 40 AS INTEGER
34cd0 20 29 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 46   ) + cor0.col2 F
34ce0 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
34cf0 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32 38 37 0d 0a 2d  ..----..-1287..-
34d00 33 31 39 38 0d 0a 2d 33 39 0d 0a 0d 0a 71 75 65  3198..-39....que
34d10 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
34d20 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f  LECT DISTINCT co
34d30 6c 32 20 2a 20 2b 20 38 32 20 2b 20 2b 20 63 6f  l2 * + 82 + + co
34d40 6c 30 20 2a 20 2d 20 63 6f 6c 30 20 41 53 20 63  l0 * - col0 AS c
34d50 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 63 6f  ol2 FROM tab2 co
34d60 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 31 32 35 0d  r0..----..-3125.
34d70 0a 2d 33 39 35 32 0d 0a 32 31 36 35 0d 0a 0d 0a  .-3952..2165....
34d80 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
34d90 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
34da0 20 2b 20 63 6f 6c 32 20 2b 20 63 6f 6c 30 20 46   + col2 + col0 F
34db0 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d  ROM tab0 cor0..-
34dc0 2d 2d 2d 0d 0a 31 37 31 0d 0a 33 36 0d 0a 35 37  ---..171..36..57
34dd0 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
34de0 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d   # support for M
34df0 79 53 51 4c 20 73 70 65 63 69 66 69 63 20 73 79  ySQL specific sy
34e00 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73  stem types and s
34e10 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72  yntax..query I r
34e20 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 35 30  owsort label-150
34e30 31 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  1..SELECT DISTIN
34e40 43 54 20 2b 20 63 6f 6c 31 20 2b 20 43 41 53 54  CT + col1 + CAST
34e50 28 20 4e 55 4c 4c 20 41 53 20 53 49 47 4e 45 44  ( NULL AS SIGNED
34e60 20 29 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72   ) FROM tab0 cor
34e70 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 0d  0..----..NULL...
34e80 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
34e90 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
34ea0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
34eb0 6c 61 62 65 6c 2d 31 35 30 31 0d 0a 53 45 4c 45  label-1501..SELE
34ec0 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63 6f  CT DISTINCT + co
34ed0 6c 31 20 2b 20 43 41 53 54 20 28 20 4e 55 4c 4c  l1 + CAST ( NULL
34ee0 20 41 53 20 49 4e 54 45 47 45 52 20 29 20 46 52   AS INTEGER ) FR
34ef0 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d  OM tab0 cor0..--
34f00 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75 65 72  --..NULL....quer
34f10 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
34f20 45 43 54 20 2d 20 63 6f 6c 32 20 2a 20 63 6f 6c  ECT - col2 * col
34f30 31 20 2b 20 33 38 20 41 53 20 63 6f 6c 30 20 46  1 + 38 AS col0 F
34f40 52 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d  ROM tab2 cor0..-
34f50 2d 2d 2d 0d 0a 2d 31 34 39 36 0d 0a 2d 36 30 38  ---..-1496..-608
34f60 0d 0a 2d 37 39 39 0d 0a 0d 0a 71 75 65 72 79 20  ..-799....query 
34f70 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
34f80 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c  T DISTINCT - col
34f90 30 20 2a 20 63 6f 72 30 2e 63 6f 6c 30 20 2b 20  0 * cor0.col0 + 
34fa0 63 6f 6c 32 20 2b 20 2d 20 63 6f 6c 32 20 46 52  col2 + - col2 FR
34fb0 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
34fc0 0a 2d 2d 2d 2d 0d 0a 2d 34 30 39 36 0d 0a 2d 36  .----..-4096..-6
34fd0 34 30 30 0d 0a 2d 39 0d 0a 0d 0a 71 75 65 72 79  400..-9....query
34fe0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
34ff0 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 32  CT DISTINCT col2
35000 20 2a 20 36 34 20 2b 20 63 6f 6c 32 20 2b 20 63   * 64 + col2 + c
35010 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  ol1 AS col0 FROM
35020 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab0 cor0..----
35030 0d 0a 31 36 32 0d 0a 32 32 33 31 0d 0a 35 34 32  ..162..2231..542
35040 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  1....query I row
35050 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
35060 20 2d 20 2d 20 74 61 62 31 2e 63 6f 6c 32 20 46   - - tab1.col2 F
35070 52 4f 4d 20 74 61 62 31 2c 20 74 61 62 32 2c 20  ROM tab1, tab2, 
35080 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
35090 2d 2d 0d 0a 32 37 20 76 61 6c 75 65 73 20 68 61  --..27 values ha
350a0 73 68 69 6e 67 20 74 6f 20 37 66 34 61 39 62 66  shing to 7f4a9bf
350b0 32 34 64 36 34 38 33 33 37 30 36 64 66 62 64 64  24d64833706dfbdd
350c0 30 62 61 66 34 39 64 37 39 0d 0a 0d 0a 71 75 65  0baf49d79....que
350d0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
350e0 4c 45 43 54 20 32 35 20 2d 20 63 6f 6c 32 20 41  LECT 25 - col2 A
350f0 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30  S col2 FROM tab0
35100 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 37 0d 0a 2d 38 0d  ..----..-57..-8.
35110 0a 32 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .24....query I r
35120 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
35130 20 28 20 63 6f 6c 30 20 29 20 2a 20 2b 20 63 6f   ( col0 ) * + co
35140 6c 30 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74  l0 + col0 FROM t
35150 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 32 0d 0a  ab2..----..-42..
35160 2d 36 30 30 36 0d 0a 2d 36 31 36 32 0d 0a 0d 0a  -6006..-6162....
35170 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73  onlyif mysql # s
35180 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c  upport for MySQL
35190 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d   specific system
351a0 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61   types and synta
351b0 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  x..query I rowso
351c0 72 74 20 6c 61 62 65 6c 2d 31 35 30 38 0d 0a 53  rt label-1508..S
351d0 45 4c 45 43 54 20 63 6f 6c 31 20 2a 20 2d 20 63  ELECT col1 * - c
351e0 6f 6c 31 20 2b 20 2d 20 43 41 53 54 28 20 63 6f  ol1 + - CAST( co
351f0 6c 31 20 41 53 20 53 49 47 4e 45 44 20 29 20 2a  l1 AS SIGNED ) *
35200 20 2d 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62   - col1 FROM tab
35210 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30  0..----..0..0..0
35220 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
35230 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
35240 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
35250 72 74 20 6c 61 62 65 6c 2d 31 35 30 38 0d 0a 53  rt label-1508..S
35260 45 4c 45 43 54 20 63 6f 6c 31 20 2a 20 2d 20 63  ELECT col1 * - c
35270 6f 6c 31 20 2b 20 2d 20 43 41 53 54 20 28 20 63  ol1 + - CAST ( c
35280 6f 6c 31 20 41 53 20 49 4e 54 45 47 45 52 20 29  ol1 AS INTEGER )
35290 20 2a 20 2d 20 63 6f 6c 31 20 46 52 4f 4d 20 74   * - col1 FROM t
352a0 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d  ab0..----..0..0.
352b0 0a 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  .0....query I ro
352c0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
352d0 53 54 49 4e 43 54 20 63 6f 6c 32 20 2b 20 2b 20  STINCT col2 + + 
352e0 74 61 62 30 2e 63 6f 6c 30 20 46 52 4f 4d 20 74  tab0.col0 FROM t
352f0 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 37 31 0d 0a  ab0..----..171..
35300 33 36 0d 0a 35 37 0d 0a 0d 0a 71 75 65 72 79 20  36..57....query 
35310 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
35320 54 20 44 49 53 54 49 4e 43 54 20 33 32 20 2b 20  T DISTINCT 32 + 
35330 74 61 62 31 2e 63 6f 6c 32 20 46 52 4f 4d 20 74  tab1.col2 FROM t
35340 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 32 38 0d 0a  ab1..----..128..
35350 38 36 0d 0a 38 39 0d 0a 0d 0a 6f 6e 6c 79 69 66  86..89....onlyif
35360 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56   mysql # use DIV
35370 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e   operator for in
35380 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a  teger division..
35390 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
353a0 6c 61 62 65 6c 2d 31 35 31 31 0d 0a 53 45 4c 45  label-1511..SELE
353b0 43 54 20 41 4c 4c 20 2d 20 28 20 63 6f 6c 32 20  CT ALL - ( col2 
353c0 29 20 44 49 56 20 2d 20 63 6f 6c 31 20 41 53 20  ) DIV - col1 AS 
353d0 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a  col0 FROM tab0..
353e0 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d  ----..0..0..0...
353f0 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
35400 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
35410 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
35420 6c 61 62 65 6c 2d 31 35 31 31 0d 0a 53 45 4c 45  label-1511..SELE
35430 43 54 20 41 4c 4c 20 2d 20 28 20 63 6f 6c 32 20  CT ALL - ( col2 
35440 29 20 2f 20 2d 20 63 6f 6c 31 20 41 53 20 63 6f  ) / - col1 AS co
35450 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d  l0 FROM tab0..--
35460 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a 71  --..0..0..0....q
35470 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
35480 53 45 4c 45 43 54 20 41 4c 4c 20 74 61 62 31 2e  SELECT ALL tab1.
35490 63 6f 6c 30 20 2b 20 74 61 62 31 2e 63 6f 6c 30  col0 + tab1.col0
354a0 20 2a 20 74 61 62 31 2e 63 6f 6c 31 20 2b 20 63   * tab1.col1 + c
354b0 6f 6c 31 20 2a 20 63 6f 6c 32 20 2a 20 28 20 2d  ol1 * col2 * ( -
354c0 20 63 6f 6c 30 20 29 20 41 53 20 63 6f 6c 31 20   col0 ) AS col1 
354d0 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d  FROM tab1..----.
354e0 0a 2d 33 35 37 37 36 0d 0a 2d 34 31 33 31 0d 0a  .-35776..-4131..
354f0 2d 39 38 37 32 30 0d 0a 0d 0a 71 75 65 72 79 20  -98720....query 
35500 49 49 49 49 49 49 49 49 49 49 49 49 20 72 6f 77  IIIIIIIIIIII row
35510 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
35520 54 49 4e 43 54 20 2a 20 46 52 4f 4d 20 74 61 62  TINCT * FROM tab
35530 31 20 41 53 20 63 6f 72 30 20 43 52 4f 53 53 20  1 AS cor0 CROSS 
35540 4a 4f 49 4e 20 74 61 62 32 2c 20 74 61 62 32 20  JOIN tab2, tab2 
35550 41 53 20 63 6f 72 31 2c 20 74 61 62 30 20 41 53  AS cor1, tab0 AS
35560 20 63 6f 72 32 0d 0a 2d 2d 2d 2d 0d 0a 39 37 32   cor2..----..972
35570 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20   values hashing 
35580 74 6f 20 65 34 63 37 34 38 66 32 36 37 65 38 64  to e4c748f267e8d
35590 32 61 30 65 36 64 35 36 33 32 38 31 65 31 66 62  2a0e6d563281e1fb
355a0 39 37 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  975....query I r
355b0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
355c0 4c 4c 20 2b 20 63 6f 6c 31 20 2a 20 2d 20 63 6f  LL + col1 * - co
355d0 6c 30 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c  l0 + col1 AS col
355e0 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d  1 FROM tab0..---
355f0 2d 0d 0a 2d 31 39 37 38 0d 0a 2d 33 32 39 38 0d  -..-1978..-3298.
35600 0a 2d 38 30 30 38 0d 0a 0d 0a 71 75 65 72 79 20  .-8008....query 
35610 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
35620 54 20 41 4c 4c 20 2b 20 63 6f 6c 30 20 2a 20 2d  T ALL + col0 * -
35630 20 31 33 20 2b 20 2b 20 32 38 20 2a 20 2d 20 63   13 + + 28 * - c
35640 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  ol2 AS col0 FROM
35650 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
35660 2d 2d 2d 0d 0a 2d 31 35 35 31 0d 0a 2d 32 34 32  ---..-1551..-242
35670 38 0d 0a 2d 33 37 32 38 0d 0a 0d 0a 71 75 65 72  8..-3728....quer
35680 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
35690 45 43 54 20 2d 20 2b 20 63 6f 6c 32 20 2a 20 38  ECT - + col2 * 8
356a0 34 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  4 AS col0 FROM t
356b0 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
356c0 2d 0d 0a 2d 32 37 37 32 0d 0a 2d 36 38 38 38 0d  -..-2772..-6888.
356d0 0a 2d 38 34 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  .-84....onlyif m
356e0 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f  ysql # use DIV o
356f0 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65  perator for inte
35700 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75  ger division..qu
35710 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
35720 62 65 6c 2d 31 35 31 37 0d 0a 53 45 4c 45 43 54  bel-1517..SELECT
35730 20 41 4c 4c 20 2d 20 2b 20 63 6f 72 30 2e 63 6f   ALL - + cor0.co
35740 6c 32 20 44 49 56 20 28 20 63 6f 6c 31 20 2b 20  l2 DIV ( col1 + 
35750 2b 20 63 6f 6c 32 20 29 20 46 52 4f 4d 20 74 61  + col2 ) FROM ta
35760 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
35770 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a 73 6b 69  ..0..0..0....ski
35780 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
35790 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
357a0 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
357b0 6c 2d 31 35 31 37 0d 0a 53 45 4c 45 43 54 20 41  l-1517..SELECT A
357c0 4c 4c 20 2d 20 2b 20 63 6f 72 30 2e 63 6f 6c 32  LL - + cor0.col2
357d0 20 2f 20 28 20 63 6f 6c 31 20 2b 20 2b 20 63 6f   / ( col1 + + co
357e0 6c 32 20 29 20 46 52 4f 4d 20 74 61 62 30 20 41  l2 ) FROM tab0 A
357f0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d  S cor0..----..0.
35800 0a 30 0d 0a 30 0d 0a 0d 0a 71 75 65 72 79 20 49  .0..0....query I
35810 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
35820 20 44 49 53 54 49 4e 43 54 20 2b 20 2b 20 63 6f   DISTINCT + + co
35830 6c 31 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c  l1 + col1 AS col
35840 30 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30  0 FROM tab0 cor0
35850 0d 0a 2d 2d 2d 2d 0d 0a 31 37 32 0d 0a 31 38 32  ..----..172..182
35860 0d 0a 31 39 34 0d 0a 0d 0a 71 75 65 72 79 20 49  ..194....query I
35870 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
35880 20 41 4c 4c 20 63 6f 6c 32 20 2b 20 63 6f 6c 30   ALL col2 + col0
35890 20 2a 20 2d 20 28 20 2d 20 63 6f 6c 31 20 29 20   * - ( - col1 ) 
358a0 2b 20 2b 20 37 38 20 46 52 4f 4d 20 74 61 62 30  + + 78 FROM tab0
358b0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
358c0 32 31 37 35 0d 0a 33 34 37 34 0d 0a 38 32 35 39  2175..3474..8259
358d0 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67  ....skipif postg
358e0 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53  resql # PostgreS
358f0 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77  QL requires AS w
35900 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74  hen renaming out
35910 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65  put columns..que
35920 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
35930 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 31 20 2b 20  LECT ALL col1 + 
35940 35 31 20 2b 20 2b 20 63 6f 6c 31 20 2a 20 2d 20  51 + + col1 * - 
35950 63 6f 6c 31 20 63 6f 6c 32 20 46 52 4f 4d 20 74  col1 col2 FROM t
35960 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
35970 2d 0d 0a 2d 31 30 35 0d 0a 2d 33 39 0d 0a 2d 35  -..-105..-39..-5
35980 39 39 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73  99....skipif pos
35990 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72  tgresql # Postgr
359a0 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53  eSQL requires AS
359b0 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f   when renaming o
359c0 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71  utput columns..q
359d0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
359e0 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
359f0 2b 20 63 6f 6c 30 20 2b 20 37 36 20 63 6f 6c 31  + col0 + 76 col1
35a00 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
35a10 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 34 30 0d 0a 31  r0..----..140..1
35a20 35 36 0d 0a 37 39 0d 0a 0d 0a 71 75 65 72 79 20  56..79....query 
35a30 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
35a40 54 20 2d 20 2d 20 63 6f 6c 31 20 2b 20 28 20 38  T - - col1 + ( 8
35a50 20 2a 20 2b 20 63 6f 6c 30 20 29 20 2b 20 2b 20   * + col0 ) + + 
35a60 34 34 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  44 AS col0 FROM 
35a70 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
35a80 2d 2d 0d 0a 33 32 32 0d 0a 34 32 31 0d 0a 38 34  --..322..421..84
35a90 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  7....query I row
35aa0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c  sort..SELECT col
35ab0 32 20 2b 20 28 20 2b 20 63 6f 6c 32 20 29 20 2b  2 + ( + col2 ) +
35ac0 20 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46 52   col2 AS col0 FR
35ad0 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
35ae0 0a 2d 2d 2d 2d 0d 0a 31 36 32 0d 0a 31 37 31 0d  .----..162..171.
35af0 0a 32 38 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .288....query I 
35b00 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
35b10 44 49 53 54 49 4e 43 54 20 2d 20 36 30 20 2d 20  DISTINCT - 60 - 
35b20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 41 53 20 63  - cor0.col2 AS c
35b30 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 2c 20 74  ol2 FROM tab1, t
35b40 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
35b50 2d 0d 0a 2d 32 37 0d 0a 2d 35 39 0d 0a 32 32 0d  -..-27..-59..22.
35b60 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
35b70 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 28 20 31  rt..SELECT + ( 1
35b80 38 20 29 20 46 52 4f 4d 20 74 61 62 32 20 41 53  8 ) FROM tab2 AS
35b90 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 38 0d   cor0..----..18.
35ba0 0a 31 38 0d 0a 31 38 0d 0a 0d 0a 71 75 65 72 79  .18..18....query
35bb0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
35bc0 43 54 20 2d 20 2d 20 35 38 20 46 52 4f 4d 20 74  CT - - 58 FROM t
35bd0 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
35be0 2d 0d 0a 35 38 0d 0a 35 38 0d 0a 35 38 0d 0a 0d  -..58..58..58...
35bf0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
35c00 0d 0a 53 45 4c 45 43 54 20 2b 20 38 31 20 2a 20  ..SELECT + 81 * 
35c10 28 20 63 6f 6c 30 20 29 20 46 52 4f 4d 20 74 61  ( col0 ) FROM ta
35c20 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
35c30 0d 0a 35 36 37 0d 0a 36 33 31 38 0d 0a 36 33 39  ..567..6318..639
35c40 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  9....query I row
35c50 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 34 31 20  sort..SELECT 41 
35c60 2b 20 2d 20 38 34 20 2b 20 63 6f 6c 30 20 41 53  + - 84 + col0 AS
35c70 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 0d   col1 FROM tab1.
35c80 0a 2d 2d 2d 2d 0d 0a 2d 34 30 0d 0a 32 31 0d 0a  .----..-40..21..
35c90 33 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  37....query I ro
35ca0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
35cb0 2d 20 63 6f 6c 30 20 2a 20 63 6f 72 30 2e 63 6f  - col0 * cor0.co
35cc0 6c 31 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  l1 AS col2 FROM 
35cd0 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab2 cor0..----.
35ce0 0a 31 33 34 33 0d 0a 32 31 37 0d 0a 34 36 30 32  .1343..217..4602
35cf0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
35d00 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
35d10 2b 20 63 6f 6c 31 20 2b 20 2d 20 74 61 62 30 2e  + col1 + - tab0.
35d20 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46 52 4f  col1 AS col2 FRO
35d30 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d  M tab0..----..0.
35d40 0a 30 0d 0a 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  .0..0....onlyif 
35d50 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20  mysql # use DIV 
35d60 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74  operator for int
35d70 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71  eger division..q
35d80 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
35d90 61 62 65 6c 2d 31 35 33 31 0d 0a 53 45 4c 45 43  abel-1531..SELEC
35da0 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c  T DISTINCT + col
35db0 32 20 2b 20 63 6f 6c 31 20 2b 20 63 6f 6c 31 20  2 + col1 + col1 
35dc0 44 49 56 20 63 6f 72 30 2e 63 6f 6c 32 20 41 53  DIV cor0.col2 AS
35dd0 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20   col1 FROM tab0 
35de0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
35df0 32 31 0d 0a 31 37 34 0d 0a 31 39 35 0d 0a 0d 0a  21..174..195....
35e00 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
35e10 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
35e20 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
35e30 61 62 65 6c 2d 31 35 33 31 0d 0a 53 45 4c 45 43  abel-1531..SELEC
35e40 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c  T DISTINCT + col
35e50 32 20 2b 20 63 6f 6c 31 20 2b 20 63 6f 6c 31 20  2 + col1 + col1 
35e60 2f 20 63 6f 72 30 2e 63 6f 6c 32 20 41 53 20 63  / cor0.col2 AS c
35e70 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol1 FROM tab0 AS
35e80 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 31   cor0..----..121
35e90 0d 0a 31 37 34 0d 0a 31 39 35 0d 0a 0d 0a 73 6b  ..174..195....sk
35ea0 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20  ipif postgresql 
35eb0 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71  # PostgreSQL req
35ec0 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65  uires AS when re
35ed0 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f  naming output co
35ee0 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72  lumns..query I r
35ef0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 31  owsort..SELECT 1
35f00 20 2b 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 63   + + cor0.col0 c
35f10 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol2 FROM tab2 AS
35f20 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 37 39 0d   cor0..----..79.
35f30 0a 38 0d 0a 38 30 0d 0a 0d 0a 71 75 65 72 79 20  .8..80....query 
35f40 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
35f50 54 20 2b 20 2b 20 35 35 20 2b 20 2b 20 63 6f 6c  T + + 55 + + col
35f60 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  0 FROM tab2 AS c
35f70 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33 33 0d 0a  or0..----..133..
35f80 31 33 34 0d 0a 36 32 0d 0a 0d 0a 71 75 65 72 79  134..62....query
35f90 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
35fa0 43 54 20 41 4c 4c 20 2b 20 39 20 2b 20 2b 20 63  CT ALL + 9 + + c
35fb0 6f 6c 31 20 2a 20 2b 20 63 6f 6c 30 20 46 52 4f  ol1 * + col0 FRO
35fc0 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
35fd0 2d 2d 2d 2d 0d 0a 31 33 35 32 0d 0a 32 32 36 0d  ----..1352..226.
35fe0 0a 34 36 31 31 0d 0a 0d 0a 73 6b 69 70 69 66 20  .4611....skipif 
35ff0 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
36000 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
36010 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
36020 2b 20 43 41 53 54 20 28 20 34 36 20 41 53 20 52  + CAST ( 46 AS R
36030 45 41 4c 20 29 20 41 53 20 63 6f 6c 31 20 46 52  EAL ) AS col1 FR
36040 4f 4d 20 74 61 62 31 2c 20 74 61 62 31 20 41 53  OM tab1, tab1 AS
36050 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76   cor0..----..9 v
36060 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f  alues hashing to
36070 20 33 31 38 31 38 63 39 64 34 64 33 32 35 65 62   31818c9d4d325eb
36080 32 34 38 37 33 35 63 39 37 63 62 31 64 63 65 33  248735c97cb1dce3
36090 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  9....query I row
360a0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2b  sort..SELECT - +
360b0 20 28 20 2b 20 31 31 20 29 20 2a 20 2d 20 63 6f   ( + 11 ) * - co
360c0 6c 32 20 2a 20 63 6f 6c 32 20 41 53 20 63 6f 6c  l2 * col2 AS col
360d0 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  0 FROM tab2 AS c
360e0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 35 38 38 34  or0..----..15884
360f0 0d 0a 37 34 33 36 0d 0a 38 30 31 39 0d 0a 0d 0a  ..7436..8019....
36100 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73  onlyif mysql # s
36110 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c  upport for MySQL
36120 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d   specific system
36130 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61   types and synta
36140 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  x..query I rowso
36150 72 74 20 6c 61 62 65 6c 2d 31 35 33 37 0d 0a 53  rt label-1537..S
36160 45 4c 45 43 54 20 2d 20 43 41 53 54 28 20 4e 55  ELECT - CAST( NU
36170 4c 4c 20 41 53 20 53 49 47 4e 45 44 20 29 20 2a  LL AS SIGNED ) *
36180 20 2b 20 38 38 20 2b 20 63 6f 6c 30 20 46 52 4f   + 88 + col0 FRO
36190 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
361a0 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c  ----..NULL..NULL
361b0 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66  ..NULL....skipif
361c0 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
361d0 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
361e0 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
361f0 35 33 37 0d 0a 53 45 4c 45 43 54 20 2d 20 43 41  537..SELECT - CA
36200 53 54 20 28 20 4e 55 4c 4c 20 41 53 20 49 4e 54  ST ( NULL AS INT
36210 45 47 45 52 20 29 20 2a 20 2b 20 38 38 20 2b 20  EGER ) * + 88 + 
36220 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41  col0 FROM tab2 A
36230 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55  S cor0..----..NU
36240 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a  LL..NULL..NULL..
36250 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
36260 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 30 20 2a  t..SELECT col0 *
36270 20 2d 20 32 38 20 2a 20 2d 20 74 61 62 31 2e 63   - 28 * - tab1.c
36280 6f 6c 31 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f  ol1 + col1 AS co
36290 6c 32 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d  l2 FROM tab1..--
362a0 2d 2d 0d 0a 31 37 39 33 30 0d 0a 32 32 31 30 0d  --..17930..2210.
362b0 0a 32 39 31 33 33 0d 0a 0d 0a 71 75 65 72 79 20  .29133....query 
362c0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
362d0 54 20 44 49 53 54 49 4e 43 54 20 2d 20 32 37 20  T DISTINCT - 27 
362e0 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
362f0 32 2c 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  2, tab0 AS cor0.
36300 0a 2d 2d 2d 2d 0d 0a 2d 32 37 0d 0a 0d 0a 71 75  .----..-27....qu
36310 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
36320 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 30 20 2a  ELECT ALL col0 *
36330 20 63 6f 6c 32 20 2a 20 63 6f 6c 31 20 46 52 4f   col2 * col1 FRO
36340 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 33 33  M tab0..----..33
36350 39 35 0d 0a 36 36 34 31 31 38 0d 0a 36 38 31 31  95..664118..6811
36360 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  2....query I row
36370 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
36380 20 37 39 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d   79 AS col1 FROM
36390 20 74 61 62 31 2c 20 74 61 62 32 20 41 53 20 63   tab1, tab2 AS c
363a0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c  or0..----..9 val
363b0 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 34  ues hashing to 4
363c0 30 61 32 32 36 31 63 61 61 32 63 35 63 64 62 66  0a2261caa2c5cdbf
363d0 64 38 30 39 36 35 64 37 64 66 31 32 33 31 66 0d  d80965d7df1231f.
363e0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
363f0 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b  rt..SELECT ALL +
36400 20 35 38 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d   58 AS col0 FROM
36410 20 74 61 62 32 2c 20 74 61 62 30 20 41 53 20 63   tab2, tab0 AS c
36420 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c  or0..----..9 val
36430 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 65  ues hashing to e
36440 66 36 65 36 33 61 65 65 64 32 35 38 31 61 31 36  f6e63aeed2581a16
36450 38 66 30 37 36 34 36 64 32 35 38 66 36 36 36 0d  8f07646d258f666.
36460 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
36470 72 74 0d 0a 53 45 4c 45 43 54 20 74 61 62 32 2e  rt..SELECT tab2.
36480 63 6f 6c 32 20 2b 20 28 20 2b 20 63 6f 6c 31 20  col2 + ( + col1 
36490 29 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  ) AS col0 FROM t
364a0 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 35 35 0d 0a 35  ab2..----..55..5
364b0 38 0d 0a 38 35 0d 0a 0d 0a 71 75 65 72 79 20 49  8..85....query I
364c0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
364d0 20 41 4c 4c 20 63 6f 6c 31 20 2a 20 2d 20 35 20   ALL col1 * - 5 
364e0 2b 20 2d 20 63 6f 6c 31 20 41 53 20 63 6f 6c 32  + - col1 AS col2
364f0 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d   FROM tab0..----
36500 0d 0a 2d 35 31 36 0d 0a 2d 35 34 36 0d 0a 2d 35  ..-516..-546..-5
36510 38 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  82....query I ro
36520 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
36530 28 20 2d 20 38 38 20 29 20 46 52 4f 4d 20 74 61  ( - 88 ) FROM ta
36540 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 38  b1 cor0..----..8
36550 38 0d 0a 38 38 0d 0a 38 38 0d 0a 0d 0a 71 75 65  8..88..88....que
36560 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
36570 4c 45 43 54 20 2d 20 28 20 63 6f 6c 31 20 29 20  LECT - ( col1 ) 
36580 2b 20 63 6f 6c 31 20 2a 20 63 6f 6c 32 20 46 52  + col1 * col2 FR
36590 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
365a0 0a 2d 2d 2d 2d 0d 0a 31 32 33 35 0d 0a 31 33 37  .----..1235..137
365b0 38 0d 0a 35 36 30 0d 0a 0d 0a 71 75 65 72 79 20  8..560....query 
365c0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
365d0 54 20 41 4c 4c 20 2b 20 2b 20 28 20 2d 20 63 6f  T ALL + + ( - co
365e0 6c 30 20 29 20 46 52 4f 4d 20 74 61 62 31 20 41  l0 ) FROM tab1 A
365f0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33  S cor0..----..-3
36600 0d 0a 2d 36 34 0d 0a 2d 38 30 0d 0a 0d 0a 6f 6e  ..-64..-80....on
36610 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
36620 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
36630 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
36640 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
36650 6f 72 74 20 6c 61 62 65 6c 2d 31 35 34 38 0d 0a  ort label-1548..
36660 53 45 4c 45 43 54 20 63 6f 6c 31 20 44 49 56 20  SELECT col1 DIV 
36670 2d 20 63 6f 72 30 2e 63 6f 6c 31 20 46 52 4f 4d  - cor0.col1 FROM
36680 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
36690 2d 2d 2d 0d 0a 2d 31 0d 0a 2d 31 0d 0a 2d 31 0d  ---..-1..-1..-1.
366a0 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
366b0 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
366c0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
366d0 74 20 6c 61 62 65 6c 2d 31 35 34 38 0d 0a 53 45  t label-1548..SE
366e0 4c 45 43 54 20 63 6f 6c 31 20 2f 20 2d 20 63 6f  LECT col1 / - co
366f0 72 30 2e 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  r0.col1 FROM tab
36700 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
36710 0a 2d 31 0d 0a 2d 31 0d 0a 2d 31 0d 0a 0d 0a 71  .-1..-1..-1....q
36720 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
36730 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 2d 20 63  SELECT ALL - - c
36740 6f 72 30 2e 63 6f 6c 30 20 2a 20 63 6f 6c 30 20  or0.col0 * col0 
36750 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
36760 30 0d 0a 2d 2d 2d 2d 0d 0a 34 30 39 36 0d 0a 36  0..----..4096..6
36770 34 30 30 0d 0a 39 0d 0a 0d 0a 71 75 65 72 79 20  400..9....query 
36780 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
36790 54 20 2d 20 31 35 20 2a 20 2b 20 63 6f 6c 31 20  T - 15 * + col1 
367a0 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
367b0 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 35 30 0d 0a 2d  0..----..-150..-
367c0 31 39 35 0d 0a 2d 33 39 30 0d 0a 0d 0a 73 6b 69  195..-390....ski
367d0 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23  pif postgresql #
367e0 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75   PostgreSQL requ
367f0 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e  ires AS when ren
36800 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c  aming output col
36810 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f  umns..query I ro
36820 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
36830 4c 20 2b 20 63 6f 6c 31 20 2a 20 63 6f 72 30 2e  L + col1 * cor0.
36840 63 6f 6c 30 20 63 6f 6c 31 20 46 52 4f 4d 20 74  col0 col1 FROM t
36850 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab0 cor0..----..
36860 32 30 36 34 0d 0a 33 33 39 35 0d 0a 38 30 39 39  2064..3395..8099
36870 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
36880 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61   # use DIV opera
36890 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20  tor for integer 
368a0 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20  division..query 
368b0 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
368c0 31 35 35 32 0d 0a 53 45 4c 45 43 54 20 44 49 53  1552..SELECT DIS
368d0 54 49 4e 43 54 20 2b 20 36 20 44 49 56 20 2b 20  TINCT + 6 DIV + 
368e0 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46 52 4f  col0 AS col2 FRO
368f0 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
36900 2d 2d 2d 2d 0d 0a 30 0d 0a 32 0d 0a 0d 0a 73 6b  ----..0..2....sk
36910 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
36920 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
36930 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
36940 65 6c 2d 31 35 35 32 0d 0a 53 45 4c 45 43 54 20  el-1552..SELECT 
36950 44 49 53 54 49 4e 43 54 20 2b 20 36 20 2f 20 2b  DISTINCT + 6 / +
36960 20 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46 52   col0 AS col2 FR
36970 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
36980 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 32 0d 0a 0d 0a 71  .----..0..2....q
36990 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
369a0 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 39 36 20  SELECT ALL + 96 
369b0 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
369c0 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
369d0 0a 39 36 0d 0a 39 36 0d 0a 39 36 0d 0a 0d 0a 6f  .96..96..96....o
369e0 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75  nlyif mysql # su
369f0 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20  pport for MySQL 
36a00 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20  specific system 
36a10 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78  types and syntax
36a20 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
36a30 74 20 6c 61 62 65 6c 2d 31 35 35 34 0d 0a 53 45  t label-1554..SE
36a40 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 43 41  LECT DISTINCT CA
36a50 53 54 28 20 4e 55 4c 4c 20 41 53 20 53 49 47 4e  ST( NULL AS SIGN
36a60 45 44 20 29 20 63 6f 6c 32 20 46 52 4f 4d 20 74  ED ) col2 FROM t
36a70 61 62 31 20 63 6f 72 30 20 43 52 4f 53 53 20 4a  ab1 cor0 CROSS J
36a80 4f 49 4e 20 74 61 62 31 20 41 53 20 63 6f 72 31  OIN tab1 AS cor1
36a90 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 0d 0a  ..----..NULL....
36aa0 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71  skipif postgresq
36ab0 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72  l # PostgreSQL r
36ac0 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20  equires AS when 
36ad0 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20  renaming output 
36ae0 63 6f 6c 75 6d 6e 73 0d 0a 73 6b 69 70 69 66 20  columns..skipif 
36af0 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
36b00 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
36b10 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 35  rowsort label-15
36b20 35 34 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  54..SELECT DISTI
36b30 4e 43 54 20 43 41 53 54 20 28 20 4e 55 4c 4c 20  NCT CAST ( NULL 
36b40 41 53 20 49 4e 54 45 47 45 52 20 29 20 63 6f 6c  AS INTEGER ) col
36b50 32 20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30  2 FROM tab1 cor0
36b60 20 43 52 4f 53 53 20 4a 4f 49 4e 20 74 61 62 31   CROSS JOIN tab1
36b70 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a   AS cor1..----..
36b80 4e 55 4c 4c 0d 0a 0d 0a 71 75 65 72 79 20 49 20  NULL....query I 
36b90 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
36ba0 2b 20 38 34 20 2b 20 34 31 20 41 53 20 63 6f 6c  + 84 + 41 AS col
36bb0 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  1 FROM tab0 AS c
36bc0 6f 72 30 20 43 52 4f 53 53 20 4a 4f 49 4e 20 74  or0 CROSS JOIN t
36bd0 61 62 31 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a  ab1 cor1..----..
36be0 39 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67  9 values hashing
36bf0 20 74 6f 20 32 39 37 33 38 37 38 33 39 38 65 34   to 2973878398e4
36c00 36 39 64 38 33 33 38 35 65 37 65 30 36 62 64 35  69d83385e7e06bd5
36c10 61 66 39 39 0d 0a 0d 0a 73 6b 69 70 69 66 20 70  af99....skipif p
36c20 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74  ostgresql # Post
36c30 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20  greSQL requires 
36c40 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67  AS when renaming
36c50 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d   output columns.
36c60 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
36c70 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
36c80 54 20 28 20 63 6f 6c 31 20 29 20 2b 20 63 6f 72  T ( col1 ) + cor
36c90 30 2e 63 6f 6c 32 20 63 6f 6c 30 20 46 52 4f 4d  0.col2 col0 FROM
36ca0 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab2 cor0..----
36cb0 0d 0a 35 35 0d 0a 35 38 0d 0a 38 35 0d 0a 0d 0a  ..55..58..85....
36cc0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
36cd0 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
36ce0 20 2b 20 63 6f 6c 32 20 2d 20 63 6f 6c 30 20 41   + col2 - col0 A
36cf0 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30  S col0 FROM tab0
36d00 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
36d10 2d 33 34 0d 0a 2d 37 0d 0a 39 0d 0a 0d 0a 71 75  -34..-7..9....qu
36d20 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
36d30 45 4c 45 43 54 20 41 4c 4c 20 2b 20 2b 20 63 6f  ELECT ALL + + co
36d40 6c 32 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74  l2 + col0 FROM t
36d50 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
36d60 2d 0d 0a 31 37 31 0d 0a 33 36 0d 0a 35 37 0d 0a  -..171..36..57..
36d70 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
36d80 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 30  t..SELECT + col0
36d90 20 2a 20 2b 20 63 6f 6c 32 20 2b 20 2d 20 63 6f   * + col2 + - co
36da0 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l1 FROM tab2 AS 
36db0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 35 38 0d  cor0..----..158.
36dc0 0a 31 39 36 39 0d 0a 32 39 38 35 0d 0a 0d 0a 71  .1969..2985....q
36dd0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
36de0 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 2b 20 32  SELECT ALL + + 2
36df0 36 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  6 AS col0 FROM t
36e00 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
36e10 2d 0d 0a 32 36 0d 0a 32 36 0d 0a 32 36 0d 0a 0d  -..26..26..26...
36e20 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
36e30 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 35  ..SELECT ALL + 5
36e40 32 20 2a 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20  2 * + cor0.col1 
36e50 2d 20 2d 20 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c  - - col1 * - col
36e60 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  2 FROM tab1 AS c
36e70 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 30 0d 0a  or0..----..-50..
36e80 2d 35 32 0d 0a 2d 35 37 32 0d 0a 0d 0a 6f 6e 6c  -52..-572....onl
36e90 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20  yif mysql # use 
36ea0 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72  DIV operator for
36eb0 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f   integer divisio
36ec0 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  n..query I rowso
36ed0 72 74 20 6c 61 62 65 6c 2d 31 35 36 32 0d 0a 53  rt label-1562..S
36ee0 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 32  ELECT ALL + col2
36ef0 20 44 49 56 20 2d 20 63 6f 6c 31 20 41 53 20 63   DIV - col1 AS c
36f00 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol1 FROM tab0 AS
36f10 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a   cor0..----..0..
36f20 30 0d 0a 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  0..0....skipif m
36f30 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
36f40 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
36f50 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 35 36  owsort label-156
36f60 32 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20  2..SELECT ALL + 
36f70 63 6f 6c 32 20 2f 20 2d 20 63 6f 6c 31 20 41 53  col2 / - col1 AS
36f80 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20   col1 FROM tab0 
36f90 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30  AS cor0..----..0
36fa0 0d 0a 30 0d 0a 30 0d 0a 0d 0a 71 75 65 72 79 20  ..0..0....query 
36fb0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
36fc0 54 20 41 4c 4c 20 2d 20 2b 20 63 6f 72 30 2e 63  T ALL - + cor0.c
36fd0 6f 6c 31 20 2b 20 2d 20 63 6f 6c 31 20 41 53 20  ol1 + - col1 AS 
36fe0 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41  col2 FROM tab0 A
36ff0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
37000 37 32 0d 0a 2d 31 38 32 0d 0a 2d 31 39 34 0d 0a  72..-182..-194..
37010 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
37020 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20  t..SELECT ALL + 
37030 2b 20 63 6f 72 31 2e 63 6f 6c 30 20 2b 20 2d 20  + cor1.col0 + - 
37040 63 6f 72 31 2e 63 6f 6c 30 20 46 52 4f 4d 20 74  cor1.col0 FROM t
37050 61 62 31 2c 20 74 61 62 32 20 63 6f 72 30 2c 20  ab1, tab2 cor0, 
37060 74 61 62 31 20 63 6f 72 31 2c 20 74 61 62 30 2c  tab1 cor1, tab0,
37070 20 74 61 62 31 20 41 53 20 63 6f 72 32 0d 0a 2d   tab1 AS cor2..-
37080 2d 2d 2d 0d 0a 32 34 33 20 76 61 6c 75 65 73 20  ---..243 values 
37090 68 61 73 68 69 6e 67 20 74 6f 20 66 61 33 64 35  hashing to fa3d5
370a0 62 36 39 65 34 34 34 64 66 39 36 39 62 36 30 64  b69e444df969b60d
370b0 61 35 65 34 63 35 63 33 35 30 37 0d 0a 0d 0a 73  a5e4c5c3507....s
370c0 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c  kipif postgresql
370d0 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65   # PostgreSQL re
370e0 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72  quires AS when r
370f0 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63  enaming output c
37100 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20  olumns..query I 
37110 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
37120 44 49 53 54 49 4e 43 54 20 63 6f 6c 32 20 2d 20  DISTINCT col2 - 
37130 2b 20 63 6f 6c 30 20 63 6f 6c 32 20 46 52 4f 4d  + col0 col2 FROM
37140 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
37150 2d 2d 2d 0d 0a 2d 37 0d 0a 31 36 0d 0a 35 31 0d  ---..-7..16..51.
37160 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
37170 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
37180 4e 43 54 20 2b 20 2d 20 63 6f 6c 32 20 2a 20 2d  NCT + - col2 * -
37190 20 28 20 2d 20 33 34 20 29 20 2d 20 63 6f 72 30   ( - 34 ) - cor0
371a0 2e 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20  .col2 FROM tab0 
371b0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
371c0 31 31 35 35 0d 0a 2d 32 38 37 30 0d 0a 2d 33 35  1155..-2870..-35
371d0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
371e0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
371f0 49 4e 43 54 20 2b 20 2d 20 63 6f 6c 30 20 2a 20  INCT + - col0 * 
37200 63 6f 6c 31 20 2b 20 28 20 2b 20 63 6f 6c 31 20  col1 + ( + col1 
37210 29 20 2b 20 2d 20 63 6f 6c 32 20 2a 20 36 33 20  ) + - col2 * 63 
37220 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
37230 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 31 37 34 0d  0..----..-13174.
37240 0a 2d 33 33 36 31 0d 0a 2d 34 30 35 37 0d 0a 0d  .-3361..-4057...
37250 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
37260 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c  ..SELECT ALL col
37270 31 20 2b 20 28 20 63 6f 6c 30 20 29 20 2b 20 63  1 + ( col0 ) + c
37280 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  ol0 AS col0 FROM
37290 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
372a0 2d 2d 2d 0d 0a 31 33 38 0d 0a 31 37 33 0d 0a 33  ---..138..173..3
372b0 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  2....query I row
372c0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
372d0 20 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c 30 20 2b   col1 * + col0 +
372e0 20 2b 20 63 6f 6c 31 20 2a 20 2d 20 63 6f 72 30   + col1 * - cor0
372f0 2e 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46 52  .col2 AS col1 FR
37300 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
37310 0a 2d 2d 2d 2d 0d 0a 2d 37 37 34 0d 0a 33 32 39  .----..-774..329
37320 38 0d 0a 36 33 37 0d 0a 0d 0a 71 75 65 72 79 20  8..637....query 
37330 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
37340 54 20 44 49 53 54 49 4e 43 54 20 37 20 2a 20 37  T DISTINCT 7 * 7
37350 30 20 46 52 4f 4d 20 74 61 62 31 2c 20 74 61 62  0 FROM tab1, tab
37360 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
37370 0a 34 39 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  .490....onlyif m
37380 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f  ysql # use DIV o
37390 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65  perator for inte
373a0 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75  ger division..qu
373b0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
373c0 62 65 6c 2d 31 35 37 31 0d 0a 53 45 4c 45 43 54  bel-1571..SELECT
373d0 20 41 4c 4c 20 63 6f 6c 30 20 2a 20 63 6f 6c 31   ALL col0 * col1
373e0 20 2b 20 63 6f 6c 30 20 44 49 56 20 63 6f 6c 31   + col0 DIV col1
373f0 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
37400 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 33 34 37 0d 0a  b2..----..1347..
37410 32 31 37 0d 0a 34 36 30 33 0d 0a 0d 0a 73 6b 69  217..4603....ski
37420 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
37430 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
37440 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
37450 6c 2d 31 35 37 31 0d 0a 53 45 4c 45 43 54 20 41  l-1571..SELECT A
37460 4c 4c 20 63 6f 6c 30 20 2a 20 63 6f 6c 31 20 2b  LL col0 * col1 +
37470 20 63 6f 6c 30 20 2f 20 63 6f 6c 31 20 41 53 20   col0 / col1 AS 
37480 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 0d 0a  col0 FROM tab2..
37490 2d 2d 2d 2d 0d 0a 31 33 34 37 0d 0a 32 31 37 0d  ----..1347..217.
374a0 0a 34 36 30 33 0d 0a 0d 0a 71 75 65 72 79 20 49  .4603....query I
374b0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
374c0 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 31 20 2b   DISTINCT col1 +
374d0 20 2d 20 63 6f 6c 32 20 2a 20 63 6f 72 30 2e 63   - col2 * cor0.c
374e0 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  ol0 AS col2 FROM
374f0 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
37500 2d 2d 2d 0d 0a 2d 31 33 36 0d 0a 2d 33 36 33 38  ---..-136..-3638
37510 0d 0a 2d 37 36 36 37 0d 0a 0d 0a 73 6b 69 70 69  ..-7667....skipi
37520 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50  f postgresql # P
37530 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72  ostgreSQL requir
37540 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d  es AS when renam
37550 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d  ing output colum
37560 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ns..query I rows
37570 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
37580 49 4e 43 54 20 37 35 20 63 6f 6c 30 20 46 52 4f  INCT 75 col0 FRO
37590 4d 20 74 61 62 31 2c 20 74 61 62 31 20 41 53 20  M tab1, tab1 AS 
375a0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 37 35 0d 0a  cor0..----..75..
375b0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
375c0 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 32  t..SELECT + col2
375d0 20 2b 20 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c 30   + col0 * + col0
375e0 20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d   FROM tab1 cor0.
375f0 0a 2d 2d 2d 2d 0d 0a 34 31 35 33 0d 0a 36 33 0d  .----..4153..63.
37600 0a 36 34 39 36 0d 0a 0d 0a 71 75 65 72 79 20 49  .6496....query I
37610 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
37620 20 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c 32 20 46   col1 * + col2 F
37630 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d  ROM tab1 cor0..-
37640 2d 2d 2d 0d 0a 31 32 34 38 0d 0a 31 34 30 34 0d  ---..1248..1404.
37650 0a 35 37 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .570....query I 
37660 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
37670 44 49 53 54 49 4e 43 54 20 34 31 20 46 52 4f 4d  DISTINCT 41 FROM
37680 20 74 61 62 30 2c 20 74 61 62 30 20 41 53 20 63   tab0, tab0 AS c
37690 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 34 31 0d 0a 0d  or0..----..41...
376a0 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73  .skipif postgres
376b0 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20  ql # PostgreSQL 
376c0 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e  requires AS when
376d0 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74   renaming output
376e0 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20   columns..query 
376f0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
37700 54 20 2b 20 2d 20 63 6f 6c 30 20 2b 20 2d 20 35  T + - col0 + - 5
37710 35 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32  5 col1 FROM tab2
37720 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
37730 2d 31 33 33 0d 0a 2d 31 33 34 0d 0a 2d 36 32 0d  -133..-134..-62.
37740 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
37750 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2b 20 31  rt..SELECT - + 1
37760 34 20 2b 20 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c  4 + col1 * + col
37770 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  0 FROM tab0 AS c
37780 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 30 35 30 0d  or0..----..2050.
37790 0a 33 33 38 31 0d 0a 38 30 38 35 0d 0a 0d 0a 71  .3381..8085....q
377a0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
377b0 53 45 4c 45 43 54 20 33 20 46 52 4f 4d 20 74 61  SELECT 3 FROM ta
377c0 62 30 2c 20 74 61 62 30 20 41 53 20 63 6f 72 30  b0, tab0 AS cor0
377d0 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73  ..----..9 values
377e0 20 68 61 73 68 69 6e 67 20 74 6f 20 33 63 66 31   hashing to 3cf1
377f0 65 33 37 37 61 39 34 33 35 38 39 38 39 37 62 38  e377a943589897b8
37800 64 34 33 31 61 38 33 34 66 31 62 61 0d 0a 0d 0a  d431a834f1ba....
37810 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
37820 0a 53 45 4c 45 43 54 20 2d 20 28 20 35 34 20 29  .SELECT - ( 54 )
37830 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
37840 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 34 0d 0a 2d  r0..----..-54..-
37850 35 34 0d 0a 2d 35 34 0d 0a 0d 0a 71 75 65 72 79  54..-54....query
37860 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
37870 43 54 20 33 39 20 2b 20 63 6f 6c 32 20 46 52 4f  CT 39 + col2 FRO
37880 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
37890 2d 2d 2d 2d 0d 0a 31 32 31 0d 0a 34 30 0d 0a 37  ----..121..40..7
378a0 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  2....query I row
378b0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
378c0 20 2d 20 28 20 37 36 20 29 20 2b 20 2b 20 63 6f   - ( 76 ) + + co
378d0 6c 30 20 2a 20 63 6f 72 30 2e 63 6f 6c 30 20 2a  l0 * cor0.col0 *
378e0 20 2d 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62   - col2 FROM tab
378f0 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
37900 0a 2d 31 33 39 39 0d 0a 2d 31 35 38 32 36 30 0d  .-1399..-158260.
37910 0a 2d 32 33 37 32 33 34 0d 0a 0d 0a 71 75 65 72  .-237234....quer
37920 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
37930 45 43 54 20 74 61 62 30 2e 63 6f 6c 30 20 2b 20  ECT tab0.col0 + 
37940 2b 20 37 37 20 46 52 4f 4d 20 74 61 62 30 0d 0a  + 77 FROM tab0..
37950 2d 2d 2d 2d 0d 0a 31 30 31 0d 0a 31 31 32 0d 0a  ----..101..112..
37960 31 36 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  166....query I r
37970 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
37980 20 34 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20   4 AS col2 FROM 
37990 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
379a0 2d 2d 0d 0a 2d 34 0d 0a 2d 34 0d 0a 2d 34 0d 0a  --..-4..-4..-4..
379b0 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
379c0 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f   use DIV operato
379d0 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69  r for integer di
379e0 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20  vision..query I 
379f0 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 35  rowsort label-15
37a00 38 35 0d 0a 53 45 4c 45 43 54 20 32 35 20 44 49  85..SELECT 25 DI
37a10 56 20 2d 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61  V - col0 FROM ta
37a20 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
37a30 0d 0a 2d 38 0d 0a 30 0d 0a 30 0d 0a 0d 0a 73 6b  ..-8..0..0....sk
37a40 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
37a50 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
37a60 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
37a70 65 6c 2d 31 35 38 35 0d 0a 53 45 4c 45 43 54 20  el-1585..SELECT 
37a80 32 35 20 2f 20 2d 20 63 6f 6c 30 20 46 52 4f 4d  25 / - col0 FROM
37a90 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
37aa0 2d 2d 2d 0d 0a 2d 38 0d 0a 30 0d 0a 30 0d 0a 0d  ---..-8..0..0...
37ab0 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
37ac0 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72  use DIV operator
37ad0 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76   for integer div
37ae0 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72  ision..query I r
37af0 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 35 38  owsort label-158
37b00 36 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20  6..SELECT ALL - 
37b10 34 37 20 44 49 56 20 2b 20 63 6f 6c 31 20 46 52  47 DIV + col1 FR
37b20 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
37b30 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 2d 32 0d 0a 30  .----..-1..-2..0
37b40 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
37b50 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
37b60 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
37b70 72 74 20 6c 61 62 65 6c 2d 31 35 38 36 0d 0a 53  rt label-1586..S
37b80 45 4c 45 43 54 20 41 4c 4c 20 2d 20 34 37 20 2f  ELECT ALL - 47 /
37b90 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62   + col1 FROM tab
37ba0 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
37bb0 0a 2d 31 0d 0a 2d 32 0d 0a 30 0d 0a 0d 0a 71 75  .-1..-2..0....qu
37bc0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
37bd0 45 4c 45 43 54 20 41 4c 4c 20 2b 20 2d 20 63 6f  ELECT ALL + - co
37be0 6c 31 20 2a 20 63 6f 6c 30 20 41 53 20 63 6f 6c  l1 * col0 AS col
37bf0 31 20 46 52 4f 4d 20 74 61 62 32 20 63 6f 72 30  1 FROM tab2 cor0
37c00 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 34 33 0d 0a 2d  ..----..-1343..-
37c10 32 31 37 0d 0a 2d 34 36 30 32 0d 0a 0d 0a 71 75  217..-4602....qu
37c20 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
37c30 45 4c 45 43 54 20 28 20 2b 20 74 61 62 31 2e 63  ELECT ( + tab1.c
37c40 6f 6c 30 20 29 20 2b 20 63 6f 6c 32 20 2a 20 28  ol0 ) + col2 * (
37c50 20 2b 20 63 6f 6c 30 20 29 20 2b 20 2b 20 63 6f   + col0 ) + + co
37c60 6c 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  l2 AS col2 FROM 
37c70 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 32 31 39 0d  tab1..----..219.
37c80 0a 33 37 36 39 0d 0a 37 38 35 36 0d 0a 0d 0a 73  .3769..7856....s
37c90 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c  kipif postgresql
37ca0 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65   # PostgreSQL re
37cb0 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72  quires AS when r
37cc0 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63  enaming output c
37cd0 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20  olumns..query I 
37ce0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
37cf0 44 49 53 54 49 4e 43 54 20 74 61 62 30 2e 63 6f  DISTINCT tab0.co
37d00 6c 30 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  l0 col0 FROM tab
37d10 30 2c 20 74 61 62 31 2c 20 74 61 62 31 20 41 53  0, tab1, tab1 AS
37d20 20 63 6f 72 30 2c 20 74 61 62 30 20 41 53 20 63   cor0, tab0 AS c
37d30 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 32 34 0d 0a 33  or1..----..24..3
37d40 35 0d 0a 38 39 0d 0a 0d 0a 71 75 65 72 79 20 49  5..89....query I
37d50 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
37d60 20 2b 20 74 61 62 32 2e 63 6f 6c 32 20 41 53 20   + tab2.col2 AS 
37d70 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 2c 20  col2 FROM tab2, 
37d80 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
37d90 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73  --..9 values has
37da0 68 69 6e 67 20 74 6f 20 35 39 31 31 62 61 63 35  hing to 5911bac5
37db0 31 34 34 31 66 34 66 66 36 34 30 62 32 61 32 62  1441f4ff640b2a2b
37dc0 37 32 31 65 61 38 65 33 0d 0a 0d 0a 71 75 65 72  721ea8e3....quer
37dd0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
37de0 45 43 54 20 41 4c 4c 20 2b 20 2d 20 63 6f 72 30  ECT ALL + - cor0
37df0 2e 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c 30 20 41  .col1 * - col0 A
37e00 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31  S col2 FROM tab1
37e10 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
37e20 31 30 34 30 0d 0a 36 34 30 0d 0a 37 38 0d 0a 0d  1040..640..78...
37e30 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
37e40 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63  ..SELECT ALL + c
37e50 6f 6c 30 20 2a 20 2b 20 63 6f 6c 32 20 41 53 20  ol0 * + col2 AS 
37e60 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 0d 0a  col1 FROM tab2..
37e70 2d 2d 2d 2d 0d 0a 31 38 39 0d 0a 32 30 32 38 0d  ----..189..2028.
37e80 0a 33 30 30 32 0d 0a 0d 0a 71 75 65 72 79 20 49  .3002....query I
37e90 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
37ea0 20 44 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c 32   DISTINCT + col2
37eb0 20 2a 20 2d 20 74 61 62 31 2e 63 6f 6c 32 20 46   * - tab1.col2 F
37ec0 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab1..----..
37ed0 2d 32 39 31 36 0d 0a 2d 33 32 34 39 0d 0a 2d 39  -2916..-3249..-9
37ee0 32 31 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  216....query I r
37ef0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
37f00 49 53 54 49 4e 43 54 20 31 30 20 46 52 4f 4d 20  ISTINCT 10 FROM 
37f10 74 61 62 31 2c 20 74 61 62 30 20 41 53 20 63 6f  tab1, tab0 AS co
37f20 72 30 2c 20 74 61 62 32 20 41 53 20 63 6f 72 31  r0, tab2 AS cor1
37f30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 0d 0a 0d 0a 71 75  ..----..10....qu
37f40 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
37f50 45 4c 45 43 54 20 37 31 20 2a 20 2d 20 32 33 20  ELECT 71 * - 23 
37f60 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
37f70 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 36 33 33 0d 0a  1..----..-1633..
37f80 2d 31 36 33 33 0d 0a 2d 31 36 33 33 0d 0a 0d 0a  -1633..-1633....
37f90 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
37fa0 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
37fb0 20 2d 20 28 20 2d 20 74 61 62 32 2e 63 6f 6c 30   - ( - tab2.col0
37fc0 20 29 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20   ) AS col0 FROM 
37fd0 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 37 0d 0a 37  tab2..----..7..7
37fe0 38 0d 0a 37 39 0d 0a 0d 0a 71 75 65 72 79 20 49  8..79....query I
37ff0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
38000 20 41 4c 4c 20 2b 20 63 6f 72 30 2e 63 6f 6c 30   ALL + cor0.col0
38010 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
38020 62 32 2c 20 74 61 62 30 20 41 53 20 63 6f 72 30  b2, tab0 AS cor0
38030 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73  ..----..9 values
38040 20 68 61 73 68 69 6e 67 20 74 6f 20 38 62 34 39   hashing to 8b49
38050 37 39 39 39 34 32 61 39 65 33 35 33 61 33 64 32  799942a9e353a3d2
38060 37 39 63 66 36 34 65 66 33 66 36 33 0d 0a 0d 0a  79cf64ef3f63....
38070 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
38080 0a 53 45 4c 45 43 54 20 41 4c 4c 20 31 30 20 2b  .SELECT ALL 10 +
38090 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62   + col0 FROM tab
380a0 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 34  0 cor0..----..34
380b0 0d 0a 34 35 0d 0a 39 39 0d 0a 0d 0a 71 75 65 72  ..45..99....quer
380c0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
380d0 45 43 54 20 2b 20 2d 20 28 20 63 6f 6c 31 20 29  ECT + - ( col1 )
380e0 20 2a 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c   * + col1 AS col
380f0 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  0 FROM tab0 AS c
38100 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 37 33 39 36  or0..----..-7396
38110 0d 0a 2d 38 32 38 31 0d 0a 2d 39 34 30 39 0d 0a  ..-8281..-9409..
38120 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
38130 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20  t..SELECT ALL - 
38140 31 34 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  14 AS col2 FROM 
38150 74 61 62 30 2c 20 74 61 62 31 20 41 53 20 63 6f  tab0, tab1 AS co
38160 72 30 20 43 52 4f 53 53 20 4a 4f 49 4e 20 74 61  r0 CROSS JOIN ta
38170 62 31 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c  b1..----..27 val
38180 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 63  ues hashing to c
38190 32 62 66 30 65 32 34 32 30 64 32 32 63 64 35 38  2bf0e2420d22cd58
381a0 64 37 65 65 33 62 33 30 38 32 37 61 66 63 63 0d  d7ee3b30827afcc.
381b0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
381c0 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c  rt..SELECT - col
381d0 30 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c 30  0 + col1 AS col0
381e0 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d   FROM tab1..----
381f0 0d 0a 2d 35 34 0d 0a 2d 36 37 0d 0a 32 33 0d 0a  ..-54..-67..23..
38200 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
38210 74 0d 0a 53 45 4c 45 43 54 20 2d 20 39 20 41 53  t..SELECT - 9 AS
38220 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 2c   col2 FROM tab0,
38230 20 74 61 62 31 20 41 53 20 63 6f 72 30 20 43 52   tab1 AS cor0 CR
38240 4f 53 53 20 4a 4f 49 4e 20 74 61 62 32 2c 20 74  OSS JOIN tab2, t
38250 61 62 32 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d  ab2 AS cor1..---
38260 2d 0d 0a 38 31 20 76 61 6c 75 65 73 20 68 61 73  -..81 values has
38270 68 69 6e 67 20 74 6f 20 65 61 32 65 65 34 38 62  hing to ea2ee48b
38280 36 64 62 30 65 64 30 65 39 66 38 37 37 31 31 64  6db0ed0e9f87711d
38290 33 65 65 65 66 30 34 39 0d 0a 0d 0a 6f 6e 6c 79  3eeef049....only
382a0 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f  if mysql # suppo
382b0 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65  rt for MySQL spe
382c0 63 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70  cific system typ
382d0 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71  es and syntax..q
382e0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
382f0 61 62 65 6c 2d 31 36 30 33 0d 0a 53 45 4c 45 43  abel-1603..SELEC
38300 54 20 44 49 53 54 49 4e 43 54 20 2d 20 43 41 53  T DISTINCT - CAS
38310 54 28 20 63 6f 6c 30 20 41 53 20 53 49 47 4e 45  T( col0 AS SIGNE
38320 44 20 29 20 2b 20 2d 20 63 6f 6c 31 20 2f 20 43  D ) + - col1 / C
38330 41 53 54 28 20 4e 55 4c 4c 20 41 53 20 53 49 47  AST( NULL AS SIG
38340 4e 45 44 20 29 20 46 52 4f 4d 20 74 61 62 32 0d  NED ) FROM tab2.
38350 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73  .----..NULL....s
38360 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
38370 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
38380 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
38390 62 65 6c 2d 31 36 30 33 0d 0a 53 45 4c 45 43 54  bel-1603..SELECT
383a0 20 44 49 53 54 49 4e 43 54 20 2d 20 43 41 53 54   DISTINCT - CAST
383b0 20 28 20 63 6f 6c 30 20 41 53 20 49 4e 54 45 47   ( col0 AS INTEG
383c0 45 52 20 29 20 2b 20 2d 20 63 6f 6c 31 20 2f 20  ER ) + - col1 / 
383d0 43 41 53 54 20 28 20 4e 55 4c 4c 20 41 53 20 49  CAST ( NULL AS I
383e0 4e 54 45 47 45 52 20 29 20 46 52 4f 4d 20 74 61  NTEGER ) FROM ta
383f0 62 32 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a  b2..----..NULL..
38400 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
38410 74 0d 0a 53 45 4c 45 43 54 20 2b 20 38 35 20 41  t..SELECT + 85 A
38420 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32  S col0 FROM tab2
38430 0d 0a 2d 2d 2d 2d 0d 0a 38 35 0d 0a 38 35 0d 0a  ..----..85..85..
38440 38 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  85....query I ro
38450 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
38460 34 35 20 2d 20 2b 20 63 6f 6c 31 20 46 52 4f 4d  45 - + col1 FROM
38470 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 39 0d   tab1..----..19.
38480 0a 33 32 0d 0a 33 35 0d 0a 0d 0a 71 75 65 72 79  .32..35....query
38490 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
384a0 43 54 20 2b 20 63 6f 6c 32 20 2a 20 2b 20 63 6f  CT + col2 * + co
384b0 6c 30 20 2b 20 2d 20 63 6f 6c 31 20 2a 20 63 6f  l0 + - col1 * co
384c0 6c 32 20 2a 20 63 6f 6c 31 20 41 53 20 63 6f 6c  l2 * col1 AS col
384d0 32 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d  2 FROM tab2..---
384e0 2d 0d 0a 2d 32 35 37 35 38 0d 0a 2d 37 39 38 30  -..-25758..-7980
384f0 0d 0a 2d 38 38 34 37 38 0d 0a 0d 0a 71 75 65 72  ..-88478....quer
38500 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
38510 45 43 54 20 44 49 53 54 49 4e 43 54 20 37 39 20  ECT DISTINCT 79 
38520 2b 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 41 53  + + cor0.col1 AS
38530 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20   col0 FROM tab0 
38540 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
38550 36 35 0d 0a 31 37 30 0d 0a 31 37 36 0d 0a 0d 0a  65..170..176....
38560 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
38570 0a 53 45 4c 45 43 54 20 2d 20 2b 20 34 38 20 2a  .SELECT - + 48 *
38580 20 2d 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62   - col1 FROM tab
38590 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
385a0 0a 34 31 32 38 0d 0a 34 33 36 38 0d 0a 34 36 35  .4128..4368..465
385b0 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  6....query I row
385c0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
385d0 54 49 4e 43 54 20 2b 20 63 6f 6c 32 20 2a 20 63  TINCT + col2 * c
385e0 6f 6c 31 20 2b 20 2d 20 63 6f 6c 30 20 41 53 20  ol1 + - col0 AS 
385f0 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41  col1 FROM tab2 A
38600 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 34  S cor0..----..14
38610 35 36 0d 0a 35 36 37 0d 0a 38 33 30 0d 0a 0d 0a  56..567..830....
38620 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
38630 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
38640 20 2d 20 39 33 20 46 52 4f 4d 20 74 61 62 30 2c   - 93 FROM tab0,
38650 20 74 61 62 31 20 41 53 20 63 6f 72 30 2c 20 74   tab1 AS cor0, t
38660 61 62 32 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d  ab2 AS cor1..---
38670 2d 0d 0a 2d 39 33 0d 0a 0d 0a 71 75 65 72 79 20  -..-93....query 
38680 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
38690 54 20 63 6f 6c 30 20 2b 20 63 6f 6c 32 20 2a 20  T col0 + col2 * 
386a0 63 6f 72 30 2e 63 6f 6c 31 20 2b 20 2d 20 63 6f  cor0.col1 + - co
386b0 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l2 FROM tab1 AS 
386c0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 33 32  cor0..----..1232
386d0 0d 0a 31 33 35 33 0d 0a 35 37 37 0d 0a 0d 0a 71  ..1353..577....q
386e0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
386f0 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 30 20  SELECT ALL col0 
38700 2d 20 2b 20 37 34 20 41 53 20 63 6f 6c 30 20 46  - + 74 AS col0 F
38710 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab0..----..
38720 2d 33 39 0d 0a 2d 35 30 0d 0a 31 35 0d 0a 0d 0a  -39..-50..15....
38730 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
38740 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 74 61  .SELECT ALL + ta
38750 62 32 2e 63 6f 6c 30 20 2d 20 30 20 46 52 4f 4d  b2.col0 - 0 FROM
38760 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 37 0d 0a   tab2..----..7..
38770 37 38 0d 0a 37 39 0d 0a 0d 0a 71 75 65 72 79 20  78..79....query 
38780 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
38790 54 20 41 4c 4c 20 63 6f 6c 32 20 2d 20 28 20 63  T ALL col2 - ( c
387a0 6f 6c 32 20 29 20 46 52 4f 4d 20 74 61 62 32 0d  ol2 ) FROM tab2.
387b0 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a  .----..0..0..0..
387c0 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65  ..skipif postgre
387d0 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c  sql # PostgreSQL
387e0 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65   requires AS whe
387f0 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75  n renaming outpu
38800 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79  t columns..query
38810 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
38820 43 54 20 38 39 20 63 6f 6c 30 20 46 52 4f 4d 20  CT 89 col0 FROM 
38830 74 61 62 32 2c 20 74 61 62 31 20 63 6f 72 30 0d  tab2, tab1 cor0.
38840 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20  .----..9 values 
38850 68 61 73 68 69 6e 67 20 74 6f 20 35 63 38 34 32  hashing to 5c842
38860 38 65 39 66 31 65 37 64 65 33 64 30 39 63 62 30  8e9f1e7de3d09cb0
38870 38 31 34 62 34 63 63 31 37 34 33 0d 0a 0d 0a 71  814b4cc1743....q
38880 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
38890 53 45 4c 45 43 54 20 2d 20 63 6f 6c 30 20 2a 20  SELECT - col0 * 
388a0 28 20 2b 20 63 6f 6c 31 20 29 20 2d 20 63 6f 6c  ( + col1 ) - col
388b0 30 20 46 52 4f 4d 20 74 61 62 32 20 63 6f 72 30  0 FROM tab2 cor0
388c0 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 34 32 32 0d 0a 2d  ..----..-1422..-
388d0 32 32 34 0d 0a 2d 34 36 38 30 0d 0a 0d 0a 6f 6e  224..-4680....on
388e0 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
388f0 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
38900 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
38910 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
38920 6f 72 74 20 6c 61 62 65 6c 2d 31 36 31 37 0d 0a  ort label-1617..
38930 53 45 4c 45 43 54 20 2d 20 28 20 2b 20 63 6f 6c  SELECT - ( + col
38940 30 20 29 20 44 49 56 20 2d 20 63 6f 6c 31 20 2b  0 ) DIV - col1 +
38950 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20   col1 FROM tab0 
38960 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 38 36 0d 0a  cor0..----..86..
38970 39 31 0d 0a 39 37 0d 0a 0d 0a 73 6b 69 70 69 66  91..97....skipif
38980 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
38990 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
389a0 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
389b0 36 31 37 0d 0a 53 45 4c 45 43 54 20 2d 20 28 20  617..SELECT - ( 
389c0 2b 20 63 6f 6c 30 20 29 20 2f 20 2d 20 63 6f 6c  + col0 ) / - col
389d0 31 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61  1 + col1 FROM ta
389e0 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 38  b0 cor0..----..8
389f0 36 0d 0a 39 31 0d 0a 39 37 0d 0a 0d 0a 6f 6e 6c  6..91..97....onl
38a00 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20  yif mysql # use 
38a10 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72  DIV operator for
38a20 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f   integer divisio
38a30 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  n..query I rowso
38a40 72 74 20 6c 61 62 65 6c 2d 31 36 31 38 0d 0a 53  rt label-1618..S
38a50 45 4c 45 43 54 20 41 4c 4c 20 2b 20 2d 20 39 36  ELECT ALL + - 96
38a60 20 44 49 56 20 2b 20 63 6f 6c 30 20 2d 20 63 6f   DIV + col0 - co
38a70 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l0 FROM tab1 AS 
38a80 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 35 0d  cor0..----..-35.
38a90 0a 2d 36 35 0d 0a 2d 38 31 0d 0a 0d 0a 73 6b 69  .-65..-81....ski
38aa0 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
38ab0 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
38ac0 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
38ad0 6c 2d 31 36 31 38 0d 0a 53 45 4c 45 43 54 20 41  l-1618..SELECT A
38ae0 4c 4c 20 2b 20 2d 20 39 36 20 2f 20 2b 20 63 6f  LL + - 96 / + co
38af0 6c 30 20 2d 20 63 6f 6c 30 20 46 52 4f 4d 20 74  l0 - col0 FROM t
38b00 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
38b10 2d 0d 0a 2d 33 35 0d 0a 2d 36 35 0d 0a 2d 38 31  -..-35..-65..-81
38b20 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
38b30 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f  ort..SELECT - co
38b40 72 30 2e 63 6f 6c 31 20 2a 20 28 20 63 6f 72 30  r0.col1 * ( cor0
38b50 2e 63 6f 6c 31 20 29 20 2b 20 63 6f 72 30 2e 63  .col1 ) + cor0.c
38b60 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  ol0 AS col1 FROM
38b70 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
38b80 2d 2d 2d 0d 0a 2d 37 33 37 32 0d 0a 2d 38 31 39  ---..-7372..-819
38b90 32 0d 0a 2d 39 33 37 34 0d 0a 0d 0a 71 75 65 72  2..-9374....quer
38ba0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
38bb0 45 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c  ECT DISTINCT col
38bc0 32 20 2b 20 2d 20 63 6f 6c 30 20 2a 20 63 6f 6c  2 + - col0 * col
38bd0 32 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 46 52  2 + cor0.col0 FR
38be0 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d  OM tab1 cor0..--
38bf0 2d 2d 0d 0a 2d 31 30 35 0d 0a 2d 33 35 32 37 0d  --..-105..-3527.
38c00 0a 2d 37 35 30 34 0d 0a 0d 0a 71 75 65 72 79 20  .-7504....query 
38c10 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
38c20 54 20 34 38 20 2a 20 63 6f 72 30 2e 63 6f 6c 31  T 48 * cor0.col1
38c30 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20   + col0 AS col1 
38c40 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
38c50 30 0d 0a 2d 2d 2d 2d 0d 0a 31 34 39 35 0d