sqllogictest
Hex Artifact Content
Not logged in

Artifact 9800111e43805cfd9deef07465c642ce4d69363d:


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 73 6b 69 70 69 66 20 70 6f 73 74 67 72  ...skipif postgr
02d0: 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51  esql # PostgreSQ
02e0: 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68  L requires AS wh
02f0: 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70  en renaming outp
0300: 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72  ut columns..quer
0310: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
0320: 45 43 54 20 2b 20 2b 20 39 31 20 2d 20 2b 20 63  ECT + + 91 - + c
0330: 6f 6c 30 20 2a 20 2b 20 28 20 63 6f 6c 30 20 29  ol0 * + ( col0 )
0340: 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20   col0 FROM tab1 
0350: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
0360: 34 30 30 35 0d 0a 2d 36 33 30 39 0d 0a 38 32 0d  4005..-6309..82.
0370: 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
0380: 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74  # use DIV operat
0390: 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64  or for integer d
03a0: 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49  ivision..query I
03b0: 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
03c0: 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 31 20 44 49  ..SELECT col1 DI
03d0: 56 20 28 20 2d 20 63 6f 6c 31 20 29 20 2b 20 63  V ( - col1 ) + c
03e0: 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  ol0 AS col1 FROM
03f0: 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 36 0d 0a   tab2..----..6..
0400: 37 37 0d 0a 37 38 0d 0a 0d 0a 73 6b 69 70 69 66  77..78....skipif
0410: 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
0420: 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
0430: 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
0440: 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 31 20 2f 20  ..SELECT col1 / 
0450: 28 20 2d 20 63 6f 6c 31 20 29 20 2b 20 63 6f 6c  ( - col1 ) + col
0460: 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  0 AS col1 FROM t
0470: 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 36 0d 0a 37 37  ab2..----..6..77
0480: 0d 0a 37 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..78....query I 
0490: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
04a0: 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 72 30 2e  DISTINCT - cor0.
04b0: 63 6f 6c 30 20 2a 20 36 35 20 41 53 20 63 6f 6c  col0 * 65 AS col
04c0: 30 20 46 52 4f 4d 20 74 61 62 31 2c 20 74 61 62  0 FROM tab1, tab
04d0: 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
04e0: 0a 2d 34 35 35 0d 0a 2d 35 30 37 30 0d 0a 2d 35  .-455..-5070..-5
04f0: 31 33 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  135....query I r
0500: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
0510: 4c 4c 20 2b 20 2d 20 63 6f 6c 30 20 2b 20 63 6f  LL + - col0 + co
0520: 6c 31 20 2a 20 63 6f 6c 32 20 46 52 4f 4d 20 74  l1 * col2 FROM t
0530: 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
0540: 2d 0d 0a 32 38 31 34 0d 0a 36 32 0d 0a 37 33 37  -..2814..62..737
0550: 33 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  3....onlyif mysq
0560: 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20  l # support for 
0570: 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63 20 73  MySQL specific s
0580: 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20  ystem types and 
0590: 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20  syntax..query I 
05a0: 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 34 0d  rowsort label-4.
05b0: 0a 53 45 4c 45 43 54 20 2d 20 2d 20 63 6f 6c 30  .SELECT - - col0
05c0: 20 2b 20 43 41 53 54 28 20 63 6f 6c 30 20 41 53   + CAST( col0 AS
05d0: 20 53 49 47 4e 45 44 20 29 20 2a 20 2b 20 63 6f   SIGNED ) * + co
05e0: 6c 32 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  l2 col0 FROM tab
05f0: 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
0600: 0a 31 36 35 0d 0a 33 37 31 32 0d 0a 37 37 36 30  .165..3712..7760
0610: 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67  ....skipif postg
0620: 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53  resql # PostgreS
0630: 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77  QL requires AS w
0640: 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74  hen renaming out
0650: 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 73 6b 69  put columns..ski
0660: 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
0670: 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
0680: 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
0690: 6c 2d 34 0d 0a 53 45 4c 45 43 54 20 2d 20 2d 20  l-4..SELECT - - 
06a0: 63 6f 6c 30 20 2b 20 43 41 53 54 20 28 20 63 6f  col0 + CAST ( co
06b0: 6c 30 20 41 53 20 49 4e 54 45 47 45 52 20 29 20  l0 AS INTEGER ) 
06c0: 2a 20 2b 20 63 6f 6c 32 20 63 6f 6c 30 20 46 52  * + col2 col0 FR
06d0: 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
06e0: 0a 2d 2d 2d 2d 0d 0a 31 36 35 0d 0a 33 37 31 32  .----..165..3712
06f0: 0d 0a 37 37 36 30 0d 0a 0d 0a 71 75 65 72 79 20  ..7760....query 
0700: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
0710: 54 20 41 4c 4c 20 2b 20 2d 20 63 6f 6c 31 20 2b  T ALL + - col1 +
0720: 20 34 38 20 2a 20 2d 20 63 6f 6c 30 20 2a 20 2d   48 * - col0 * -
0730: 20 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46 52   col1 AS col2 FR
0740: 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
0750: 0a 2d 2d 2d 2d 0d 0a 33 30 37 31 30 0d 0a 33 37  .----..30710..37
0760: 31 38 0d 0a 34 39 39 30 37 0d 0a 0d 0a 6f 6e 6c  18..49907....onl
0770: 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70  yif mysql # supp
0780: 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70  ort for MySQL sp
0790: 65 63 69 66 69 63 20 73 79 73 74 65 6d 20 74 79  ecific system ty
07a0: 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a  pes and syntax..
07b0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
07c0: 6c 61 62 65 6c 2d 36 0d 0a 53 45 4c 45 43 54 20  label-6..SELECT 
07d0: 44 49 53 54 49 4e 43 54 20 2d 20 43 41 53 54 28  DISTINCT - CAST(
07e0: 20 4e 55 4c 4c 20 41 53 20 53 49 47 4e 45 44 20   NULL AS SIGNED 
07f0: 29 20 2a 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61  ) * col2 FROM ta
0800: 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e  b0 cor0..----..N
0810: 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  ULL....skipif my
0820: 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
0830: 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
0840: 77 73 6f 72 74 20 6c 61 62 65 6c 2d 36 0d 0a 53  wsort label-6..S
0850: 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d  ELECT DISTINCT -
0860: 20 43 41 53 54 20 28 20 4e 55 4c 4c 20 41 53 20   CAST ( NULL AS 
0870: 49 4e 54 45 47 45 52 20 29 20 2a 20 63 6f 6c 32  INTEGER ) * col2
0880: 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d   FROM tab0 cor0.
0890: 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 6f  .----..NULL....o
08a0: 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75  nlyif mysql # su
08b0: 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20  pport for MySQL 
08c0: 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20  specific system 
08d0: 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78  types and syntax
08e0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
08f0: 74 20 6c 61 62 65 6c 2d 37 0d 0a 53 45 4c 45 43  t label-7..SELEC
0900: 54 20 2d 20 43 41 53 54 28 20 63 6f 6c 30 20 41  T - CAST( col0 A
0910: 53 20 53 49 47 4e 45 44 20 29 20 2a 20 63 6f 6c  S SIGNED ) * col
0920: 31 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  1 AS col0 FROM t
0930: 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
0940: 2d 0d 0a 2d 31 30 34 30 0d 0a 2d 36 34 30 0d 0a  -..-1040..-640..
0950: 2d 37 38 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  -78....skipif my
0960: 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
0970: 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
0980: 77 73 6f 72 74 20 6c 61 62 65 6c 2d 37 0d 0a 53  wsort label-7..S
0990: 45 4c 45 43 54 20 2d 20 43 41 53 54 20 28 20 63  ELECT - CAST ( c
09a0: 6f 6c 30 20 41 53 20 49 4e 54 45 47 45 52 20 29  ol0 AS INTEGER )
09b0: 20 2a 20 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20   * col1 AS col0 
09c0: 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
09d0: 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 34 30 0d 0a  0..----..-1040..
09e0: 2d 36 34 30 0d 0a 2d 37 38 0d 0a 0d 0a 71 75 65  -640..-78....que
09f0: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
0a00: 4c 45 43 54 20 41 4c 4c 20 2b 20 2b 20 63 6f 6c  LECT ALL + + col
0a10: 30 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 46 52  0 + cor0.col1 FR
0a20: 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
0a30: 0a 2d 2d 2d 2d 0d 0a 32 39 0d 0a 37 34 0d 0a 39  .----..29..74..9
0a40: 33 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  3....onlyif mysq
0a50: 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20  l # support for 
0a60: 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63 20 73  MySQL specific s
0a70: 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20  ystem types and 
0a80: 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20  syntax..query I 
0a90: 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 39 0d  rowsort label-9.
0aa0: 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 28 20  .SELECT ALL - ( 
0ab0: 2d 20 39 32 20 29 20 2a 20 2d 20 63 6f 6c 31 20  - 92 ) * - col1 
0ac0: 2a 20 2b 20 43 41 53 54 28 20 63 6f 6c 31 20 2a  * + CAST( col1 *
0ad0: 20 63 6f 6c 31 20 41 53 20 53 49 47 4e 45 44 20   col1 AS SIGNED 
0ae0: 29 20 2b 20 63 6f 6c 32 20 41 53 20 63 6f 6c 30  ) + col2 AS col0
0af0: 20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d   FROM tab1 cor0.
0b00: 0a 2d 2d 2d 2d 0d 0a 2d 31 36 31 36 39 33 38 0d  .----..-1616938.
0b10: 0a 2d 32 30 32 30 32 38 0d 0a 2d 39 31 39 34 33  .-202028..-91943
0b20: 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
0b30: 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
0b40: 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
0b50: 72 74 20 6c 61 62 65 6c 2d 39 0d 0a 53 45 4c 45  rt label-9..SELE
0b60: 43 54 20 41 4c 4c 20 2d 20 28 20 2d 20 39 32 20  CT ALL - ( - 92 
0b70: 29 20 2a 20 2d 20 63 6f 6c 31 20 2a 20 2b 20 43  ) * - col1 * + C
0b80: 41 53 54 20 28 20 63 6f 6c 31 20 2a 20 63 6f 6c  AST ( col1 * col
0b90: 31 20 41 53 20 49 4e 54 45 47 45 52 20 29 20 2b  1 AS INTEGER ) +
0ba0: 20 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46 52   col2 AS col0 FR
0bb0: 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d  OM tab1 cor0..--
0bc0: 2d 2d 0d 0a 2d 31 36 31 36 39 33 38 0d 0a 2d 32  --..-1616938..-2
0bd0: 30 32 30 32 38 0d 0a 2d 39 31 39 34 33 0d 0a 0d  02028..-91943...
0be0: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
0bf0: 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
0c00: 54 20 2b 20 34 33 20 2b 20 37 39 20 46 52 4f 4d  T + 43 + 79 FROM
0c10: 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
0c20: 2d 2d 2d 0d 0a 31 32 32 0d 0a 0d 0a 71 75 65 72  ---..122....quer
0c30: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
0c40: 45 43 54 20 37 37 20 2a 20 63 6f 6c 32 20 46 52  ECT 77 * col2 FR
0c50: 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
0c60: 0a 2d 2d 2d 2d 0d 0a 32 30 30 32 0d 0a 32 30 37  .----..2002..207
0c70: 39 0d 0a 32 39 32 36 0d 0a 0d 0a 71 75 65 72 79  9..2926....query
0c80: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
0c90: 43 54 20 41 4c 4c 20 2b 20 31 30 20 2b 20 2b 20  CT ALL + 10 + + 
0ca0: 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c 30 20 46 52  col1 * + col0 FR
0cb0: 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
0cc0: 0a 2d 2d 2d 2d 0d 0a 32 30 37 34 0d 0a 33 34 30  .----..2074..340
0cd0: 35 0d 0a 38 31 30 39 0d 0a 0d 0a 71 75 65 72 79  5..8109....query
0ce0: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
0cf0: 43 54 20 2d 20 2b 20 28 20 37 35 20 29 20 41 53  CT - + ( 75 ) AS
0d00: 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20   col1 FROM tab1 
0d10: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 37 35 0d  cor0..----..-75.
0d20: 0a 2d 37 35 0d 0a 2d 37 35 0d 0a 0d 0a 6f 6e 6c  .-75..-75....onl
0d30: 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20  yif mysql # use 
0d40: 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72  DIV operator for
0d50: 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f   integer divisio
0d60: 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  n..query I rowso
0d70: 72 74 20 6c 61 62 65 6c 2d 31 34 0d 0a 53 45 4c  rt label-14..SEL
0d80: 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 28  ECT DISTINCT - (
0d90: 20 63 6f 6c 32 20 29 20 2b 20 2d 20 63 6f 6c 32   col2 ) + - col2
0da0: 20 44 49 56 20 63 6f 6c 31 20 41 53 20 63 6f 6c   DIV col1 AS col
0db0: 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  0 FROM tab2 AS c
0dc0: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 36 0d 0a  or0..----..-26..
0dd0: 2d 32 37 0d 0a 2d 34 30 0d 0a 0d 0a 73 6b 69 70  -27..-40....skip
0de0: 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
0df0: 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
0e00: 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
0e10: 2d 31 34 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  -14..SELECT DIST
0e20: 49 4e 43 54 20 2d 20 28 20 63 6f 6c 32 20 29 20  INCT - ( col2 ) 
0e30: 2b 20 2d 20 63 6f 6c 32 20 2f 20 63 6f 6c 31 20  + - col2 / col1 
0e40: 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
0e50: 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
0e60: 0a 2d 32 36 0d 0a 2d 32 37 0d 0a 2d 34 30 0d 0a  .-26..-27..-40..
0e70: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
0e80: 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
0e90: 43 54 20 2d 20 2d 20 63 6f 6c 31 20 2a 20 2d 20  CT - - col1 * - 
0ea0: 34 37 20 2b 20 2b 20 63 6f 6c 30 20 2b 20 2b 20  47 + + col0 + + 
0eb0: 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46 52 4f  col0 AS col0 FRO
0ec0: 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
0ed0: 2d 2d 2d 2d 0d 0a 2d 31 32 31 36 0d 0a 2d 33 34  ----..-1216..-34
0ee0: 32 0d 0a 2d 34 35 31 0d 0a 0d 0a 71 75 65 72 79  2..-451....query
0ef0: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
0f00: 43 54 20 2b 20 2b 20 63 6f 6c 30 20 2b 20 2b 20  CT + + col0 + + 
0f10: 63 6f 6c 32 20 2a 20 63 6f 6c 32 20 41 53 20 63  col2 * col2 AS c
0f20: 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol0 FROM tab0 AS
0f30: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 31   cor0..----..111
0f40: 33 0d 0a 33 36 0d 0a 36 38 31 33 0d 0a 0d 0a 71  3..36..6813....q
0f50: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
0f60: 53 45 4c 45 43 54 20 2b 20 2d 20 35 35 20 41 53  SELECT + - 55 AS
0f70: 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20   col0 FROM tab2 
0f80: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 35 0d  cor0..----..-55.
0f90: 0a 2d 35 35 0d 0a 2d 35 35 0d 0a 0d 0a 71 75 65  .-55..-55....que
0fa0: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
0fb0: 4c 45 43 54 20 2d 20 63 6f 6c 31 20 2a 20 63 6f  LECT - col1 * co
0fc0: 6c 30 20 2b 20 2b 20 63 6f 6c 31 20 2a 20 2d 20  l0 + + col1 * - 
0fd0: 74 61 62 32 2e 63 6f 6c 31 20 46 52 4f 4d 20 74  tab2.col1 FROM t
0fe0: 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 37 38  ab2..----..-1178
0ff0: 0d 0a 2d 31 36 33 32 0d 0a 2d 38 30 38 33 0d 0a  ..-1632..-8083..
1000: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1010: 74 0d 0a 53 45 4c 45 43 54 20 35 35 20 41 53 20  t..SELECT 55 AS 
1020: 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 2c 20  col0 FROM tab0, 
1030: 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
1040: 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73  --..9 values has
1050: 68 69 6e 67 20 74 6f 20 31 36 32 36 62 64 33 30  hing to 1626bd30
1060: 30 38 61 62 64 39 66 31 38 63 63 38 38 63 64 65  08abd9f18cc88cde
1070: 63 66 37 62 36 34 64 30 0d 0a 0d 0a 71 75 65 72  cf7b64d0....quer
1080: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
1090: 45 43 54 20 2b 20 28 20 63 6f 6c 32 20 29 20 2b  ECT + ( col2 ) +
10a0: 20 2d 20 74 61 62 32 2e 63 6f 6c 31 20 2a 20 63   - tab2.col1 * c
10b0: 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d  ol1 FROM tab2..-
10c0: 2d 2d 2d 0d 0a 2d 32 35 31 0d 0a 2d 33 34 35 35  ---..-251..-3455
10d0: 0d 0a 2d 39 33 34 0d 0a 0d 0a 71 75 65 72 79 20  ..-934....query 
10e0: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
10f0: 54 20 44 49 53 54 49 4e 43 54 20 2b 20 39 38 20  T DISTINCT + 98 
1100: 2a 20 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46  * col2 AS col0 F
1110: 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab1..----..
1120: 35 32 39 32 0d 0a 35 35 38 36 0d 0a 39 34 30 38  5292..5586..9408
1130: 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67  ....skipif postg
1140: 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53  resql # PostgreS
1150: 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77  QL requires AS w
1160: 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74  hen renaming out
1170: 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65  put columns..que
1180: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
1190: 4c 45 43 54 20 2d 20 2b 20 63 6f 6c 31 20 2a 20  LECT - + col1 * 
11a0: 63 6f 6c 32 20 2b 20 63 6f 6c 31 20 63 6f 6c 31  col2 + col1 col1
11b0: 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d   FROM tab0 cor0.
11c0: 0a 2d 2d 2d 2d 0d 0a 2d 32 37 35 32 0d 0a 2d 37  .----..-2752..-7
11d0: 33 37 31 0d 0a 30 0d 0a 0d 0a 71 75 65 72 79 20  371..0....query 
11e0: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
11f0: 54 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 2b 20  T + cor0.col2 + 
1200: 2d 20 37 39 20 2a 20 2b 20 63 6f 6c 31 20 41 53  - 79 * + col1 AS
1210: 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20   col0 FROM tab2 
1220: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
1230: 31 33 30 35 0d 0a 2d 32 34 32 32 0d 0a 2d 34 36  1305..-2422..-46
1240: 33 35 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  35....onlyif mys
1250: 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65  ql # use DIV ope
1260: 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65  rator for intege
1270: 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72  r division..quer
1280: 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
1290: 6c 2d 32 34 0d 0a 53 45 4c 45 43 54 20 2d 20 63  l-24..SELECT - c
12a0: 6f 6c 31 20 44 49 56 20 33 39 20 46 52 4f 4d 20  ol1 DIV 39 FROM 
12b0: 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
12c0: 2d 2d 0d 0a 2d 32 0d 0a 2d 32 0d 0a 2d 32 0d 0a  --..-2..-2..-2..
12d0: 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
12e0: 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
12f0: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1300: 20 6c 61 62 65 6c 2d 32 34 0d 0a 53 45 4c 45 43   label-24..SELEC
1310: 54 20 2d 20 63 6f 6c 31 20 2f 20 33 39 20 46 52  T - col1 / 39 FR
1320: 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
1330: 0a 2d 2d 2d 2d 0d 0a 2d 32 0d 0a 2d 32 0d 0a 2d  .----..-2..-2..-
1340: 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  2....query I row
1350: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c  sort..SELECT col
1360: 31 20 2b 20 63 6f 6c 30 20 2b 20 63 6f 6c 31 20  1 + col0 + col1 
1370: 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
1380: 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 39  0 cor0..----..19
1390: 36 0d 0a 32 32 39 0d 0a 32 37 31 0d 0a 0d 0a 6f  6..229..271....o
13a0: 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75  nlyif mysql # su
13b0: 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20  pport for MySQL 
13c0: 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20  specific system 
13d0: 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78  types and syntax
13e0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
13f0: 74 20 6c 61 62 65 6c 2d 32 36 0d 0a 53 45 4c 45  t label-26..SELE
1400: 43 54 20 41 4c 4c 20 2d 20 2b 20 63 6f 6c 30 20  CT ALL - + col0 
1410: 2b 20 2b 20 43 41 53 54 28 20 4e 55 4c 4c 20 41  + + CAST( NULL A
1420: 53 20 44 45 43 49 4d 41 4c 20 29 20 2a 20 2b 20  S DECIMAL ) * + 
1430: 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41  col1 FROM tab0 A
1440: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55  S cor0..----..NU
1450: 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a  LL..NULL..NULL..
1460: 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
1470: 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
1480: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1490: 20 6c 61 62 65 6c 2d 32 36 0d 0a 53 45 4c 45 43   label-26..SELEC
14a0: 54 20 41 4c 4c 20 2d 20 2b 20 63 6f 6c 30 20 2b  T ALL - + col0 +
14b0: 20 2b 20 43 41 53 54 20 28 20 4e 55 4c 4c 20 41   + CAST ( NULL A
14c0: 53 20 52 45 41 4c 20 29 20 2a 20 2b 20 63 6f 6c  S REAL ) * + col
14d0: 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  1 FROM tab0 AS c
14e0: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d  or0..----..NULL.
14f0: 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73  .NULL..NULL....s
1500: 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c  kipif postgresql
1510: 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65   # PostgreSQL re
1520: 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72  quires AS when r
1530: 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63  enaming output c
1540: 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20  olumns..query I 
1550: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
1560: 41 4c 4c 20 2b 20 2d 20 63 6f 6c 31 20 2b 20 2d  ALL + - col1 + -
1570: 20 63 6f 6c 30 20 63 6f 6c 30 20 46 52 4f 4d 20   col0 col0 FROM 
1580: 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab0 cor0..----.
1590: 0a 2d 31 31 30 0d 0a 2d 31 33 32 0d 0a 2d 31 38  .-110..-132..-18
15a0: 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  0....onlyif mysq
15b0: 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72  l # use DIV oper
15c0: 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72  ator for integer
15d0: 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79   division..query
15e0: 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
15f0: 2d 32 38 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f  -28..SELECT - co
1600: 6c 31 20 44 49 56 20 2b 20 63 6f 72 30 2e 63 6f  l1 DIV + cor0.co
1610: 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 63 6f 72  l0 FROM tab2 cor
1620: 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 0d 0a 30 0d 0a  0..----..-4..0..
1630: 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  0....skipif mysq
1640: 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
1650: 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
1660: 6f 72 74 20 6c 61 62 65 6c 2d 32 38 0d 0a 53 45  ort label-28..SE
1670: 4c 45 43 54 20 2d 20 63 6f 6c 31 20 2f 20 2b 20  LECT - col1 / + 
1680: 63 6f 72 30 2e 63 6f 6c 30 20 46 52 4f 4d 20 74  cor0.col0 FROM t
1690: 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab2 cor0..----..
16a0: 2d 34 0d 0a 30 0d 0a 30 0d 0a 0d 0a 71 75 65 72  -4..0..0....quer
16b0: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
16c0: 45 43 54 20 63 6f 72 30 2e 63 6f 6c 31 20 2a 20  ECT cor0.col1 * 
16d0: 2b 20 32 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20  + 2 + cor0.col2 
16e0: 2a 20 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46  * col0 AS col1 F
16f0: 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
1700: 0d 0a 2d 2d 2d 2d 0d 0a 32 31 34 36 0d 0a 32 35  ..----..2146..25
1710: 31 0d 0a 33 30 33 36 0d 0a 0d 0a 71 75 65 72 79  1..3036....query
1720: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
1730: 43 54 20 2b 20 63 6f 6c 30 20 2a 20 39 34 20 41  CT + col0 * 94 A
1740: 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32  S col2 FROM tab2
1750: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
1760: 36 35 38 0d 0a 37 33 33 32 0d 0a 37 34 32 36 0d  658..7332..7426.
1770: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
1780: 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
1790: 4e 43 54 20 2d 20 33 35 20 2b 20 2d 20 63 6f 6c  NCT - 35 + - col
17a0: 32 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d  2 FROM tab0..---
17b0: 2d 0d 0a 2d 31 31 37 0d 0a 2d 33 36 0d 0a 2d 36  -..-117..-36..-6
17c0: 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  8....query I row
17d0: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
17e0: 20 33 31 20 2a 20 2b 20 74 61 62 31 2e 63 6f 6c   31 * + tab1.col
17f0: 30 20 2b 20 2b 20 63 6f 6c 31 20 2a 20 63 6f 6c  0 + + col1 * col
1800: 32 20 2a 20 2b 20 63 6f 6c 31 20 2b 20 2b 20 63  2 * + col1 + + c
1810: 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d  ol0 FROM tab1..-
1820: 2d 2d 2d 0d 0a 31 38 37 38 34 0d 0a 33 36 36 30  ---..18784..3660
1830: 30 0d 0a 37 37 34 38 0d 0a 0d 0a 71 75 65 72 79  0..7748....query
1840: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
1850: 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f 72 30  CT DISTINCT cor0
1860: 2e 63 6f 6c 32 20 2a 20 2d 20 63 6f 72 30 2e 63  .col2 * - cor0.c
1870: 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 2c 20 74  ol0 FROM tab2, t
1880: 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
1890: 2d 0d 0a 2d 31 36 32 0d 0a 2d 33 36 34 38 0d 0a  -..-162..-3648..
18a0: 2d 37 36 38 30 0d 0a 0d 0a 71 75 65 72 79 20 49  -7680....query I
18b0: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
18c0: 20 2b 20 35 36 20 41 53 20 63 6f 6c 30 20 46 52   + 56 AS col0 FR
18d0: 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 35  OM tab2..----..5
18e0: 36 0d 0a 35 36 0d 0a 35 36 0d 0a 0d 0a 71 75 65  6..56..56....que
18f0: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
1900: 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 30 20  LECT ALL - col0 
1910: 2b 20 63 6f 6c 31 20 2a 20 63 6f 6c 30 20 2b 20  + col1 * col0 + 
1920: 2d 20 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46  - col1 AS col2 F
1930: 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab2..----..
1940: 31 32 34 37 0d 0a 31 37 39 0d 0a 34 34 36 35 0d  1247..179..4465.
1950: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
1960: 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c  rt..SELECT - col
1970: 31 20 2a 20 63 6f 6c 32 20 2b 20 63 6f 6c 30 20  1 * col2 + col0 
1980: 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
1990: 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 34 35 36 0d 0a  2..----..-1456..
19a0: 2d 35 36 37 0d 0a 2d 38 33 30 0d 0a 0d 0a 71 75  -567..-830....qu
19b0: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
19c0: 45 4c 45 43 54 20 2b 20 63 6f 6c 32 20 2a 20 2d  ELECT + col2 * -
19d0: 20 28 20 28 20 63 6f 6c 31 20 29 20 2b 20 2d 20   ( ( col1 ) + - 
19e0: 63 6f 72 30 2e 63 6f 6c 31 20 29 20 41 53 20 63  cor0.col1 ) AS c
19f0: 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 63 6f  ol1 FROM tab0 co
1a00: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a  r0..----..0..0..
1a10: 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74  0....skipif post
1a20: 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65  gresql # Postgre
1a30: 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20  SQL requires AS 
1a40: 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75  when renaming ou
1a50: 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75  tput columns..qu
1a60: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
1a70: 45 4c 45 43 54 20 63 6f 6c 32 20 2a 20 74 61 62  ELECT col2 * tab
1a80: 30 2e 63 6f 6c 32 20 2b 20 2d 20 63 6f 6c 32 20  0.col2 + - col2 
1a90: 2b 20 28 20 2d 20 63 6f 6c 30 20 29 20 63 6f 6c  + ( - col0 ) col
1aa0: 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d  1 FROM tab0..---
1ab0: 2d 0d 0a 2d 33 35 0d 0a 31 30 33 32 0d 0a 36 35  -..-35..1032..65
1ac0: 35 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  53....query I ro
1ad0: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
1ae0: 4c 20 37 36 20 41 53 20 63 6f 6c 32 20 46 52 4f  L 76 AS col2 FRO
1af0: 4d 20 74 61 62 30 2c 20 74 61 62 30 20 41 53 20  M tab0, tab0 AS 
1b00: 63 6f 72 30 2c 20 74 61 62 32 20 41 53 20 63 6f  cor0, tab2 AS co
1b10: 72 31 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c  r1..----..27 val
1b20: 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 37  ues hashing to 7
1b30: 62 32 62 30 38 64 64 33 66 31 61 64 65 66 30 32  b2b08dd3f1adef02
1b40: 38 64 33 66 34 30 65 66 37 63 37 31 36 64 61 0d  8d3f40ef7c716da.
1b50: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
1b60: 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 36  rt..SELECT ALL 6
1b70: 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
1b80: 62 30 2c 20 74 61 62 31 20 41 53 20 63 6f 72 30  b0, tab1 AS cor0
1b90: 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73  ..----..9 values
1ba0: 20 68 61 73 68 69 6e 67 20 74 6f 20 35 64 31 63   hashing to 5d1c
1bb0: 62 39 30 65 64 35 38 66 61 37 35 37 33 38 39 35  b90ed58fa7573895
1bc0: 64 32 66 39 35 62 32 31 31 38 32 31 0d 0a 0d 0a  d2f95b211821....
1bd0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
1be0: 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 31 20 2b  .SELECT - col1 +
1bf0: 20 63 6f 6c 31 20 2a 20 63 6f 6c 30 20 2a 20 63   col1 * col0 * c
1c00: 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol2 FROM tab2 AS
1c10: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 39   cor0..----..119
1c20: 35 39 33 0d 0a 35 31 30 31 37 0d 0a 35 38 32 38  593..51017..5828
1c30: 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
1c40: 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61   # use DIV opera
1c50: 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20  tor for integer 
1c60: 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20  division..query 
1c70: 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
1c80: 34 32 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 32 20  42..SELECT col2 
1c90: 44 49 56 20 36 30 20 2b 20 63 6f 6c 32 20 2a 20  DIV 60 + col2 * 
1ca0: 63 6f 6c 30 20 2a 20 63 6f 6c 32 20 41 53 20 63  col0 * col2 AS c
1cb0: 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d  ol2 FROM tab1..-
1cc0: 2d 2d 2d 0d 0a 32 30 37 39 33 36 0d 0a 37 33 37  ---..207936..737
1cd0: 32 38 31 0d 0a 38 37 34 38 0d 0a 0d 0a 73 6b 69  281..8748....ski
1ce0: 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
1cf0: 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
1d00: 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
1d10: 6c 2d 34 32 0d 0a 53 45 4c 45 43 54 20 63 6f 6c  l-42..SELECT col
1d20: 32 20 2f 20 36 30 20 2b 20 63 6f 6c 32 20 2a 20  2 / 60 + col2 * 
1d30: 63 6f 6c 30 20 2a 20 63 6f 6c 32 20 41 53 20 63  col0 * col2 AS c
1d40: 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d  ol2 FROM tab1..-
1d50: 2d 2d 2d 0d 0a 32 30 37 39 33 36 0d 0a 37 33 37  ---..207936..737
1d60: 32 38 31 0d 0a 38 37 34 38 0d 0a 0d 0a 71 75 65  281..8748....que
1d70: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
1d80: 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 32 20  LECT ALL + col2 
1d90: 2a 20 34 38 20 46 52 4f 4d 20 74 61 62 30 20 41  * 48 FROM tab0 A
1da0: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 35  S cor0..----..15
1db0: 38 34 0d 0a 33 39 33 36 0d 0a 34 38 0d 0a 0d 0a  84..3936..48....
1dc0: 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71  skipif postgresq
1dd0: 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72  l # PostgreSQL r
1de0: 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20  equires AS when 
1df0: 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20  renaming output 
1e00: 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49  columns..query I
1e10: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
1e20: 20 41 4c 4c 20 2b 20 2d 20 33 30 20 63 6f 6c 30   ALL + - 30 col0
1e30: 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
1e40: 72 30 20 43 52 4f 53 53 20 4a 4f 49 4e 20 74 61  r0 CROSS JOIN ta
1e50: 62 31 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d  b1 AS cor1..----
1e60: 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68 69  ..9 values hashi
1e70: 6e 67 20 74 6f 20 35 36 66 61 32 35 66 39 66 62  ng to 56fa25f9fb
1e80: 38 30 34 30 34 36 30 66 65 33 63 38 39 34 30 30  8040460fe3c89400
1e90: 30 65 61 38 66 62 0d 0a 0d 0a 71 75 65 72 79 20  0ea8fb....query 
1ea0: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
1eb0: 54 20 41 4c 4c 20 2d 20 2b 20 63 6f 6c 30 20 2b  T ALL - + col0 +
1ec0: 20 2d 20 33 33 20 41 53 20 63 6f 6c 32 20 46 52   - 33 AS col2 FR
1ed0: 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
1ee0: 0a 2d 2d 2d 2d 0d 0a 2d 31 31 33 0d 0a 2d 33 36  .----..-113..-36
1ef0: 0d 0a 2d 39 37 0d 0a 0d 0a 73 6b 69 70 69 66 20  ..-97....skipif 
1f00: 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73  postgresql # Pos
1f10: 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73  tgreSQL requires
1f20: 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e   AS when renamin
1f30: 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73  g output columns
1f40: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1f50: 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
1f60: 43 54 20 37 36 20 63 6f 6c 30 20 46 52 4f 4d 20  CT 76 col0 FROM 
1f70: 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 37 36 0d 0a  tab2..----..76..
1f80: 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
1f90: 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f   use DIV operato
1fa0: 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69  r for integer di
1fb0: 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20  vision..query I 
1fc0: 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 34 37  rowsort label-47
1fd0: 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 32 20 2b 20  ..SELECT col2 + 
1fe0: 63 6f 6c 30 20 44 49 56 20 74 61 62 31 2e 63 6f  col0 DIV tab1.co
1ff0: 6c 30 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d  l0 FROM tab1..--
2000: 2d 2d 0d 0a 35 35 0d 0a 35 38 0d 0a 39 37 0d 0a  --..55..58..97..
2010: 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
2020: 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
2030: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2040: 20 6c 61 62 65 6c 2d 34 37 0d 0a 53 45 4c 45 43   label-47..SELEC
2050: 54 20 63 6f 6c 32 20 2b 20 63 6f 6c 30 20 2f 20  T col2 + col0 / 
2060: 74 61 62 31 2e 63 6f 6c 30 20 46 52 4f 4d 20 74  tab1.col0 FROM t
2070: 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 35 35 0d 0a 35  ab1..----..55..5
2080: 38 0d 0a 39 37 0d 0a 0d 0a 71 75 65 72 79 20 49  8..97....query I
2090: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
20a0: 20 2d 20 2d 20 35 38 20 2b 20 33 34 20 46 52 4f   - - 58 + 34 FRO
20b0: 4d 20 74 61 62 32 20 63 6f 72 30 20 43 52 4f 53  M tab2 cor0 CROS
20c0: 53 20 4a 4f 49 4e 20 74 61 62 32 2c 20 74 61 62  S JOIN tab2, tab
20d0: 30 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d  0 AS cor1..----.
20e0: 0a 32 37 20 76 61 6c 75 65 73 20 68 61 73 68 69  .27 values hashi
20f0: 6e 67 20 74 6f 20 63 36 34 63 62 37 61 38 31 64  ng to c64cb7a81d
2100: 61 35 31 66 34 62 65 30 62 36 39 30 36 61 32 32  a51f4be0b6906a22
2110: 33 65 38 38 31 37 0d 0a 0d 0a 6f 6e 6c 79 69 66  3e8817....onlyif
2120: 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56   mysql # use DIV
2130: 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e   operator for in
2140: 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a  teger division..
2150: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
2160: 6c 61 62 65 6c 2d 34 39 0d 0a 53 45 4c 45 43 54  label-49..SELECT
2170: 20 41 4c 4c 20 2b 20 2b 20 63 6f 6c 30 20 2b 20   ALL + + col0 + 
2180: 2b 20 63 6f 6c 32 20 44 49 56 20 38 30 20 41 53  + col2 DIV 80 AS
2190: 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20   col1 FROM tab2 
21a0: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 37  AS cor0..----..7
21b0: 0d 0a 37 38 0d 0a 37 39 0d 0a 0d 0a 73 6b 69 70  ..78..79....skip
21c0: 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
21d0: 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
21e0: 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
21f0: 2d 34 39 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  -49..SELECT ALL 
2200: 2b 20 2b 20 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c  + + col0 + + col
2210: 32 20 2f 20 38 30 20 41 53 20 63 6f 6c 31 20 46  2 / 80 AS col1 F
2220: 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
2230: 0d 0a 2d 2d 2d 2d 0d 0a 37 0d 0a 37 38 0d 0a 37  ..----..7..78..7
2240: 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  9....query I row
2250: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
2260: 20 63 6f 6c 30 20 2a 20 63 6f 6c 31 20 2a 20 37   col0 * col1 * 7
2270: 37 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  7 AS col1 FROM t
2280: 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab0 cor0..----..
2290: 31 35 38 39 32 38 0d 0a 32 36 31 34 31 35 0d 0a  158928..261415..
22a0: 36 32 33 36 32 33 0d 0a 0d 0a 71 75 65 72 79 20  623623....query 
22b0: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
22c0: 54 20 41 4c 4c 20 35 36 20 2a 20 2d 20 63 6f 6c  T ALL 56 * - col
22d0: 32 20 2d 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f  2 - + col1 AS co
22e0: 6c 30 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d  l0 FROM tab1..--
22f0: 2d 2d 0d 0a 2d 33 30 35 30 0d 0a 2d 33 32 30 32  --..-3050..-3202
2300: 0d 0a 2d 35 33 38 39 0d 0a 0d 0a 6f 6e 6c 79 69  ..-5389....onlyi
2310: 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49  f mysql # use DI
2320: 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69  V operator for i
2330: 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d  nteger division.
2340: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2350: 20 6c 61 62 65 6c 2d 35 32 0d 0a 53 45 4c 45 43   label-52..SELEC
2360: 54 20 2d 20 2b 20 28 20 2d 20 63 6f 6c 32 20 29  T - + ( - col2 )
2370: 20 2b 20 2d 20 63 6f 6c 30 20 44 49 56 20 2d 20   + - col0 DIV - 
2380: 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46 52 4f  col0 AS col2 FRO
2390: 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
23a0: 2d 2d 2d 2d 0d 0a 35 35 0d 0a 35 38 0d 0a 39 37  ----..55..58..97
23b0: 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
23c0: 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
23d0: 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
23e0: 72 74 20 6c 61 62 65 6c 2d 35 32 0d 0a 53 45 4c  rt label-52..SEL
23f0: 45 43 54 20 2d 20 2b 20 28 20 2d 20 63 6f 6c 32  ECT - + ( - col2
2400: 20 29 20 2b 20 2d 20 63 6f 6c 30 20 2f 20 2d 20   ) + - col0 / - 
2410: 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46 52 4f  col0 AS col2 FRO
2420: 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
2430: 2d 2d 2d 2d 0d 0a 35 35 0d 0a 35 38 0d 0a 39 37  ----..55..58..97
2440: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
2450: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 74 61  ort..SELECT + ta
2460: 62 32 2e 63 6f 6c 32 20 2a 20 32 38 20 46 52 4f  b2.col2 * 28 FRO
2470: 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 30  M tab2..----..10
2480: 36 34 0d 0a 37 32 38 0d 0a 37 35 36 0d 0a 0d 0a  64..728..756....
2490: 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
24a0: 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
24b0: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
24c0: 53 45 4c 45 43 54 20 2b 20 43 41 53 54 20 28 20  SELECT + CAST ( 
24d0: 2d 20 63 6f 6c 32 20 41 53 20 52 45 41 4c 20 29  - col2 AS REAL )
24e0: 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
24f0: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 34 0d 0a 2d  r0..----..-54..-
2500: 35 37 0d 0a 2d 39 36 0d 0a 0d 0a 71 75 65 72 79  57..-96....query
2510: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
2520: 43 54 20 2b 20 2d 20 63 6f 6c 31 20 2a 20 2d 20  CT + - col1 * - 
2530: 36 36 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  66 FROM tab1 AS 
2540: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 37 31 36  cor0..----..1716
2550: 0d 0a 36 36 30 0d 0a 38 35 38 0d 0a 0d 0a 71 75  ..660..858....qu
2560: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
2570: 45 4c 45 43 54 20 37 20 2b 20 2b 20 38 31 20 46  ELECT 7 + + 81 F
2580: 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d  ROM tab0 cor0..-
2590: 2d 2d 2d 0d 0a 38 38 0d 0a 38 38 0d 0a 38 38 0d  ---..88..88..88.
25a0: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
25b0: 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 72  rt..SELECT - cor
25c0: 30 2e 63 6f 6c 31 20 2a 20 63 6f 6c 32 20 2a 20  0.col1 * col2 * 
25d0: 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 2b 20 63 6f  + cor0.col2 + co
25e0: 6c 31 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  l1 AS col0 FROM 
25f0: 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
2600: 2d 2d 0d 0a 2d 36 31 31 37 39 33 0d 0a 2d 39 33  --..-611793..-93
2610: 35 36 38 0d 0a 30 0d 0a 0d 0a 71 75 65 72 79 20  568..0....query 
2620: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
2630: 54 20 2d 20 2b 20 33 37 20 2b 20 63 6f 6c 32 20  T - + 37 + col2 
2640: 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
2650: 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
2660: 0a 31 37 0d 0a 32 30 0d 0a 35 39 0d 0a 0d 0a 73  .17..20..59....s
2670: 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c  kipif postgresql
2680: 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65   # PostgreSQL re
2690: 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72  quires AS when r
26a0: 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63  enaming output c
26b0: 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20  olumns..query I 
26c0: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
26d0: 28 20 63 6f 6c 30 20 29 20 2b 20 63 6f 6c 32 20  ( col0 ) + col2 
26e0: 2a 20 2b 20 31 33 20 63 6f 6c 32 20 46 52 4f 4d  * + 13 col2 FROM
26f0: 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
2700: 2d 2d 2d 0d 0a 31 33 32 38 0d 0a 37 30 35 0d 0a  ---..1328..705..
2710: 38 30 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  805....query I r
2720: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
2730: 49 53 54 49 4e 43 54 20 2d 20 63 6f 72 30 2e 63  ISTINCT - cor0.c
2740: 6f 6c 32 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20  ol2 + cor0.col2 
2750: 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
2760: 32 2c 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d  2, tab1 cor0..--
2770: 2d 2d 0d 0a 30 0d 0a 0d 0a 71 75 65 72 79 20 49  --..0....query I
2780: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
2790: 20 2d 20 63 6f 6c 30 20 2a 20 63 6f 6c 30 20 2a   - col0 * col0 *
27a0: 20 36 31 20 46 52 4f 4d 20 74 61 62 30 20 63 6f   61 FROM tab0 co
27b0: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 35 31 33 36  r0..----..-35136
27c0: 0d 0a 2d 34 38 33 31 38 31 0d 0a 2d 37 34 37 32  ..-483181..-7472
27d0: 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  5....query I row
27e0: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63  sort..SELECT - c
27f0: 6f 6c 30 20 2a 20 2b 20 63 6f 6c 30 20 2b 20 2b  ol0 * + col0 + +
2800: 20 63 6f 6c 30 20 2a 20 63 6f 6c 30 20 41 53 20   col0 * col0 AS 
2810: 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41  col1 FROM tab1 A
2820: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d  S cor0..----..0.
2830: 0a 30 0d 0a 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  .0..0....onlyif 
2840: 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20  mysql # use DIV 
2850: 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74  operator for int
2860: 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71  eger division..q
2870: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
2880: 61 62 65 6c 2d 36 33 0d 0a 53 45 4c 45 43 54 20  abel-63..SELECT 
2890: 41 4c 4c 20 2b 20 63 6f 6c 32 20 2a 20 2b 20 63  ALL + col2 * + c
28a0: 6f 72 30 2e 63 6f 6c 32 20 2a 20 63 6f 72 30 2e  or0.col2 * cor0.
28b0: 63 6f 6c 32 20 2b 20 2d 20 63 6f 6c 30 20 44 49  col2 + - col0 DI
28c0: 56 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30  V col1 FROM tab0
28d0: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
28e0: 31 0d 0a 33 35 39 33 37 0d 0a 35 35 31 33 36 38  1..35937..551368
28f0: 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
2900: 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
2910: 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
2920: 72 74 20 6c 61 62 65 6c 2d 36 33 0d 0a 53 45 4c  rt label-63..SEL
2930: 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 32 20 2a  ECT ALL + col2 *
2940: 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 2a 20 63   + cor0.col2 * c
2950: 6f 72 30 2e 63 6f 6c 32 20 2b 20 2d 20 63 6f 6c  or0.col2 + - col
2960: 30 20 2f 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61  0 / col1 FROM ta
2970: 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
2980: 0d 0a 31 0d 0a 33 35 39 33 37 0d 0a 35 35 31 33  ..1..35937..5513
2990: 36 38 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  68....onlyif mys
29a0: 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65  ql # use DIV ope
29b0: 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65  rator for intege
29c0: 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72  r division..quer
29d0: 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
29e0: 6c 2d 36 34 0d 0a 53 45 4c 45 43 54 20 44 49 53  l-64..SELECT DIS
29f0: 54 49 4e 43 54 20 2d 20 2d 20 31 30 20 44 49 56  TINCT - - 10 DIV
2a00: 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20   col2 FROM tab0 
2a10: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30  AS cor0..----..0
2a20: 0d 0a 31 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  ..10....skipif m
2a30: 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
2a40: 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
2a50: 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 36 34 0d  owsort label-64.
2a60: 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
2a70: 20 2d 20 2d 20 31 30 20 2f 20 63 6f 6c 32 20 46   - - 10 / col2 F
2a80: 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
2a90: 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 31 30 0d 0a 0d  ..----..0..10...
2aa0: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2ab0: 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 30 20  ..SELECT - col0 
2ac0: 2a 20 63 6f 6c 31 20 2b 20 63 6f 6c 32 20 2a 20  * col1 + col2 * 
2ad0: 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41  col0 FROM tab1 A
2ae0: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 30  S cor0..----..30
2af0: 30 38 0d 0a 36 36 34 30 0d 0a 38 34 0d 0a 0d 0a  08..6640..84....
2b00: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
2b10: 0a 53 45 4c 45 43 54 20 2d 20 2d 20 32 37 20 2b  .SELECT - - 27 +
2b20: 20 63 6f 6c 32 20 2a 20 28 20 2b 20 63 6f 72 30   col2 * ( + cor0
2b30: 2e 63 6f 6c 32 20 29 20 46 52 4f 4d 20 74 61 62  .col2 ) FROM tab
2b40: 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31  0 cor0..----..11
2b50: 31 36 0d 0a 32 38 0d 0a 36 37 35 31 0d 0a 0d 0a  16..28..6751....
2b60: 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75  onlyif mysql # u
2b70: 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20  se DIV operator 
2b80: 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69  for integer divi
2b90: 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f  sion..query I ro
2ba0: 77 73 6f 72 74 20 6c 61 62 65 6c 2d 36 37 0d 0a  wsort label-67..
2bb0: 53 45 4c 45 43 54 20 2b 20 2b 20 63 6f 6c 30 20  SELECT + + col0 
2bc0: 44 49 56 20 2d 20 63 6f 6c 32 20 2b 20 28 20 63  DIV - col2 + ( c
2bd0: 6f 6c 32 20 29 20 2a 20 2d 20 63 6f 6c 32 20 41  ol2 ) * - col2 A
2be0: 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31  S col1 FROM tab1
2bf0: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
2c00: 2d 32 39 31 36 0d 0a 2d 33 32 35 30 0d 0a 2d 39  -2916..-3250..-9
2c10: 32 31 36 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  216....skipif my
2c20: 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
2c30: 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
2c40: 77 73 6f 72 74 20 6c 61 62 65 6c 2d 36 37 0d 0a  wsort label-67..
2c50: 53 45 4c 45 43 54 20 2b 20 2b 20 63 6f 6c 30 20  SELECT + + col0 
2c60: 2f 20 2d 20 63 6f 6c 32 20 2b 20 28 20 63 6f 6c  / - col2 + ( col
2c70: 32 20 29 20 2a 20 2d 20 63 6f 6c 32 20 41 53 20  2 ) * - col2 AS 
2c80: 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41  col1 FROM tab1 A
2c90: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32  S cor0..----..-2
2ca0: 39 31 36 0d 0a 2d 33 32 35 30 0d 0a 2d 39 32 31  916..-3250..-921
2cb0: 36 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74  6....skipif post
2cc0: 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65  gresql # Postgre
2cd0: 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20  SQL requires AS 
2ce0: 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75  when renaming ou
2cf0: 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75  tput columns..qu
2d00: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
2d10: 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 31  ELECT ALL - col1
2d20: 20 2a 20 63 6f 72 30 2e 63 6f 6c 30 20 63 6f 6c   * cor0.col0 col
2d30: 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  2 FROM tab0 AS c
2d40: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 30 36 34  or0..----..-2064
2d50: 0d 0a 2d 33 33 39 35 0d 0a 2d 38 30 39 39 0d 0a  ..-3395..-8099..
2d60: 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
2d70: 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f   use DIV operato
2d80: 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69  r for integer di
2d90: 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20  vision..query I 
2da0: 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 36 39  rowsort label-69
2db0: 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c  ..SELECT ALL col
2dc0: 30 20 2b 20 2b 20 63 6f 6c 31 20 44 49 56 20 63  0 + + col1 DIV c
2dd0: 6f 72 30 2e 63 6f 6c 31 20 41 53 20 63 6f 6c 32  or0.col1 AS col2
2de0: 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
2df0: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 35 0d 0a 33 36  r0..----..25..36
2e00: 0d 0a 39 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  ..90....skipif m
2e10: 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
2e20: 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
2e30: 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 36 39 0d  owsort label-69.
2e40: 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 30  .SELECT ALL col0
2e50: 20 2b 20 2b 20 63 6f 6c 31 20 2f 20 63 6f 72 30   + + col1 / cor0
2e60: 2e 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46 52  .col1 AS col2 FR
2e70: 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
2e80: 0a 2d 2d 2d 2d 0d 0a 32 35 0d 0a 33 36 0d 0a 39  .----..25..36..9
2e90: 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74  0....skipif post
2ea0: 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65  gresql # Postgre
2eb0: 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20  SQL requires AS 
2ec0: 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75  when renaming ou
2ed0: 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75  tput columns..qu
2ee0: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
2ef0: 45 4c 45 43 54 20 41 4c 4c 20 2b 20 37 33 20 2a  ELECT ALL + 73 *
2f00: 20 2d 20 63 6f 6c 30 20 63 6f 6c 32 20 46 52 4f   - col0 col2 FRO
2f10: 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
2f20: 2d 2d 2d 2d 0d 0a 2d 35 31 31 0d 0a 2d 35 36 39  ----..-511..-569
2f30: 34 0d 0a 2d 35 37 36 37 0d 0a 0d 0a 71 75 65 72  4..-5767....quer
2f40: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
2f50: 45 43 54 20 41 4c 4c 20 31 31 20 41 53 20 63 6f  ECT ALL 11 AS co
2f60: 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l1 FROM tab1 AS 
2f70: 63 6f 72 30 20 43 52 4f 53 53 20 4a 4f 49 4e 20  cor0 CROSS JOIN 
2f80: 74 61 62 31 20 41 53 20 63 6f 72 31 0d 0a 2d 2d  tab1 AS cor1..--
2f90: 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73  --..9 values has
2fa0: 68 69 6e 67 20 74 6f 20 66 34 64 31 39 39 35 38  hing to f4d19958
2fb0: 34 62 34 34 37 33 32 66 31 61 38 39 37 65 36 36  4b44732f1a897e66
2fc0: 39 31 62 34 65 61 30 30 0d 0a 0d 0a 71 75 65 72  91b4ea00....quer
2fd0: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
2fe0: 45 43 54 20 2d 20 2d 20 63 6f 6c 32 20 2a 20 2b  ECT - - col2 * +
2ff0: 20 33 38 20 2a 20 63 6f 6c 32 20 46 52 4f 4d 20   38 * col2 FROM 
3000: 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
3010: 2d 2d 0d 0a 31 31 30 38 30 38 0d 0a 31 32 33 34  --..110808..1234
3020: 36 32 0d 0a 33 35 30 32 30 38 0d 0a 0d 0a 71 75  62..350208....qu
3030: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
3040: 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d  ELECT DISTINCT -
3050: 20 63 6f 6c 32 20 2a 20 63 6f 6c 31 20 2a 20 2b   col2 * col1 * +
3060: 20 28 20 2b 20 63 6f 6c 30 20 29 20 41 53 20 63   ( + col0 ) AS c
3070: 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol1 FROM tab0 AS
3080: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 33   cor0..----..-33
3090: 39 35 0d 0a 2d 36 36 34 31 31 38 0d 0a 2d 36 38  95..-664118..-68
30a0: 31 31 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  112....query I r
30b0: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
30c0: 49 53 54 49 4e 43 54 20 2d 20 2d 20 63 6f 6c 31  ISTINCT - - col1
30d0: 20 2b 20 2d 20 63 6f 6c 32 20 2a 20 63 6f 72 30   + - col2 * cor0
30e0: 2e 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46 52  .col2 AS col2 FR
30f0: 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
3100: 0a 2d 2d 2d 2d 0d 0a 2d 32 38 39 30 0d 0a 2d 33  .----..-2890..-3
3110: 32 33 39 0d 0a 2d 39 32 30 33 0d 0a 0d 0a 71 75  239..-9203....qu
3120: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
3130: 45 4c 45 43 54 20 2d 20 63 6f 6c 31 20 2b 20 2b  ELECT - col1 + +
3140: 20 33 30 20 2a 20 2d 20 63 6f 72 30 2e 63 6f 6c   30 * - cor0.col
3150: 30 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  0 AS col0 FROM t
3160: 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
3170: 2d 0d 0a 2d 31 31 36 0d 0a 2d 31 39 33 30 0d 0a  -..-116..-1930..
3180: 2d 32 34 31 33 0d 0a 0d 0a 71 75 65 72 79 20 49  -2413....query I
3190: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
31a0: 20 38 31 20 2b 20 2b 20 63 6f 6c 31 20 2a 20 32   81 + + col1 * 2
31b0: 34 20 2a 20 63 6f 6c 32 20 41 53 20 63 6f 6c 30  4 * col2 AS col0
31c0: 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d   FROM tab1..----
31d0: 0d 0a 31 33 37 36 31 0d 0a 33 30 30 33 33 0d 0a  ..13761..30033..
31e0: 33 33 37 37 37 0d 0a 0d 0a 73 6b 69 70 69 66 20  33777....skipif 
31f0: 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73  postgresql # Pos
3200: 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73  tgreSQL requires
3210: 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e   AS when renamin
3220: 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73  g output columns
3230: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
3240: 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 39 33  t..SELECT ALL 93
3250: 20 2b 20 63 6f 6c 30 20 63 6f 6c 32 20 46 52 4f   + col0 col2 FRO
3260: 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31  M tab0..----..11
3270: 37 0d 0a 31 32 38 0d 0a 31 38 32 0d 0a 0d 0a 6f  7..128..182....o
3280: 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73  nlyif mysql # us
3290: 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66  e DIV operator f
32a0: 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73  or integer divis
32b0: 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ion..query I row
32c0: 73 6f 72 74 20 6c 61 62 65 6c 2d 37 38 0d 0a 53  sort label-78..S
32d0: 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 63  ELECT DISTINCT c
32e0: 6f 6c 30 20 44 49 56 20 63 6f 6c 30 20 2b 20 2d  ol0 DIV col0 + -
32f0: 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 0d   col0 FROM tab1.
3300: 0a 2d 2d 2d 2d 0d 0a 2d 32 0d 0a 2d 36 33 0d 0a  .----..-2..-63..
3310: 2d 37 39 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  -79....skipif my
3320: 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
3330: 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
3340: 77 73 6f 72 74 20 6c 61 62 65 6c 2d 37 38 0d 0a  wsort label-78..
3350: 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
3360: 63 6f 6c 30 20 2f 20 63 6f 6c 30 20 2b 20 2d 20  col0 / col0 + - 
3370: 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 0d 0a  col0 FROM tab1..
3380: 2d 2d 2d 2d 0d 0a 2d 32 0d 0a 2d 36 33 0d 0a 2d  ----..-2..-63..-
3390: 37 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  79....query I ro
33a0: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
33b0: 34 34 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  44 AS col1 FROM 
33c0: 74 61 62 30 20 41 53 20 63 6f 72 30 20 43 52 4f  tab0 AS cor0 CRO
33d0: 53 53 20 4a 4f 49 4e 20 74 61 62 31 20 41 53 20  SS JOIN tab1 AS 
33e0: 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61  cor1..----..9 va
33f0: 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20  lues hashing to 
3400: 30 37 34 35 37 64 39 65 35 37 31 65 30 33 36 61  07457d9e571e036a
3410: 39 61 33 61 30 66 35 61 35 61 32 65 31 65 66 32  9a3a0f5a5a2e1ef2
3420: 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
3430: 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d   # support for M
3440: 79 53 51 4c 20 73 70 65 63 69 66 69 63 20 73 79  ySQL specific sy
3450: 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73  stem types and s
3460: 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72  yntax..query I r
3470: 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 38 30 0d  owsort label-80.
3480: 0a 53 45 4c 45 43 54 20 43 41 53 54 28 20 4e 55  .SELECT CAST( NU
3490: 4c 4c 20 41 53 20 53 49 47 4e 45 44 20 29 20 46  LL AS SIGNED ) F
34a0: 52 4f 4d 20 74 61 62 32 20 63 6f 72 30 20 43 52  ROM tab2 cor0 CR
34b0: 4f 53 53 20 4a 4f 49 4e 20 74 61 62 32 20 41 53  OSS JOIN tab2 AS
34c0: 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76   cor1..----..9 v
34d0: 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f  alues hashing to
34e0: 20 63 64 37 61 37 39 30 31 65 34 37 63 31 35 31   cd7a7901e47c151
34f0: 35 35 34 30 34 61 66 66 30 64 32 31 36 66 65 30  55404aff0d216fe0
3500: 62 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  b....skipif mysq
3510: 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
3520: 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
3530: 6f 72 74 20 6c 61 62 65 6c 2d 38 30 0d 0a 53 45  ort label-80..SE
3540: 4c 45 43 54 20 43 41 53 54 20 28 20 4e 55 4c 4c  LECT CAST ( NULL
3550: 20 41 53 20 49 4e 54 45 47 45 52 20 29 20 46 52   AS INTEGER ) FR
3560: 4f 4d 20 74 61 62 32 20 63 6f 72 30 20 43 52 4f  OM tab2 cor0 CRO
3570: 53 53 20 4a 4f 49 4e 20 74 61 62 32 20 41 53 20  SS JOIN tab2 AS 
3580: 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61  cor1..----..9 va
3590: 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20  lues hashing to 
35a0: 63 64 37 61 37 39 30 31 65 34 37 63 31 35 31 35  cd7a7901e47c1515
35b0: 35 34 30 34 61 66 66 30 64 32 31 36 66 65 30 62  5404aff0d216fe0b
35c0: 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
35d0: 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61   # use DIV opera
35e0: 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20  tor for integer 
35f0: 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20  division..query 
3600: 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
3610: 38 31 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d  81..SELECT ALL -
3620: 20 2d 20 28 20 63 6f 6c 30 20 29 20 2b 20 63 6f   - ( col0 ) + co
3630: 6c 30 20 44 49 56 20 63 6f 6c 31 20 41 53 20 63  l0 DIV col1 AS c
3640: 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol1 FROM tab0 AS
3650: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 34 0d   cor0..----..24.
3660: 0a 33 35 0d 0a 38 39 0d 0a 0d 0a 73 6b 69 70 69  .35..89....skipi
3670: 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
3680: 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
3690: 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
36a0: 38 31 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d  81..SELECT ALL -
36b0: 20 2d 20 28 20 63 6f 6c 30 20 29 20 2b 20 63 6f   - ( col0 ) + co
36c0: 6c 30 20 2f 20 63 6f 6c 31 20 41 53 20 63 6f 6c  l0 / col1 AS col
36d0: 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  1 FROM tab0 AS c
36e0: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 34 0d 0a 33  or0..----..24..3
36f0: 35 0d 0a 38 39 0d 0a 0d 0a 71 75 65 72 79 20 49  5..89....query I
3700: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
3710: 20 63 6f 72 30 2e 63 6f 6c 31 20 2d 20 2d 20 36   cor0.col1 - - 6
3720: 37 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  7 AS col0 FROM t
3730: 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
3740: 2d 0d 0a 31 35 33 0d 0a 31 35 38 0d 0a 31 36 34  -..153..158..164
3750: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
3760: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
3770: 2b 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 2a 20  + + cor0.col2 * 
3780: 63 6f 6c 31 20 2b 20 63 6f 6c 31 20 2a 20 63 6f  col1 + col1 * co
3790: 72 30 2e 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20  r0.col2 AS col1 
37a0: 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
37b0: 30 0d 0a 2d 2d 2d 2d 0d 0a 31 34 39 32 34 0d 0a  0..----..14924..
37c0: 31 39 34 0d 0a 35 36 37 36 0d 0a 0d 0a 6f 6e 6c  194..5676....onl
37d0: 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20  yif mysql # use 
37e0: 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72  DIV operator for
37f0: 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f   integer divisio
3800: 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  n..query I rowso
3810: 72 74 20 6c 61 62 65 6c 2d 38 34 0d 0a 53 45 4c  rt label-84..SEL
3820: 45 43 54 20 41 4c 4c 20 63 6f 6c 32 20 44 49 56  ECT ALL col2 DIV
3830: 20 2d 20 74 61 62 32 2e 63 6f 6c 31 20 63 6f 6c   - tab2.col1 col
3840: 31 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d  1 FROM tab2..---
3850: 2d 0d 0a 2d 32 0d 0a 30 0d 0a 30 0d 0a 0d 0a 73  -..-2..0..0....s
3860: 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c  kipif postgresql
3870: 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65   # PostgreSQL re
3880: 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72  quires AS when r
3890: 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63  enaming output c
38a0: 6f 6c 75 6d 6e 73 0d 0a 73 6b 69 70 69 66 20 6d  olumns..skipif m
38b0: 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
38c0: 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
38d0: 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 38 34 0d  owsort label-84.
38e0: 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 32  .SELECT ALL col2
38f0: 20 2f 20 2d 20 74 61 62 32 2e 63 6f 6c 31 20 63   / - tab2.col1 c
3900: 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d  ol1 FROM tab2..-
3910: 2d 2d 2d 0d 0a 2d 32 0d 0a 30 0d 0a 30 0d 0a 0d  ---..-2..0..0...
3920: 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73  .skipif postgres
3930: 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20  ql # PostgreSQL 
3940: 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e  requires AS when
3950: 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74   renaming output
3960: 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20   columns..query 
3970: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
3980: 54 20 2b 20 34 34 20 2a 20 2d 20 28 20 63 6f 72  T + 44 * - ( cor
3990: 30 2e 63 6f 6c 30 20 2b 20 28 20 2d 20 38 31 20  0.col0 + ( - 81 
39a0: 29 20 29 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61  ) ) col0 FROM ta
39b0: 62 31 2c 20 74 61 62 30 20 41 53 20 63 6f 72 30  b1, tab0 AS cor0
39c0: 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73  ..----..9 values
39d0: 20 68 61 73 68 69 6e 67 20 74 6f 20 65 61 34 39   hashing to ea49
39e0: 33 61 36 61 37 33 62 37 64 62 65 65 36 35 62 61  3a6a73b7dbee65ba
39f0: 35 38 66 39 66 65 36 30 38 36 32 38 0d 0a 0d 0a  58f9fe608628....
3a00: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
3a10: 0a 53 45 4c 45 43 54 20 63 6f 6c 31 20 2b 20 63  .SELECT col1 + c
3a20: 6f 6c 31 20 2d 20 63 6f 6c 32 20 46 52 4f 4d 20  ol1 - col2 FROM 
3a30: 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 0d 0a  tab1..----..-2..
3a40: 2d 33 37 0d 0a 2d 37 30 0d 0a 0d 0a 71 75 65 72  -37..-70....quer
3a50: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
3a60: 45 43 54 20 44 49 53 54 49 4e 43 54 20 74 61 62  ECT DISTINCT tab
3a70: 32 2e 63 6f 6c 32 20 2d 20 2b 20 37 20 2a 20 74  2.col2 - + 7 * t
3a80: 61 62 32 2e 63 6f 6c 32 20 46 52 4f 4d 20 74 61  ab2.col2 FROM ta
3a90: 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 35 36 0d 0a  b2..----..-156..
3aa0: 2d 31 36 32 0d 0a 2d 32 32 38 0d 0a 0d 0a 71 75  -162..-228....qu
3ab0: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
3ac0: 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b  ELECT DISTINCT +
3ad0: 20 37 36 20 2a 20 38 35 20 2a 20 2b 20 63 6f 6c   76 * 85 * + col
3ae0: 30 20 2b 20 2d 20 63 6f 6c 30 20 2d 20 2d 20 74  0 + - col0 - - t
3af0: 61 62 31 2e 63 6f 6c 32 20 46 52 4f 4d 20 74 61  ab1.col2 FROM ta
3b00: 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 39 34 33 31 0d  b1..----..19431.
3b10: 0a 34 31 33 34 33 33 0d 0a 35 31 36 38 31 36 0d  .413433..516816.
3b20: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
3b30: 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 30 20  rt..SELECT col0 
3b40: 2a 20 38 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  * 8 AS col0 FROM
3b50: 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 35 36 0d   tab2..----..56.
3b60: 0a 36 32 34 0d 0a 36 33 32 0d 0a 0d 0a 71 75 65  .624..632....que
3b70: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
3b80: 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 28 20  LECT DISTINCT ( 
3b90: 2b 20 28 20 2d 20 74 61 62 32 2e 63 6f 6c 31 20  + ( - tab2.col1 
3ba0: 29 20 29 20 2d 20 33 33 20 46 52 4f 4d 20 74 61  ) ) - 33 FROM ta
3bb0: 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 30 0d 0a 2d  b2..----..-50..-
3bc0: 36 34 0d 0a 2d 39 32 0d 0a 0d 0a 73 6b 69 70 69  64..-92....skipi
3bd0: 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50  f postgresql # P
3be0: 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72  ostgreSQL requir
3bf0: 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d  es AS when renam
3c00: 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d  ing output colum
3c10: 6e 73 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ns..skipif mysql
3c20: 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
3c30: 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
3c40: 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 43 41 53  rt..SELECT - CAS
3c50: 54 20 28 20 2b 20 63 6f 6c 30 20 41 53 20 52 45  T ( + col0 AS RE
3c60: 41 4c 20 29 20 63 6f 6c 30 20 46 52 4f 4d 20 74  AL ) col0 FROM t
3c70: 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
3c80: 2d 0d 0a 2d 32 34 0d 0a 2d 33 35 0d 0a 2d 38 39  -..-24..-35..-89
3c90: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
3ca0: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
3cb0: 36 33 20 2a 20 63 6f 6c 30 20 2b 20 2d 20 63 6f  63 * col0 + - co
3cc0: 6c 31 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  l1 AS col0 FROM 
3cd0: 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 34 31 30 0d  tab2..----..410.
3ce0: 0a 34 38 35 35 0d 0a 34 39 36 30 0d 0a 0d 0a 71  .4855..4960....q
3cf0: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
3d00: 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 72 30 2e  SELECT ALL cor0.
3d10: 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46 52 4f  col2 AS col0 FRO
3d20: 4d 20 74 61 62 30 2c 20 74 61 62 32 20 41 53 20  M tab0, tab2 AS 
3d30: 63 6f 72 30 2c 20 74 61 62 32 20 41 53 20 63 6f  cor0, tab2 AS co
3d40: 72 31 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c  r1..----..27 val
3d50: 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 34  ues hashing to 4
3d60: 30 66 64 38 63 63 30 64 65 39 32 65 61 36 38 64  0fd8cc0de92ea68d
3d70: 37 33 36 33 34 63 32 64 38 66 37 35 62 66 35 0d  73634c2d8f75bf5.
3d80: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
3d90: 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c  rt..SELECT - col
3da0: 32 20 2b 20 31 38 20 2a 20 63 6f 6c 31 20 46 52  2 + 18 * col1 FR
3db0: 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
3dc0: 0a 2d 2d 2d 2d 0d 0a 31 30 33 36 0d 0a 32 36 38  .----..1036..268
3dd0: 0d 0a 35 33 31 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  ..531....onlyif 
3de0: 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20  mysql # use DIV 
3df0: 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74  operator for int
3e00: 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71  eger division..q
3e10: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
3e20: 61 62 65 6c 2d 39 35 0d 0a 53 45 4c 45 43 54 20  abel-95..SELECT 
3e30: 44 49 53 54 49 4e 43 54 20 2b 20 2b 20 63 6f 6c  DISTINCT + + col
3e40: 32 20 2b 20 2d 20 63 6f 6c 31 20 44 49 56 20 2d  2 + - col1 DIV -
3e50: 20 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46 52   col0 AS col1 FR
3e60: 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
3e70: 0a 2d 2d 2d 2d 0d 0a 35 37 0d 0a 36 32 0d 0a 39  .----..57..62..9
3e80: 36 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  6....skipif mysq
3e90: 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
3ea0: 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
3eb0: 6f 72 74 20 6c 61 62 65 6c 2d 39 35 0d 0a 53 45  ort label-95..SE
3ec0: 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20  LECT DISTINCT + 
3ed0: 2b 20 63 6f 6c 32 20 2b 20 2d 20 63 6f 6c 31 20  + col2 + - col1 
3ee0: 2f 20 2d 20 63 6f 6c 30 20 41 53 20 63 6f 6c 31  / - col0 AS col1
3ef0: 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
3f00: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 35 37 0d 0a 36 32  r0..----..57..62
3f10: 0d 0a 39 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..96....query I 
3f20: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
3f30: 44 49 53 54 49 4e 43 54 20 2d 20 33 38 20 2d 20  DISTINCT - 38 - 
3f40: 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 63  col1 FROM tab1 c
3f50: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 38 0d 0a  or0..----..-48..
3f60: 2d 35 31 0d 0a 2d 36 34 0d 0a 0d 0a 71 75 65 72  -51..-64....quer
3f70: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
3f80: 45 43 54 20 41 4c 4c 20 63 6f 6c 30 20 2a 20 2b  ECT ALL col0 * +
3f90: 20 35 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20   5 AS col1 FROM 
3fa0: 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab1 cor0..----.
3fb0: 0a 31 35 0d 0a 33 32 30 0d 0a 34 30 30 0d 0a 0d  .15..320..400...
3fc0: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
3fd0: 0d 0a 53 45 4c 45 43 54 20 28 20 34 35 20 29 20  ..SELECT ( 45 ) 
3fe0: 46 52 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a  FROM tab2 cor0..
3ff0: 2d 2d 2d 2d 0d 0a 34 35 0d 0a 34 35 0d 0a 34 35  ----..45..45..45
4000: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
4010: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 39 31 20 2b  ort..SELECT 91 +
4020: 20 2b 20 63 6f 6c 31 20 2a 20 63 6f 6c 31 20 41   + col1 * col1 A
4030: 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31  S col2 FROM tab1
4040: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
4050: 31 39 31 0d 0a 32 36 30 0d 0a 37 36 37 0d 0a 0d  191..260..767...
4060: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
4070: 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
4080: 54 20 2d 20 2b 20 39 36 20 41 53 20 63 6f 6c 32  T - + 96 AS col2
4090: 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
40a0: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 39 36 0d 0a 0d  r0..----..-96...
40b0: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
40c0: 0d 0a 53 45 4c 45 43 54 20 2b 20 2d 20 37 38 20  ..SELECT + - 78 
40d0: 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
40e0: 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 37  1 cor0..----..-7
40f0: 38 0d 0a 2d 37 38 0d 0a 2d 37 38 0d 0a 0d 0a 71  8..-78..-78....q
4100: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
4110: 53 45 4c 45 43 54 20 2b 20 2b 20 63 6f 6c 31 20  SELECT + + col1 
4120: 2a 20 33 36 20 41 53 20 63 6f 6c 30 20 46 52 4f  * 36 AS col0 FRO
4130: 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
4140: 2d 2d 2d 2d 0d 0a 33 36 30 0d 0a 34 36 38 0d 0a  ----..360..468..
4150: 39 33 36 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  936....onlyif my
4160: 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70  sql # use DIV op
4170: 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67  erator for integ
4180: 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65  er division..que
4190: 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
41a0: 65 6c 2d 31 30 33 0d 0a 53 45 4c 45 43 54 20 63  el-103..SELECT c
41b0: 6f 6c 30 20 2b 20 2d 20 63 6f 6c 30 20 44 49 56  ol0 + - col0 DIV
41c0: 20 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46 52   col1 AS col1 FR
41d0: 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 37  OM tab2..----..7
41e0: 0d 0a 37 35 0d 0a 37 37 0d 0a 0d 0a 73 6b 69 70  ..75..77....skip
41f0: 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
4200: 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
4210: 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
4220: 2d 31 30 33 0d 0a 53 45 4c 45 43 54 20 63 6f 6c  -103..SELECT col
4230: 30 20 2b 20 2d 20 63 6f 6c 30 20 2f 20 63 6f 6c  0 + - col0 / col
4240: 31 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  1 AS col1 FROM t
4250: 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 37 0d 0a 37 35  ab2..----..7..75
4260: 0d 0a 37 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..77....query I 
4270: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
4280: 44 49 53 54 49 4e 43 54 20 28 20 2b 20 74 61 62  DISTINCT ( + tab
4290: 31 2e 63 6f 6c 32 20 29 20 41 53 20 63 6f 6c 30  1.col2 ) AS col0
42a0: 20 46 52 4f 4d 20 74 61 62 31 2c 20 74 61 62 31   FROM tab1, tab1
42b0: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
42c0: 35 34 0d 0a 35 37 0d 0a 39 36 0d 0a 0d 0a 71 75  54..57..96....qu
42d0: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
42e0: 45 4c 45 43 54 20 41 4c 4c 20 74 61 62 30 2e 63  ELECT ALL tab0.c
42f0: 6f 6c 32 20 2a 20 2d 20 37 20 46 52 4f 4d 20 74  ol2 * - 7 FROM t
4300: 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 33 31 0d  ab0..----..-231.
4310: 0a 2d 35 37 34 0d 0a 2d 37 0d 0a 0d 0a 6f 6e 6c  .-574..-7....onl
4320: 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20  yif mysql # use 
4330: 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72  DIV operator for
4340: 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f   integer divisio
4350: 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  n..query I rowso
4360: 72 74 20 6c 61 62 65 6c 2d 31 30 36 0d 0a 53 45  rt label-106..SE
4370: 4c 45 43 54 20 2d 20 63 6f 6c 31 20 44 49 56 20  LECT - col1 DIV 
4380: 2d 20 63 6f 6c 31 20 2b 20 35 38 20 46 52 4f 4d  - col1 + 58 FROM
4390: 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab2 cor0..----
43a0: 0d 0a 35 39 0d 0a 35 39 0d 0a 35 39 0d 0a 0d 0a  ..59..59..59....
43b0: 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
43c0: 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
43d0: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
43e0: 61 62 65 6c 2d 31 30 36 0d 0a 53 45 4c 45 43 54  abel-106..SELECT
43f0: 20 2d 20 63 6f 6c 31 20 2f 20 2d 20 63 6f 6c 31   - col1 / - col1
4400: 20 2b 20 35 38 20 46 52 4f 4d 20 74 61 62 32 20   + 58 FROM tab2 
4410: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 35 39 0d 0a  cor0..----..59..
4420: 35 39 0d 0a 35 39 0d 0a 0d 0a 71 75 65 72 79 20  59..59....query 
4430: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
4440: 54 20 2b 20 63 6f 6c 32 20 2d 20 2d 20 63 6f 6c  T + col2 - - col
4450: 31 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  1 AS col1 FROM t
4460: 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
4470: 2d 0d 0a 31 31 39 0d 0a 31 37 33 0d 0a 39 38 0d  -..119..173..98.
4480: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
4490: 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 33 32 20  rt..SELECT + 32 
44a0: 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
44b0: 31 2c 20 74 61 62 32 20 41 53 20 63 6f 72 30 2c  1, tab2 AS cor0,
44c0: 20 74 61 62 32 20 63 6f 72 31 2c 20 74 61 62 32   tab2 cor1, tab2
44d0: 20 41 53 20 63 6f 72 32 0d 0a 2d 2d 2d 2d 0d 0a   AS cor2..----..
44e0: 38 31 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e  81 values hashin
44f0: 67 20 74 6f 20 36 62 65 66 30 34 31 35 32 38 64  g to 6bef041528d
4500: 30 31 34 37 62 65 32 36 66 37 64 65 31 36 32 63  0147be26f7de162c
4510: 36 36 61 35 66 0d 0a 0d 0a 71 75 65 72 79 20 49  66a5f....query I
4520: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
4530: 20 41 4c 4c 20 2d 20 2d 20 63 6f 72 30 2e 63 6f   ALL - - cor0.co
4540: 6c 32 20 2b 20 2d 20 37 31 20 46 52 4f 4d 20 74  l2 + - 71 FROM t
4550: 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
4560: 2d 0d 0a 2d 33 38 0d 0a 2d 37 30 0d 0a 31 31 0d  -..-38..-70..11.
4570: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
4580: 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
4590: 4e 43 54 20 2b 20 33 36 20 46 52 4f 4d 20 74 61  NCT + 36 FROM ta
45a0: 62 31 20 63 6f 72 30 20 43 52 4f 53 53 20 4a 4f  b1 cor0 CROSS JO
45b0: 49 4e 20 74 61 62 31 20 63 6f 72 31 0d 0a 2d 2d  IN tab1 cor1..--
45c0: 2d 2d 0d 0a 33 36 0d 0a 0d 0a 71 75 65 72 79 20  --..36....query 
45d0: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
45e0: 54 20 41 4c 4c 20 2b 20 63 6f 6c 31 20 2b 20 2d  T ALL + col1 + -
45f0: 20 63 6f 6c 30 20 2b 20 74 61 62 31 2e 63 6f 6c   col0 + tab1.col
4600: 30 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d  0 FROM tab1..---
4610: 2d 0d 0a 31 30 0d 0a 31 33 0d 0a 32 36 0d 0a 0d  -..10..13..26...
4620: 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
4630: 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72  use DIV operator
4640: 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76   for integer div
4650: 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72  ision..query I r
4660: 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 31 32  owsort label-112
4670: 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
4680: 54 20 63 6f 6c 31 20 44 49 56 20 2b 20 63 6f 6c  T col1 DIV + col
4690: 30 20 2b 20 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c  0 + col0 * + col
46a0: 32 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  2 AS col0 FROM t
46b0: 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 37 30 0d 0a  ab1..----..170..
46c0: 33 36 34 38 0d 0a 37 36 38 30 0d 0a 0d 0a 73 6b  3648..7680....sk
46d0: 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
46e0: 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
46f0: 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
4700: 65 6c 2d 31 31 32 0d 0a 53 45 4c 45 43 54 20 44  el-112..SELECT D
4710: 49 53 54 49 4e 43 54 20 63 6f 6c 31 20 2f 20 2b  ISTINCT col1 / +
4720: 20 63 6f 6c 30 20 2b 20 63 6f 6c 30 20 2a 20 2b   col0 + col0 * +
4730: 20 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46 52   col2 AS col0 FR
4740: 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31  OM tab1..----..1
4750: 37 30 0d 0a 33 36 34 38 0d 0a 37 36 38 30 0d 0a  70..3648..7680..
4760: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
4770: 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20  t..SELECT ALL - 
4780: 74 61 62 32 2e 63 6f 6c 32 20 41 53 20 63 6f 6c  tab2.col2 AS col
4790: 32 20 46 52 4f 4d 20 74 61 62 32 2c 20 74 61 62  2 FROM tab2, tab
47a0: 31 2c 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  1, tab2 AS cor0.
47b0: 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75 65 73  .----..27 values
47c0: 20 68 61 73 68 69 6e 67 20 74 6f 20 66 39 64 34   hashing to f9d4
47d0: 62 62 38 36 37 37 64 62 37 62 39 38 63 37 65 64  bb8677db7b98c7ed
47e0: 38 39 64 30 36 65 36 65 38 63 64 36 0d 0a 0d 0a  89d06e6e8cd6....
47f0: 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75  onlyif mysql # u
4800: 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20  se DIV operator 
4810: 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69  for integer divi
4820: 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f  sion..query I ro
4830: 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 31 34 0d  wsort label-114.
4840: 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
4850: 20 2d 20 63 6f 6c 30 20 44 49 56 20 31 31 20 46   - col0 DIV 11 F
4860: 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
4870: 0d 0a 2d 2d 2d 2d 0d 0a 2d 37 0d 0a 30 0d 0a 0d  ..----..-7..0...
4880: 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
4890: 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
48a0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
48b0: 6c 61 62 65 6c 2d 31 31 34 0d 0a 53 45 4c 45 43  label-114..SELEC
48c0: 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c  T DISTINCT - col
48d0: 30 20 2f 20 31 31 20 46 52 4f 4d 20 74 61 62 32  0 / 11 FROM tab2
48e0: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
48f0: 2d 37 0d 0a 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  -7..0....onlyif 
4900: 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20  mysql # support 
4910: 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66  for MySQL specif
4920: 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20  ic system types 
4930: 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72  and syntax..quer
4940: 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
4950: 6c 2d 31 31 35 0d 0a 53 45 4c 45 43 54 20 63 6f  l-115..SELECT co
4960: 72 30 2e 63 6f 6c 30 20 2b 20 2b 20 43 41 53 54  r0.col0 + + CAST
4970: 28 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 41 53  ( + cor0.col2 AS
4980: 20 53 49 47 4e 45 44 20 29 20 2b 20 2d 20 63 6f   SIGNED ) + - co
4990: 6c 31 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  l1 col1 FROM tab
49a0: 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
49b0: 0a 2d 32 39 0d 0a 2d 36 31 0d 0a 38 30 0d 0a 0d  .-29..-61..80...
49c0: 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73  .skipif postgres
49d0: 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20  ql # PostgreSQL 
49e0: 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e  requires AS when
49f0: 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74   renaming output
4a00: 20 63 6f 6c 75 6d 6e 73 0d 0a 73 6b 69 70 69 66   columns..skipif
4a10: 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
4a20: 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
4a30: 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
4a40: 31 35 0d 0a 53 45 4c 45 43 54 20 63 6f 72 30 2e  15..SELECT cor0.
4a50: 63 6f 6c 30 20 2b 20 2b 20 43 41 53 54 20 28 20  col0 + + CAST ( 
4a60: 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 41 53 20 49  + cor0.col2 AS I
4a70: 4e 54 45 47 45 52 20 29 20 2b 20 2d 20 63 6f 6c  NTEGER ) + - col
4a80: 31 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30  1 col1 FROM tab0
4a90: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
4aa0: 2d 32 39 0d 0a 2d 36 31 0d 0a 38 30 0d 0a 0d 0a  -29..-61..80....
4ab0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
4ac0: 0a 53 45 4c 45 43 54 20 2d 20 36 20 46 52 4f 4d  .SELECT - 6 FROM
4ad0: 20 74 61 62 30 2c 20 74 61 62 30 20 41 53 20 63   tab0, tab0 AS c
4ae0: 6f 72 30 2c 20 74 61 62 30 20 41 53 20 63 6f 72  or0, tab0 AS cor
4af0: 31 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75  1..----..27 valu
4b00: 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 38 62  es hashing to 8b
4b10: 65 38 39 31 30 35 30 37 39 30 38 65 36 33 35 33  e8910507908e6353
4b20: 64 30 32 61 35 34 35 62 37 34 38 32 35 32 0d 0a  d02a545b748252..
4b30: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
4b40: 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20  t..SELECT ALL + 
4b50: 63 6f 6c 30 20 2b 20 2d 20 35 35 20 46 52 4f 4d  col0 + - 55 FROM
4b60: 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab0 cor0..----
4b70: 0d 0a 2d 32 30 0d 0a 2d 33 31 0d 0a 33 34 0d 0a  ..-20..-31..34..
4b80: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
4b90: 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 30  t..SELECT + col0
4ba0: 20 2a 20 63 6f 6c 31 20 2b 20 63 6f 6c 30 20 2a   * col1 + col0 *
4bb0: 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20   col0 FROM tab1 
4bc0: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 34 37 33 36  cor0..----..4736
4bd0: 0d 0a 37 34 34 30 0d 0a 38 37 0d 0a 0d 0a 71 75  ..7440..87....qu
4be0: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
4bf0: 45 4c 45 43 54 20 2d 20 74 61 62 30 2e 63 6f 6c  ELECT - tab0.col
4c00: 32 20 2a 20 2d 20 33 32 20 46 52 4f 4d 20 74 61  2 * - 32 FROM ta
4c10: 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 35 36 0d 0a  b0..----..1056..
4c20: 32 36 32 34 0d 0a 33 32 0d 0a 0d 0a 71 75 65 72  2624..32....quer
4c30: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
4c40: 45 43 54 20 63 6f 72 30 2e 63 6f 6c 30 20 2a 20  ECT cor0.col0 * 
4c50: 28 20 35 32 20 29 20 2b 20 63 6f 6c 32 20 2a 20  ( 52 ) + col2 * 
4c60: 31 38 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  18 FROM tab0 AS 
4c70: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 38 33 38  cor0..----..1838
4c80: 0d 0a 31 38 34 32 0d 0a 36 31 30 34 0d 0a 0d 0a  ..1842..6104....
4c90: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
4ca0: 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 30 20 2b  .SELECT - col0 +
4cb0: 20 33 32 20 2a 20 2d 20 39 30 20 41 53 20 63 6f   32 * - 90 AS co
4cc0: 6c 32 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d  l2 FROM tab0..--
4cd0: 2d 2d 0d 0a 2d 32 39 30 34 0d 0a 2d 32 39 31 35  --..-2904..-2915
4ce0: 0d 0a 2d 32 39 36 39 0d 0a 0d 0a 71 75 65 72 79  ..-2969....query
4cf0: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
4d00: 43 54 20 2b 20 2d 20 63 6f 6c 31 20 2b 20 2d 20  CT + - col1 + - 
4d10: 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c 30 20 41 53  col1 * + col0 AS
4d20: 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20   col1 FROM tab2 
4d30: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
4d40: 31 33 36 30 0d 0a 2d 32 34 38 0d 0a 2d 34 36 36  1360..-248..-466
4d50: 31 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  1....onlyif mysq
4d60: 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72  l # use DIV oper
4d70: 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72  ator for integer
4d80: 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79   division..query
4d90: 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
4da0: 2d 31 32 33 0d 0a 53 45 4c 45 43 54 20 2b 20 2b  -123..SELECT + +
4db0: 20 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c 30 20 2b   col2 * - col0 +
4dc0: 20 2b 20 28 20 63 6f 6c 32 20 29 20 44 49 56 20   + ( col2 ) DIV 
4dd0: 28 20 63 6f 72 30 2e 63 6f 6c 31 20 29 20 46 52  ( cor0.col1 ) FR
4de0: 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
4df0: 0a 2d 2d 2d 2d 0d 0a 2d 33 35 0d 0a 2d 37 32 39  .----..-35..-729
4e00: 38 0d 0a 2d 37 39 32 0d 0a 0d 0a 73 6b 69 70 69  8..-792....skipi
4e10: 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
4e20: 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
4e30: 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
4e40: 31 32 33 0d 0a 53 45 4c 45 43 54 20 2b 20 2b 20  123..SELECT + + 
4e50: 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c 30 20 2b 20  col2 * - col0 + 
4e60: 2b 20 28 20 63 6f 6c 32 20 29 20 2f 20 28 20 63  + ( col2 ) / ( c
4e70: 6f 72 30 2e 63 6f 6c 31 20 29 20 46 52 4f 4d 20  or0.col1 ) FROM 
4e80: 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
4e90: 2d 2d 0d 0a 2d 33 35 0d 0a 2d 37 32 39 38 0d 0a  --..-35..-7298..
4ea0: 2d 37 39 32 0d 0a 0d 0a 73 6b 69 70 69 66 20 70  -792....skipif p
4eb0: 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74  ostgresql # Post
4ec0: 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20  greSQL requires 
4ed0: 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67  AS when renaming
4ee0: 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d   output columns.
4ef0: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
4f00: 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
4f10: 54 20 2d 20 2d 20 63 6f 72 30 2e 63 6f 6c 31 20  T - - cor0.col1 
4f20: 2b 20 2d 20 28 20 2b 20 63 6f 6c 30 20 2a 20 63  + - ( + col0 * c
4f30: 6f 6c 32 20 29 20 2b 20 63 6f 6c 31 20 63 6f 6c  ol2 ) + col1 col
4f40: 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  0 FROM tab2 AS c
4f50: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32 37 0d  or0..----..-127.
4f60: 0a 2d 31 39 31 30 0d 0a 2d 32 39 36 38 0d 0a 0d  .-1910..-2968...
4f70: 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
4f80: 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72  use DIV operator
4f90: 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76   for integer div
4fa0: 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72  ision..query I r
4fb0: 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 32 35  owsort label-125
4fc0: 0d 0a 53 45 4c 45 43 54 20 2d 20 38 35 20 44 49  ..SELECT - 85 DI
4fd0: 56 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 46 52  V + cor0.col1 FR
4fe0: 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
4ff0: 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 2d 32 0d 0a 2d  .----..-1..-2..-
5000: 35 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  5....skipif mysq
5010: 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
5020: 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
5030: 6f 72 74 20 6c 61 62 65 6c 2d 31 32 35 0d 0a 53  ort label-125..S
5040: 45 4c 45 43 54 20 2d 20 38 35 20 2f 20 2b 20 63  ELECT - 85 / + c
5050: 6f 72 30 2e 63 6f 6c 31 20 46 52 4f 4d 20 74 61  or0.col1 FROM ta
5060: 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
5070: 0d 0a 2d 31 0d 0a 2d 32 0d 0a 2d 35 0d 0a 0d 0a  ..-1..-2..-5....
5080: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
5090: 0a 53 45 4c 45 43 54 20 28 20 35 36 20 29 20 46  .SELECT ( 56 ) F
50a0: 52 4f 4d 20 74 61 62 31 2c 20 74 61 62 31 20 41  ROM tab1, tab1 A
50b0: 53 20 63 6f 72 30 2c 20 74 61 62 30 20 41 53 20  S cor0, tab0 AS 
50c0: 63 6f 72 31 2c 20 74 61 62 31 20 41 53 20 63 6f  cor1, tab1 AS co
50d0: 72 32 0d 0a 2d 2d 2d 2d 0d 0a 38 31 20 76 61 6c  r2..----..81 val
50e0: 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 39  ues hashing to 9
50f0: 63 65 65 39 31 63 61 39 63 36 30 62 61 36 65 34  cee91ca9c60ba6e4
5100: 35 61 33 33 62 33 38 38 61 33 62 37 64 39 62 0d  5a33b388a3b7d9b.
5110: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
5120: 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 28 20 2d  rt..SELECT - ( -
5130: 20 31 34 20 29 20 41 53 20 63 6f 6c 30 20 46 52   14 ) AS col0 FR
5140: 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
5150: 0a 2d 2d 2d 2d 0d 0a 31 34 0d 0a 31 34 0d 0a 31  .----..14..14..1
5160: 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  4....query I row
5170: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 34  sort..SELECT + 4
5180: 37 20 2a 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f  7 * + col1 AS co
5190: 6c 31 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d  l1 FROM tab1..--
51a0: 2d 2d 0d 0a 31 32 32 32 0d 0a 34 37 30 0d 0a 36  --..1222..470..6
51b0: 31 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  11....query I ro
51c0: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
51d0: 74 61 62 32 2e 63 6f 6c 32 20 2a 20 2b 20 74 61  tab2.col2 * + ta
51e0: 62 32 2e 63 6f 6c 32 20 2a 20 2b 20 74 61 62 32  b2.col2 * + tab2
51f0: 2e 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46 52  .col0 AS col2 FR
5200: 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d  OM tab2..----..-
5210: 31 31 34 30 37 36 0d 0a 2d 35 31 30 33 0d 0a 2d  114076..-5103..-
5220: 35 32 37 32 38 0d 0a 0d 0a 71 75 65 72 79 20 49  52728....query I
5230: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
5240: 20 2b 20 63 6f 6c 31 20 2a 20 63 6f 6c 30 20 2d   + col1 * col0 -
5250: 20 2b 20 37 38 20 41 53 20 63 6f 6c 30 20 46 52   + 78 AS col0 FR
5260: 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
5270: 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 35 36 32 0d 0a 39  .----..0..562..9
5280: 36 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  62....query I ro
5290: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
52a0: 4c 20 2d 20 38 34 20 2a 20 2d 20 63 6f 6c 31 20  L - 84 * - col1 
52b0: 2b 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61  + + col1 FROM ta
52c0: 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
52d0: 0d 0a 37 33 31 30 0d 0a 37 37 33 35 0d 0a 38 32  ..7310..7735..82
52e0: 34 35 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73  45....skipif pos
52f0: 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72  tgresql # Postgr
5300: 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53  eSQL requires AS
5310: 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f   when renaming o
5320: 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71  utput columns..q
5330: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
5340: 53 45 4c 45 43 54 20 2d 20 63 6f 6c 30 20 2a 20  SELECT - col0 * 
5350: 2b 20 63 6f 6c 31 20 2b 20 2b 20 63 6f 6c 30 20  + col1 + + col0 
5360: 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41  col0 FROM tab2 A
5370: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
5380: 32 36 34 0d 0a 2d 32 31 30 0d 0a 2d 34 35 32 34  264..-210..-4524
5390: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
53a0: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f  ort..SELECT + co
53b0: 6c 32 20 2b 20 2b 20 63 6f 72 30 2e 63 6f 6c 32  l2 + + cor0.col2
53c0: 20 2b 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74   + + col1 FROM t
53d0: 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
53e0: 2d 0d 0a 31 31 31 0d 0a 38 35 0d 0a 39 33 0d 0a  -..111..85..93..
53f0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
5400: 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2d 20 63 6f  t..SELECT - - co
5410: 6c 32 20 2b 20 32 31 20 2a 20 32 33 20 2b 20 63  l2 + 21 * 23 + c
5420: 6f 72 30 2e 63 6f 6c 30 20 46 52 4f 4d 20 74 61  or0.col0 FROM ta
5430: 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
5440: 0d 0a 35 34 30 0d 0a 36 30 34 0d 0a 36 35 39 0d  ..540..604..659.
5450: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
5460: 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c  rt..SELECT + col
5470: 31 20 2b 20 31 38 20 41 53 20 63 6f 6c 31 20 46  1 + 18 AS col1 F
5480: 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
5490: 0d 0a 2d 2d 2d 2d 0d 0a 33 35 0d 0a 34 39 0d 0a  ..----..35..49..
54a0: 37 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  77....query I ro
54b0: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f  wsort..SELECT co
54c0: 6c 32 20 2b 20 2d 20 63 6f 6c 30 20 2a 20 28 20  l2 + - col0 * ( 
54d0: 28 20 2b 20 63 6f 6c 30 20 29 20 29 20 46 52 4f  ( + col0 ) ) FRO
54e0: 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 32  M tab2..----..-2
54f0: 32 0d 0a 2d 36 30 35 38 0d 0a 2d 36 32 30 33 0d  2..-6058..-6203.
5500: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
5510: 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
5520: 4e 43 54 20 2d 20 28 20 74 61 62 30 2e 63 6f 6c  NCT - ( tab0.col
5530: 30 20 29 20 2a 20 2d 20 28 20 2b 20 63 6f 6c 31  0 ) * - ( + col1
5540: 20 29 20 2b 20 2b 20 63 6f 6c 30 20 46 52 4f 4d   ) + + col0 FROM
5550: 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 32 30 38   tab0..----..208
5560: 38 0d 0a 33 34 33 30 0d 0a 38 31 38 38 0d 0a 0d  8..3430..8188...
5570: 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
5580: 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51  support for MySQ
5590: 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65  L specific syste
55a0: 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74  m types and synt
55b0: 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ax..query I rows
55c0: 6f 72 74 20 6c 61 62 65 6c 2d 31 33 38 0d 0a 53  ort label-138..S
55d0: 45 4c 45 43 54 20 41 4c 4c 20 37 35 20 2a 20 63  ELECT ALL 75 * c
55e0: 6f 6c 31 20 2b 20 43 41 53 54 28 20 2b 20 63 6f  ol1 + CAST( + co
55f0: 6c 30 20 41 53 20 53 49 47 4e 45 44 20 29 20 46  l0 AS SIGNED ) F
5600: 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab1..----..
5610: 31 30 35 35 0d 0a 31 39 35 33 0d 0a 38 31 34 0d  1055..1953..814.
5620: 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
5630: 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
5640: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
5650: 74 20 6c 61 62 65 6c 2d 31 33 38 0d 0a 53 45 4c  t label-138..SEL
5660: 45 43 54 20 41 4c 4c 20 37 35 20 2a 20 63 6f 6c  ECT ALL 75 * col
5670: 31 20 2b 20 43 41 53 54 20 28 20 2b 20 63 6f 6c  1 + CAST ( + col
5680: 30 20 41 53 20 49 4e 54 45 47 45 52 20 29 20 46  0 AS INTEGER ) F
5690: 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab1..----..
56a0: 31 30 35 35 0d 0a 31 39 35 33 0d 0a 38 31 34 0d  1055..1953..814.
56b0: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
56c0: 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c  rt..SELECT + col
56d0: 32 20 2b 20 37 32 20 2a 20 2b 20 63 6f 72 30 2e  2 + 72 * + cor0.
56e0: 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 63  col1 FROM tab2 c
56f0: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 36 32 0d  or0..----..1262.
5700: 0a 32 32 35 39 0d 0a 34 32 37 34 0d 0a 0d 0a 6f  .2259..4274....o
5710: 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73  nlyif mysql # us
5720: 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66  e DIV operator f
5730: 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73  or integer divis
5740: 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ion..query I row
5750: 73 6f 72 74 20 6c 61 62 65 6c 2d 31 34 30 0d 0a  sort label-140..
5760: 53 45 4c 45 43 54 20 2b 20 2d 20 63 6f 6c 30 20  SELECT + - col0 
5770: 2a 20 28 20 2d 20 63 6f 6c 31 20 29 20 2d 20 2d  * ( - col1 ) - -
5780: 20 63 6f 6c 30 20 44 49 56 20 63 6f 72 30 2e 63   col0 DIV cor0.c
5790: 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 63 6f  ol0 FROM tab2 co
57a0: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33 34 34 0d 0a  r0..----..1344..
57b0: 32 31 38 0d 0a 34 36 30 33 0d 0a 0d 0a 73 6b 69  218..4603....ski
57c0: 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
57d0: 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
57e0: 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
57f0: 6c 2d 31 34 30 0d 0a 53 45 4c 45 43 54 20 2b 20  l-140..SELECT + 
5800: 2d 20 63 6f 6c 30 20 2a 20 28 20 2d 20 63 6f 6c  - col0 * ( - col
5810: 31 20 29 20 2d 20 2d 20 63 6f 6c 30 20 2f 20 63  1 ) - - col0 / c
5820: 6f 72 30 2e 63 6f 6c 30 20 46 52 4f 4d 20 74 61  or0.col0 FROM ta
5830: 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  b2 cor0..----..1
5840: 33 34 34 0d 0a 32 31 38 0d 0a 34 36 30 33 0d 0a  344..218..4603..
5850: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
5860: 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2b 20 28 20  t..SELECT + + ( 
5870: 2d 20 63 6f 6c 32 20 29 20 2b 20 2d 20 63 6f 6c  - col2 ) + - col
5880: 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  0 FROM tab0 AS c
5890: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 37 31 0d  or0..----..-171.
58a0: 0a 2d 33 36 0d 0a 2d 35 37 0d 0a 0d 0a 71 75 65  .-36..-57....que
58b0: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
58c0: 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 31 20 2a 20  LECT ALL col1 * 
58d0: 63 6f 6c 30 20 2a 20 38 37 20 2d 20 63 6f 6c 32  col0 * 87 - col2
58e0: 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
58f0: 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
5900: 0d 0a 31 31 36 38 30 33 0d 0a 31 38 38 35 32 0d  ..116803..18852.
5910: 0a 34 30 30 33 34 38 0d 0a 0d 0a 73 6b 69 70 69  .400348....skipi
5920: 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50  f postgresql # P
5930: 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72  ostgreSQL requir
5940: 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d  es AS when renam
5950: 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d  ing output colum
5960: 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ns..query I rows
5970: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 32  ort..SELECT col2
5980: 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 63 6f 6c   + cor0.col1 col
5990: 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  2 FROM tab1 AS c
59a0: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 39 0d 0a  or0..----..109..
59b0: 36 37 0d 0a 38 30 0d 0a 0d 0a 71 75 65 72 79 20  67..80....query 
59c0: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
59d0: 54 20 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c 30 20  T col1 * - col0 
59e0: 2b 20 2b 20 28 20 63 6f 72 30 2e 63 6f 6c 31 20  + + ( cor0.col1 
59f0: 29 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  ) FROM tab1 AS c
5a00: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 32 37  or0..----..-1027
5a10: 0d 0a 2d 35 32 0d 0a 2d 36 33 30 0d 0a 0d 0a 71  ..-52..-630....q
5a20: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
5a30: 53 45 4c 45 43 54 20 32 20 2b 20 2d 20 63 6f 6c  SELECT 2 + - col
5a40: 30 20 2a 20 63 6f 6c 30 20 2a 20 2d 20 63 6f 72  0 * col0 * - cor
5a50: 30 2e 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30  0.col0 FROM tab0
5a60: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
5a70: 31 33 38 32 36 0d 0a 34 32 38 37 37 0d 0a 37 30  13826..42877..70
5a80: 34 39 37 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20  4971....query I 
5a90: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
5aa0: 44 49 53 54 49 4e 43 54 20 2d 20 2b 20 63 6f 6c  DISTINCT - + col
5ab0: 30 20 2a 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f  0 * + col1 AS co
5ac0: 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l1 FROM tab1 AS 
5ad0: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 34  cor0..----..-104
5ae0: 30 0d 0a 2d 36 34 30 0d 0a 2d 37 38 0d 0a 0d 0a  0..-640..-78....
5af0: 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71  skipif postgresq
5b00: 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72  l # PostgreSQL r
5b10: 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20  equires AS when 
5b20: 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20  renaming output 
5b30: 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49  columns..query I
5b40: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
5b50: 20 44 49 53 54 49 4e 43 54 20 2d 20 28 20 2b 20   DISTINCT - ( + 
5b60: 28 20 63 6f 6c 32 20 29 20 29 20 63 6f 6c 31 20  ( col2 ) ) col1 
5b70: 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d  FROM tab0..----.
5b80: 0a 2d 31 0d 0a 2d 33 33 0d 0a 2d 38 32 0d 0a 0d  .-1..-33..-82...
5b90: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
5ba0: 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 32 20  ..SELECT - col2 
5bb0: 2a 20 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c 32 20  * col0 * - col2 
5bc0: 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
5bd0: 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
5be0: 0a 32 30 37 39 33 36 0d 0a 37 33 37 32 38 30 0d  .207936..737280.
5bf0: 0a 38 37 34 38 0d 0a 0d 0a 71 75 65 72 79 20 49  .8748....query I
5c00: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
5c10: 20 44 49 53 54 49 4e 43 54 20 2d 20 2d 20 63 6f   DISTINCT - - co
5c20: 6c 31 20 2a 20 2d 20 36 36 20 41 53 20 63 6f 6c  l1 * - 66 AS col
5c30: 32 20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30  2 FROM tab1 cor0
5c40: 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 37 31 36 0d 0a 2d  ..----..-1716..-
5c50: 36 36 30 0d 0a 2d 38 35 38 0d 0a 0d 0a 73 6b 69  660..-858....ski
5c60: 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23  pif postgresql #
5c70: 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75   PostgreSQL requ
5c80: 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e  ires AS when ren
5c90: 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c  aming output col
5ca0: 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f  umns..query I ro
5cb0: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
5cc0: 4c 20 74 61 62 30 2e 63 6f 6c 32 20 2b 20 2b 20  L tab0.col2 + + 
5cd0: 63 6f 6c 32 20 63 6f 6c 31 20 46 52 4f 4d 20 74  col2 col1 FROM t
5ce0: 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 36 34 0d 0a  ab0..----..164..
5cf0: 32 0d 0a 36 36 0d 0a 0d 0a 71 75 65 72 79 20 49  2..66....query I
5d00: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
5d10: 20 2b 20 39 37 20 2a 20 63 6f 6c 30 20 2b 20 2b   + 97 * col0 + +
5d20: 20 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46 52   col1 AS col2 FR
5d30: 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 33  OM tab1..----..3
5d40: 31 37 0d 0a 36 32 31 38 0d 0a 37 37 37 33 0d 0a  17..6218..7773..
5d50: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
5d60: 74 0d 0a 53 45 4c 45 43 54 20 34 33 20 2d 20 38  t..SELECT 43 - 8
5d70: 31 20 46 52 4f 4d 20 74 61 62 31 2c 20 74 61 62  1 FROM tab1, tab
5d80: 31 20 41 53 20 63 6f 72 30 2c 20 74 61 62 31 20  1 AS cor0, tab1 
5d90: 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 32  AS cor1..----..2
5da0: 37 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67  7 values hashing
5db0: 20 74 6f 20 65 38 63 30 36 34 35 34 33 62 66 30   to e8c064543bf0
5dc0: 66 32 65 35 37 33 32 39 64 62 31 62 62 30 61 34  f2e57329db1bb0a4
5dd0: 31 31 65 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20  11e3....query I 
5de0: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
5df0: 2b 20 74 61 62 32 2e 63 6f 6c 31 20 2a 20 2d 20  + tab2.col1 * - 
5e00: 63 6f 6c 30 20 2b 20 2d 20 38 33 20 41 53 20 63  col0 + - 83 AS c
5e10: 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d  ol1 FROM tab2..-
5e20: 2d 2d 2d 0d 0a 2d 31 34 32 36 0d 0a 2d 33 30 30  ---..-1426..-300
5e30: 0d 0a 2d 34 36 38 35 0d 0a 0d 0a 71 75 65 72 79  ..-4685....query
5e40: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
5e50: 43 54 20 41 4c 4c 20 38 37 20 46 52 4f 4d 20 74  CT ALL 87 FROM t
5e60: 61 62 32 2c 20 74 61 62 31 2c 20 74 61 62 31 20  ab2, tab1, tab1 
5e70: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32  AS cor0..----..2
5e80: 37 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67  7 values hashing
5e90: 20 74 6f 20 38 36 36 31 66 66 62 64 31 61 37 32   to 8661ffbd1a72
5ea0: 38 39 37 63 34 39 35 34 30 35 63 35 33 62 38 31  897c495405c53b81
5eb0: 36 65 35 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20  6e50....query I 
5ec0: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
5ed0: 41 4c 4c 20 2b 20 63 6f 6c 32 20 2a 20 74 61 62  ALL + col2 * tab
5ee0: 31 2e 63 6f 6c 30 20 2b 20 34 34 20 41 53 20 63  1.col0 + 44 AS c
5ef0: 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d  ol2 FROM tab1..-
5f00: 2d 2d 2d 0d 0a 32 30 36 0d 0a 33 36 39 32 0d 0a  ---..206..3692..
5f10: 37 37 32 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20  7724....query I 
5f20: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
5f30: 44 49 53 54 49 4e 43 54 20 2b 20 38 39 20 2b 20  DISTINCT + 89 + 
5f40: 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c 30 20 2b 20  col2 * + col0 + 
5f50: 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 63  col2 FROM tab0 c
5f60: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 35 0d 0a  or0..----..125..
5f70: 37 34 36 39 0d 0a 39 31 34 0d 0a 0d 0a 71 75 65  7469..914....que
5f80: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
5f90: 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20  LECT DISTINCT + 
5fa0: 63 6f 6c 31 20 2a 20 2b 20 34 39 20 46 52 4f 4d  col1 * + 49 FROM
5fb0: 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 34 32 31   tab0..----..421
5fc0: 34 0d 0a 34 34 35 39 0d 0a 34 37 35 33 0d 0a 0d  4..4459..4753...
5fd0: 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
5fe0: 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72  use DIV operator
5ff0: 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76   for integer div
6000: 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72  ision..query I r
6010: 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 35 38  owsort label-158
6020: 0d 0a 53 45 4c 45 43 54 20 2d 20 2d 20 63 6f 72  ..SELECT - - cor
6030: 30 2e 63 6f 6c 32 20 44 49 56 20 63 6f 6c 31 20  0.col2 DIV col1 
6040: 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41  col1 FROM tab0 A
6050: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d  S cor0..----..0.
6060: 0a 30 0d 0a 30 0d 0a 0d 0a 73 6b 69 70 69 66 20  .0..0....skipif 
6070: 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73  postgresql # Pos
6080: 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73  tgreSQL requires
6090: 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e   AS when renamin
60a0: 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73  g output columns
60b0: 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
60c0: 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
60d0: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
60e0: 20 6c 61 62 65 6c 2d 31 35 38 0d 0a 53 45 4c 45   label-158..SELE
60f0: 43 54 20 2d 20 2d 20 63 6f 72 30 2e 63 6f 6c 32  CT - - cor0.col2
6100: 20 2f 20 63 6f 6c 31 20 63 6f 6c 31 20 46 52 4f   / col1 col1 FRO
6110: 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
6120: 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d  ----..0..0..0...
6130: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
6140: 0d 0a 53 45 4c 45 43 54 20 2b 20 28 20 2d 20 63  ..SELECT + ( - c
6150: 6f 6c 32 20 29 20 2b 20 2b 20 63 6f 6c 30 20 41  ol2 ) + + col0 A
6160: 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30  S col0 FROM tab0
6170: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
6180: 2d 39 0d 0a 33 34 0d 0a 37 0d 0a 0d 0a 71 75 65  -9..34..7....que
6190: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
61a0: 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 30 20  LECT ALL + col0 
61b0: 2b 20 32 36 20 41 53 20 63 6f 6c 32 20 46 52 4f  + 26 AS col2 FRO
61c0: 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab0 cor0..---
61d0: 2d 0d 0a 31 31 35 0d 0a 35 30 0d 0a 36 31 0d 0a  -..115..50..61..
61e0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
61f0: 74 0d 0a 53 45 4c 45 43 54 20 2b 20 28 20 37 35  t..SELECT + ( 75
6200: 20 29 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20   ) FROM tab0 AS 
6210: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 37 35 0d 0a  cor0..----..75..
6220: 37 35 0d 0a 37 35 0d 0a 0d 0a 71 75 65 72 79 20  75..75....query 
6230: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
6240: 54 20 44 49 53 54 49 4e 43 54 20 28 20 2b 20 63  T DISTINCT ( + c
6250: 6f 6c 31 20 29 20 2a 20 63 6f 6c 31 20 2b 20 2b  ol1 ) * col1 + +
6260: 20 28 20 28 20 2b 20 63 6f 6c 30 20 29 20 29 20   ( ( + col0 ) ) 
6270: 2b 20 28 20 63 6f 6c 31 20 2b 20 2b 20 63 6f 6c  + ( col1 + + col
6280: 31 20 29 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  1 ) AS col1 FROM
6290: 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
62a0: 2d 2d 2d 0d 0a 31 38 34 0d 0a 32 37 35 0d 0a 37  ---..184..275..7
62b0: 33 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  31....query I ro
62c0: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
62d0: 63 6f 72 30 2e 63 6f 6c 31 20 2d 20 63 6f 6c 32  cor0.col1 - col2
62e0: 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
62f0: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 35 33 0d 0a 39 0d  r0..----..53..9.
6300: 0a 39 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .96....query I r
6310: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
6320: 4c 4c 20 31 20 41 53 20 63 6f 6c 32 20 46 52 4f  LL 1 AS col2 FRO
6330: 4d 20 74 61 62 32 2c 20 74 61 62 30 20 41 53 20  M tab2, tab0 AS 
6340: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61  cor0..----..9 va
6350: 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20  lues hashing to 
6360: 30 30 31 35 35 34 63 32 39 35 32 66 31 61 38 30  001554c2952f1a80
6370: 35 30 36 62 31 38 32 65 65 30 34 36 38 36 66 35  506b182ee04686f5
6380: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
6390: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 31  ort..SELECT col1
63a0: 20 2a 20 2d 20 74 61 62 31 2e 63 6f 6c 31 20 2a   * - tab1.col1 *
63b0: 20 2d 20 31 31 20 41 53 20 63 6f 6c 30 20 46 52   - 11 AS col0 FR
63c0: 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31  OM tab1..----..1
63d0: 31 30 30 0d 0a 31 38 35 39 0d 0a 37 34 33 36 0d  100..1859..7436.
63e0: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
63f0: 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 36  rt..SELECT ALL 6
6400: 38 20 2b 20 2b 20 74 61 62 31 2e 63 6f 6c 30 20  8 + + tab1.col0 
6410: 2a 20 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46  * col0 AS col1 F
6420: 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab1..----..
6430: 34 31 36 34 0d 0a 36 34 36 38 0d 0a 37 37 0d 0a  4164..6468..77..
6440: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
6450: 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20  t..SELECT ALL - 
6460: 31 32 20 46 52 4f 4d 20 74 61 62 32 2c 20 74 61  12 FROM tab2, ta
6470: 62 30 20 63 6f 72 30 20 43 52 4f 53 53 20 4a 4f  b0 cor0 CROSS JO
6480: 49 4e 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 32  IN tab1..----..2
6490: 37 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67  7 values hashing
64a0: 20 74 6f 20 33 39 38 33 62 66 66 65 32 61 64 66   to 3983bffe2adf
64b0: 38 38 63 62 32 65 66 63 33 62 65 39 33 65 65 36  88cb2efc3be93ee6
64c0: 32 30 63 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20  20c0....query I 
64d0: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
64e0: 2b 20 2d 20 37 39 20 2b 20 2d 20 63 6f 6c 31 20  + - 79 + - col1 
64f0: 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
6500: 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
6510: 0a 2d 31 30 35 0d 0a 2d 38 39 0d 0a 2d 39 32 0d  .-105..-89..-92.
6520: 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
6530: 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74  # use DIV operat
6540: 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64  or for integer d
6550: 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49  ivision..query I
6560: 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
6570: 36 39 0d 0a 53 45 4c 45 43 54 20 2d 20 2b 20 63  69..SELECT - + c
6580: 6f 6c 32 20 44 49 56 20 63 6f 72 30 2e 63 6f 6c  ol2 DIV cor0.col
6590: 32 20 2d 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f  2 - + col1 AS co
65a0: 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l0 FROM tab1 AS 
65b0: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 0d  cor0..----..-11.
65c0: 0a 2d 31 34 0d 0a 2d 32 37 0d 0a 0d 0a 73 6b 69  .-14..-27....ski
65d0: 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
65e0: 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
65f0: 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
6600: 6c 2d 31 36 39 0d 0a 53 45 4c 45 43 54 20 2d 20  l-169..SELECT - 
6610: 2b 20 63 6f 6c 32 20 2f 20 63 6f 72 30 2e 63 6f  + col2 / cor0.co
6620: 6c 32 20 2d 20 2b 20 63 6f 6c 31 20 41 53 20 63  l2 - + col1 AS c
6630: 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol0 FROM tab1 AS
6640: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31   cor0..----..-11
6650: 0d 0a 2d 31 34 0d 0a 2d 32 37 0d 0a 0d 0a 71 75  ..-14..-27....qu
6660: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
6670: 45 4c 45 43 54 20 2b 20 2b 20 28 20 2d 20 34 37  ELECT + + ( - 47
6680: 20 29 20 2a 20 63 6f 72 30 2e 63 6f 6c 32 20 41   ) * cor0.col2 A
6690: 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30  S col2 FROM tab0
66a0: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
66b0: 2d 31 35 35 31 0d 0a 2d 33 38 35 34 0d 0a 2d 34  -1551..-3854..-4
66c0: 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  7....query I row
66d0: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
66e0: 54 49 4e 43 54 20 2b 20 63 6f 6c 30 20 2d 20 2b  TINCT + col0 - +
66f0: 20 39 38 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d   98 FROM tab2..-
6700: 2d 2d 2d 0d 0a 2d 31 39 0d 0a 2d 32 30 0d 0a 2d  ---..-19..-20..-
6710: 39 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  91....query I ro
6720: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
6730: 53 54 49 4e 43 54 20 2b 20 74 61 62 32 2e 63 6f  STINCT + tab2.co
6740: 6c 31 20 2d 20 63 6f 6c 31 20 41 53 20 63 6f 6c  l1 - col1 AS col
6750: 32 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d  2 FROM tab2..---
6760: 2d 0d 0a 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20  -..0....query I 
6770: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
6780: 41 4c 4c 20 28 20 2b 20 63 6f 6c 32 20 29 20 2d  ALL ( + col2 ) -
6790: 20 2d 20 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c 30   - col2 * - col0
67a0: 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
67b0: 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 38 0d 0a  b1..----..-108..
67c0: 2d 33 35 39 31 0d 0a 2d 37 35 38 34 0d 0a 0d 0a  -3591..-7584....
67d0: 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73  onlyif mysql # s
67e0: 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c  upport for MySQL
67f0: 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d   specific system
6800: 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61   types and synta
6810: 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  x..query I rowso
6820: 72 74 20 6c 61 62 65 6c 2d 31 37 34 0d 0a 53 45  rt label-174..SE
6830: 4c 45 43 54 20 41 4c 4c 20 43 41 53 54 28 20 63  LECT ALL CAST( c
6840: 6f 6c 32 20 41 53 20 53 49 47 4e 45 44 20 29 20  ol2 AS SIGNED ) 
6850: 2a 20 2b 20 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c  * + col1 * + col
6860: 30 20 2d 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20  0 - + col0 FROM 
6870: 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 33 33 36 30  tab0..----..3360
6880: 0d 0a 36 36 34 30 32 39 0d 0a 36 38 30 38 38 0d  ..664029..68088.
6890: 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
68a0: 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
68b0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
68c0: 74 20 6c 61 62 65 6c 2d 31 37 34 0d 0a 53 45 4c  t label-174..SEL
68d0: 45 43 54 20 41 4c 4c 20 43 41 53 54 20 28 20 63  ECT ALL CAST ( c
68e0: 6f 6c 32 20 41 53 20 49 4e 54 45 47 45 52 20 29  ol2 AS INTEGER )
68f0: 20 2a 20 2b 20 63 6f 6c 31 20 2a 20 2b 20 63 6f   * + col1 * + co
6900: 6c 30 20 2d 20 2b 20 63 6f 6c 30 20 46 52 4f 4d  l0 - + col0 FROM
6910: 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 33 33 36   tab0..----..336
6920: 30 0d 0a 36 36 34 30 32 39 0d 0a 36 38 30 38 38  0..664029..68088
6930: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
6940: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 28 20  ort..SELECT - ( 
6950: 63 6f 6c 30 20 29 20 2a 20 63 6f 6c 32 20 46 52  col0 ) * col2 FR
6960: 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d  OM tab1..----..-
6970: 31 36 32 0d 0a 2d 33 36 34 38 0d 0a 2d 37 36 38  162..-3648..-768
6980: 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  0....query I row
6990: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
69a0: 20 38 35 20 2d 20 2b 20 63 6f 6c 32 20 2a 20 63   85 - + col2 * c
69b0: 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  ol2 AS col1 FROM
69c0: 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33   tab2..----..-13
69d0: 35 39 0d 0a 2d 35 39 31 0d 0a 2d 36 34 34 0d 0a  59..-591..-644..
69e0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
69f0: 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
6a00: 43 54 20 2d 20 63 6f 6c 32 20 2b 20 2d 20 63 6f  CT - col2 + - co
6a10: 6c 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  l0 AS col1 FROM 
6a20: 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab0 cor0..----.
6a30: 0a 2d 31 37 31 0d 0a 2d 33 36 0d 0a 2d 35 37 0d  .-171..-36..-57.
6a40: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
6a50: 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 33 39 20  rt..SELECT - 39 
6a60: 2a 20 2d 20 63 6f 6c 30 20 2b 20 63 6f 6c 30 20  * - col0 + col0 
6a70: 2a 20 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46  * col1 AS col2 F
6a80: 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
6a90: 0d 0a 2d 2d 2d 2d 0d 0a 34 34 32 34 0d 0a 34 39  ..----..4424..49
6aa0: 30 0d 0a 37 36 34 34 0d 0a 0d 0a 71 75 65 72 79  0..7644....query
6ab0: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
6ac0: 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 30  CT DISTINCT col0
6ad0: 20 2a 20 2b 20 39 30 20 2b 20 2d 20 63 6f 6c 30   * + 90 + - col0
6ae0: 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
6af0: 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
6b00: 0d 0a 36 32 33 0d 0a 36 39 34 32 0d 0a 37 30 33  ..623..6942..703
6b10: 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  1....query I row
6b20: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 31 35 20  sort..SELECT 15 
6b30: 2b 20 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c 30 20  + col0 * - col0 
6b40: 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d  FROM tab2..----.
6b50: 0a 2d 33 34 0d 0a 2d 36 30 36 39 0d 0a 2d 36 32  .-34..-6069..-62
6b60: 32 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  26....query I ro
6b70: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
6b80: 4c 20 2d 20 34 31 20 2a 20 63 6f 72 30 2e 63 6f  L - 41 * cor0.co
6b90: 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l0 FROM tab0 AS 
6ba0: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 34 33  cor0..----..-143
6bb0: 35 0d 0a 2d 33 36 34 39 0d 0a 2d 39 38 34 0d 0a  5..-3649..-984..
6bc0: 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
6bd0: 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53   support for MyS
6be0: 51 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74  QL specific syst
6bf0: 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e  em types and syn
6c00: 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  tax..query I row
6c10: 73 6f 72 74 20 6c 61 62 65 6c 2d 31 38 32 0d 0a  sort label-182..
6c20: 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 72 30 2e  SELECT ALL cor0.
6c30: 63 6f 6c 30 20 2b 20 63 6f 6c 32 20 2a 20 43 41  col0 + col2 * CA
6c40: 53 54 28 20 4e 55 4c 4c 20 41 53 20 53 49 47 4e  ST( NULL AS SIGN
6c50: 45 44 20 29 20 46 52 4f 4d 20 74 61 62 30 20 41  ED ) FROM tab0 A
6c60: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55  S cor0..----..NU
6c70: 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a  LL..NULL..NULL..
6c80: 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
6c90: 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
6ca0: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
6cb0: 20 6c 61 62 65 6c 2d 31 38 32 0d 0a 53 45 4c 45   label-182..SELE
6cc0: 43 54 20 41 4c 4c 20 63 6f 72 30 2e 63 6f 6c 30  CT ALL cor0.col0
6cd0: 20 2b 20 63 6f 6c 32 20 2a 20 43 41 53 54 20 28   + col2 * CAST (
6ce0: 20 4e 55 4c 4c 20 41 53 20 49 4e 54 45 47 45 52   NULL AS INTEGER
6cf0: 20 29 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20   ) FROM tab0 AS 
6d00: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c  cor0..----..NULL
6d10: 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a  ..NULL..NULL....
6d20: 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71  skipif postgresq
6d30: 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72  l # PostgreSQL r
6d40: 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20  equires AS when 
6d50: 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20  renaming output 
6d60: 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49  columns..query I
6d70: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
6d80: 20 35 30 20 2a 20 2d 20 63 6f 72 30 2e 63 6f 6c   50 * - cor0.col
6d90: 30 20 2a 20 36 37 20 2b 20 63 6f 6c 32 20 2b 20  0 * 67 + col2 + 
6da0: 2b 20 63 6f 6c 30 20 63 6f 6c 32 20 46 52 4f 4d  + col0 col2 FROM
6db0: 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
6dc0: 2d 2d 2d 0d 0a 2d 32 33 34 31 36 0d 0a 2d 32 36  ---..-23416..-26
6dd0: 31 31 39 36 0d 0a 2d 32 36 34 35 33 33 0d 0a 0d  1196..-264533...
6de0: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
6df0: 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63  ..SELECT ALL - c
6e00: 6f 6c 31 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20  ol1 + cor0.col0 
6e10: 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a  FROM tab0 cor0..
6e20: 2d 2d 2d 2d 0d 0a 2d 32 0d 0a 2d 36 32 0d 0a 2d  ----..-2..-62..-
6e30: 36 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  62....query I ro
6e40: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
6e50: 4c 20 2d 20 35 31 20 41 53 20 63 6f 6c 31 20 46  L - 51 AS col1 F
6e60: 52 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d  ROM tab2 cor0..-
6e70: 2d 2d 2d 0d 0a 2d 35 31 0d 0a 2d 35 31 0d 0a 2d  ---..-51..-51..-
6e80: 35 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  51....query I ro
6e90: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
6ea0: 2b 20 31 32 20 2a 20 63 6f 6c 30 20 2b 20 35 39  + 12 * col0 + 59
6eb0: 20 46 52 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d   FROM tab2 cor0.
6ec0: 0a 2d 2d 2d 2d 0d 0a 2d 32 35 0d 0a 2d 38 37 37  .----..-25..-877
6ed0: 0d 0a 2d 38 38 39 0d 0a 0d 0a 6f 6e 6c 79 69 66  ..-889....onlyif
6ee0: 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56   mysql # use DIV
6ef0: 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e   operator for in
6f00: 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a  teger division..
6f10: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
6f20: 6c 61 62 65 6c 2d 31 38 37 0d 0a 53 45 4c 45 43  label-187..SELEC
6f30: 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c  T DISTINCT + col
6f40: 31 20 44 49 56 20 2b 20 63 6f 6c 30 20 41 53 20  1 DIV + col0 AS 
6f50: 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41  col2 FROM tab0 A
6f60: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 0d  S cor0..----..1.
6f70: 0a 32 0d 0a 33 0d 0a 0d 0a 73 6b 69 70 69 66 20  .2..3....skipif 
6f80: 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
6f90: 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
6fa0: 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 38  rowsort label-18
6fb0: 37 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  7..SELECT DISTIN
6fc0: 43 54 20 2b 20 63 6f 6c 31 20 2f 20 2b 20 63 6f  CT + col1 / + co
6fd0: 6c 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  l0 AS col2 FROM 
6fe0: 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
6ff0: 2d 2d 0d 0a 31 0d 0a 32 0d 0a 33 0d 0a 0d 0a 6f  --..1..2..3....o
7000: 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75  nlyif mysql # su
7010: 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20  pport for MySQL 
7020: 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20  specific system 
7030: 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78  types and syntax
7040: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
7050: 74 20 6c 61 62 65 6c 2d 31 38 38 0d 0a 53 45 4c  t label-188..SEL
7060: 45 43 54 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20  ECT + cor0.col0 
7070: 2b 20 63 6f 6c 32 20 2a 20 43 41 53 54 28 20 2b  + col2 * CAST( +
7080: 20 28 20 63 6f 6c 31 20 29 20 41 53 20 53 49 47   ( col1 ) AS SIG
7090: 4e 45 44 20 29 20 41 53 20 63 6f 6c 31 20 46 52  NED ) AS col1 FR
70a0: 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
70b0: 0a 2d 2d 2d 2d 0d 0a 31 33 32 0d 0a 32 38 36 32  .----..132..2862
70c0: 0d 0a 37 35 35 31 0d 0a 0d 0a 73 6b 69 70 69 66  ..7551....skipif
70d0: 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
70e0: 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
70f0: 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
7100: 38 38 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 72  88..SELECT + cor
7110: 30 2e 63 6f 6c 30 20 2b 20 63 6f 6c 32 20 2a 20  0.col0 + col2 * 
7120: 43 41 53 54 20 28 20 2b 20 28 20 63 6f 6c 31 20  CAST ( + ( col1 
7130: 29 20 41 53 20 49 4e 54 45 47 45 52 20 29 20 41  ) AS INTEGER ) A
7140: 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30  S col1 FROM tab0
7150: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
7160: 31 33 32 0d 0a 32 38 36 32 0d 0a 37 35 35 31 0d  132..2862..7551.
7170: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
7180: 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b  rt..SELECT ALL +
7190: 20 28 20 2d 20 63 6f 72 30 2e 63 6f 6c 30 20 29   ( - cor0.col0 )
71a0: 20 2b 20 2d 20 63 6f 6c 32 20 46 52 4f 4d 20 74   + - col2 FROM t
71b0: 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
71c0: 2d 0d 0a 2d 31 30 34 0d 0a 2d 31 31 37 0d 0a 2d  -..-104..-117..-
71d0: 33 34 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  34....onlyif mys
71e0: 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72  ql # support for
71f0: 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63 20   MySQL specific 
7200: 73 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64  system types and
7210: 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49   syntax..query I
7220: 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
7230: 39 30 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  90..SELECT DISTI
7240: 4e 43 54 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20  NCT + cor0.col0 
7250: 2a 20 2d 20 63 6f 6c 31 20 2b 20 43 41 53 54 28  * - col1 + CAST(
7260: 20 4e 55 4c 4c 20 41 53 20 53 49 47 4e 45 44 20   NULL AS SIGNED 
7270: 29 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30  ) FROM tab0 cor0
7280: 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 0d 0a  ..----..NULL....
7290: 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
72a0: 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
72b0: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
72c0: 61 62 65 6c 2d 31 39 30 0d 0a 53 45 4c 45 43 54  abel-190..SELECT
72d0: 20 44 49 53 54 49 4e 43 54 20 2b 20 63 6f 72 30   DISTINCT + cor0
72e0: 2e 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c 31 20 2b  .col0 * - col1 +
72f0: 20 43 41 53 54 20 28 20 4e 55 4c 4c 20 41 53 20   CAST ( NULL AS 
7300: 49 4e 54 45 47 45 52 20 29 20 46 52 4f 4d 20 74  INTEGER ) FROM t
7310: 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab0 cor0..----..
7320: 4e 55 4c 4c 0d 0a 0d 0a 71 75 65 72 79 20 49 20  NULL....query I 
7330: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
7340: 44 49 53 54 49 4e 43 54 20 31 39 20 2a 20 63 6f  DISTINCT 19 * co
7350: 72 30 2e 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20  r0.col1 AS col2 
7360: 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
7370: 30 0d 0a 2d 2d 2d 2d 0d 0a 31 36 33 34 0d 0a 31  0..----..1634..1
7380: 37 32 39 0d 0a 31 38 34 33 0d 0a 0d 0a 71 75 65  729..1843....que
7390: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
73a0: 4c 45 43 54 20 63 6f 72 30 2e 63 6f 6c 32 20 2d  LECT cor0.col2 -
73b0: 20 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c 32 20 46   col2 * - col2 F
73c0: 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d  ROM tab1 cor0..-
73d0: 2d 2d 2d 0d 0a 32 39 37 30 0d 0a 33 33 30 36 0d  ---..2970..3306.
73e0: 0a 39 33 31 32 0d 0a 0d 0a 71 75 65 72 79 20 49  .9312....query I
73f0: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
7400: 20 2d 20 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c 30   - col2 * + col0
7410: 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20   + col0 AS col0 
7420: 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d  FROM tab0..----.
7430: 0a 2d 37 32 30 39 0d 0a 2d 37 36 38 0d 0a 30 0d  .-7209..-768..0.
7440: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
7450: 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d  rt..SELECT ALL -
7460: 20 63 6f 6c 30 20 2a 20 63 6f 6c 32 20 2b 20 63   col0 * col2 + c
7470: 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  ol0 AS col1 FROM
7480: 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
7490: 2d 2d 2d 0d 0a 2d 31 35 39 0d 0a 2d 33 35 38 34  ---..-159..-3584
74a0: 0d 0a 2d 37 36 30 30 0d 0a 0d 0a 71 75 65 72 79  ..-7600....query
74b0: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
74c0: 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 31  CT DISTINCT col1
74d0: 20 2a 20 63 6f 6c 30 20 2b 20 2d 20 35 33 20 41   * col0 + - 53 A
74e0: 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31  S col1 FROM tab1
74f0: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
7500: 32 35 0d 0a 35 38 37 0d 0a 39 38 37 0d 0a 0d 0a  25..587..987....
7510: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
7520: 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
7530: 20 2b 20 2b 20 63 6f 6c 31 20 2b 20 28 20 63 6f   + + col1 + ( co
7540: 6c 30 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 29  l0 + cor0.col1 )
7550: 20 2a 20 2b 20 63 6f 6c 32 20 2a 20 2b 20 63 6f   * + col2 * + co
7560: 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l2 FROM tab2 AS 
7570: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33 38 36  cor0..----..1386
7580: 34 31 0d 0a 32 37 37 33 33 0d 0a 39 32 36 37 31  41..27733..92671
7590: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
75a0: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 30  ort..SELECT col0
75b0: 20 2a 20 36 31 20 41 53 20 63 6f 6c 31 20 46 52   * 61 AS col1 FR
75c0: 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d  OM tab2 cor0..--
75d0: 2d 2d 0d 0a 34 32 37 0d 0a 34 37 35 38 0d 0a 34  --..427..4758..4
75e0: 38 31 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  819....query I r
75f0: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
7600: 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c 30 20 2d  ISTINCT + col0 -
7610: 20 28 20 2d 20 63 6f 6c 32 20 2b 20 2d 20 63 6f   ( - col2 + - co
7620: 6c 30 20 29 20 46 52 4f 4d 20 74 61 62 31 20 41  l0 ) FROM tab1 A
7630: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 38  S cor0..----..18
7640: 35 0d 0a 32 35 36 0d 0a 36 30 0d 0a 0d 0a 71 75  5..256..60....qu
7650: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
7660: 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f 72 30  ELECT ALL + cor0
7670: 2e 63 6f 6c 31 20 2b 20 2d 20 39 39 20 41 53 20  .col1 + - 99 AS 
7680: 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41  col1 FROM tab2 A
7690: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 34  S cor0..----..-4
76a0: 30 0d 0a 2d 36 38 0d 0a 2d 38 32 0d 0a 0d 0a 73  0..-68..-82....s
76b0: 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c  kipif postgresql
76c0: 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65   # PostgreSQL re
76d0: 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72  quires AS when r
76e0: 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63  enaming output c
76f0: 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20  olumns..query I 
7700: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
7710: 41 4c 4c 20 2b 20 63 6f 6c 32 20 2a 20 2b 20 63  ALL + col2 * + c
7720: 6f 6c 30 20 2b 20 2b 20 63 6f 6c 30 20 63 6f 6c  ol0 + + col0 col
7730: 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  1 FROM tab2 AS c
7740: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 39 36 0d 0a  or0..----..196..
7750: 32 31 30 36 0d 0a 33 30 38 31 0d 0a 0d 0a 73 6b  2106..3081....sk
7760: 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20  ipif postgresql 
7770: 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71  # PostgreSQL req
7780: 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65  uires AS when re
7790: 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f  naming output co
77a0: 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72  lumns..query I r
77b0: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
77c0: 49 53 54 49 4e 43 54 20 2d 20 36 37 20 2a 20 35  ISTINCT - 67 * 5
77d0: 37 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32  7 col1 FROM tab2
77e0: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
77f0: 2d 33 38 31 39 0d 0a 0d 0a 71 75 65 72 79 20 49  -3819....query I
7800: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
7810: 20 41 4c 4c 20 2b 20 2b 20 63 6f 72 30 2e 63 6f   ALL + + cor0.co
7820: 6c 32 20 2b 20 63 6f 6c 32 20 46 52 4f 4d 20 74  l2 + col2 FROM t
7830: 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab0 cor0..----..
7840: 31 36 34 0d 0a 32 0d 0a 36 36 0d 0a 0d 0a 6f 6e  164..2..66....on
7850: 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70  lyif mysql # sup
7860: 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73  port for MySQL s
7870: 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20 74  pecific system t
7880: 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d  ypes and syntax.
7890: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
78a0: 20 6c 61 62 65 6c 2d 32 30 33 0d 0a 53 45 4c 45   label-203..SELE
78b0: 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 43 41  CT DISTINCT + CA
78c0: 53 54 28 20 4e 55 4c 4c 20 41 53 20 44 45 43 49  ST( NULL AS DECI
78d0: 4d 41 4c 20 29 20 2b 20 31 20 41 53 20 63 6f 6c  MAL ) + 1 AS col
78e0: 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  0 FROM tab2 AS c
78f0: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d  or0..----..NULL.
7900: 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
7910: 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
7920: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
7930: 74 20 6c 61 62 65 6c 2d 32 30 33 0d 0a 53 45 4c  t label-203..SEL
7940: 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 43  ECT DISTINCT + C
7950: 41 53 54 20 28 20 4e 55 4c 4c 20 41 53 20 52 45  AST ( NULL AS RE
7960: 41 4c 20 29 20 2b 20 31 20 41 53 20 63 6f 6c 30  AL ) + 1 AS col0
7970: 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
7980: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a  r0..----..NULL..
7990: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
79a0: 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2d 20 28 20  t..SELECT - - ( 
79b0: 35 20 29 20 46 52 4f 4d 20 74 61 62 31 20 41 53  5 ) FROM tab1 AS
79c0: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 35 0d 0a   cor0..----..5..
79d0: 35 0d 0a 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20  5..5....query I 
79e0: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
79f0: 2d 20 63 6f 6c 31 20 2b 20 2b 20 30 20 41 53 20  - col1 + + 0 AS 
7a00: 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 0d 0a  col2 FROM tab2..
7a10: 2d 2d 2d 2d 0d 0a 2d 31 37 0d 0a 2d 33 31 0d 0a  ----..-17..-31..
7a20: 2d 35 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  -59....query I r
7a30: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
7a40: 4c 4c 20 2d 20 63 6f 6c 30 20 2b 20 2b 20 32 38  LL - col0 + + 28
7a50: 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
7a60: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 30 0d 0a 2d  r0..----..-50..-
7a70: 35 31 0d 0a 32 31 0d 0a 0d 0a 71 75 65 72 79 20  51..21....query 
7a80: 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 20  IIIIIIIIIIIIIII 
7a90: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
7aa0: 2a 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  * FROM tab2 AS c
7ab0: 6f 72 30 20 43 52 4f 53 53 20 4a 4f 49 4e 20 74  or0 CROSS JOIN t
7ac0: 61 62 30 2c 20 74 61 62 31 20 41 53 20 63 6f 72  ab0, tab1 AS cor
7ad0: 31 2c 20 74 61 62 31 2c 20 74 61 62 32 20 63 6f  1, tab1, tab2 co
7ae0: 72 32 0d 0a 2d 2d 2d 2d 0d 0a 33 36 34 35 20 76  r2..----..3645 v
7af0: 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f  alues hashing to
7b00: 20 63 63 34 66 30 36 39 65 36 31 64 30 63 63 35   cc4f069e61d0cc5
7b10: 32 66 34 33 33 66 39 65 38 63 30 30 35 38 38 30  2f433f9e8c005880
7b20: 38 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  8....onlyif mysq
7b30: 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72  l # use DIV oper
7b40: 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72  ator for integer
7b50: 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79   division..query
7b60: 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
7b70: 2d 32 30 38 0d 0a 53 45 4c 45 43 54 20 44 49 53  -208..SELECT DIS
7b80: 54 49 4e 43 54 20 2b 20 63 6f 72 30 2e 63 6f 6c  TINCT + cor0.col
7b90: 31 20 2b 20 2d 20 63 6f 6c 32 20 44 49 56 20 63  1 + - col2 DIV c
7ba0: 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol0 FROM tab1 AS
7bb0: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 0d   cor0..----..10.
7bc0: 0a 31 32 0d 0a 38 0d 0a 0d 0a 73 6b 69 70 69 66  .12..8....skipif
7bd0: 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
7be0: 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
7bf0: 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 32   rowsort label-2
7c00: 30 38 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  08..SELECT DISTI
7c10: 4e 43 54 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20  NCT + cor0.col1 
7c20: 2b 20 2d 20 63 6f 6c 32 20 2f 20 63 6f 6c 30 20  + - col2 / col0 
7c30: 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
7c40: 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 0d 0a 31 32 0d  0..----..10..12.
7c50: 0a 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  .8....query I ro
7c60: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
7c70: 53 54 49 4e 43 54 20 2b 20 31 36 20 2a 20 2d 20  STINCT + 16 * - 
7c80: 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52 4f  col1 AS col0 FRO
7c90: 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  M tab0..----..-1
7ca0: 33 37 36 0d 0a 2d 31 34 35 36 0d 0a 2d 31 35 35  376..-1456..-155
7cb0: 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  2....query I row
7cc0: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
7cd0: 20 35 35 20 2a 20 63 6f 6c 30 20 46 52 4f 4d 20   55 * col0 FROM 
7ce0: 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 33 38 35 0d  tab2..----..385.
7cf0: 0a 34 32 39 30 0d 0a 34 33 34 35 0d 0a 0d 0a 6f  .4290..4345....o
7d00: 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73  nlyif mysql # us
7d10: 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66  e DIV operator f
7d20: 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73  or integer divis
7d30: 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ion..query I row
7d40: 73 6f 72 74 20 6c 61 62 65 6c 2d 32 31 31 0d 0a  sort label-211..
7d50: 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
7d60: 63 6f 6c 31 20 44 49 56 20 2d 20 63 6f 6c 31 20  col1 DIV - col1 
7d70: 2d 20 2b 20 63 6f 6c 30 20 63 6f 6c 32 20 46 52  - + col0 col2 FR
7d80: 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
7d90: 0a 2d 2d 2d 2d 0d 0a 2d 32 35 0d 0a 2d 33 36 0d  .----..-25..-36.
7da0: 0a 2d 39 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 70  .-90....skipif p
7db0: 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74  ostgresql # Post
7dc0: 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20  greSQL requires 
7dd0: 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67  AS when renaming
7de0: 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d   output columns.
7df0: 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
7e00: 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
7e10: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
7e20: 6c 61 62 65 6c 2d 32 31 31 0d 0a 53 45 4c 45 43  label-211..SELEC
7e30: 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 31 20  T DISTINCT col1 
7e40: 2f 20 2d 20 63 6f 6c 31 20 2d 20 2b 20 63 6f 6c  / - col1 - + col
7e50: 30 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30  0 col2 FROM tab0
7e60: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
7e70: 2d 32 35 0d 0a 2d 33 36 0d 0a 2d 39 30 0d 0a 0d  -25..-36..-90...
7e80: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
7e90: 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c  ..SELECT ALL col
7ea0: 31 20 2a 20 63 6f 6c 30 20 2a 20 32 31 20 41 53  1 * col0 * 21 AS
7eb0: 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20   col2 FROM tab1 
7ec0: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
7ed0: 33 34 34 30 0d 0a 31 36 33 38 0d 0a 32 31 38 34  3440..1638..2184
7ee0: 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  0....query I row
7ef0: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
7f00: 20 2b 20 38 30 20 2a 20 2b 20 63 6f 6c 30 20 46   + 80 * + col0 F
7f10: 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
7f20: 0d 0a 2d 2d 2d 2d 0d 0a 32 34 30 0d 0a 35 31 32  ..----..240..512
7f30: 30 0d 0a 36 34 30 30 0d 0a 0d 0a 71 75 65 72 79  0..6400....query
7f40: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
7f50: 43 54 20 2d 20 2d 20 28 20 2b 20 63 6f 6c 30 20  CT - - ( + col0 
7f60: 29 20 2b 20 2b 20 28 20 2b 20 36 39 20 2b 20 2b  ) + + ( + 69 + +
7f70: 20 63 6f 6c 31 20 29 20 46 52 4f 4d 20 74 61 62   col1 ) FROM tab
7f80: 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
7f90: 0a 31 34 33 0d 0a 31 36 32 0d 0a 39 38 0d 0a 0d  .143..162..98...
7fa0: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
7fb0: 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 37 39 20  ..SELECT ALL 79 
7fc0: 2a 20 2d 20 63 6f 6c 30 20 2b 20 63 6f 6c 32 20  * - col0 + col2 
7fd0: 2a 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32  * col0 FROM tab2
7fe0: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
7ff0: 2d 33 32 33 39 0d 0a 2d 33 36 34 0d 0a 2d 34 31  -3239..-364..-41
8000: 33 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  34....query I ro
8010: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
8020: 53 54 49 4e 43 54 20 2b 20 2d 20 34 35 20 2b 20  STINCT + - 45 + 
8030: 2d 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31  - col1 FROM tab1
8040: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
8050: 2d 35 35 0d 0a 2d 35 38 0d 0a 2d 37 31 0d 0a 0d  -55..-58..-71...
8060: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
8070: 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 2d  ..SELECT ALL + -
8080: 20 36 35 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d   65 AS col0 FROM
8090: 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
80a0: 2d 2d 2d 0d 0a 2d 36 35 0d 0a 2d 36 35 0d 0a 2d  ---..-65..-65..-
80b0: 36 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  65....query I ro
80c0: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
80d0: 53 54 49 4e 43 54 20 2b 20 37 37 20 2b 20 63 6f  STINCT + 77 + co
80e0: 72 30 2e 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20  r0.col0 AS col1 
80f0: 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
8100: 30 0d 0a 2d 2d 2d 2d 0d 0a 31 35 35 0d 0a 31 35  0..----..155..15
8110: 36 0d 0a 38 34 0d 0a 0d 0a 71 75 65 72 79 20 49  6..84....query I
8120: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
8130: 20 2d 20 37 32 20 2a 20 2b 20 39 38 20 41 53 20   - 72 * + 98 AS 
8140: 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 2c 20  col2 FROM tab0, 
8150: 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
8160: 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73  --..9 values has
8170: 68 69 6e 67 20 74 6f 20 30 37 39 39 31 66 33 63  hing to 07991f3c
8180: 34 63 64 31 61 31 32 39 38 62 38 32 37 33 63 31  4cd1a1298b8273c1
8190: 33 62 31 33 66 36 34 35 0d 0a 0d 0a 71 75 65 72  3b13f645....quer
81a0: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
81b0: 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 38  ECT DISTINCT - 8
81c0: 31 20 2b 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20  1 + + col0 FROM 
81d0: 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
81e0: 2d 2d 0d 0a 2d 34 36 0d 0a 2d 35 37 0d 0a 38 0d  --..-46..-57..8.
81f0: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
8200: 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b  rt..SELECT ALL +
8210: 20 33 34 20 2d 20 2b 20 63 6f 6c 32 20 41 53 20   34 - + col2 AS 
8220: 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41  col1 FROM tab0 A
8230: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 34  S cor0..----..-4
8240: 38 0d 0a 31 0d 0a 33 33 0d 0a 0d 0a 71 75 65 72  8..1..33....quer
8250: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
8260: 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 36  ECT DISTINCT - 6
8270: 31 20 2b 20 37 37 20 2a 20 2b 20 63 6f 6c 30 20  1 + 77 * + col0 
8280: 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
8290: 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 37  1 cor0..----..17
82a0: 30 0d 0a 34 38 36 37 0d 0a 36 30 39 39 0d 0a 0d  0..4867..6099...
82b0: 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73  .skipif postgres
82c0: 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20  ql # PostgreSQL 
82d0: 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e  requires AS when
82e0: 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74   renaming output
82f0: 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20   columns..query 
8300: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
8310: 54 20 63 6f 72 30 2e 63 6f 6c 31 20 2a 20 2d 20  T cor0.col1 * - 
8320: 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c 30 20 63 6f  col2 * + col0 co
8330: 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72  l2 FROM tab0 cor
8340: 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 33 39 35 0d 0a  0..----..-3395..
8350: 2d 36 36 34 31 31 38 0d 0a 2d 36 38 31 31 32 0d  -664118..-68112.
8360: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
8370: 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
8380: 4e 43 54 20 2d 20 63 6f 6c 32 20 2a 20 2b 20 39  NCT - col2 * + 9
8390: 33 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  3 FROM tab0 AS c
83a0: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 30 36 39  or0..----..-3069
83b0: 0d 0a 2d 37 36 32 36 0d 0a 2d 39 33 0d 0a 0d 0a  ..-7626..-93....
83c0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
83d0: 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f  .SELECT ALL + co
83e0: 6c 31 20 2a 20 63 6f 6c 30 20 2a 20 63 6f 6c 31  l1 * col0 * col1
83f0: 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d   FROM tab0 cor0.
8400: 0a 2d 2d 2d 2d 0d 0a 31 37 37 35 30 34 0d 0a 33  .----..177504..3
8410: 32 39 33 31 35 0d 0a 37 33 37 30 30 39 0d 0a 0d  29315..737009...
8420: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
8430: 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
8440: 54 20 2b 20 63 6f 72 31 2e 63 6f 6c 30 20 41 53  T + cor1.col0 AS
8450: 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 2c   col1 FROM tab2,
8460: 20 74 61 62 31 20 41 53 20 63 6f 72 30 2c 20 74   tab1 AS cor0, t
8470: 61 62 30 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d  ab0 AS cor1..---
8480: 2d 0d 0a 32 34 0d 0a 33 35 0d 0a 38 39 0d 0a 0d  -..24..35..89...
8490: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
84a0: 0d 0a 53 45 4c 45 43 54 20 33 30 20 2b 20 2b 20  ..SELECT 30 + + 
84b0: 63 6f 6c 30 20 2b 20 63 6f 6c 30 20 46 52 4f 4d  col0 + col0 FROM
84c0: 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
84d0: 2d 2d 2d 0d 0a 31 35 38 0d 0a 31 39 30 0d 0a 33  ---..158..190..3
84e0: 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  6....query I row
84f0: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
8500: 54 49 4e 43 54 20 63 6f 6c 30 20 2d 20 2d 20 34  TINCT col0 - - 4
8510: 37 20 2a 20 2d 20 63 6f 6c 31 20 41 53 20 63 6f  7 * - col1 AS co
8520: 6c 31 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d  l1 FROM tab2..--
8530: 2d 2d 0d 0a 2d 31 34 35 30 0d 0a 2d 32 36 39 35  --..-1450..-2695
8540: 0d 0a 2d 37 32 30 0d 0a 0d 0a 71 75 65 72 79 20  ..-720....query 
8550: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
8560: 54 20 2d 20 28 20 2b 20 63 6f 6c 31 20 29 20 2a  T - ( + col1 ) *
8570: 20 2b 20 63 6f 6c 30 20 2d 20 2b 20 63 6f 6c 32   + col0 - + col2
8580: 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
8590: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 38 31 0d  r0..----..-1381.
85a0: 0a 2d 32 34 34 0d 0a 2d 34 36 32 38 0d 0a 0d 0a  .-244..-4628....
85b0: 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73  onlyif mysql # s
85c0: 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c  upport for MySQL
85d0: 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d   specific system
85e0: 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61   types and synta
85f0: 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  x..query I rowso
8600: 72 74 20 6c 61 62 65 6c 2d 32 33 30 0d 0a 53 45  rt label-230..SE
8610: 4c 45 43 54 20 28 20 2d 20 28 20 2b 20 63 6f 72  LECT ( - ( + cor
8620: 30 2e 63 6f 6c 30 20 29 20 29 20 2a 20 43 41 53  0.col0 ) ) * CAS
8630: 54 28 20 63 6f 6c 30 20 41 53 20 53 49 47 4e 45  T( col0 AS SIGNE
8640: 44 20 29 20 2b 20 2d 20 63 6f 6c 32 20 2d 20 2d  D ) + - col2 - -
8650: 20 63 6f 72 30 2e 63 6f 6c 32 20 46 52 4f 4d 20   cor0.col2 FROM 
8660: 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab0 cor0..----.
8670: 0a 2d 31 32 32 35 0d 0a 2d 35 37 36 0d 0a 2d 37  .-1225..-576..-7
8680: 39 32 31 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  921....skipif my
8690: 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
86a0: 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
86b0: 77 73 6f 72 74 20 6c 61 62 65 6c 2d 32 33 30 0d  wsort label-230.
86c0: 0a 53 45 4c 45 43 54 20 28 20 2d 20 28 20 2b 20  .SELECT ( - ( + 
86d0: 63 6f 72 30 2e 63 6f 6c 30 20 29 20 29 20 2a 20  cor0.col0 ) ) * 
86e0: 43 41 53 54 20 28 20 63 6f 6c 30 20 41 53 20 49  CAST ( col0 AS I
86f0: 4e 54 45 47 45 52 20 29 20 2b 20 2d 20 63 6f 6c  NTEGER ) + - col
8700: 32 20 2d 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20  2 - - cor0.col2 
8710: 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a  FROM tab0 cor0..
8720: 2d 2d 2d 2d 0d 0a 2d 31 32 32 35 0d 0a 2d 35 37  ----..-1225..-57
8730: 36 0d 0a 2d 37 39 32 31 0d 0a 0d 0a 73 6b 69 70  6..-7921....skip
8740: 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20  if postgresql # 
8750: 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69  PostgreSQL requi
8760: 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61  res AS when rena
8770: 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75  ming output colu
8780: 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  mns..query I row
8790: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
87a0: 20 38 33 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   83 col1 FROM ta
87b0: 62 32 2c 20 74 61 62 30 20 41 53 20 63 6f 72 30  b2, tab0 AS cor0
87c0: 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73  ..----..9 values
87d0: 20 68 61 73 68 69 6e 67 20 74 6f 20 31 38 66 34   hashing to 18f4
87e0: 30 35 63 33 31 61 30 66 62 34 37 63 65 33 63 63  05c31a0fb47ce3cc
87f0: 39 66 37 65 66 66 61 38 38 35 35 63 0d 0a 0d 0a  9f7effa8855c....
8800: 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71  skipif postgresq
8810: 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72  l # PostgreSQL r
8820: 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20  equires AS when 
8830: 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20  renaming output 
8840: 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49  columns..query I
8850: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
8860: 20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c 32   DISTINCT - col2
8870: 20 2b 20 2d 20 63 6f 6c 30 20 63 6f 6c 31 20 46   + - col0 col1 F
8880: 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab0..----..
8890: 2d 31 37 31 0d 0a 2d 33 36 0d 0a 2d 35 37 0d 0a  -171..-36..-57..
88a0: 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
88b0: 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53   support for MyS
88c0: 51 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74  QL specific syst
88d0: 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e  em types and syn
88e0: 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  tax..query I row
88f0: 73 6f 72 74 20 6c 61 62 65 6c 2d 32 33 33 0d 0a  sort label-233..
8900: 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 43 41 53  SELECT ALL + CAS
8910: 54 28 20 4e 55 4c 4c 20 41 53 20 44 45 43 49 4d  T( NULL AS DECIM
8920: 41 4c 20 29 20 2b 20 2b 20 74 61 62 30 2e 63 6f  AL ) + + tab0.co
8930: 6c 31 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  l1 AS col2 FROM 
8940: 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c  tab0..----..NULL
8950: 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a  ..NULL..NULL....
8960: 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
8970: 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
8980: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
8990: 61 62 65 6c 2d 32 33 33 0d 0a 53 45 4c 45 43 54  abel-233..SELECT
89a0: 20 41 4c 4c 20 2b 20 43 41 53 54 20 28 20 4e 55   ALL + CAST ( NU
89b0: 4c 4c 20 41 53 20 52 45 41 4c 20 29 20 2b 20 2b  LL AS REAL ) + +
89c0: 20 74 61 62 30 2e 63 6f 6c 31 20 41 53 20 63 6f   tab0.col1 AS co
89d0: 6c 32 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d  l2 FROM tab0..--
89e0: 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a  --..NULL..NULL..
89f0: 4e 55 4c 4c 0d 0a 0d 0a 71 75 65 72 79 20 49 20  NULL....query I 
8a00: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
8a10: 2d 20 63 6f 6c 31 20 2b 20 63 6f 6c 32 20 2a 20  - col1 + col2 * 
8a20: 2d 20 63 6f 6c 31 20 2a 20 2d 20 28 20 2b 20 63  - col1 * - ( + c
8a30: 6f 6c 32 20 29 20 41 53 20 63 6f 6c 31 20 46 52  ol2 ) AS col1 FR
8a40: 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
8a50: 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 36 31 31 37 39 33  .----..0..611793
8a60: 0d 0a 39 33 35 36 38 0d 0a 0d 0a 71 75 65 72 79  ..93568....query
8a70: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
8a80: 43 54 20 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c 31  CT col1 * + col1
8a90: 20 2a 20 63 6f 6c 32 20 2b 20 2b 20 36 20 2a 20   * col2 + + 6 * 
8aa0: 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 0d 0a  col2 FROM tab0..
8ab0: 2d 2d 2d 2d 0d 0a 32 34 34 32 36 36 0d 0a 36 37  ----..244266..67
8ac0: 39 35 33 34 0d 0a 39 34 31 35 0d 0a 0d 0a 71 75  9534..9415....qu
8ad0: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
8ae0: 45 4c 45 43 54 20 41 4c 4c 20 2b 20 28 20 63 6f  ELECT ALL + ( co
8af0: 6c 31 20 29 20 2b 20 63 6f 6c 32 20 41 53 20 63  l1 ) + col2 AS c
8b00: 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d  ol2 FROM tab1..-
8b10: 2d 2d 2d 0d 0a 31 30 39 0d 0a 36 37 0d 0a 38 30  ---..109..67..80
8b20: 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67  ....skipif postg
8b30: 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53  resql # PostgreS
8b40: 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77  QL requires AS w
8b50: 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74  hen renaming out
8b60: 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65  put columns..que
8b70: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
8b80: 4c 45 43 54 20 63 6f 6c 30 20 2d 20 2b 20 63 6f  LECT col0 - + co
8b90: 6c 31 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  l1 col1 FROM tab
8ba0: 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32  1 cor0..----..-2
8bb0: 33 0d 0a 35 34 0d 0a 36 37 0d 0a 0d 0a 71 75 65  3..54..67....que
8bc0: 72 79 20 49 49 49 49 49 49 49 49 49 49 49 49 49  ry IIIIIIIIIIIII
8bd0: 49 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45  II rowsort..SELE
8be0: 43 54 20 2a 20 46 52 4f 4d 20 74 61 62 32 2c 20  CT * FROM tab2, 
8bf0: 74 61 62 32 20 63 6f 72 30 20 43 52 4f 53 53 20  tab2 cor0 CROSS 
8c00: 4a 4f 49 4e 20 74 61 62 30 2c 20 74 61 62 32 20  JOIN tab0, tab2 
8c10: 41 53 20 63 6f 72 31 2c 20 74 61 62 31 20 63 6f  AS cor1, tab1 co
8c20: 72 32 0d 0a 2d 2d 2d 2d 0d 0a 33 36 34 35 20 76  r2..----..3645 v
8c30: 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f  alues hashing to
8c40: 20 66 63 37 63 30 30 35 30 39 66 62 39 64 34 62   fc7c00509fb9d4b
8c50: 38 61 35 32 39 30 66 61 36 39 32 36 63 63 35 31  8a5290fa6926cc51
8c60: 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  8....query I row
8c70: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
8c80: 20 74 61 62 30 2e 63 6f 6c 32 20 46 52 4f 4d 20   tab0.col2 FROM 
8c90: 74 61 62 30 2c 20 74 61 62 31 20 41 53 20 63 6f  tab0, tab1 AS co
8ca0: 72 30 2c 20 74 61 62 32 2c 20 74 61 62 32 20 41  r0, tab2, tab2 A
8cb0: 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 38 31  S cor1..----..81
8cc0: 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20   values hashing 
8cd0: 74 6f 20 65 39 33 38 37 37 37 65 62 66 66 63 32  to e938777ebffc2
8ce0: 65 33 65 39 63 30 63 64 66 61 61 34 66 37 33 32  e3e9c0cdfaa4f732
8cf0: 63 30 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  c05....query I r
8d00: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
8d10: 49 53 54 49 4e 43 54 20 36 32 20 2a 20 2d 20 63  ISTINCT 62 * - c
8d20: 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  ol1 AS col1 FROM
8d30: 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 36   tab1..----..-16
8d40: 31 32 0d 0a 2d 36 32 30 0d 0a 2d 38 30 36 0d 0a  12..-620..-806..
8d50: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
8d60: 74 0d 0a 53 45 4c 45 43 54 20 2b 20 35 35 20 2a  t..SELECT + 55 *
8d70: 20 2d 20 63 6f 6c 30 20 2b 20 2b 20 28 20 2d 20   - col0 + + ( - 
8d80: 63 6f 6c 31 20 29 20 46 52 4f 4d 20 74 61 62 30  col1 ) FROM tab0
8d90: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
8da0: 2d 31 34 30 36 0d 0a 2d 32 30 32 32 0d 0a 2d 34  -1406..-2022..-4
8db0: 39 38 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  986....query I r
8dc0: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
8dd0: 20 63 6f 6c 32 20 2a 20 2d 20 63 6f 72 30 2e 63   col2 * - cor0.c
8de0: 6f 6c 30 20 2b 20 28 20 63 6f 6c 32 20 29 20 46  ol0 + ( col2 ) F
8df0: 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
8e00: 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 36 32 0d 0a 2d 32  ..----..-162..-2
8e10: 30 30 32 0d 0a 2d 32 39 36 34 0d 0a 0d 0a 71 75  002..-2964....qu
8e20: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
8e30: 45 4c 45 43 54 20 2d 20 63 6f 6c 30 20 2a 20 63  ELECT - col0 * c
8e40: 6f 6c 32 20 2b 20 2d 20 31 33 20 41 53 20 63 6f  ol2 + - 13 AS co
8e50: 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l2 FROM tab0 AS 
8e60: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 38 0d  cor0..----..-48.
8e70: 0a 2d 37 33 31 31 0d 0a 2d 38 30 35 0d 0a 0d 0a  .-7311..-805....
8e80: 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75  onlyif mysql # u
8e90: 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20  se DIV operator 
8ea0: 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69  for integer divi
8eb0: 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f  sion..query I ro
8ec0: 77 73 6f 72 74 20 6c 61 62 65 6c 2d 32 34 34 0d  wsort label-244.
8ed0: 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
8ee0: 20 2d 20 63 6f 6c 30 20 44 49 56 20 74 61 62 31   - col0 DIV tab1
8ef0: 2e 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46 52  .col2 AS col2 FR
8f00: 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d  OM tab1..----..-
8f10: 31 0d 0a 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  1..0....skipif m
8f20: 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
8f30: 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
8f40: 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 32 34 34  owsort label-244
8f50: 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
8f60: 54 20 2d 20 63 6f 6c 30 20 2f 20 74 61 62 31 2e  T - col0 / tab1.
8f70: 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46 52 4f  col2 AS col2 FRO
8f80: 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  M tab1..----..-1
8f90: 0d 0a 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  ..0....query I r
8fa0: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63  owsort..SELECT c
8fb0: 6f 6c 31 20 2a 20 2b 20 34 35 20 2b 20 37 34 20  ol1 * + 45 + 74 
8fc0: 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d  FROM tab0..----.
8fd0: 0a 33 39 34 34 0d 0a 34 31 36 39 0d 0a 34 34 33  .3944..4169..443
8fe0: 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  9....query I row
8ff0: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
9000: 54 49 4e 43 54 20 2d 20 63 6f 6c 32 20 2a 20 2d  TINCT - col2 * -
9010: 20 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46 52   col1 AS col1 FR
9020: 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d  OM tab1 cor0..--
9030: 2d 2d 0d 0a 31 32 34 38 0d 0a 31 34 30 34 0d 0a  --..1248..1404..
9040: 35 37 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  570....query I r
9050: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
9060: 20 2b 20 63 6f 6c 30 20 2a 20 2b 20 28 20 2b 20   + col0 * + ( + 
9070: 63 6f 6c 31 20 29 20 41 53 20 63 6f 6c 32 20 46  col1 ) AS col2 F
9080: 52 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d  ROM tab2 cor0..-
9090: 2d 2d 2d 0d 0a 2d 31 33 34 33 0d 0a 2d 32 31 37  ---..-1343..-217
90a0: 0d 0a 2d 34 36 30 32 0d 0a 0d 0a 71 75 65 72 79  ..-4602....query
90b0: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
90c0: 43 54 20 44 49 53 54 49 4e 43 54 20 38 20 2a 20  CT DISTINCT 8 * 
90d0: 28 20 63 6f 72 30 2e 63 6f 6c 32 20 29 20 41 53  ( cor0.col2 ) AS
90e0: 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20   col1 FROM tab2 
90f0: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32  AS cor0..----..2
9100: 30 38 0d 0a 32 31 36 0d 0a 33 30 34 0d 0a 0d 0a  08..216..304....
9110: 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71  skipif postgresq
9120: 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72  l # PostgreSQL r
9130: 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20  equires AS when 
9140: 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20  renaming output 
9150: 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49  columns..query I
9160: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
9170: 20 63 6f 72 30 2e 63 6f 6c 30 20 2a 20 2d 20 28   cor0.col0 * - (
9180: 20 2d 20 63 6f 6c 32 20 29 20 2b 20 2d 20 63 6f   - col2 ) + - co
9190: 72 30 2e 63 6f 6c 31 20 63 6f 6c 32 20 46 52 4f  r0.col1 col2 FRO
91a0: 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
91b0: 2d 2d 2d 2d 0d 0a 2d 36 32 0d 0a 37 30 36 0d 0a  ----..-62..706..
91c0: 37 32 30 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20  7207....query I 
91d0: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
91e0: 41 4c 4c 20 2b 20 63 6f 6c 30 20 2a 20 2b 20 34  ALL + col0 * + 4
91f0: 33 20 2a 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61  3 * col1 FROM ta
9200: 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
9210: 0d 0a 31 34 35 39 38 35 0d 0a 33 34 38 32 35 37  ..145985..348257
9220: 0d 0a 38 38 37 35 32 0d 0a 0d 0a 71 75 65 72 79  ..88752....query
9230: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
9240: 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63 6f  CT DISTINCT + co
9250: 6c 30 20 2b 20 2d 20 35 35 20 46 52 4f 4d 20 74  l0 + - 55 FROM t
9260: 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
9270: 2d 0d 0a 2d 32 30 0d 0a 2d 33 31 0d 0a 33 34 0d  -..-20..-31..34.
9280: 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72  ...skipif postgr
9290: 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51  esql # PostgreSQ
92a0: 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68  L requires AS wh
92b0: 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70  en renaming outp
92c0: 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72  ut columns..quer
92d0: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
92e0: 45 43 54 20 63 6f 6c 32 20 2a 20 63 6f 6c 31 20  ECT col2 * col1 
92f0: 2b 20 63 6f 6c 30 20 2d 20 63 6f 6c 32 20 63 6f  + col0 - col2 co
9300: 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l0 FROM tab2 AS 
9310: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 35 38 36  cor0..----..1586
9320: 0d 0a 36 38 37 0d 0a 38 31 37 0d 0a 0d 0a 73 6b  ..687..817....sk
9330: 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20  ipif postgresql 
9340: 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71  # PostgreSQL req
9350: 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65  uires AS when re
9360: 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f  naming output co
9370: 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72  lumns..query I r
9380: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
9390: 20 35 39 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   59 col1 FROM ta
93a0: 62 30 2c 20 74 61 62 30 20 41 53 20 63 6f 72 30  b0, tab0 AS cor0
93b0: 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73  ..----..9 values
93c0: 20 68 61 73 68 69 6e 67 20 74 6f 20 61 39 62 39   hashing to a9b9
93d0: 39 36 36 64 37 34 39 64 31 62 32 63 65 35 39 35  966d749d1b2ce595
93e0: 35 65 64 31 32 33 39 34 66 39 62 63 0d 0a 0d 0a  5ed12394f9bc....
93f0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
9400: 0a 53 45 4c 45 43 54 20 2d 20 2b 20 63 6f 6c 32  .SELECT - + col2
9410: 20 2a 20 2b 20 63 6f 6c 32 20 46 52 4f 4d 20 74   * + col2 FROM t
9420: 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab2 cor0..----..
9430: 2d 31 34 34 34 0d 0a 2d 36 37 36 0d 0a 2d 37 32  -1444..-676..-72
9440: 39 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  9....onlyif mysq
9450: 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20  l # support for 
9460: 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63 20 73  MySQL specific s
9470: 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20  ystem types and 
9480: 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20  syntax..query I 
9490: 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 32 35  rowsort label-25
94a0: 35 0d 0a 53 45 4c 45 43 54 20 28 20 2d 20 63 6f  5..SELECT ( - co
94b0: 72 30 2e 63 6f 6c 30 20 29 20 2b 20 2b 20 63 6f  r0.col0 ) + + co
94c0: 6c 32 20 2a 20 43 41 53 54 28 20 4e 55 4c 4c 20  l2 * CAST( NULL 
94d0: 41 53 20 53 49 47 4e 45 44 20 29 20 2d 20 28 20  AS SIGNED ) - ( 
94e0: 63 6f 6c 32 20 29 20 2a 20 63 6f 72 30 2e 63 6f  col2 ) * cor0.co
94f0: 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l0 FROM tab2 AS 
9500: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c  cor0..----..NULL
9510: 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a  ..NULL..NULL....
9520: 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
9530: 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
9540: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
9550: 61 62 65 6c 2d 32 35 35 0d 0a 53 45 4c 45 43 54  abel-255..SELECT
9560: 20 28 20 2d 20 63 6f 72 30 2e 63 6f 6c 30 20 29   ( - cor0.col0 )
9570: 20 2b 20 2b 20 63 6f 6c 32 20 2a 20 43 41 53 54   + + col2 * CAST
9580: 20 28 20 4e 55 4c 4c 20 41 53 20 49 4e 54 45 47   ( NULL AS INTEG
9590: 45 52 20 29 20 2d 20 28 20 63 6f 6c 32 20 29 20  ER ) - ( col2 ) 
95a0: 2a 20 63 6f 72 30 2e 63 6f 6c 30 20 46 52 4f 4d  * cor0.col0 FROM
95b0: 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
95c0: 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d  ---..NULL..NULL.
95d0: 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75 65 72 79 20 49  .NULL....query I
95e0: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
95f0: 20 2d 20 28 20 2b 20 31 38 20 29 20 2a 20 2b 20   - ( + 18 ) * + 
9600: 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41  col0 FROM tab1 A
9610: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
9620: 31 35 32 0d 0a 2d 31 34 34 30 0d 0a 2d 35 34 0d  152..-1440..-54.
9630: 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
9640: 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74  # use DIV operat
9650: 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64  or for integer d
9660: 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49  ivision..query I
9670: 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 32   rowsort label-2
9680: 35 37 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 72  57..SELECT - cor
9690: 30 2e 63 6f 6c 32 20 2a 20 63 6f 6c 30 20 2b 20  0.col2 * col0 + 
96a0: 63 6f 6c 31 20 44 49 56 20 2b 20 63 6f 6c 32 20  col1 DIV + col2 
96b0: 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
96c0: 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 36 32 0d 0a 2d  0..----..-162..-
96d0: 33 36 34 38 0d 0a 2d 37 36 38 30 0d 0a 0d 0a 73  3648..-7680....s
96e0: 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
96f0: 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
9700: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
9710: 62 65 6c 2d 32 35 37 0d 0a 53 45 4c 45 43 54 20  bel-257..SELECT 
9720: 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 2a 20 63 6f  - cor0.col2 * co
9730: 6c 30 20 2b 20 63 6f 6c 31 20 2f 20 2b 20 63 6f  l0 + col1 / + co
9740: 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l2 FROM tab1 AS 
9750: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 36 32  cor0..----..-162
9760: 0d 0a 2d 33 36 34 38 0d 0a 2d 37 36 38 30 0d 0a  ..-3648..-7680..
9770: 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65  ..skipif postgre
9780: 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c  sql # PostgreSQL
9790: 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65   requires AS whe
97a0: 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75  n renaming outpu
97b0: 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79  t columns..query
97c0: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
97d0: 43 54 20 2b 20 63 6f 6c 30 20 2a 20 63 6f 6c 30  CT + col0 * col0
97e0: 20 2b 20 2d 20 63 6f 6c 32 20 2b 20 2d 20 63 6f   + - col2 + - co
97f0: 6c 30 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  l0 col1 FROM tab
9800: 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 34  1 cor0..----..-4
9810: 38 0d 0a 33 39 37 35 0d 0a 36 32 32 34 0d 0a 0d  8..3975..6224...
9820: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
9830: 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 30 20  ..SELECT + col0 
9840: 2a 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 2b 20  * - cor0.col2 + 
9850: 2d 20 34 30 20 2a 20 2d 20 63 6f 6c 30 20 41 53  - 40 * - col0 AS
9860: 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20   col1 FROM tab2 
9870: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 39 32  cor0..----..1092
9880: 0d 0a 31 35 38 0d 0a 39 31 0d 0a 0d 0a 6f 6e 6c  ..158..91....onl
9890: 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70  yif mysql # supp
98a0: 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70  ort for MySQL sp
98b0: 65 63 69 66 69 63 20 73 79 73 74 65 6d 20 74 79  ecific system ty
98c0: 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a  pes and syntax..
98d0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
98e0: 6c 61 62 65 6c 2d 32 36 30 0d 0a 53 45 4c 45 43  label-260..SELEC
98f0: 54 20 44 49 53 54 49 4e 43 54 20 2b 20 74 61 62  T DISTINCT + tab
9900: 30 2e 63 6f 6c 31 20 2a 20 2d 20 43 41 53 54 28  0.col1 * - CAST(
9910: 20 4e 55 4c 4c 20 41 53 20 53 49 47 4e 45 44 20   NULL AS SIGNED 
9920: 29 20 2d 20 2b 20 74 61 62 30 2e 63 6f 6c 31 20  ) - + tab0.col1 
9930: 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
9940: 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 0d  0..----..NULL...
9950: 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
9960: 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
9970: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
9980: 6c 61 62 65 6c 2d 32 36 30 0d 0a 53 45 4c 45 43  label-260..SELEC
9990: 54 20 44 49 53 54 49 4e 43 54 20 2b 20 74 61 62  T DISTINCT + tab
99a0: 30 2e 63 6f 6c 31 20 2a 20 2d 20 43 41 53 54 20  0.col1 * - CAST 
99b0: 28 20 4e 55 4c 4c 20 41 53 20 49 4e 54 45 47 45  ( NULL AS INTEGE
99c0: 52 20 29 20 2d 20 2b 20 74 61 62 30 2e 63 6f 6c  R ) - + tab0.col
99d0: 31 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  1 AS col2 FROM t
99e0: 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d  ab0..----..NULL.
99f0: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
9a00: 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
9a10: 4e 43 54 20 2b 20 63 6f 6c 31 20 2b 20 33 39 20  NCT + col1 + 39 
9a20: 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
9a30: 31 0d 0a 2d 2d 2d 2d 0d 0a 34 39 0d 0a 35 32 0d  1..----..49..52.
9a40: 0a 36 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .65....query I r
9a50: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63  owsort..SELECT c
9a60: 6f 6c 30 20 2a 20 28 20 2d 20 28 20 63 6f 6c 32  ol0 * ( - ( col2
9a70: 20 29 20 29 20 2a 20 63 6f 6c 32 20 46 52 4f 4d   ) ) * col2 FROM
9a80: 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31   tab2..----..-11
9a90: 34 30 37 36 0d 0a 2d 35 31 30 33 0d 0a 2d 35 32  4076..-5103..-52
9aa0: 37 32 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  728....query I r
9ab0: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
9ac0: 49 53 54 49 4e 43 54 20 63 6f 6c 32 20 2b 20 2d  ISTINCT col2 + -
9ad0: 20 32 20 2a 20 38 20 41 53 20 63 6f 6c 31 20 46   2 * 8 AS col1 F
9ae0: 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab0..----..
9af0: 2d 31 35 0d 0a 31 37 0d 0a 36 36 0d 0a 0d 0a 71  -15..17..66....q
9b00: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
9b10: 53 45 4c 45 43 54 20 2d 20 63 6f 6c 31 20 2d 20  SELECT - col1 - 
9b20: 28 20 2b 20 63 6f 6c 31 20 29 20 2a 20 2b 20 63  ( + col1 ) * + c
9b30: 6f 72 30 2e 63 6f 6c 31 20 46 52 4f 4d 20 74 61  or0.col1 FROM ta
9b40: 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
9b50: 0d 0a 2d 37 34 38 32 0d 0a 2d 38 33 37 32 0d 0a  ..-7482..-8372..
9b60: 2d 39 35 30 36 0d 0a 0d 0a 71 75 65 72 79 20 49  -9506....query I
9b70: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
9b80: 20 44 49 53 54 49 4e 43 54 20 38 35 20 2d 20 32   DISTINCT 85 - 2
9b90: 34 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  4 AS col1 FROM t
9ba0: 61 62 30 2c 20 74 61 62 31 20 41 53 20 63 6f 72  ab0, tab1 AS cor
9bb0: 30 0d 0a 2d 2d 2d 2d 0d 0a 36 31 0d 0a 0d 0a 71  0..----..61....q
9bc0: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
9bd0: 53 45 4c 45 43 54 20 2d 20 63 6f 6c 31 20 2a 20  SELECT - col1 * 
9be0: 31 30 20 2b 20 33 38 20 41 53 20 63 6f 6c 30 20  10 + 38 AS col0 
9bf0: 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
9c00: 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 32 32 0d 0a 2d  0..----..-222..-
9c10: 36 32 0d 0a 2d 39 32 0d 0a 0d 0a 71 75 65 72 79  62..-92....query
9c20: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
9c30: 43 54 20 39 36 20 46 52 4f 4d 20 74 61 62 31 2c  CT 96 FROM tab1,
9c40: 20 74 61 62 32 20 41 53 20 63 6f 72 30 2c 20 74   tab2 AS cor0, t
9c50: 61 62 30 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d  ab0 AS cor1..---
9c60: 2d 0d 0a 32 37 20 76 61 6c 75 65 73 20 68 61 73  -..27 values has
9c70: 68 69 6e 67 20 74 6f 20 66 31 64 39 37 38 63 32  hing to f1d978c2
9c80: 64 35 62 66 63 36 66 32 36 65 30 39 30 37 61 63  d5bfc6f26e0907ac
9c90: 37 37 37 62 65 38 33 65 0d 0a 0d 0a 6f 6e 6c 79  777be83e....only
9ca0: 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44  if mysql # use D
9cb0: 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20  IV operator for 
9cc0: 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e  integer division
9cd0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
9ce0: 74 20 6c 61 62 65 6c 2d 32 36 38 0d 0a 53 45 4c  t label-268..SEL
9cf0: 45 43 54 20 2d 20 2d 20 63 6f 6c 31 20 2a 20 2b  ECT - - col1 * +
9d00: 20 63 6f 6c 31 20 2b 20 2b 20 63 6f 6c 32 20 44   col1 + + col2 D
9d10: 49 56 20 2d 20 63 6f 6c 30 20 63 6f 6c 32 20 46  IV - col0 col2 F
9d20: 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
9d30: 0d 0a 2d 2d 2d 2d 0d 0a 31 30 30 0d 0a 31 36 38  ..----..100..168
9d40: 0d 0a 36 35 38 0d 0a 0d 0a 73 6b 69 70 69 66 20  ..658....skipif 
9d50: 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73  postgresql # Pos
9d60: 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73  tgreSQL requires
9d70: 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e   AS when renamin
9d80: 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73  g output columns
9d90: 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
9da0: 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
9db0: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
9dc0: 20 6c 61 62 65 6c 2d 32 36 38 0d 0a 53 45 4c 45   label-268..SELE
9dd0: 43 54 20 2d 20 2d 20 63 6f 6c 31 20 2a 20 2b 20  CT - - col1 * + 
9de0: 63 6f 6c 31 20 2b 20 2b 20 63 6f 6c 32 20 2f 20  col1 + + col2 / 
9df0: 2d 20 63 6f 6c 30 20 63 6f 6c 32 20 46 52 4f 4d  - col0 col2 FROM
9e00: 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
9e10: 2d 2d 2d 0d 0a 31 30 30 0d 0a 31 36 38 0d 0a 36  ---..100..168..6
9e20: 35 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  58....query I ro
9e30: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
9e40: 53 54 49 4e 43 54 20 2b 20 31 32 20 2a 20 63 6f  STINCT + 12 * co
9e50: 72 30 2e 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20  r0.col0 AS col1 
9e60: 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
9e70: 30 0d 0a 2d 2d 2d 2d 0d 0a 38 34 0d 0a 39 33 36  0..----..84..936
9e80: 0d 0a 39 34 38 0d 0a 0d 0a 71 75 65 72 79 20 49  ..948....query I
9e90: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
9ea0: 20 41 4c 4c 20 2b 20 36 32 20 2a 20 63 6f 6c 30   ALL + 62 * col0
9eb0: 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
9ec0: 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
9ed0: 0d 0a 31 38 36 0d 0a 33 39 36 38 0d 0a 34 39 36  ..186..3968..496
9ee0: 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  0....query I row
9ef0: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
9f00: 20 28 20 2b 20 37 34 20 29 20 2a 20 63 6f 6c 32   ( + 74 ) * col2
9f10: 20 2b 20 36 35 20 2a 20 2d 20 63 6f 6c 31 20 46   + 65 * - col1 F
9f20: 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
9f30: 0d 0a 2d 2d 2d 2d 0d 0a 32 33 30 36 0d 0a 33 35  ..----..2306..35
9f40: 36 38 0d 0a 36 32 35 39 0d 0a 0d 0a 71 75 65 72  68..6259....quer
9f50: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
9f60: 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 2b  ECT DISTINCT - +
9f70: 20 63 6f 6c 30 20 2b 20 2b 20 38 31 20 2b 20 2d   col0 + + 81 + -
9f80: 20 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46 52   col2 AS col1 FR
9f90: 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
9fa0: 0a 2d 2d 2d 2d 0d 0a 2d 39 30 0d 0a 32 34 0d 0a  .----..-90..24..
9fb0: 34 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  45....query I ro
9fc0: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
9fd0: 2d 20 31 35 20 2b 20 38 37 20 41 53 20 63 6f 6c  - 15 + 87 AS col
9fe0: 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  1 FROM tab1 AS c
9ff0: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 32 0d 0a  or0..----..102..
a000: 31 30 32 0d 0a 31 30 32 0d 0a 0d 0a 6f 6e 6c 79  102..102....only
a010: 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44  if mysql # use D
a020: 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20  IV operator for 
a030: 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e  integer division
a040: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
a050: 74 20 6c 61 62 65 6c 2d 32 37 34 0d 0a 53 45 4c  t label-274..SEL
a060: 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 2b  ECT DISTINCT + +
a070: 20 63 6f 6c 30 20 44 49 56 20 63 6f 72 30 2e 63   col0 DIV cor0.c
a080: 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol0 FROM tab1 AS
a090: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 0d 0a   cor0..----..1..
a0a0: 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
a0b0: 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
a0c0: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
a0d0: 20 6c 61 62 65 6c 2d 32 37 34 0d 0a 53 45 4c 45   label-274..SELE
a0e0: 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 2b 20  CT DISTINCT + + 
a0f0: 63 6f 6c 30 20 2f 20 63 6f 72 30 2e 63 6f 6c 30  col0 / cor0.col0
a100: 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
a110: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 0d 0a 0d 0a 71  r0..----..1....q
a120: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
a130: 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c  SELECT ALL - col
a140: 30 20 2b 20 28 20 63 6f 6c 31 20 2b 20 2d 20 34  0 + ( col1 + - 4
a150: 31 20 29 20 46 52 4f 4d 20 74 61 62 31 20 41 53  1 ) FROM tab1 AS
a160: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30   cor0..----..-10
a170: 38 0d 0a 2d 31 38 0d 0a 2d 39 35 0d 0a 0d 0a 6f  8..-18..-95....o
a180: 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75  nlyif mysql # su
a190: 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20  pport for MySQL 
a1a0: 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20  specific system 
a1b0: 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78  types and syntax
a1c0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
a1d0: 74 20 6c 61 62 65 6c 2d 32 37 36 0d 0a 53 45 4c  t label-276..SEL
a1e0: 45 43 54 20 41 4c 4c 20 2b 20 43 41 53 54 28 20  ECT ALL + CAST( 
a1f0: 4e 55 4c 4c 20 41 53 20 53 49 47 4e 45 44 20 29  NULL AS SIGNED )
a200: 20 2b 20 39 32 20 41 53 20 63 6f 6c 30 20 46 52   + 92 AS col0 FR
a210: 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
a220: 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c  .----..NULL..NUL
a230: 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69  L..NULL....skipi
a240: 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
a250: 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
a260: 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
a270: 32 37 36 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  276..SELECT ALL 
a280: 2b 20 43 41 53 54 20 28 20 4e 55 4c 4c 20 41 53  + CAST ( NULL AS
a290: 20 49 4e 54 45 47 45 52 20 29 20 2b 20 39 32 20   INTEGER ) + 92 
a2a0: 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
a2b0: 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
a2c0: 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c  .NULL..NULL..NUL
a2d0: 4c 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  L....query I row
a2e0: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2b  sort..SELECT + +
a2f0: 20 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c 32 20 2b   col2 * + col2 +
a300: 20 63 6f 6c 31 20 2a 20 28 20 63 6f 72 30 2e 63   col1 * ( cor0.c
a310: 6f 6c 31 20 29 20 46 52 4f 4d 20 74 61 62 31 20  ol1 ) FROM tab1 
a320: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33  AS cor0..----..3
a330: 33 34 39 0d 0a 33 35 39 32 0d 0a 39 33 38 35 0d  349..3592..9385.
a340: 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
a350: 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74  # use DIV operat
a360: 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64  or for integer d
a370: 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49  ivision..query I
a380: 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 32   rowsort label-2
a390: 37 38 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c  78..SELECT - col
a3a0: 30 20 44 49 56 20 32 38 20 2b 20 2d 20 63 6f 6c  0 DIV 28 + - col
a3b0: 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  0 AS col1 FROM t
a3c0: 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
a3d0: 2d 0d 0a 2d 37 0d 0a 2d 38 30 0d 0a 2d 38 31 0d  -..-7..-80..-81.
a3e0: 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
a3f0: 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
a400: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
a410: 74 20 6c 61 62 65 6c 2d 32 37 38 0d 0a 53 45 4c  t label-278..SEL
a420: 45 43 54 20 2d 20 63 6f 6c 30 20 2f 20 32 38 20  ECT - col0 / 28 
a430: 2b 20 2d 20 63 6f 6c 30 20 41 53 20 63 6f 6c 31  + - col0 AS col1
a440: 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
a450: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 37 0d 0a 2d 38  r0..----..-7..-8
a460: 30 0d 0a 2d 38 31 0d 0a 0d 0a 71 75 65 72 79 20  0..-81....query 
a470: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
a480: 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c  T DISTINCT - col
a490: 31 20 2b 20 2b 20 63 6f 6c 31 20 2a 20 63 6f 6c  1 + + col1 * col
a4a0: 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  0 FROM tab1 AS c
a4b0: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 32 37 0d  or0..----..1027.
a4c0: 0a 35 32 0d 0a 36 33 30 0d 0a 0d 0a 71 75 65 72  .52..630....quer
a4d0: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
a4e0: 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63  ECT DISTINCT - c
a4f0: 6f 6c 30 20 2a 20 2b 20 74 61 62 32 2e 63 6f 6c  ol0 * + tab2.col
a500: 32 20 2a 20 2b 20 28 20 63 6f 6c 30 20 29 20 41  2 * + ( col0 ) A
a510: 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32  S col1 FROM tab2
a520: 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 32 33 0d 0a 2d  ..----..-1323..-
a530: 31 35 38 31 38 34 0d 0a 2d 32 33 37 31 35 38 0d  158184..-237158.
a540: 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
a550: 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74  # use DIV operat
a560: 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64  or for integer d
a570: 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49  ivision..query I
a580: 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 32   rowsort label-2
a590: 38 31 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c  81..SELECT - col
a5a0: 30 20 2a 20 74 61 62 31 2e 63 6f 6c 31 20 2b 20  0 * tab1.col1 + 
a5b0: 2d 20 63 6f 6c 30 20 44 49 56 20 63 6f 6c 30 20  - col0 DIV col0 
a5c0: 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d  FROM tab1..----.
a5d0: 0a 2d 31 30 34 31 0d 0a 2d 36 34 31 0d 0a 2d 37  .-1041..-641..-7
a5e0: 39 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  9....skipif mysq
a5f0: 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
a600: 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
a610: 6f 72 74 20 6c 61 62 65 6c 2d 32 38 31 0d 0a 53  ort label-281..S
a620: 45 4c 45 43 54 20 2d 20 63 6f 6c 30 20 2a 20 74  ELECT - col0 * t
a630: 61 62 31 2e 63 6f 6c 31 20 2b 20 2d 20 63 6f 6c  ab1.col1 + - col
a640: 30 20 2f 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61  0 / col0 FROM ta
a650: 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 34 31 0d  b1..----..-1041.
a660: 0a 2d 36 34 31 0d 0a 2d 37 39 0d 0a 0d 0a 71 75  .-641..-79....qu
a670: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
a680: 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 33  ELECT DISTINCT 3
a690: 32 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 46 52  2 + cor0.col1 FR
a6a0: 4f 4d 20 74 61 62 32 2c 20 74 61 62 32 20 41 53  OM tab2, tab2 AS
a6b0: 20 63 6f 72 30 2c 20 74 61 62 32 20 41 53 20 63   cor0, tab2 AS c
a6c0: 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 34 39 0d 0a 36  or1..----..49..6
a6d0: 33 0d 0a 39 31 0d 0a 0d 0a 71 75 65 72 79 20 49  3..91....query I
a6e0: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
a6f0: 20 2b 20 63 6f 6c 30 20 2a 20 63 6f 6c 32 20 2b   + col0 * col2 +
a700: 20 2d 20 28 20 2d 20 37 30 20 29 20 2a 20 2b 20   - ( - 70 ) * + 
a710: 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41  col2 FROM tab0 A
a720: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30  S cor0..----..10
a730: 35 0d 0a 31 33 30 33 38 0d 0a 33 31 30 32 0d 0a  5..13038..3102..
a740: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
a750: 74 0d 0a 53 45 4c 45 43 54 20 2b 20 28 20 63 6f  t..SELECT + ( co
a760: 6c 31 20 29 20 2b 20 2b 20 63 6f 72 30 2e 63 6f  l1 ) + + cor0.co
a770: 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72  l0 FROM tab1 cor
a780: 30 0d 0a 2d 2d 2d 2d 0d 0a 32 39 0d 0a 37 34 0d  0..----..29..74.
a790: 0a 39 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .93....query I r
a7a0: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
a7b0: 20 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c 31 20 2a   col0 * + col1 *
a7c0: 20 2d 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62   - col0 FROM tab
a7d0: 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
a7e0: 0a 32 33 34 0d 0a 34 30 39 36 30 0d 0a 38 33 32  .234..40960..832
a7f0: 30 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  00....onlyif mys
a800: 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65  ql # use DIV ope
a810: 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65  rator for intege
a820: 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72  r division..quer
a830: 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
a840: 6c 2d 32 38 36 0d 0a 53 45 4c 45 43 54 20 44 49  l-286..SELECT DI
a850: 53 54 49 4e 43 54 20 2b 20 63 6f 6c 32 20 44 49  STINCT + col2 DI
a860: 56 20 2d 20 74 61 62 31 2e 63 6f 6c 31 20 41 53  V - tab1.col1 AS
a870: 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 0d   col2 FROM tab1.
a880: 0a 2d 2d 2d 2d 0d 0a 2d 32 0d 0a 2d 35 0d 0a 2d  .----..-2..-5..-
a890: 37 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  7....skipif mysq
a8a0: 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
a8b0: 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
a8c0: 6f 72 74 20 6c 61 62 65 6c 2d 32 38 36 0d 0a 53  ort label-286..S
a8d0: 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b  ELECT DISTINCT +
a8e0: 20 63 6f 6c 32 20 2f 20 2d 20 74 61 62 31 2e 63   col2 / - tab1.c
a8f0: 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  ol1 AS col2 FROM
a900: 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 0d   tab1..----..-2.
a910: 0a 2d 35 0d 0a 2d 37 0d 0a 0d 0a 71 75 65 72 79  .-5..-7....query
a920: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
a930: 43 54 20 41 4c 4c 20 2b 20 2d 20 33 31 20 2b 20  CT ALL + - 31 + 
a940: 2d 20 63 6f 6c 32 20 2a 20 2b 20 32 32 20 46 52  - col2 * + 22 FR
a950: 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
a960: 0a 2d 2d 2d 2d 0d 0a 2d 36 30 33 0d 0a 2d 36 32  .----..-603..-62
a970: 35 0d 0a 2d 38 36 37 0d 0a 0d 0a 71 75 65 72 79  5..-867....query
a980: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
a990: 43 54 20 41 4c 4c 20 34 36 20 41 53 20 63 6f 6c  CT ALL 46 AS col
a9a0: 31 20 46 52 4f 4d 20 74 61 62 32 2c 20 74 61 62  1 FROM tab2, tab
a9b0: 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
a9c0: 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e  .9 values hashin
a9d0: 67 20 74 6f 20 33 31 38 31 38 63 39 64 34 64 33  g to 31818c9d4d3
a9e0: 32 35 65 62 32 34 38 37 33 35 63 39 37 63 62 31  25eb248735c97cb1
a9f0: 64 63 65 33 39 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  dce39....onlyif 
aa00: 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20  mysql # use DIV 
aa10: 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74  operator for int
aa20: 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71  eger division..q
aa30: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
aa40: 61 62 65 6c 2d 32 38 39 0d 0a 53 45 4c 45 43 54  abel-289..SELECT
aa50: 20 44 49 53 54 49 4e 43 54 20 2d 20 32 30 20 44   DISTINCT - 20 D
aa60: 49 56 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c  IV + col1 AS col
aa70: 31 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d  1 FROM tab2..---
aa80: 2d 0d 0a 2d 31 0d 0a 30 0d 0a 0d 0a 73 6b 69 70  -..-1..0....skip
aa90: 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
aaa0: 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
aab0: 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
aac0: 2d 32 38 39 0d 0a 53 45 4c 45 43 54 20 44 49 53  -289..SELECT DIS
aad0: 54 49 4e 43 54 20 2d 20 32 30 20 2f 20 2b 20 63  TINCT - 20 / + c
aae0: 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  ol1 AS col1 FROM
aaf0: 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d   tab2..----..-1.
ab00: 0a 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  .0....onlyif mys
ab10: 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72  ql # support for
ab20: 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63 20   MySQL specific 
ab30: 73 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64  system types and
ab40: 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49   syntax..query I
ab50: 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 32   rowsort label-2
ab60: 39 30 0d 0a 53 45 4c 45 43 54 20 2b 20 43 41 53  90..SELECT + CAS
ab70: 54 28 20 4e 55 4c 4c 20 41 53 20 53 49 47 4e 45  T( NULL AS SIGNE
ab80: 44 20 29 20 2a 20 2d 20 33 32 20 41 53 20 63 6f  D ) * - 32 AS co
ab90: 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72  l1 FROM tab1 cor
aba0: 30 20 43 52 4f 53 53 20 4a 4f 49 4e 20 74 61 62  0 CROSS JOIN tab
abb0: 30 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d  0 AS cor1..----.
abc0: 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e  .9 values hashin
abd0: 67 20 74 6f 20 63 64 37 61 37 39 30 31 65 34 37  g to cd7a7901e47
abe0: 63 31 35 31 35 35 34 30 34 61 66 66 30 64 32 31  c15155404aff0d21
abf0: 36 66 65 30 62 0d 0a 0d 0a 73 6b 69 70 69 66 20  6fe0b....skipif 
ac00: 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
ac10: 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
ac20: 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 32 39  rowsort label-29
ac30: 30 0d 0a 53 45 4c 45 43 54 20 2b 20 43 41 53 54  0..SELECT + CAST
ac40: 20 28 20 4e 55 4c 4c 20 41 53 20 49 4e 54 45 47   ( NULL AS INTEG
ac50: 45 52 20 29 20 2a 20 2d 20 33 32 20 41 53 20 63  ER ) * - 32 AS c
ac60: 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 63 6f  ol1 FROM tab1 co
ac70: 72 30 20 43 52 4f 53 53 20 4a 4f 49 4e 20 74 61  r0 CROSS JOIN ta
ac80: 62 30 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d  b0 AS cor1..----
ac90: 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68 69  ..9 values hashi
aca0: 6e 67 20 74 6f 20 63 64 37 61 37 39 30 31 65 34  ng to cd7a7901e4
acb0: 37 63 31 35 31 35 35 34 30 34 61 66 66 30 64 32  7c15155404aff0d2
acc0: 31 36 66 65 30 62 0d 0a 0d 0a 71 75 65 72 79 20  16fe0b....query 
acd0: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
ace0: 54 20 44 49 53 54 49 4e 43 54 20 34 20 41 53 20  T DISTINCT 4 AS 
acf0: 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41  col1 FROM tab2 A
ad00: 53 20 63 6f 72 30 20 43 52 4f 53 53 20 4a 4f 49  S cor0 CROSS JOI
ad10: 4e 20 74 61 62 30 20 63 6f 72 31 0d 0a 2d 2d 2d  N tab0 cor1..---
ad20: 2d 0d 0a 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20  -..4....query I 
ad30: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
ad40: 44 49 53 54 49 4e 43 54 20 2d 20 2b 20 31 38 20  DISTINCT - + 18 
ad50: 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
ad60: 30 20 43 52 4f 53 53 20 4a 4f 49 4e 20 74 61 62  0 CROSS JOIN tab
ad70: 32 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d  2 AS cor1..----.
ad80: 0a 2d 31 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .-18....query I 
ad90: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
ada0: 2b 20 39 36 20 2a 20 2b 20 74 61 62 31 2e 63 6f  + 96 * + tab1.co
adb0: 6c 30 20 2d 20 2b 20 36 34 20 46 52 4f 4d 20 74  l0 - + 64 FROM t
adc0: 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 32 32 34 0d 0a  ab1..----..224..
add0: 36 30 38 30 0d 0a 37 36 31 36 0d 0a 0d 0a 71 75  6080..7616....qu
ade0: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
adf0: 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d  ELECT DISTINCT -
ae00: 20 63 6f 6c 32 20 2a 20 31 20 46 52 4f 4d 20 74   col2 * 1 FROM t
ae10: 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab0 cor0..----..
ae20: 2d 31 0d 0a 2d 33 33 0d 0a 2d 38 32 0d 0a 0d 0a  -1..-33..-82....
ae30: 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73  onlyif mysql # s
ae40: 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c  upport for MySQL
ae50: 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d   specific system
ae60: 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61   types and synta
ae70: 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  x..query I rowso
ae80: 72 74 20 6c 61 62 65 6c 2d 32 39 35 0d 0a 53 45  rt label-295..SE
ae90: 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20  LECT DISTINCT + 
aea0: 63 6f 6c 32 20 2f 20 43 41 53 54 28 20 4e 55 4c  col2 / CAST( NUL
aeb0: 4c 20 41 53 20 53 49 47 4e 45 44 20 29 20 2b 20  L AS SIGNED ) + 
aec0: 2d 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32  - col0 FROM tab2
aed0: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
aee0: 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  NULL....skipif m
aef0: 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
af00: 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
af10: 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 32 39 35  owsort label-295
af20: 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
af30: 54 20 2b 20 63 6f 6c 32 20 2f 20 43 41 53 54 20  T + col2 / CAST 
af40: 28 20 4e 55 4c 4c 20 41 53 20 49 4e 54 45 47 45  ( NULL AS INTEGE
af50: 52 20 29 20 2b 20 2d 20 63 6f 6c 30 20 46 52 4f  R ) + - col0 FRO
af60: 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
af70: 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b  ----..NULL....sk
af80: 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20  ipif postgresql 
af90: 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71  # PostgreSQL req
afa0: 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65  uires AS when re
afb0: 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f  naming output co
afc0: 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72  lumns..query I r
afd0: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
afe0: 49 53 54 49 4e 43 54 20 63 6f 6c 30 20 2a 20 2d  ISTINCT col0 * -
aff0: 20 28 20 63 6f 6c 30 20 29 20 2a 20 63 6f 6c 32   ( col0 ) * col2
b000: 20 2b 20 2d 20 63 6f 72 30 2e 63 6f 6c 30 20 2a   + - cor0.col0 *
b010: 20 2d 20 28 20 2d 20 63 6f 6c 32 20 29 20 63 6f   - ( - col2 ) co
b020: 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l2 FROM tab0 AS 
b030: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32 36  cor0..----..-126
b040: 30 0d 0a 2d 31 39 38 30 30 0d 0a 2d 36 35 36 38  0..-19800..-6568
b050: 32 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  20....query I ro
b060: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
b070: 63 6f 6c 31 20 2a 20 2d 20 28 20 38 30 20 29 20  col1 * - ( 80 ) 
b080: 46 52 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a  FROM tab2 cor0..
b090: 2d 2d 2d 2d 0d 0a 2d 31 33 36 30 0d 0a 2d 32 34  ----..-1360..-24
b0a0: 38 30 0d 0a 2d 34 37 32 30 0d 0a 0d 0a 73 6b 69  80..-4720....ski
b0b0: 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23  pif postgresql #
b0c0: 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75   PostgreSQL requ
b0d0: 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e  ires AS when ren
b0e0: 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c  aming output col
b0f0: 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f  umns..query I ro
b100: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
b110: 4c 20 2d 20 36 39 20 2a 20 2d 20 63 6f 6c 31 20  L - 69 * - col1 
b120: 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 0d 0a  col2 FROM tab0..
b130: 2d 2d 2d 2d 0d 0a 35 39 33 34 0d 0a 36 32 37 39  ----..5934..6279
b140: 0d 0a 36 36 39 33 0d 0a 0d 0a 73 6b 69 70 69 66  ..6693....skipif
b150: 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f   postgresql # Po
b160: 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65  stgreSQL require
b170: 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69  s AS when renami
b180: 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e  ng output column
b190: 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  s..query I rowso
b1a0: 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
b1b0: 4e 43 54 20 2d 20 36 38 20 63 6f 6c 31 20 46 52  NCT - 68 col1 FR
b1c0: 4f 4d 20 74 61 62 30 2c 20 74 61 62 32 2c 20 74  OM tab0, tab2, t
b1d0: 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
b1e0: 2d 0d 0a 2d 36 38 0d 0a 0d 0a 71 75 65 72 79 20  -..-68....query 
b1f0: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
b200: 54 20 2b 20 63 6f 6c 32 20 2a 20 63 6f 6c 32 20  T + col2 * col2 
b210: 2d 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31  - col1 FROM tab1
b220: 0d 0a 2d 2d 2d 2d 0d 0a 32 38 39 30 0d 0a 33 32  ..----..2890..32
b230: 33 39 0d 0a 39 32 30 33 0d 0a 0d 0a 71 75 65 72  39..9203....quer
b240: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
b250: 45 43 54 20 2b 20 63 6f 6c 30 20 2a 20 63 6f 6c  ECT + col0 * col
b260: 32 20 2b 20 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c  2 + col1 * - col
b270: 31 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d  1 FROM tab1..---
b280: 2d 0d 0a 2d 35 31 34 0d 0a 33 35 34 38 0d 0a 37  -..-514..3548..7
b290: 35 31 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  511....query I r
b2a0: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 34  owsort..SELECT 4
b2b0: 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
b2c0: 62 31 2c 20 74 61 62 31 20 41 53 20 63 6f 72 30  b1, tab1 AS cor0
b2d0: 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73  ..----..9 values
b2e0: 20 68 61 73 68 69 6e 67 20 74 6f 20 36 66 65 63   hashing to 6fec
b2f0: 39 36 35 62 36 30 62 39 38 38 35 63 34 61 66 37  965b60b9885c4af7
b300: 33 65 38 35 34 32 32 63 66 64 39 62 0d 0a 0d 0a  3e85422cfd9b....
b310: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
b320: 0a 53 45 4c 45 43 54 20 63 6f 72 30 2e 63 6f 6c  .SELECT cor0.col
b330: 30 20 2a 20 63 6f 6c 32 20 41 53 20 63 6f 6c 30  0 * col2 AS col0
b340: 20 46 52 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d   FROM tab2 cor0.
b350: 0a 2d 2d 2d 2d 0d 0a 31 38 39 0d 0a 32 30 32 38  .----..189..2028
b360: 0d 0a 33 30 30 32 0d 0a 0d 0a 6f 6e 6c 79 69 66  ..3002....onlyif
b370: 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56   mysql # use DIV
b380: 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e   operator for in
b390: 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a  teger division..
b3a0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
b3b0: 6c 61 62 65 6c 2d 33 30 34 0d 0a 53 45 4c 45 43  label-304..SELEC
b3c0: 54 20 41 4c 4c 20 63 6f 6c 30 20 44 49 56 20 2b  T ALL col0 DIV +
b3d0: 20 63 6f 6c 32 20 2b 20 2b 20 63 6f 6c 30 20 63   col2 + + col0 c
b3e0: 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol1 FROM tab0 AS
b3f0: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 34 0d   cor0..----..24.
b400: 0a 37 30 0d 0a 39 30 0d 0a 0d 0a 73 6b 69 70 69  .70..90....skipi
b410: 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50  f postgresql # P
b420: 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72  ostgreSQL requir
b430: 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d  es AS when renam
b440: 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d  ing output colum
b450: 6e 73 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ns..skipif mysql
b460: 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
b470: 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
b480: 72 74 20 6c 61 62 65 6c 2d 33 30 34 0d 0a 53 45  rt label-304..SE
b490: 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 30 20 2f 20  LECT ALL col0 / 
b4a0: 2b 20 63 6f 6c 32 20 2b 20 2b 20 63 6f 6c 30 20  + col2 + + col0 
b4b0: 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41  col1 FROM tab0 A
b4c0: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 34  S cor0..----..24
b4d0: 0d 0a 37 30 0d 0a 39 30 0d 0a 0d 0a 71 75 65 72  ..70..90....quer
b4e0: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
b4f0: 45 43 54 20 2b 20 63 6f 6c 30 20 2a 20 2d 20 32  ECT + col0 * - 2
b500: 34 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30  4 FROM tab0 cor0
b510: 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 31 33 36 0d 0a 2d  ..----..-2136..-
b520: 35 37 36 0d 0a 2d 38 34 30 0d 0a 0d 0a 71 75 65  576..-840....que
b530: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
b540: 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 30 20  LECT ALL + col0 
b550: 2a 20 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  * 2 AS col2 FROM
b560: 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
b570: 2d 2d 2d 0d 0a 31 34 0d 0a 31 35 36 0d 0a 31 35  ---..14..156..15
b580: 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  8....query I row
b590: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63  sort..SELECT - c
b5a0: 6f 6c 30 20 2a 20 2b 20 63 6f 72 30 2e 63 6f 6c  ol0 * + cor0.col
b5b0: 32 20 2a 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61  2 * col2 FROM ta
b5c0: 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
b5d0: 0d 0a 2d 32 36 31 33 36 0d 0a 2d 33 35 0d 0a 2d  ..-26136..-35..-
b5e0: 35 39 38 34 33 36 0d 0a 0d 0a 71 75 65 72 79 20  598436....query 
b5f0: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
b600: 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 30 20  T DISTINCT col0 
b610: 2b 20 63 6f 6c 30 20 2a 20 63 6f 72 30 2e 63 6f  + col0 * cor0.co
b620: 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l0 FROM tab0 AS 
b630: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 36 30  cor0..----..1260
b640: 0d 0a 36 30 30 0d 0a 38 30 31 30 0d 0a 0d 0a 6f  ..600..8010....o
b650: 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73  nlyif mysql # us
b660: 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66  e DIV operator f
b670: 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73  or integer divis
b680: 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ion..query I row
b690: 73 6f 72 74 20 6c 61 62 65 6c 2d 33 30 39 0d 0a  sort label-309..
b6a0: 53 45 4c 45 43 54 20 63 6f 6c 32 20 44 49 56 20  SELECT col2 DIV 
b6b0: 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32  + col0 FROM tab2
b6c0: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a   cor0..----..0..
b6d0: 30 0d 0a 33 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  0..3....skipif m
b6e0: 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
b6f0: 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
b700: 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 33 30 39  owsort label-309
b710: 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 32 20 2f 20  ..SELECT col2 / 
b720: 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32  + col0 FROM tab2
b730: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a   cor0..----..0..
b740: 30 0d 0a 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20  0..3....query I 
b750: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
b760: 2b 20 63 6f 6c 30 20 2a 20 38 39 20 41 53 20 63  + col0 * 89 AS c
b770: 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol0 FROM tab0 AS
b780: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 31 33   cor0..----..213
b790: 36 0d 0a 33 31 31 35 0d 0a 37 39 32 31 0d 0a 0d  6..3115..7921...
b7a0: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
b7b0: 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
b7c0: 54 20 2b 20 63 6f 6c 30 20 2a 20 35 39 20 2b 20  T + col0 * 59 + 
b7d0: 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46 52 4f  col0 AS col2 FRO
b7e0: 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 34 32  M tab2..----..42
b7f0: 30 0d 0a 34 36 38 30 0d 0a 34 37 34 30 0d 0a 0d  0..4680..4740...
b800: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
b810: 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 31 20  ..SELECT - col1 
b820: 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 2a 20 63 6f  + cor0.col0 * co
b830: 72 30 2e 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  r0.col2 FROM tab
b840: 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
b850: 0a 2d 36 32 0d 0a 37 30 36 0d 0a 37 32 30 37 0d  .-62..706..7207.
b860: 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
b870: 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
b880: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
b890: 74 0d 0a 53 45 4c 45 43 54 20 43 41 53 54 20 28  t..SELECT CAST (
b8a0: 20 28 20 63 6f 6c 30 20 29 20 41 53 20 52 45 41   ( col0 ) AS REA
b8b0: 4c 20 29 20 2a 20 63 6f 6c 31 20 2b 20 31 20 46  L ) * col1 + 1 F
b8c0: 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab1..----..
b8d0: 31 30 34 31 0d 0a 36 34 31 0d 0a 37 39 0d 0a 0d  1041..641..79...
b8e0: 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
b8f0: 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72  use DIV operator
b900: 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76   for integer div
b910: 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72  ision..query I r
b920: 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 33 31 34  owsort label-314
b930: 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 31 20  ..SELECT - col1 
b940: 2b 20 63 6f 6c 32 20 44 49 56 20 63 6f 6c 31 20  + col2 DIV col1 
b950: 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
b960: 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  2 cor0..----..-1
b970: 35 0d 0a 2d 33 31 0d 0a 2d 35 39 0d 0a 0d 0a 73  5..-31..-59....s
b980: 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
b990: 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
b9a0: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
b9b0: 62 65 6c 2d 33 31 34 0d 0a 53 45 4c 45 43 54 20  bel-314..SELECT 
b9c0: 2d 20 63 6f 6c 31 20 2b 20 63 6f 6c 32 20 2f 20  - col1 + col2 / 
b9d0: 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46 52 4f  col1 AS col2 FRO
b9e0: 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab2 cor0..---
b9f0: 2d 0d 0a 2d 31 35 0d 0a 2d 33 31 0d 0a 2d 35 39  -..-15..-31..-59
ba00: 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
ba10: 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61   # use DIV opera
ba20: 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20  tor for integer 
ba30: 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20  division..query 
ba40: 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
ba50: 33 31 35 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  315..SELECT DIST
ba60: 49 4e 43 54 20 63 6f 6c 30 20 44 49 56 20 63 6f  INCT col0 DIV co
ba70: 6c 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  l0 AS col2 FROM 
ba80: 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab2 cor0..----.
ba90: 0a 31 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  .1....skipif mys
baa0: 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
bab0: 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
bac0: 73 6f 72 74 20 6c 61 62 65 6c 2d 33 31 35 0d 0a  sort label-315..
bad0: 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
bae0: 63 6f 6c 30 20 2f 20 63 6f 6c 30 20 41 53 20 63  col0 / col0 AS c
baf0: 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 63 6f  ol2 FROM tab2 co
bb00: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 0d 0a 0d 0a 71  r0..----..1....q
bb10: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
bb20: 53 45 4c 45 43 54 20 36 34 20 2a 20 2d 20 63 6f  SELECT 64 * - co
bb30: 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l2 FROM tab1 AS 
bb40: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 34 35  cor0..----..-345
bb50: 36 0d 0a 2d 33 36 34 38 0d 0a 2d 36 31 34 34 0d  6..-3648..-6144.
bb60: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
bb70: 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
bb80: 4e 43 54 20 2d 20 2b 20 35 37 20 41 53 20 63 6f  NCT - + 57 AS co
bb90: 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l1 FROM tab0 AS 
bba0: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 37 0d  cor0..----..-57.
bbb0: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
bbc0: 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 35 32 20  rt..SELECT + 52 
bbd0: 2a 20 63 6f 72 30 2e 63 6f 6c 31 20 46 52 4f 4d  * cor0.col1 FROM
bbe0: 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
bbf0: 2d 2d 2d 0d 0a 31 36 31 32 0d 0a 33 30 36 38 0d  ---..1612..3068.
bc00: 0a 38 38 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .884....query I 
bc10: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
bc20: 41 4c 4c 20 28 20 2b 20 63 6f 6c 30 20 29 20 2a  ALL ( + col0 ) *
bc30: 20 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46 52   col0 AS col1 FR
bc40: 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
bc50: 0a 2d 2d 2d 2d 0d 0a 34 39 0d 0a 36 30 38 34 0d  .----..49..6084.
bc60: 0a 36 32 34 31 0d 0a 0d 0a 71 75 65 72 79 20 49  .6241....query I
bc70: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
bc80: 20 63 6f 6c 32 20 2a 20 63 6f 6c 30 20 2b 20 63   col2 * col0 + c
bc90: 6f 6c 31 20 2a 20 38 20 46 52 4f 4d 20 74 61 62  ol1 * 8 FROM tab
bca0: 32 0d 0a 2d 2d 2d 2d 0d 0a 32 35 30 30 0d 0a 33  2..----..2500..3
bcb0: 31 33 38 0d 0a 34 33 37 0d 0a 0d 0a 6f 6e 6c 79  138..437....only
bcc0: 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44  if mysql # use D
bcd0: 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20  IV operator for 
bce0: 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e  integer division
bcf0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
bd00: 74 20 6c 61 62 65 6c 2d 33 32 31 0d 0a 53 45 4c  t label-321..SEL
bd10: 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 30 20 44  ECT ALL + col0 D
bd20: 49 56 20 2d 20 63 6f 6c 32 20 46 52 4f 4d 20 74  IV - col2 FROM t
bd30: 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab1 cor0..----..
bd40: 2d 31 0d 0a 30 0d 0a 30 0d 0a 0d 0a 73 6b 69 70  -1..0..0....skip
bd50: 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
bd60: 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
bd70: 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
bd80: 2d 33 32 31 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  -321..SELECT ALL
bd90: 20 2b 20 63 6f 6c 30 20 2f 20 2d 20 63 6f 6c 32   + col0 / - col2
bda0: 20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d   FROM tab1 cor0.
bdb0: 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 30 0d 0a 30 0d  .----..-1..0..0.
bdc0: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
bdd0: 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 31  rt..SELECT ALL 1
bde0: 36 20 46 52 4f 4d 20 74 61 62 30 2c 20 74 61 62  6 FROM tab0, tab
bdf0: 32 20 41 53 20 63 6f 72 30 2c 20 74 61 62 32 20  2 AS cor0, tab2 
be00: 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 32  AS cor1..----..2
be10: 37 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67  7 values hashing
be20: 20 74 6f 20 65 65 35 62 64 65 39 66 36 38 65 65   to ee5bde9f68ee
be30: 38 32 38 65 38 63 64 38 36 62 30 64 35 39 30 30  828e8cd86b0d5900
be40: 39 30 62 63 0d 0a 0d 0a 71 75 65 72 79 20 49 20  90bc....query I 
be50: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
be60: 41 4c 4c 20 2d 20 63 6f 6c 30 20 2a 20 2d 20 33  ALL - col0 * - 3
be70: 33 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c 31  3 + col0 AS col1
be80: 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d   FROM tab0..----
be90: 0d 0a 31 31 39 30 0d 0a 33 30 32 36 0d 0a 38 31  ..1190..3026..81
bea0: 36 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  6....onlyif mysq
beb0: 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72  l # use DIV oper
bec0: 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72  ator for integer
bed0: 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79   division..query
bee0: 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
bef0: 2d 33 32 34 0d 0a 53 45 4c 45 43 54 20 44 49 53  -324..SELECT DIS
bf00: 54 49 4e 43 54 20 2d 20 63 6f 6c 31 20 44 49 56  TINCT - col1 DIV
bf10: 20 2b 20 28 20 2b 20 39 34 20 2a 20 2b 20 74 61   + ( + 94 * + ta
bf20: 62 30 2e 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c 32  b0.col0 + + col2
bf30: 20 29 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d   ) FROM tab0..--
bf40: 2d 2d 0d 0a 30 0d 0a 0d 0a 73 6b 69 70 69 66 20  --..0....skipif 
bf50: 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
bf60: 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
bf70: 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 33 32  rowsort label-32
bf80: 34 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  4..SELECT DISTIN
bf90: 43 54 20 2d 20 63 6f 6c 31 20 2f 20 2b 20 28 20  CT - col1 / + ( 
bfa0: 2b 20 39 34 20 2a 20 2b 20 74 61 62 30 2e 63 6f  + 94 * + tab0.co
bfb0: 6c 30 20 2b 20 2b 20 63 6f 6c 32 20 29 20 46 52  l0 + + col2 ) FR
bfc0: 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 30  OM tab0..----..0
bfd0: 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67  ....skipif postg
bfe0: 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53  resql # PostgreS
bff0: 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77  QL requires AS w
c000: 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74  hen renaming out
c010: 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65  put columns..que
c020: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
c030: 4c 45 43 54 20 41 4c 4c 20 63 6f 72 30 2e 63 6f  LECT ALL cor0.co
c040: 6c 31 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  l1 col1 FROM tab
c050: 31 2c 20 74 61 62 31 20 41 53 20 63 6f 72 30 2c  1, tab1 AS cor0,
c060: 20 74 61 62 30 20 41 53 20 63 6f 72 31 0d 0a 2d   tab0 AS cor1..-
c070: 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75 65 73 20 68  ---..27 values h
c080: 61 73 68 69 6e 67 20 74 6f 20 64 36 37 31 61 30  ashing to d671a0
c090: 36 34 65 32 64 61 37 30 39 63 61 34 63 64 66 65  64e2da709ca4cdfe
c0a0: 61 33 31 37 62 38 65 38 39 32 0d 0a 0d 0a 71 75  a317b8e892....qu
c0b0: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
c0c0: 45 4c 45 43 54 20 2d 20 35 20 46 52 4f 4d 20 74  ELECT - 5 FROM t
c0d0: 61 62 31 2c 20 74 61 62 32 20 63 6f 72 30 2c 20  ab1, tab2 cor0, 
c0e0: 74 61 62 32 2c 20 74 61 62 32 20 41 53 20 63 6f  tab2, tab2 AS co
c0f0: 72 31 0d 0a 2d 2d 2d 2d 0d 0a 38 31 20 76 61 6c  r1..----..81 val
c100: 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 65  ues hashing to e
c110: 64 65 34 39 30 63 35 39 36 30 34 37 32 33 63 30  de490c59604723c0
c120: 30 30 34 34 39 65 30 32 37 65 35 63 66 31 38 0d  00449e027e5cf18.
c130: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
c140: 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 31 20  rt..SELECT col1 
c150: 2a 20 2d 20 39 38 20 41 53 20 63 6f 6c 30 20 46  * - 98 AS col0 F
c160: 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
c170: 0d 0a 2d 2d 2d 2d 0d 0a 2d 38 34 32 38 0d 0a 2d  ..----..-8428..-
c180: 38 39 31 38 0d 0a 2d 39 35 30 36 0d 0a 0d 0a 71  8918..-9506....q
c190: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
c1a0: 53 45 4c 45 43 54 20 2b 20 28 20 2b 20 31 30 20  SELECT + ( + 10 
c1b0: 2b 20 63 6f 6c 30 20 29 20 2a 20 2d 20 28 20 2b  + col0 ) * - ( +
c1c0: 20 35 37 20 29 20 2a 20 74 61 62 32 2e 63 6f 6c   57 ) * tab2.col
c1d0: 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  2 AS col2 FROM t
c1e0: 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 30 34  ab2..----..-1304
c1f0: 31 36 0d 0a 2d 31 39 32 37 37 34 0d 0a 2d 32 36  16..-192774..-26
c200: 31 36 33 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  163....onlyif my
c210: 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70  sql # use DIV op
c220: 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67  erator for integ
c230: 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65  er division..que
c240: 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
c250: 65 6c 2d 33 32 39 0d 0a 53 45 4c 45 43 54 20 63  el-329..SELECT c
c260: 6f 6c 30 20 44 49 56 20 2d 20 63 6f 6c 31 20 2b  ol0 DIV - col1 +
c270: 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 41 53 20   + cor0.col0 AS 
c280: 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41  col0 FROM tab1 A
c290: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 0d  S cor0..----..3.
c2a0: 0a 35 38 0d 0a 37 34 0d 0a 0d 0a 73 6b 69 70 69  .58..74....skipi
c2b0: 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
c2c0: 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
c2d0: 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
c2e0: 33 32 39 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 30  329..SELECT col0
c2f0: 20 2f 20 2d 20 63 6f 6c 31 20 2b 20 2b 20 63 6f   / - col1 + + co
c300: 72 30 2e 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20  r0.col0 AS col0 
c310: 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
c320: 30 0d 0a 2d 2d 2d 2d 0d 0a 33 0d 0a 35 38 0d 0a  0..----..3..58..
c330: 37 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  74....query I ro
c340: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f  wsort..SELECT co
c350: 6c 32 20 2a 20 2d 20 63 6f 72 30 2e 63 6f 6c 31  l2 * - cor0.col1
c360: 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 2a 20 2b   + cor0.col1 * +
c370: 20 63 6f 6c 32 20 2b 20 2d 20 63 6f 6c 32 20 41   col2 + - col2 A
c380: 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31  S col2 FROM tab1
c390: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
c3a0: 2d 35 34 0d 0a 2d 35 37 0d 0a 2d 39 36 0d 0a 0d  -54..-57..-96...
c3b0: 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73  .skipif postgres
c3c0: 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20  ql # PostgreSQL 
c3d0: 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e  requires AS when
c3e0: 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74   renaming output
c3f0: 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20   columns..query 
c400: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
c410: 54 20 2d 20 28 20 2b 20 63 6f 72 30 2e 63 6f 6c  T - ( + cor0.col
c420: 31 20 29 20 2b 20 2d 20 63 6f 6c 32 20 2a 20 2b  1 ) + - col2 * +
c430: 20 36 33 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   63 col1 FROM ta
c440: 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
c450: 0d 0a 2d 31 36 30 0d 0a 2d 32 31 36 35 0d 0a 2d  ..-160..-2165..-
c460: 35 32 35 37 0d 0a 0d 0a 73 6b 69 70 69 66 20 70  5257....skipif p
c470: 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74  ostgresql # Post
c480: 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20  greSQL requires 
c490: 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67  AS when renaming
c4a0: 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d   output columns.
c4b0: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
c4c0: 0d 0a 53 45 4c 45 43 54 20 2d 20 2b 20 63 6f 6c  ..SELECT - + col
c4d0: 32 20 2a 20 2d 20 63 6f 6c 30 20 63 6f 6c 32 20  2 * - col0 col2 
c4e0: 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a  FROM tab1 cor0..
c4f0: 2d 2d 2d 2d 0d 0a 31 36 32 0d 0a 33 36 34 38 0d  ----..162..3648.
c500: 0a 37 36 38 30 0d 0a 0d 0a 71 75 65 72 79 20 49  .7680....query I
c510: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
c520: 20 41 4c 4c 20 2b 20 2d 20 63 6f 6c 32 20 2a 20   ALL + - col2 * 
c530: 63 6f 72 30 2e 63 6f 6c 30 20 41 53 20 63 6f 6c  cor0.col0 AS col
c540: 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  1 FROM tab1 AS c
c550: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 36 32 0d  or0..----..-162.
c560: 0a 2d 33 36 34 38 0d 0a 2d 37 36 38 30 0d 0a 0d  .-3648..-7680...
c570: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
c580: 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 30 20  ..SELECT + col0 
c590: 2a 20 33 34 20 46 52 4f 4d 20 74 61 62 30 20 41  * 34 FROM tab0 A
c5a0: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31  S cor0..----..11
c5b0: 39 30 0d 0a 33 30 32 36 0d 0a 38 31 36 0d 0a 0d  90..3026..816...
c5c0: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
c5d0: 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
c5e0: 54 20 2d 20 2d 20 28 20 37 34 20 29 20 41 53 20  T - - ( 74 ) AS 
c5f0: 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41  col0 FROM tab1 A
c600: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 37 34  S cor0..----..74
c610: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
c620: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 28 20  ort..SELECT - ( 
c630: 36 31 20 29 20 2b 20 2d 20 63 6f 6c 30 20 46 52  61 ) + - col0 FR
c640: 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
c650: 0a 2d 2d 2d 2d 0d 0a 2d 31 32 35 0d 0a 2d 31 34  .----..-125..-14
c660: 31 0d 0a 2d 36 34 0d 0a 0d 0a 71 75 65 72 79 20  1..-64....query 
c670: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
c680: 54 20 44 49 53 54 49 4e 43 54 20 2d 20 36 39 20  T DISTINCT - 69 
c690: 2b 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61  + + col0 FROM ta
c6a0: 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
c6b0: 0d 0a 2d 35 0d 0a 2d 36 36 0d 0a 31 31 0d 0a 0d  ..-5..-66..11...
c6c0: 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
c6d0: 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72  use DIV operator
c6e0: 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76   for integer div
c6f0: 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72  ision..query I r
c700: 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 33 33 38  owsort label-338
c710: 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
c720: 54 20 2b 20 31 38 20 2b 20 2b 20 63 6f 6c 31 20  T + 18 + + col1 
c730: 2a 20 2b 20 63 6f 6c 31 20 2b 20 63 6f 72 30 2e  * + col1 + cor0.
c740: 63 6f 6c 31 20 44 49 56 20 2d 20 63 6f 6c 32 20  col1 DIV - col2 
c750: 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
c760: 30 0d 0a 2d 2d 2d 2d 0d 0a 37 34 31 32 0d 0a 38  0..----..7412..8
c770: 32 39 38 0d 0a 39 33 33 30 0d 0a 0d 0a 73 6b 69  298..9330....ski
c780: 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
c790: 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
c7a0: 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
c7b0: 6c 2d 33 33 38 0d 0a 53 45 4c 45 43 54 20 44 49  l-338..SELECT DI
c7c0: 53 54 49 4e 43 54 20 2b 20 31 38 20 2b 20 2b 20  STINCT + 18 + + 
c7d0: 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c 31 20 2b 20  col1 * + col1 + 
c7e0: 63 6f 72 30 2e 63 6f 6c 31 20 2f 20 2d 20 63 6f  cor0.col1 / - co
c7f0: 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l2 FROM tab0 AS 
c800: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 37 34 31 32  cor0..----..7412
c810: 0d 0a 38 32 39 38 0d 0a 39 33 33 30 0d 0a 0d 0a  ..8298..9330....
c820: 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73  onlyif mysql # s
c830: 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c  upport for MySQL
c840: 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d   specific system
c850: 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61   types and synta
c860: 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  x..query I rowso
c870: 72 74 20 6c 61 62 65 6c 2d 33 33 39 0d 0a 53 45  rt label-339..SE
c880: 4c 45 43 54 20 41 4c 4c 20 2b 20 2d 20 35 32 20  LECT ALL + - 52 
c890: 2b 20 2d 20 63 6f 6c 32 20 2a 20 43 41 53 54 28  + - col2 * CAST(
c8a0: 20 63 6f 6c 30 20 41 53 20 53 49 47 4e 45 44 20   col0 AS SIGNED 
c8b0: 29 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  ) FROM tab2 AS c
c8c0: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 30 38 30  or0..----..-2080
c8d0: 0d 0a 2d 32 34 31 0d 0a 2d 33 30 35 34 0d 0a 0d  ..-241..-3054...
c8e0: 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
c8f0: 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
c900: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
c910: 6c 61 62 65 6c 2d 33 33 39 0d 0a 53 45 4c 45 43  label-339..SELEC
c920: 54 20 41 4c 4c 20 2b 20 2d 20 35 32 20 2b 20 2d  T ALL + - 52 + -
c930: 20 63 6f 6c 32 20 2a 20 43 41 53 54 20 28 20 63   col2 * CAST ( c
c940: 6f 6c 30 20 41 53 20 49 4e 54 45 47 45 52 20 29  ol0 AS INTEGER )
c950: 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
c960: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 30 38 30 0d  r0..----..-2080.
c970: 0a 2d 32 34 31 0d 0a 2d 33 30 35 34 0d 0a 0d 0a  .-241..-3054....
c980: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
c990: 0a 53 45 4c 45 43 54 20 41 4c 4c 20 31 38 20 2b  .SELECT ALL 18 +
c9a0: 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20   + col0 AS col0 
c9b0: 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
c9c0: 30 0d 0a 2d 2d 2d 2d 0d 0a 32 35 0d 0a 39 36 0d  0..----..25..96.
c9d0: 0a 39 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .97....query I r
c9e0: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
c9f0: 20 2b 20 28 20 2b 20 63 6f 6c 31 20 29 20 41 53   + ( + col1 ) AS
ca00: 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20   col0 FROM tab2 
ca10: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
ca20: 31 37 0d 0a 2d 33 31 0d 0a 2d 35 39 0d 0a 0d 0a  17..-31..-59....
ca30: 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73  onlyif mysql # s
ca40: 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c  upport for MySQL
ca50: 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d   specific system
ca60: 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61   types and synta
ca70: 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  x..query I rowso
ca80: 72 74 20 6c 61 62 65 6c 2d 33 34 32 0d 0a 53 45  rt label-342..SE
ca90: 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20  LECT DISTINCT - 
caa0: 2b 20 28 20 63 6f 72 30 2e 63 6f 6c 31 20 29 20  + ( cor0.col1 ) 
cab0: 2a 20 2d 20 43 41 53 54 28 20 4e 55 4c 4c 20 41  * - CAST( NULL A
cac0: 53 20 53 49 47 4e 45 44 20 29 20 2b 20 2b 20 36  S SIGNED ) + + 6
cad0: 30 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32  0 col1 FROM tab2
cae0: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
caf0: 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 70  NULL....skipif p
cb00: 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74  ostgresql # Post
cb10: 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20  greSQL requires 
cb20: 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67  AS when renaming
cb30: 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d   output columns.
cb40: 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
cb50: 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
cb60: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
cb70: 6c 61 62 65 6c 2d 33 34 32 0d 0a 53 45 4c 45 43  label-342..SELEC
cb80: 54 20 44 49 53 54 49 4e 43 54 20 2d 20 2b 20 28  T DISTINCT - + (
cb90: 20 63 6f 72 30 2e 63 6f 6c 31 20 29 20 2a 20 2d   cor0.col1 ) * -
cba0: 20 43 41 53 54 20 28 20 4e 55 4c 4c 20 41 53 20   CAST ( NULL AS 
cbb0: 49 4e 54 45 47 45 52 20 29 20 2b 20 2b 20 36 30  INTEGER ) + + 60
cbc0: 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20   col1 FROM tab2 
cbd0: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e  AS cor0..----..N
cbe0: 55 4c 4c 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  ULL....query I r
cbf0: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
cc00: 4c 4c 20 63 6f 6c 32 20 2b 20 2d 20 37 35 20 46  LL col2 + - 75 F
cc10: 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
cc20: 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 32 0d 0a 2d 37 34  ..----..-42..-74
cc30: 0d 0a 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  ..7....query I r
cc40: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63  owsort..SELECT c
cc50: 6f 6c 32 20 2b 20 2d 20 39 34 20 2d 20 63 6f 6c  ol2 + - 94 - col
cc60: 32 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  2 AS col0 FROM t
cc70: 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab2 cor0..----..
cc80: 2d 39 34 0d 0a 2d 39 34 0d 0a 2d 39 34 0d 0a 0d  -94..-94..-94...
cc90: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
cca0: 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 32 20  ..SELECT - col2 
ccb0: 2b 20 2d 20 32 20 2a 20 2d 20 63 6f 6c 30 20 46  + - 2 * - col0 F
ccc0: 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
ccd0: 0d 0a 2d 2d 2d 2d 0d 0a 31 35 0d 0a 36 39 0d 0a  ..----..15..69..
cce0: 39 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  96....query I ro
ccf0: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
cd00: 63 6f 6c 31 20 2a 20 2d 20 28 20 31 35 20 2b 20  col1 * - ( 15 + 
cd10: 2d 20 63 6f 6c 31 20 29 20 46 52 4f 4d 20 74 61  - col1 ) FROM ta
cd20: 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
cd30: 0d 0a 32 35 39 36 0d 0a 33 34 0d 0a 34 39 36 0d  ..2596..34..496.
cd40: 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72  ...skipif postgr
cd50: 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51  esql # PostgreSQ
cd60: 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68  L requires AS wh
cd70: 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70  en renaming outp
cd80: 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72  ut columns..quer
cd90: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
cda0: 45 43 54 20 2d 20 63 6f 6c 32 20 2a 20 63 6f 6c  ECT - col2 * col
cdb0: 30 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30  0 col2 FROM tab0
cdc0: 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 35 0d 0a 2d 37 32  ..----..-35..-72
cdd0: 39 38 0d 0a 2d 37 39 32 0d 0a 0d 0a 6f 6e 6c 79  98..-792....only
cde0: 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44  if mysql # use D
cdf0: 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20  IV operator for 
ce00: 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e  integer division
ce10: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
ce20: 74 20 6c 61 62 65 6c 2d 33 34 38 0d 0a 53 45 4c  t label-348..SEL
ce30: 45 43 54 20 2b 20 63 6f 6c 31 20 2d 20 2b 20 39  ECT + col1 - + 9
ce40: 34 20 44 49 56 20 63 6f 6c 31 20 46 52 4f 4d 20  4 DIV col1 FROM 
ce50: 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 32 0d 0a  tab2..----..12..
ce60: 32 38 0d 0a 35 38 0d 0a 0d 0a 73 6b 69 70 69 66  28..58....skipif
ce70: 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
ce80: 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
ce90: 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 33   rowsort label-3
cea0: 34 38 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c  48..SELECT + col
ceb0: 31 20 2d 20 2b 20 39 34 20 2f 20 63 6f 6c 31 20  1 - + 94 / col1 
cec0: 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d  FROM tab2..----.
ced0: 0a 31 32 0d 0a 32 38 0d 0a 35 38 0d 0a 0d 0a 71  .12..28..58....q
cee0: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
cef0: 53 45 4c 45 43 54 20 2d 20 63 6f 6c 31 20 2a 20  SELECT - col1 * 
cf00: 2d 20 39 37 20 41 53 20 63 6f 6c 31 20 46 52 4f  - 97 AS col1 FRO
cf10: 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
cf20: 2d 2d 2d 2d 0d 0a 31 36 34 39 0d 0a 33 30 30 37  ----..1649..3007
cf30: 0d 0a 35 37 32 33 0d 0a 0d 0a 71 75 65 72 79 20  ..5723....query 
cf40: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
cf50: 54 20 63 6f 72 30 2e 63 6f 6c 31 20 2b 20 28 20  T cor0.col1 + ( 
cf60: 38 37 20 29 20 41 53 20 63 6f 6c 31 20 46 52 4f  87 ) AS col1 FRO
cf70: 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab1 cor0..---
cf80: 2d 0d 0a 31 30 30 0d 0a 31 31 33 0d 0a 39 37 0d  -..100..113..97.
cf90: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
cfa0: 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63  rt..SELECT ALL c
cfb0: 6f 6c 31 20 2b 20 63 6f 6c 30 20 2a 20 63 6f 6c  ol1 + col0 * col
cfc0: 30 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30  0 FROM tab0 cor0
cfd0: 0d 0a 2d 2d 2d 2d 0d 0a 31 33 32 32 0d 0a 36 36  ..----..1322..66
cfe0: 32 0d 0a 38 30 31 32 0d 0a 0d 0a 71 75 65 72 79  2..8012....query
cff0: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
d000: 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f  CT DISTINCT - co
d010: 6c 30 20 2d 20 36 20 46 52 4f 4d 20 74 61 62 30  l0 - 6 FROM tab0
d020: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
d030: 2d 33 30 0d 0a 2d 34 31 0d 0a 2d 39 35 0d 0a 0d  -30..-41..-95...
d040: 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
d050: 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72  use DIV operator
d060: 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76   for integer div
d070: 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72  ision..query I r
d080: 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 33 35 33  owsort label-353
d090: 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
d0a0: 54 20 2b 20 63 6f 6c 31 20 44 49 56 20 2d 20 37  T + col1 DIV - 7
d0b0: 20 2b 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62   + col2 FROM tab
d0c0: 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 35 31  1 cor0..----..51
d0d0: 0d 0a 35 36 0d 0a 39 35 0d 0a 0d 0a 73 6b 69 70  ..56..95....skip
d0e0: 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
d0f0: 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
d100: 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
d110: 2d 33 35 33 0d 0a 53 45 4c 45 43 54 20 44 49 53  -353..SELECT DIS
d120: 54 49 4e 43 54 20 2b 20 63 6f 6c 31 20 2f 20 2d  TINCT + col1 / -
d130: 20 37 20 2b 20 63 6f 6c 32 20 46 52 4f 4d 20 74   7 + col2 FROM t
d140: 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab1 cor0..----..
d150: 35 31 0d 0a 35 36 0d 0a 39 35 0d 0a 0d 0a 71 75  51..56..95....qu
d160: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
d170: 45 4c 45 43 54 20 2d 20 63 6f 6c 31 20 2a 20 63  ELECT - col1 * c
d180: 6f 6c 31 20 2d 20 2b 20 63 6f 6c 32 20 2a 20 63  ol1 - + col2 * c
d190: 6f 6c 30 20 2a 20 63 6f 6c 32 20 41 53 20 63 6f  ol0 * col2 AS co
d1a0: 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l0 FROM tab2 AS 
d1b0: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 34  cor0..----..-114
d1c0: 33 36 35 0d 0a 2d 35 36 32 30 39 0d 0a 2d 36 30  365..-56209..-60
d1d0: 36 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  64....query I ro
d1e0: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
d1f0: 2d 20 34 33 20 2b 20 2b 20 63 6f 6c 30 20 46 52  - 43 + + col0 FR
d200: 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
d210: 0a 2d 2d 2d 2d 0d 0a 31 33 32 0d 0a 36 37 0d 0a  .----..132..67..
d220: 37 38 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73  78....skipif pos
d230: 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72  tgresql # Postgr
d240: 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53  eSQL requires AS
d250: 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f   when renaming o
d260: 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71  utput columns..q
d270: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
d280: 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
d290: 2b 20 36 35 20 63 6f 6c 32 20 46 52 4f 4d 20 74  + 65 col2 FROM t
d2a0: 61 62 31 20 41 53 20 63 6f 72 30 20 43 52 4f 53  ab1 AS cor0 CROS
d2b0: 53 20 4a 4f 49 4e 20 74 61 62 30 20 41 53 20 63  S JOIN tab0 AS c
d2c0: 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 36 35 0d 0a 0d  or1..----..65...
d2d0: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
d2e0: 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
d2f0: 54 20 2d 20 39 20 41 53 20 63 6f 6c 30 20 46 52  T - 9 AS col0 FR
d300: 4f 4d 20 74 61 62 32 2c 20 74 61 62 32 20 41 53  OM tab2, tab2 AS
d310: 20 63 6f 72 30 2c 20 74 61 62 31 20 41 53 20 63   cor0, tab1 AS c
d320: 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 39 0d 0a 0d  or1..----..-9...
d330: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
d340: 0d 0a 53 45 4c 45 43 54 20 31 35 20 2b 20 2b 20  ..SELECT 15 + + 
d350: 32 38 20 2a 20 2b 20 63 6f 6c 30 20 41 53 20 63  28 * + col0 AS c
d360: 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d  ol2 FROM tab1..-
d370: 2d 2d 2d 0d 0a 31 38 30 37 0d 0a 32 32 35 35 0d  ---..1807..2255.
d380: 0a 39 39 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f  .99....skipif po
d390: 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67  stgresql # Postg
d3a0: 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41  reSQL requires A
d3b0: 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20  S when renaming 
d3c0: 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a  output columns..
d3d0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
d3e0: 0a 53 45 4c 45 43 54 20 63 6f 6c 31 20 2a 20 2b  .SELECT col1 * +
d3f0: 20 38 30 20 2a 20 2d 20 63 6f 6c 32 20 63 6f 6c   80 * - col2 col
d400: 30 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d  0 FROM tab1..---
d410: 2d 0d 0a 2d 31 31 32 33 32 30 0d 0a 2d 34 35 36  -..-112320..-456
d420: 30 30 0d 0a 2d 39 39 38 34 30 0d 0a 0d 0a 71 75  00..-99840....qu
d430: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
d440: 45 4c 45 43 54 20 2b 20 33 36 20 41 53 20 63 6f  ELECT + 36 AS co
d450: 6c 32 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d  l2 FROM tab2..--
d460: 2d 2d 0d 0a 33 36 0d 0a 33 36 0d 0a 33 36 0d 0a  --..36..36..36..
d470: 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65  ..skipif postgre
d480: 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c  sql # PostgreSQL
d490: 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65   requires AS whe
d4a0: 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75  n renaming outpu
d4b0: 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79  t columns..query
d4c0: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
d4d0: 43 54 20 2d 20 63 6f 6c 30 20 2a 20 2d 20 28 20  CT - col0 * - ( 
d4e0: 28 20 2d 20 63 6f 6c 31 20 29 20 2a 20 2b 20 63  ( - col1 ) * + c
d4f0: 6f 6c 30 20 29 20 63 6f 6c 32 20 46 52 4f 4d 20  ol0 ) col2 FROM 
d500: 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab1 cor0..----.
d510: 0a 2d 32 33 34 0d 0a 2d 34 30 39 36 30 0d 0a 2d  .-234..-40960..-
d520: 38 33 32 30 30 0d 0a 0d 0a 71 75 65 72 79 20 49  83200....query I
d530: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
d540: 20 44 49 53 54 49 4e 43 54 20 63 6f 72 30 2e 63   DISTINCT cor0.c
d550: 6f 6c 32 20 2a 20 2b 20 63 6f 72 30 2e 63 6f 6c  ol2 * + cor0.col
d560: 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  2 AS col2 FROM t
d570: 61 62 32 2c 20 74 61 62 32 20 41 53 20 63 6f 72  ab2, tab2 AS cor
d580: 30 0d 0a 2d 2d 2d 2d 0d 0a 31 34 34 34 0d 0a 36  0..----..1444..6
d590: 37 36 0d 0a 37 32 39 0d 0a 0d 0a 71 75 65 72 79  76..729....query
d5a0: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
d5b0: 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 28 20  CT DISTINCT + ( 
d5c0: 2d 20 63 6f 6c 30 20 29 20 2a 20 2d 20 28 20 2b  - col0 ) * - ( +
d5d0: 20 36 36 20 29 20 2a 20 63 6f 6c 30 20 46 52 4f   66 ) * col0 FRO
d5e0: 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 32 37  M tab1..----..27
d5f0: 30 33 33 36 0d 0a 34 32 32 34 30 30 0d 0a 35 39  0336..422400..59
d600: 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  4....query I row
d610: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
d620: 20 38 31 20 46 52 4f 4d 20 74 61 62 31 2c 20 74   81 FROM tab1, t
d630: 61 62 30 2c 20 74 61 62 30 20 63 6f 72 30 0d 0a  ab0, tab0 cor0..
d640: 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75 65 73 20  ----..27 values 
d650: 68 61 73 68 69 6e 67 20 74 6f 20 30 61 38 35 36  hashing to 0a856
d660: 33 39 65 30 64 64 64 62 66 66 64 61 62 32 63 62  39e0dddbffdab2cb
d670: 31 36 62 30 32 37 63 62 33 36 30 0d 0a 0d 0a 71  16b027cb360....q
d680: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
d690: 53 45 4c 45 43 54 20 74 61 62 32 2e 63 6f 6c 32  SELECT tab2.col2
d6a0: 20 2a 20 63 6f 6c 30 20 2d 20 2d 20 63 6f 6c 30   * col0 - - col0
d6b0: 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
d6c0: 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 39 36 0d 0a 32  b2..----..196..2
d6d0: 31 30 36 0d 0a 33 30 38 31 0d 0a 0d 0a 71 75 65  106..3081....que
d6e0: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
d6f0: 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 32 20 2a 20  LECT ALL col2 * 
d700: 63 6f 6c 31 20 2a 20 2b 20 28 20 63 6f 6c 31 20  col1 * + ( col1 
d710: 2a 20 2b 20 63 6f 6c 30 20 29 20 2b 20 2d 20 63  * + col0 ) + - c
d720: 6f 72 30 2e 63 6f 6c 30 20 2b 20 63 6f 6c 32 20  or0.col0 + col2 
d730: 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
d740: 30 0d 0a 2d 2d 2d 2d 0d 0a 33 32 39 32 38 31 0d  0..----..329281.
d750: 0a 35 38 35 37 36 34 31 0d 0a 36 30 34 33 34 37  .5857641..604347
d760: 33 31 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  31....onlyif mys
d770: 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72  ql # support for
d780: 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63 20   MySQL specific 
d790: 73 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64  system types and
d7a0: 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49   syntax..query I
d7b0: 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 33   rowsort label-3
d7c0: 36 37 0d 0a 53 45 4c 45 43 54 20 2d 20 43 41 53  67..SELECT - CAS
d7d0: 54 28 20 4e 55 4c 4c 20 41 53 20 53 49 47 4e 45  T( NULL AS SIGNE
d7e0: 44 20 29 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  D ) AS col1 FROM
d7f0: 20 74 61 62 31 2c 20 74 61 62 30 20 41 53 20 63   tab1, tab0 AS c
d800: 6f 72 30 2c 20 74 61 62 30 20 63 6f 72 31 0d 0a  or0, tab0 cor1..
d810: 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75 65 73 20  ----..27 values 
d820: 68 61 73 68 69 6e 67 20 74 6f 20 31 36 62 65 38  hashing to 16be8
d830: 38 36 38 61 31 65 36 66 34 65 38 38 35 30 35 30  868a1e6f4e885050
d840: 39 66 39 33 32 37 61 66 65 39 30 0d 0a 0d 0a 73  9f9327afe90....s
d850: 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
d860: 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
d870: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
d880: 62 65 6c 2d 33 36 37 0d 0a 53 45 4c 45 43 54 20  bel-367..SELECT 
d890: 2d 20 43 41 53 54 20 28 20 4e 55 4c 4c 20 41 53  - CAST ( NULL AS
d8a0: 20 49 4e 54 45 47 45 52 20 29 20 41 53 20 63 6f   INTEGER ) AS co
d8b0: 6c 31 20 46 52 4f 4d 20 74 61 62 31 2c 20 74 61  l1 FROM tab1, ta
d8c0: 62 30 20 41 53 20 63 6f 72 30 2c 20 74 61 62 30  b0 AS cor0, tab0
d8d0: 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20   cor1..----..27 
d8e0: 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74  values hashing t
d8f0: 6f 20 31 36 62 65 38 38 36 38 61 31 65 36 66 34  o 16be8868a1e6f4
d900: 65 38 38 35 30 35 30 39 66 39 33 32 37 61 66 65  e8850509f9327afe
d910: 39 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  90....query I ro
d920: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
d930: 4c 20 33 37 20 2a 20 2d 20 63 6f 6c 30 20 2a 20  L 37 * - col0 * 
d940: 2d 20 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46  - col2 AS col1 F
d950: 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
d960: 0d 0a 2d 2d 2d 2d 0d 0a 31 31 31 30 37 34 0d 0a  ..----..111074..
d970: 36 39 39 33 0d 0a 37 35 30 33 36 0d 0a 0d 0a 71  6993..75036....q
d980: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
d990: 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
d9a0: 2b 20 28 20 63 6f 6c 31 20 29 20 2a 20 63 6f 6c  + ( col1 ) * col
d9b0: 31 20 2a 20 2d 20 28 20 2d 20 63 6f 72 30 2e 63  1 * - ( - cor0.c
d9c0: 6f 6c 32 20 2a 20 28 20 63 6f 72 30 2e 63 6f 6c  ol2 * ( cor0.col
d9d0: 30 20 29 20 29 20 46 52 4f 4d 20 74 61 62 31 20  0 ) ) FROM tab1 
d9e0: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
d9f0: 30 39 35 31 32 0d 0a 31 32 39 37 39 32 30 0d 0a  09512..1297920..
da00: 33 36 34 38 30 30 0d 0a 0d 0a 71 75 65 72 79 20  364800....query 
da10: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
da20: 54 20 2d 20 2b 20 63 6f 6c 30 20 2b 20 63 6f 72  T - + col0 + cor
da30: 30 2e 63 6f 6c 30 20 2b 20 63 6f 6c 32 20 46 52  0.col0 + col2 FR
da40: 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
da50: 0a 2d 2d 2d 2d 0d 0a 31 0d 0a 33 33 0d 0a 38 32  .----..1..33..82
da60: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
da70: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f  ort..SELECT - co
da80: 6c 31 20 2a 20 63 6f 72 30 2e 63 6f 6c 30 20 2b  l1 * cor0.col0 +
da90: 20 39 37 20 2d 20 63 6f 6c 30 20 41 53 20 63 6f   97 - col0 AS co
daa0: 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l1 FROM tab2 AS 
dab0: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32 37  cor0..----..-127
dac0: 0d 0a 2d 31 33 32 35 0d 0a 2d 34 35 38 33 0d 0a  ..-1325..-4583..
dad0: 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
dae0: 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f   use DIV operato
daf0: 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69  r for integer di
db00: 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20  vision..query I 
db10: 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 33 37  rowsort label-37
db20: 32 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f  2..SELECT ALL co
db30: 6c 30 20 2b 20 63 6f 6c 30 20 44 49 56 20 2b 20  l0 + col0 DIV + 
db40: 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46 52 4f  col0 AS col0 FRO
db50: 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 37 39  M tab2..----..79
db60: 0d 0a 38 0d 0a 38 30 0d 0a 0d 0a 73 6b 69 70 69  ..8..80....skipi
db70: 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
db80: 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
db90: 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
dba0: 33 37 32 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  372..SELECT ALL 
dbb0: 63 6f 6c 30 20 2b 20 63 6f 6c 30 20 2f 20 2b 20  col0 + col0 / + 
dbc0: 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46 52 4f  col0 AS col0 FRO
dbd0: 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 37 39  M tab2..----..79
dbe0: 0d 0a 38 0d 0a 38 30 0d 0a 0d 0a 71 75 65 72 79  ..8..80....query
dbf0: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
dc00: 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 31 20 2b 20  CT ALL - col1 + 
dc10: 2b 20 33 35 20 41 53 20 63 6f 6c 31 20 46 52 4f  + 35 AS col1 FRO
dc20: 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 35  M tab0..----..-5
dc30: 31 0d 0a 2d 35 36 0d 0a 2d 36 32 0d 0a 0d 0a 71  1..-56..-62....q
dc40: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
dc50: 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
dc60: 2b 20 63 6f 6c 30 20 2a 20 63 6f 6c 30 20 2b 20  + col0 * col0 + 
dc70: 2b 20 63 6f 6c 32 20 2a 20 63 6f 6c 31 20 46 52  + col2 * col1 FR
dc80: 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31  OM tab1..----..1
dc90: 34 31 33 0d 0a 34 36 36 36 0d 0a 37 36 34 38 0d  413..4666..7648.
dca0: 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
dcb0: 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79  # support for My
dcc0: 53 51 4c 20 73 70 65 63 69 66 69 63 20 73 79 73  SQL specific sys
dcd0: 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79  tem types and sy
dce0: 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f  ntax..query I ro
dcf0: 77 73 6f 72 74 20 6c 61 62 65 6c 2d 33 37 35 0d  wsort label-375.
dd00: 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 30 20 2a  .SELECT - col0 *
dd10: 20 43 41 53 54 28 20 4e 55 4c 4c 20 41 53 20 53   CAST( NULL AS S
dd20: 49 47 4e 45 44 20 29 20 2b 20 2d 20 63 6f 6c 30  IGNED ) + - col0
dd30: 20 2a 20 63 6f 6c 30 20 63 6f 6c 32 20 46 52 4f   * col0 col2 FRO
dd40: 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
dd50: 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c  ----..NULL..NULL
dd60: 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66  ..NULL....skipif
dd70: 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f   postgresql # Po
dd80: 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65  stgreSQL require
dd90: 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69  s AS when renami
dda0: 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e  ng output column
ddb0: 73 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  s..skipif mysql 
ddc0: 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
ddd0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
dde0: 74 20 6c 61 62 65 6c 2d 33 37 35 0d 0a 53 45 4c  t label-375..SEL
ddf0: 45 43 54 20 2d 20 63 6f 6c 30 20 2a 20 43 41 53  ECT - col0 * CAS
de00: 54 20 28 20 4e 55 4c 4c 20 41 53 20 49 4e 54 45  T ( NULL AS INTE
de10: 47 45 52 20 29 20 2b 20 2d 20 63 6f 6c 30 20 2a  GER ) + - col0 *
de20: 20 63 6f 6c 30 20 63 6f 6c 32 20 46 52 4f 4d 20   col0 col2 FROM 
de30: 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
de40: 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a  --..NULL..NULL..
de50: 4e 55 4c 4c 0d 0a 0d 0a 71 75 65 72 79 20 49 20  NULL....query I 
de60: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
de70: 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 72 30 2e  DISTINCT - cor0.
de80: 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c 32 20 2d 20  col2 * + col2 - 
de90: 63 6f 72 30 2e 63 6f 6c 32 20 41 53 20 63 6f 6c  cor0.col2 AS col
dea0: 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  2 FROM tab2 AS c
deb0: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 34 38 32  or0..----..-1482
dec0: 0d 0a 2d 37 30 32 0d 0a 2d 37 35 36 0d 0a 0d 0a  ..-702..-756....
ded0: 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75  onlyif mysql # u
dee0: 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20  se DIV operator 
def0: 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69  for integer divi
df00: 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f  sion..query I ro
df10: 77 73 6f 72 74 20 6c 61 62 65 6c 2d 33 37 37 0d  wsort label-377.
df20: 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
df30: 20 63 6f 6c 31 20 2b 20 63 6f 6c 32 20 44 49 56   col1 + col2 DIV
df40: 20 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46 52   col2 AS col0 FR
df50: 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
df60: 0a 2d 2d 2d 2d 0d 0a 38 37 0d 0a 39 32 0d 0a 39  .----..87..92..9
df70: 38 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  8....skipif mysq
df80: 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
df90: 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
dfa0: 6f 72 74 20 6c 61 62 65 6c 2d 33 37 37 0d 0a 53  ort label-377..S
dfb0: 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 63  ELECT DISTINCT c
dfc0: 6f 6c 31 20 2b 20 63 6f 6c 32 20 2f 20 63 6f 6c  ol1 + col2 / col
dfd0: 32 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  2 AS col0 FROM t
dfe0: 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
dff0: 2d 0d 0a 38 37 0d 0a 39 32 0d 0a 39 38 0d 0a 0d  -..87..92..98...
e000: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
e010: 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
e020: 54 20 2b 20 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c  T + col0 + - col
e030: 32 20 2a 20 2d 20 63 6f 72 30 2e 63 6f 6c 31 20  2 * - cor0.col1 
e040: 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
e050: 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33  1 cor0..----..13
e060: 32 38 0d 0a 31 34 30 37 0d 0a 36 33 34 0d 0a 0d  28..1407..634...
e070: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
e080: 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
e090: 54 20 63 6f 6c 32 20 2a 20 2d 20 28 20 2d 20 63  T col2 * - ( - c
e0a0: 6f 6c 32 20 29 20 2d 20 63 6f 6c 32 20 2a 20 63  ol2 ) - col2 * c
e0b0: 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  ol1 AS col1 FROM
e0c0: 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
e0d0: 2d 2d 2d 0d 0a 2d 31 30 38 0d 0a 2d 38 35 38 0d  ---..-108..-858.
e0e0: 0a 37 39 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .798....query I 
e0f0: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
e100: 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c 31 20 2a 20  col0 + + col1 * 
e110: 63 6f 72 30 2e 63 6f 6c 31 20 41 53 20 63 6f 6c  cor0.col1 AS col
e120: 32 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30  2 FROM tab0 cor0
e130: 0d 0a 2d 2d 2d 2d 0d 0a 37 34 32 30 0d 0a 38 33  ..----..7420..83
e140: 37 30 0d 0a 39 34 34 34 0d 0a 0d 0a 73 6b 69 70  70..9444....skip
e150: 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
e160: 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
e170: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
e180: 43 54 20 43 41 53 54 20 28 20 35 38 20 41 53 20  CT CAST ( 58 AS 
e190: 52 45 41 4c 20 29 20 41 53 20 63 6f 6c 30 20 46  REAL ) AS col0 F
e1a0: 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
e1b0: 0d 0a 2d 2d 2d 2d 0d 0a 35 38 0d 0a 35 38 0d 0a  ..----..58..58..
e1c0: 35 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  58....query I ro
e1d0: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
e1e0: 63 6f 6c 31 20 2a 20 2b 20 28 20 38 38 20 2a 20  col1 * + ( 88 * 
e1f0: 63 6f 6c 32 20 29 20 46 52 4f 4d 20 74 61 62 32  col2 ) FROM tab2
e200: 0d 0a 2d 2d 2d 2d 0d 0a 31 33 34 39 39 32 0d 0a  ..----..134992..
e210: 35 36 38 34 38 0d 0a 37 33 36 35 36 0d 0a 0d 0a  56848..73656....
e220: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
e230: 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
e240: 20 2d 20 28 20 63 6f 6c 31 20 29 20 2a 20 63 6f   - ( col1 ) * co
e250: 6c 32 20 2b 20 2b 20 63 6f 6c 31 20 2a 20 2b 20  l2 + + col1 * + 
e260: 63 6f 72 30 2e 63 6f 6c 32 20 46 52 4f 4d 20 74  cor0.col2 FROM t
e270: 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
e280: 2d 0d 0a 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  -..0....onlyif m
e290: 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66  ysql # support f
e2a0: 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69  or MySQL specifi
e2b0: 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61  c system types a
e2c0: 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79  nd syntax..query
e2d0: 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
e2e0: 2d 33 38 34 0d 0a 53 45 4c 45 43 54 20 44 49 53  -384..SELECT DIS
e2f0: 54 49 4e 43 54 20 2d 20 43 41 53 54 28 20 2d 20  TINCT - CAST( - 
e300: 63 6f 6c 32 20 41 53 20 53 49 47 4e 45 44 20 29  col2 AS SIGNED )
e310: 20 2b 20 2b 20 63 6f 6c 32 20 46 52 4f 4d 20 74   + + col2 FROM t
e320: 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
e330: 2d 0d 0a 31 36 34 0d 0a 32 0d 0a 36 36 0d 0a 0d  -..164..2..66...
e340: 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
e350: 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
e360: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
e370: 6c 61 62 65 6c 2d 33 38 34 0d 0a 53 45 4c 45 43  label-384..SELEC
e380: 54 20 44 49 53 54 49 4e 43 54 20 2d 20 43 41 53  T DISTINCT - CAS
e390: 54 20 28 20 2d 20 63 6f 6c 32 20 41 53 20 49 4e  T ( - col2 AS IN
e3a0: 54 45 47 45 52 20 29 20 2b 20 2b 20 63 6f 6c 32  TEGER ) + + col2
e3b0: 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
e3c0: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 36 34 0d 0a 32  r0..----..164..2
e3d0: 0d 0a 36 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..66....query I 
e3e0: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
e3f0: 2d 20 2b 20 63 6f 6c 32 20 2b 20 2b 20 32 20 41  - + col2 + + 2 A
e400: 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32  S col1 FROM tab2
e410: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
e420: 2d 32 34 0d 0a 2d 32 35 0d 0a 2d 33 36 0d 0a 0d  -24..-25..-36...
e430: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
e440: 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
e450: 54 20 2b 20 28 20 38 38 20 29 20 41 53 20 63 6f  T + ( 88 ) AS co
e460: 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l0 FROM tab2 AS 
e470: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 38 38 0d 0a  cor0..----..88..
e480: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
e490: 74 0d 0a 53 45 4c 45 43 54 20 63 6f 72 31 2e 63  t..SELECT cor1.c
e4a0: 6f 6c 32 20 2a 20 28 20 36 38 20 29 20 46 52 4f  ol2 * ( 68 ) FRO
e4b0: 4d 20 74 61 62 32 2c 20 74 61 62 30 20 41 53 20  M tab2, tab0 AS 
e4c0: 63 6f 72 30 2c 20 74 61 62 30 20 41 53 20 63 6f  cor0, tab0 AS co
e4d0: 72 31 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c  r1..----..27 val
e4e0: 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 62  ues hashing to b
e4f0: 61 64 39 36 61 33 31 39 65 61 65 34 65 36 66 31  ad96a319eae4e6f1
e500: 38 33 65 64 36 66 30 30 61 38 66 62 36 63 37 0d  83ed6f00a8fb6c7.
e510: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
e520: 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c  rt..SELECT - col
e530: 30 20 2a 20 2d 20 38 20 2b 20 2d 20 63 6f 72 30  0 * - 8 + - cor0
e540: 2e 63 6f 6c 31 20 2a 20 63 6f 6c 31 20 46 52 4f  .col1 * col1 FRO
e550: 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
e560: 2d 2d 2d 2d 0d 0a 2d 36 35 32 0d 0a 34 31 32 0d  ----..-652..412.
e570: 0a 34 37 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .471....query I 
e580: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
e590: 44 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c 30 20  DISTINCT + col0 
e5a0: 2a 20 36 33 20 41 53 20 63 6f 6c 30 20 46 52 4f  * 63 AS col0 FRO
e5b0: 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
e5c0: 2d 2d 2d 2d 0d 0a 31 35 31 32 0d 0a 32 32 30 35  ----..1512..2205
e5d0: 0d 0a 35 36 30 37 0d 0a 0d 0a 6f 6e 6c 79 69 66  ..5607....onlyif
e5e0: 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74   mysql # support
e5f0: 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69   for MySQL speci
e600: 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73  fic system types
e610: 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65   and syntax..que
e620: 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
e630: 65 6c 2d 33 39 30 0d 0a 53 45 4c 45 43 54 20 41  el-390..SELECT A
e640: 4c 4c 20 43 41 53 54 28 20 4e 55 4c 4c 20 41 53  LL CAST( NULL AS
e650: 20 53 49 47 4e 45 44 20 29 20 2f 20 63 6f 6c 32   SIGNED ) / col2
e660: 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
e670: 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
e680: 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55  ..NULL..NULL..NU
e690: 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  LL....skipif mys
e6a0: 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
e6b0: 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
e6c0: 73 6f 72 74 20 6c 61 62 65 6c 2d 33 39 30 0d 0a  sort label-390..
e6d0: 53 45 4c 45 43 54 20 41 4c 4c 20 43 41 53 54 20  SELECT ALL CAST 
e6e0: 28 20 4e 55 4c 4c 20 41 53 20 49 4e 54 45 47 45  ( NULL AS INTEGE
e6f0: 52 20 29 20 2f 20 63 6f 6c 32 20 41 53 20 63 6f  R ) / col2 AS co
e700: 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l2 FROM tab1 AS 
e710: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c  cor0..----..NULL
e720: 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a  ..NULL..NULL....
e730: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
e740: 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
e750: 20 2d 20 28 20 63 6f 6c 30 20 29 20 2a 20 2b 20   - ( col0 ) * + 
e760: 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46 52 4f  col0 AS col1 FRO
e770: 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 34  M tab1..----..-4
e780: 30 39 36 0d 0a 2d 36 34 30 30 0d 0a 2d 39 0d 0a  096..-6400..-9..
e790: 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65  ..skipif postgre
e7a0: 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c  sql # PostgreSQL
e7b0: 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65   requires AS whe
e7c0: 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75  n renaming outpu
e7d0: 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79  t columns..query
e7e0: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
e7f0: 43 54 20 2d 20 63 6f 72 30 2e 63 6f 6c 30 20 63  CT - cor0.col0 c
e800: 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 63 6f  ol1 FROM tab0 co
e810: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 34 0d 0a 2d  r0..----..-24..-
e820: 33 35 0d 0a 2d 38 39 0d 0a 0d 0a 71 75 65 72 79  35..-89....query
e830: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
e840: 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 32 20 2b 20  CT ALL - col2 + 
e850: 63 6f 72 30 2e 63 6f 6c 32 20 2b 20 63 6f 6c 30  cor0.col2 + col0
e860: 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
e870: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 37 0d 0a 37 38 0d  r0..----..7..78.
e880: 0a 37 39 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  .79....onlyif my
e890: 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f  sql # support fo
e8a0: 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63  r MySQL specific
e8b0: 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e   system types an
e8c0: 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20  d syntax..query 
e8d0: 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
e8e0: 33 39 34 0d 0a 53 45 4c 45 43 54 20 43 41 53 54  394..SELECT CAST
e8f0: 28 20 4e 55 4c 4c 20 41 53 20 53 49 47 4e 45 44  ( NULL AS SIGNED
e900: 20 29 20 2b 20 2d 20 63 6f 6c 30 20 46 52 4f 4d   ) + - col0 FROM
e910: 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c   tab2..----..NUL
e920: 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d  L..NULL..NULL...
e930: 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
e940: 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
e950: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
e960: 6c 61 62 65 6c 2d 33 39 34 0d 0a 53 45 4c 45 43  label-394..SELEC
e970: 54 20 43 41 53 54 20 28 20 4e 55 4c 4c 20 41 53  T CAST ( NULL AS
e980: 20 49 4e 54 45 47 45 52 20 29 20 2b 20 2d 20 63   INTEGER ) + - c
e990: 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d  ol0 FROM tab2..-
e9a0: 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d  ---..NULL..NULL.
e9b0: 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75 65 72 79 20 49  .NULL....query I
e9c0: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
e9d0: 20 44 49 53 54 49 4e 43 54 20 2b 20 2d 20 63 6f   DISTINCT + - co
e9e0: 72 30 2e 63 6f 6c 30 20 2b 20 63 6f 6c 32 20 41  r0.col0 + col2 A
e9f0: 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31  S col1 FROM tab1
ea00: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
ea10: 2d 37 0d 0a 31 36 0d 0a 35 31 0d 0a 0d 0a 71 75  -7..16..51....qu
ea20: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
ea30: 45 4c 45 43 54 20 63 6f 6c 32 20 2b 20 2b 20 28  ELECT col2 + + (
ea40: 20 31 39 20 29 20 41 53 20 63 6f 6c 31 20 46 52   19 ) AS col1 FR
ea50: 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
ea60: 0a 2d 2d 2d 2d 0d 0a 34 35 0d 0a 34 36 0d 0a 35  .----..45..46..5
ea70: 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  7....query I row
ea80: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
ea90: 54 49 4e 43 54 20 63 6f 6c 32 20 2a 20 2b 20 36  TINCT col2 * + 6
eaa0: 36 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  6 FROM tab2 AS c
eab0: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 37 31 36 0d  or0..----..1716.
eac0: 0a 31 37 38 32 0d 0a 32 35 30 38 0d 0a 0d 0a 71  .1782..2508....q
ead0: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
eae0: 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
eaf0: 2d 20 63 6f 6c 32 20 2b 20 34 35 20 2a 20 63 6f  - col2 + 45 * co
eb00: 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l0 FROM tab1 AS 
eb10: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 38 32 33  cor0..----..2823
eb20: 0d 0a 33 35 30 34 0d 0a 38 31 0d 0a 0d 0a 71 75  ..3504..81....qu
eb30: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
eb40: 45 4c 45 43 54 20 2d 20 63 6f 6c 32 20 2a 20 2b  ELECT - col2 * +
eb50: 20 28 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 29   ( + cor0.col0 )
eb60: 20 2a 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74   * + col0 FROM t
eb70: 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
eb80: 2d 0d 0a 2d 31 32 32 35 0d 0a 2d 31 39 30 30 38  -..-1225..-19008
eb90: 0d 0a 2d 36 34 39 35 32 32 0d 0a 0d 0a 71 75 65  ..-649522....que
eba0: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
ebb0: 4c 45 43 54 20 63 6f 6c 31 20 2b 20 63 6f 6c 30  LECT col1 + col0
ebc0: 20 2d 20 2b 20 38 36 20 2a 20 2b 20 63 6f 72 30   - + 86 * + cor0
ebd0: 2e 63 6f 6c 32 20 2a 20 33 38 20 46 52 4f 4d 20  .col2 * 38 FROM 
ebe0: 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
ebf0: 2d 2d 0d 0a 2d 31 37 36 34 34 33 0d 0a 2d 31 38  --..-176443..-18
ec00: 36 32 30 32 0d 0a 2d 33 31 33 36 33 35 0d 0a 0d  6202..-313635...
ec10: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
ec20: 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63  ..SELECT ALL - c
ec30: 6f 6c 30 20 2b 20 2d 20 63 6f 6c 32 20 2a 20 31  ol0 + - col2 * 1
ec40: 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
ec50: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 34 0d 0a  r0..----..-104..
ec60: 2d 31 31 37 0d 0a 2d 33 34 0d 0a 0d 0a 6f 6e 6c  -117..-34....onl
ec70: 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20  yif mysql # use 
ec80: 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72  DIV operator for
ec90: 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f   integer divisio
eca0: 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  n..query I rowso
ecb0: 72 74 20 6c 61 62 65 6c 2d 34 30 32 0d 0a 53 45  rt label-402..SE
ecc0: 4c 45 43 54 20 63 6f 6c 32 20 2b 20 43 41 53 54  LECT col2 + CAST
ecd0: 28 20 63 6f 6c 32 20 41 53 20 53 49 47 4e 45 44  ( col2 AS SIGNED
ece0: 20 29 20 44 49 56 20 2d 20 63 6f 6c 30 20 46 52   ) DIV - col0 FR
ecf0: 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
ed00: 0a 2d 2d 2d 2d 0d 0a 31 0d 0a 33 32 0d 0a 38 32  .----..1..32..82
ed10: 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
ed20: 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
ed30: 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
ed40: 72 74 20 6c 61 62 65 6c 2d 34 30 32 0d 0a 53 45  rt label-402..SE
ed50: 4c 45 43 54 20 63 6f 6c 32 20 2b 20 43 41 53 54  LECT col2 + CAST
ed60: 20 28 20 63 6f 6c 32 20 41 53 20 49 4e 54 45 47   ( col2 AS INTEG
ed70: 45 52 20 29 20 2f 20 2d 20 63 6f 6c 30 20 46 52  ER ) / - col0 FR
ed80: 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
ed90: 0a 2d 2d 2d 2d 0d 0a 31 0d 0a 33 32 0d 0a 38 32  .----..1..32..82
eda0: 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
edb0: 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61   # use DIV opera
edc0: 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20  tor for integer 
edd0: 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20  division..query 
ede0: 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
edf0: 34 30 33 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 30  403..SELECT col0
ee00: 20 44 49 56 20 2b 20 63 6f 6c 32 20 2b 20 34 31   DIV + col2 + 41
ee10: 20 2a 20 38 36 20 41 53 20 63 6f 6c 32 20 46 52   * 86 AS col2 FR
ee20: 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 33  OM tab0..----..3
ee30: 35 32 36 0d 0a 33 35 32 37 0d 0a 33 35 36 31 0d  526..3527..3561.
ee40: 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
ee50: 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
ee60: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
ee70: 74 20 6c 61 62 65 6c 2d 34 30 33 0d 0a 53 45 4c  t label-403..SEL
ee80: 45 43 54 20 63 6f 6c 30 20 2f 20 2b 20 63 6f 6c  ECT col0 / + col
ee90: 32 20 2b 20 34 31 20 2a 20 38 36 20 41 53 20 63  2 + 41 * 86 AS c
eea0: 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d  ol2 FROM tab0..-
eeb0: 2d 2d 2d 0d 0a 33 35 32 36 0d 0a 33 35 32 37 0d  ---..3526..3527.
eec0: 0a 33 35 36 31 0d 0a 0d 0a 71 75 65 72 79 20 49  .3561....query I
eed0: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
eee0: 20 44 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c 32   DISTINCT + col2
eef0: 20 2d 20 2d 20 63 6f 6c 31 20 41 53 20 63 6f 6c   - - col1 AS col
ef00: 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d  1 FROM tab0..---
ef10: 2d 0d 0a 31 31 39 0d 0a 31 37 33 0d 0a 39 38 0d  -..119..173..98.
ef20: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
ef30: 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 39  rt..SELECT ALL 9
ef40: 34 20 2d 20 74 61 62 31 2e 63 6f 6c 32 20 2a 20  4 - tab1.col2 * 
ef50: 2d 20 28 20 63 6f 6c 32 20 2b 20 2b 20 63 6f 6c  - ( col2 + + col
ef60: 30 20 29 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  0 ) AS col1 FROM
ef70: 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 36 39   tab1..----..169
ef80: 39 30 0d 0a 33 31 37 32 0d 0a 36 39 39 31 0d 0a  90..3172..6991..
ef90: 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
efa0: 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f   use DIV operato
efb0: 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69  r for integer di
efc0: 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20  vision..query I 
efd0: 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 34 30  rowsort label-40
efe0: 36 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 30  6..SELECT - col0
eff0: 20 44 49 56 20 2b 20 74 61 62 30 2e 63 6f 6c 31   DIV + tab0.col1
f000: 20 2b 20 2b 20 28 20 2b 20 63 6f 6c 32 20 2a 20   + + ( + col2 * 
f010: 63 6f 6c 32 20 29 20 2b 20 43 41 53 54 28 20 2d  col2 ) + CAST( -
f020: 20 34 30 20 41 53 20 53 49 47 4e 45 44 20 29 20   40 AS SIGNED ) 
f030: 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d  FROM tab0..----.
f040: 0a 2d 33 39 0d 0a 31 30 34 39 0d 0a 36 36 38 34  .-39..1049..6684
f050: 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
f060: 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
f070: 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
f080: 72 74 20 6c 61 62 65 6c 2d 34 30 36 0d 0a 53 45  rt label-406..SE
f090: 4c 45 43 54 20 2d 20 63 6f 6c 30 20 2f 20 2b 20  LECT - col0 / + 
f0a0: 74 61 62 30 2e 63 6f 6c 31 20 2b 20 2b 20 28 20  tab0.col1 + + ( 
f0b0: 2b 20 63 6f 6c 32 20 2a 20 63 6f 6c 32 20 29 20  + col2 * col2 ) 
f0c0: 2b 20 43 41 53 54 20 28 20 2d 20 34 30 20 41 53  + CAST ( - 40 AS
f0d0: 20 49 4e 54 45 47 45 52 20 29 20 46 52 4f 4d 20   INTEGER ) FROM 
f0e0: 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 39 0d  tab0..----..-39.
f0f0: 0a 31 30 34 39 0d 0a 36 36 38 34 0d 0a 0d 0a 6f  .1049..6684....o
f100: 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75  nlyif mysql # su
f110: 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20  pport for MySQL 
f120: 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20  specific system 
f130: 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78  types and syntax
f140: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
f150: 74 20 6c 61 62 65 6c 2d 34 30 37 0d 0a 53 45 4c  t label-407..SEL
f160: 45 43 54 20 63 6f 6c 30 20 2a 20 2d 20 43 41 53  ECT col0 * - CAS
f170: 54 28 20 63 6f 6c 32 20 41 53 20 53 49 47 4e 45  T( col2 AS SIGNE
f180: 44 20 29 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  D ) AS col2 FROM
f190: 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 36   tab1..----..-16
f1a0: 32 0d 0a 2d 33 36 34 38 0d 0a 2d 37 36 38 30 0d  2..-3648..-7680.
f1b0: 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
f1c0: 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
f1d0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
f1e0: 74 20 6c 61 62 65 6c 2d 34 30 37 0d 0a 53 45 4c  t label-407..SEL
f1f0: 45 43 54 20 63 6f 6c 30 20 2a 20 2d 20 43 41 53  ECT col0 * - CAS
f200: 54 20 28 20 63 6f 6c 32 20 41 53 20 49 4e 54 45  T ( col2 AS INTE
f210: 47 45 52 20 29 20 41 53 20 63 6f 6c 32 20 46 52  GER ) AS col2 FR
f220: 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d  OM tab1..----..-
f230: 31 36 32 0d 0a 2d 33 36 34 38 0d 0a 2d 37 36 38  162..-3648..-768
f240: 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  0....query I row
f250: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
f260: 20 63 6f 6c 31 20 2a 20 63 6f 6c 30 20 2b 20 2b   col1 * col0 + +
f270: 20 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46 52   col2 AS col0 FR
f280: 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31  OM tab2..----..1
f290: 33 38 31 0d 0a 32 34 34 0d 0a 34 36 32 38 0d 0a  381..244..4628..
f2a0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
f2b0: 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20  t..SELECT ALL + 
f2c0: 63 6f 6c 31 20 2b 20 63 6f 6c 30 20 2a 20 2d 20  col1 + col0 * - 
f2d0: 37 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d  7 FROM tab2..---
f2e0: 2d 0d 0a 2d 31 38 0d 0a 2d 34 38 37 0d 0a 2d 35  -..-18..-487..-5
f2f0: 33 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  36....query I ro
f300: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
f310: 4c 20 63 6f 6c 31 20 2b 20 33 38 20 2a 20 2b 20  L col1 + 38 * + 
f320: 63 6f 72 30 2e 63 6f 6c 31 20 41 53 20 63 6f 6c  cor0.col1 AS col
f330: 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  1 FROM tab0 AS c
f340: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 33 35 34 0d  or0..----..3354.
f350: 0a 33 35 34 39 0d 0a 33 37 38 33 0d 0a 0d 0a 6f  .3549..3783....o
f360: 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73  nlyif mysql # us
f370: 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66  e DIV operator f
f380: 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73  or integer divis
f390: 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ion..query I row
f3a0: 73 6f 72 74 20 6c 61 62 65 6c 2d 34 31 31 0d 0a  sort label-411..
f3b0: 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 2d 20 63  SELECT ALL - - c
f3c0: 6f 72 30 2e 63 6f 6c 32 20 44 49 56 20 2b 20 31  or0.col2 DIV + 1
f3d0: 34 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  4 AS col1 FROM t
f3e0: 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
f3f0: 2d 0d 0a 31 0d 0a 31 0d 0a 32 0d 0a 0d 0a 73 6b  -..1..1..2....sk
f400: 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
f410: 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
f420: 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
f430: 65 6c 2d 34 31 31 0d 0a 53 45 4c 45 43 54 20 41  el-411..SELECT A
f440: 4c 4c 20 2d 20 2d 20 63 6f 72 30 2e 63 6f 6c 32  LL - - cor0.col2
f450: 20 2f 20 2b 20 31 34 20 41 53 20 63 6f 6c 31 20   / + 14 AS col1 
f460: 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
f470: 30 0d 0a 2d 2d 2d 2d 0d 0a 31 0d 0a 31 0d 0a 32  0..----..1..1..2
f480: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
f490: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f  ort..SELECT + co
f4a0: 6c 31 20 2a 20 63 6f 72 30 2e 63 6f 6c 31 20 2b  l1 * cor0.col1 +
f4b0: 20 2d 20 33 39 20 2a 20 2d 20 63 6f 72 30 2e 63   - 39 * - cor0.c
f4c0: 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol1 FROM tab2 AS
f4d0: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 31 37   cor0..----..217
f4e0: 30 0d 0a 35 37 38 32 0d 0a 39 35 32 0d 0a 0d 0a  0..5782..952....
f4f0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
f500: 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f  .SELECT ALL + co
f510: 6c 30 20 2b 20 2d 20 28 20 63 6f 6c 30 20 29 20  l0 + - ( col0 ) 
f520: 2a 20 74 61 62 31 2e 63 6f 6c 30 20 2a 20 2b 20  * tab1.col0 * + 
f530: 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52 4f  col1 AS col0 FRO
f540: 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 32  M tab1..----..-2
f550: 33 31 0d 0a 2d 34 30 38 39 36 0d 0a 2d 38 33 31  31..-40896..-831
f560: 32 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  20....onlyif mys
f570: 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72  ql # support for
f580: 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63 20   MySQL specific 
f590: 73 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64  system types and
f5a0: 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49   syntax..query I
f5b0: 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 34   rowsort label-4
f5c0: 31 34 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c  14..SELECT - col
f5d0: 31 20 2a 20 43 41 53 54 28 20 4e 55 4c 4c 20 41  1 * CAST( NULL A
f5e0: 53 20 53 49 47 4e 45 44 20 29 20 2b 20 63 6f 6c  S SIGNED ) + col
f5f0: 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  0 FROM tab0 AS c
f600: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d  or0..----..NULL.
f610: 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73  .NULL..NULL....s
f620: 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
f630: 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
f640: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
f650: 62 65 6c 2d 34 31 34 0d 0a 53 45 4c 45 43 54 20  bel-414..SELECT 
f660: 2d 20 63 6f 6c 31 20 2a 20 43 41 53 54 20 28 20  - col1 * CAST ( 
f670: 4e 55 4c 4c 20 41 53 20 49 4e 54 45 47 45 52 20  NULL AS INTEGER 
f680: 29 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61  ) + col0 FROM ta
f690: 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
f6a0: 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55  ..NULL..NULL..NU
f6b0: 4c 4c 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  LL....query I ro
f6c0: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
f6d0: 63 6f 6c 31 20 2a 20 34 31 20 2b 20 38 36 20 46  col1 * 41 + 86 F
f6e0: 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d  ROM tab1 cor0..-
f6f0: 2d 2d 2d 0d 0a 2d 33 32 34 0d 0a 2d 34 34 37 0d  ---..-324..-447.
f700: 0a 2d 39 38 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  .-980....onlyif 
f710: 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20  mysql # support 
f720: 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66  for MySQL specif
f730: 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20  ic system types 
f740: 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72  and syntax..quer
f750: 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
f760: 6c 2d 34 31 36 0d 0a 53 45 4c 45 43 54 20 41 4c  l-416..SELECT AL
f770: 4c 20 2b 20 63 6f 6c 30 20 2a 20 43 41 53 54 28  L + col0 * CAST(
f780: 20 4e 55 4c 4c 20 41 53 20 53 49 47 4e 45 44 20   NULL AS SIGNED 
f790: 29 20 2a 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61  ) * col1 FROM ta
f7a0: 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
f7b0: 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55  ..NULL..NULL..NU
f7c0: 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  LL....skipif mys
f7d0: 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
f7e0: 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
f7f0: 73 6f 72 74 20 6c 61 62 65 6c 2d 34 31 36 0d 0a  sort label-416..
f800: 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c  SELECT ALL + col
f810: 30 20 2a 20 43 41 53 54 20 28 20 4e 55 4c 4c 20  0 * CAST ( NULL 
f820: 41 53 20 49 4e 54 45 47 45 52 20 29 20 2a 20 63  AS INTEGER ) * c
f830: 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol1 FROM tab1 AS
f840: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c   cor0..----..NUL
f850: 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d  L..NULL..NULL...
f860: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
f870: 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 31 20  ..SELECT + col1 
f880: 2b 20 2b 20 28 20 2d 20 63 6f 6c 30 20 2a 20 2b  + + ( - col0 * +
f890: 20 63 6f 6c 30 20 29 20 2d 20 63 6f 6c 31 20 46   col0 ) - col1 F
f8a0: 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
f8b0: 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 30 39 36 0d 0a 2d  ..----..-4096..-
f8c0: 36 34 30 30 0d 0a 2d 39 0d 0a 0d 0a 71 75 65 72  6400..-9....quer
f8d0: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
f8e0: 45 43 54 20 2d 20 63 6f 6c 31 20 2b 20 63 6f 6c  ECT - col1 + col
f8f0: 32 20 2b 20 36 35 20 46 52 4f 4d 20 74 61 62 30  2 + 65 FROM tab0
f900: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
f910: 2d 33 31 0d 0a 31 32 0d 0a 35 36 0d 0a 0d 0a 71  -31..12..56....q
f920: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
f930: 53 45 4c 45 43 54 20 2b 20 2d 20 63 6f 6c 31 20  SELECT + - col1 
f940: 2a 20 2d 20 63 6f 6c 31 20 2d 20 2d 20 63 6f 6c  * - col1 - - col
f950: 32 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  2 AS col1 FROM t
f960: 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
f970: 2d 0d 0a 33 32 37 0d 0a 33 35 30 37 0d 0a 39 38  -..327..3507..98
f980: 38 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  8....onlyif mysq
f990: 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72  l # use DIV oper
f9a0: 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72  ator for integer
f9b0: 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79   division..query
f9c0: 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
f9d0: 2d 34 32 30 0d 0a 53 45 4c 45 43 54 20 44 49 53  -420..SELECT DIS
f9e0: 54 49 4e 43 54 20 2d 20 28 20 2d 20 63 6f 6c 32  TINCT - ( - col2
f9f0: 20 2b 20 2b 20 63 6f 6c 31 20 29 20 44 49 56 20   + + col1 ) DIV 
fa00: 2b 20 74 61 62 32 2e 63 6f 6c 31 20 46 52 4f 4d  + tab2.col1 FROM
fa10: 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a   tab2..----..0..
fa20: 31 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  1....skipif mysq
fa30: 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
fa40: 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
fa50: 6f 72 74 20 6c 61 62 65 6c 2d 34 32 30 0d 0a 53  ort label-420..S
fa60: 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d  ELECT DISTINCT -
fa70: 20 28 20 2d 20 63 6f 6c 32 20 2b 20 2b 20 63 6f   ( - col2 + + co
fa80: 6c 31 20 29 20 2f 20 2b 20 74 61 62 32 2e 63 6f  l1 ) / + tab2.co
fa90: 6c 31 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d  l1 FROM tab2..--
faa0: 2d 2d 0d 0a 30 0d 0a 31 0d 0a 0d 0a 71 75 65 72  --..0..1....quer
fab0: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
fac0: 45 43 54 20 2b 20 2b 20 63 6f 6c 30 20 2d 20 2d  ECT + + col0 - -
fad0: 20 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46 52   col1 AS col1 FR
fae0: 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
faf0: 0a 2d 2d 2d 2d 0d 0a 31 31 30 0d 0a 31 33 32 0d  .----..110..132.
fb00: 0a 31 38 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .180....query I 
fb10: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
fb20: 39 31 20 2b 20 63 6f 6c 32 20 2a 20 63 6f 6c 32  91 + col2 * col2
fb30: 20 2a 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62   * col2 FROM tab
fb40: 31 0d 0a 2d 2d 2d 2d 0d 0a 31 35 37 35 35 35 0d  1..----..157555.
fb50: 0a 31 38 35 32 38 34 0d 0a 38 38 34 38 32 37 0d  .185284..884827.
fb60: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
fb70: 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c  rt..SELECT + col
fb80: 30 20 2b 20 2b 20 63 6f 6c 32 20 2a 20 74 61 62  0 + + col2 * tab
fb90: 30 2e 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30  0.col0 FROM tab0
fba0: 0d 0a 2d 2d 2d 2d 0d 0a 37 30 0d 0a 37 33 38 37  ..----..70..7387
fbb0: 0d 0a 38 31 36 0d 0a 0d 0a 71 75 65 72 79 20 49  ..816....query I
fbc0: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
fbd0: 20 44 49 53 54 49 4e 43 54 20 2d 20 36 34 20 41   DISTINCT - 64 A
fbe0: 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30  S col0 FROM tab0
fbf0: 20 41 53 20 63 6f 72 30 20 43 52 4f 53 53 20 4a   AS cor0 CROSS J
fc00: 4f 49 4e 20 74 61 62 32 20 63 6f 72 31 0d 0a 2d  OIN tab2 cor1..-
fc10: 2d 2d 2d 0d 0a 2d 36 34 0d 0a 0d 0a 6f 6e 6c 79  ---..-64....only
fc20: 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44  if mysql # use D
fc30: 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20  IV operator for 
fc40: 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e  integer division
fc50: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
fc60: 74 20 6c 61 62 65 6c 2d 34 32 35 0d 0a 53 45 4c  t label-425..SEL
fc70: 45 43 54 20 2d 20 36 33 20 44 49 56 20 34 38 20  ECT - 63 DIV 48 
fc80: 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
fc90: 30 2c 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  0, tab1 AS cor0.
fca0: 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20  .----..9 values 
fcb0: 68 61 73 68 69 6e 67 20 74 6f 20 36 30 66 64 64  hashing to 60fdd
fcc0: 36 39 32 34 62 62 37 36 33 64 36 61 63 61 30 30  6924bb763d6aca00
fcd0: 62 61 37 34 39 33 35 65 66 34 62 0d 0a 0d 0a 73  ba74935ef4b....s
fce0: 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
fcf0: 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
fd00: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
fd10: 62 65 6c 2d 34 32 35 0d 0a 53 45 4c 45 43 54 20  bel-425..SELECT 
fd20: 2d 20 36 33 20 2f 20 34 38 20 41 53 20 63 6f 6c  - 63 / 48 AS col
fd30: 31 20 46 52 4f 4d 20 74 61 62 30 2c 20 74 61 62  1 FROM tab0, tab
fd40: 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
fd50: 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e  .9 values hashin
fd60: 67 20 74 6f 20 36 30 66 64 64 36 39 32 34 62 62  g to 60fdd6924bb
fd70: 37 36 33 64 36 61 63 61 30 30 62 61 37 34 39 33  763d6aca00ba7493
fd80: 35 65 66 34 62 0d 0a 0d 0a 71 75 65 72 79 20 49  5ef4b....query I
fd90: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
fda0: 20 41 4c 4c 20 2d 20 2d 20 63 6f 6c 31 20 2a 20   ALL - - col1 * 
fdb0: 34 37 20 2a 20 63 6f 6c 32 20 46 52 4f 4d 20 74  47 * col2 FROM t
fdc0: 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
fdd0: 2d 0d 0a 33 30 33 36 32 0d 0a 33 39 33 33 39 0d  -..30362..39339.
fde0: 0a 37 32 30 39 38 0d 0a 0d 0a 71 75 65 72 79 20  .72098....query 
fdf0: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
fe00: 54 20 41 4c 4c 20 2b 20 63 6f 6c 31 20 2b 20 37  T ALL + col1 + 7
fe10: 36 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  6 AS col2 FROM t
fe20: 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab0 cor0..----..
fe30: 31 36 32 0d 0a 31 36 37 0d 0a 31 37 33 0d 0a 0d  162..167..173...
fe40: 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
fe50: 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72  use DIV operator
fe60: 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76   for integer div
fe70: 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72  ision..query I r
fe80: 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 34 32 38  owsort label-428
fe90: 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c  ..SELECT ALL col
fea0: 30 20 2b 20 32 32 20 44 49 56 20 63 6f 72 30 2e  0 + 22 DIV cor0.
feb0: 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46 52 4f  col0 AS col1 FRO
fec0: 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
fed0: 2d 2d 2d 2d 0d 0a 31 30 0d 0a 36 34 0d 0a 38 30  ----..10..64..80
fee0: 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
fef0: 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
ff00: 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
ff10: 72 74 20 6c 61 62 65 6c 2d 34 32 38 0d 0a 53 45  rt label-428..SE
ff20: 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 30 20 2b 20  LECT ALL col0 + 
ff30: 32 32 20 2f 20 63 6f 72 30 2e 63 6f 6c 30 20 41  22 / cor0.col0 A
ff40: 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31  S col1 FROM tab1
ff50: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
ff60: 31 30 0d 0a 36 34 0d 0a 38 30 0d 0a 0d 0a 73 6b  10..64..80....sk
ff70: 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20  ipif postgresql 
ff80: 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71  # PostgreSQL req
ff90: 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65  uires AS when re
ffa0: 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f  naming output co
ffb0: 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72  lumns..query I r
ffc0: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63  owsort..SELECT c
ffd0: 6f 72 30 2e 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c  or0.col0 + - col
ffe0: 32 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30  2 col0 FROM tab0
fff0: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
10000 2d 39 0d 0a 33 34 0d 0a 37 0d 0a 0d 0a 71 75 65  -9..34..7....que
10010 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
10020 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20  LECT DISTINCT - 
10030 63 6f 6c 30 20 2a 20 2b 20 35 30 20 41 53 20 63  col0 * + 50 AS c
10040 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol0 FROM tab0 AS
10050 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32   cor0..----..-12
10060 30 30 0d 0a 2d 31 37 35 30 0d 0a 2d 34 34 35 30  00..-1750..-4450
10070 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
10080 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
10090 49 4e 43 54 20 33 31 20 41 53 20 63 6f 6c 32 20  INCT 31 AS col2 
100a0 46 52 4f 4d 20 74 61 62 30 2c 20 74 61 62 31 20  FROM tab0, tab1 
100b0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 31 0d 0a  cor0..----..31..
100c0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
100d0 74 0d 0a 53 45 4c 45 43 54 20 74 61 62 31 2e 63  t..SELECT tab1.c
100e0 6f 6c 32 20 2b 20 2b 20 63 6f 6c 30 20 2a 20 2b  ol2 + + col0 * +
100f0 20 74 61 62 31 2e 63 6f 6c 31 20 2a 20 2d 20 63   tab1.col1 * - c
10100 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d  ol2 FROM tab1..-
10110 2d 2d 2d 0d 0a 2d 33 36 34 32 33 0d 0a 2d 34 31  ---..-36423..-41
10120 35 38 0d 0a 2d 39 39 37 34 34 0d 0a 0d 0a 71 75  58..-99744....qu
10130 65 72 79 20 49 49 49 20 72 6f 77 73 6f 72 74 0d  ery III rowsort.
10140 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
10150 20 2a 20 46 52 4f 4d 20 74 61 62 30 20 57 48 45   * FROM tab0 WHE
10160 52 45 20 28 20 4e 55 4c 4c 20 29 20 3e 3d 20 2b  RE ( NULL ) >= +
10170 20 63 6f 6c 32 20 2a 20 63 6f 6c 31 20 2b 20 2b   col2 * col1 + +
10180 20 63 6f 6c 30 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a 71   col0..----....q
10190 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
101a0 53 45 4c 45 43 54 20 63 6f 6c 31 20 41 53 20 63  SELECT col1 AS c
101b0 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 57 48  ol2 FROM tab2 WH
101c0 45 52 45 20 4e 4f 54 20 4e 55 4c 4c 20 3c 20 4e  ERE NOT NULL < N
101d0 55 4c 4c 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a 71 75 65  ULL..----....que
101e0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
101f0 4c 45 43 54 20 2b 20 63 6f 6c 31 20 2d 20 2b 20  LECT + col1 - + 
10200 74 61 62 32 2e 63 6f 6c 31 20 46 52 4f 4d 20 74  tab2.col1 FROM t
10210 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d  ab2..----..0..0.
10220 0a 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  .0....query I ro
10230 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
10240 4c 20 2d 20 74 61 62 31 2e 63 6f 6c 31 20 2d 20  L - tab1.col1 - 
10250 74 61 62 31 2e 63 6f 6c 31 20 2a 20 63 6f 6c 31  tab1.col1 * col1
10260 20 2a 20 74 61 62 31 2e 63 6f 6c 30 20 41 53 20   * tab1.col0 AS 
10270 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 0d 0a  col2 FROM tab1..
10280 2d 2d 2d 2d 0d 0a 2d 31 33 35 33 33 0d 0a 2d 32  ----..-13533..-2
10290 30 35 34 0d 0a 2d 36 34 31 30 0d 0a 0d 0a 71 75  054..-6410....qu
102a0 65 72 79 20 49 49 49 20 72 6f 77 73 6f 72 74 0d  ery III rowsort.
102b0 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2a 20 46 52  .SELECT ALL * FR
102c0 4f 4d 20 74 61 62 32 20 57 48 45 52 45 20 4e 4f  OM tab2 WHERE NO
102d0 54 20 63 6f 6c 32 20 3c 3e 20 2b 20 63 6f 6c 32  T col2 <> + col2
102e0 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73  ..----..9 values
102f0 20 68 61 73 68 69 6e 67 20 74 6f 20 61 64 30 35   hashing to ad05
10300 62 35 39 34 32 34 30 30 64 35 65 37 61 32 31 62  b5942400d5e7a21b
10310 33 32 33 62 33 64 61 36 35 61 34 35 0d 0a 0d 0a  323b3da65a45....
10320 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
10330 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 74 61  .SELECT ALL + ta
10340 62 31 2e 63 6f 6c 32 20 2b 20 2d 20 63 6f 6c 32  b1.col2 + - col2
10350 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
10360 62 31 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a  b1..----..0..0..
10370 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  0....query I row
10380 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
10390 54 49 4e 43 54 20 63 6f 6c 32 20 2b 20 2b 20 63  TINCT col2 + + c
103a0 6f 6c 32 20 2a 20 63 6f 6c 30 20 41 53 20 63 6f  ol2 * col0 AS co
103b0 6c 31 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d  l1 FROM tab1..--
103c0 2d 2d 0d 0a 32 31 36 0d 0a 33 37 30 35 0d 0a 37  --..216..3705..7
103d0 37 37 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  776....query I r
103e0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
103f0 20 63 6f 72 31 2e 63 6f 6c 31 20 2d 20 2b 20 63   cor1.col1 - + c
10400 6f 72 31 2e 63 6f 6c 31 20 41 53 20 63 6f 6c 31  or1.col1 AS col1
10410 20 46 52 4f 4d 20 74 61 62 32 2c 20 74 61 62 31   FROM tab2, tab1
10420 20 41 53 20 63 6f 72 30 2c 20 74 61 62 31 20 41   AS cor0, tab1 A
10430 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 32 37  S cor1..----..27
10440 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20   values hashing 
10450 74 6f 20 66 32 66 37 30 37 39 39 35 64 33 62 66  to f2f707995d3bf
10460 31 35 66 62 61 61 37 30 36 30 62 33 66 33 35 63  15fbaa7060b3f35c
10470 31 31 32 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  112....onlyif my
10480 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70  sql # use DIV op
10490 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67  erator for integ
104a0 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65  er division..que
104b0 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
104c0 65 6c 2d 34 34 31 0d 0a 53 45 4c 45 43 54 20 2d  el-441..SELECT -
104d0 20 34 20 44 49 56 20 2b 20 63 6f 6c 30 20 2b 20   4 DIV + col0 + 
104e0 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a  col1 FROM tab0..
104f0 2d 2d 2d 2d 0d 0a 38 36 0d 0a 39 31 0d 0a 39 37  ----..86..91..97
10500 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
10510 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
10520 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
10530 72 74 20 6c 61 62 65 6c 2d 34 34 31 0d 0a 53 45  rt label-441..SE
10540 4c 45 43 54 20 2d 20 34 20 2f 20 2b 20 63 6f 6c  LECT - 4 / + col
10550 30 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61  0 + col1 FROM ta
10560 62 30 0d 0a 2d 2d 2d 2d 0d 0a 38 36 0d 0a 39 31  b0..----..86..91
10570 0d 0a 39 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..97....query I 
10580 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
10590 28 20 2d 20 63 6f 6c 32 20 2b 20 2d 20 63 6f 6c  ( - col2 + - col
105a0 30 20 29 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d  0 ) FROM tab2..-
105b0 2d 2d 2d 0d 0a 2d 31 30 34 0d 0a 2d 31 31 37 0d  ---..-104..-117.
105c0 0a 2d 33 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .-34....query I 
105d0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
105e0 44 49 53 54 49 4e 43 54 20 35 34 20 2a 20 2b 20  DISTINCT 54 * + 
105f0 74 61 62 32 2e 63 6f 6c 31 20 2a 20 32 30 20 41  tab2.col1 * 20 A
10600 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32  S col2 FROM tab2
10610 0d 0a 2d 2d 2d 2d 0d 0a 31 38 33 36 30 0d 0a 33  ..----..18360..3
10620 33 34 38 30 0d 0a 36 33 37 32 30 0d 0a 0d 0a 6f  3480..63720....o
10630 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73  nlyif mysql # us
10640 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66  e DIV operator f
10650 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73  or integer divis
10660 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ion..query I row
10670 73 6f 72 74 20 6c 61 62 65 6c 2d 34 34 34 0d 0a  sort label-444..
10680 53 45 4c 45 43 54 20 63 6f 6c 32 20 2b 20 2b 20  SELECT col2 + + 
10690 63 6f 6c 31 20 44 49 56 20 63 6f 6c 31 20 46 52  col1 DIV col1 FR
106a0 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
106b0 0a 2d 2d 2d 2d 0d 0a 32 0d 0a 33 34 0d 0a 38 33  .----..2..34..83
106c0 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
106d0 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
106e0 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
106f0 72 74 20 6c 61 62 65 6c 2d 34 34 34 0d 0a 53 45  rt label-444..SE
10700 4c 45 43 54 20 63 6f 6c 32 20 2b 20 2b 20 63 6f  LECT col2 + + co
10710 6c 31 20 2f 20 63 6f 6c 31 20 46 52 4f 4d 20 74  l1 / col1 FROM t
10720 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
10730 2d 0d 0a 32 0d 0a 33 34 0d 0a 38 33 0d 0a 0d 0a  -..2..34..83....
10740 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75  onlyif mysql # u
10750 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20  se DIV operator 
10760 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69  for integer divi
10770 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f  sion..query I ro
10780 77 73 6f 72 74 20 6c 61 62 65 6c 2d 34 34 35 0d  wsort label-445.
10790 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 32 20 2a  .SELECT - col2 *
107a0 20 2b 20 63 6f 6c 32 20 44 49 56 20 63 6f 6c 32   + col2 DIV col2
107b0 20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d   FROM tab1 cor0.
107c0 0a 2d 2d 2d 2d 0d 0a 2d 35 34 0d 0a 2d 35 37 0d  .----..-54..-57.
107d0 0a 2d 39 36 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  .-96....skipif m
107e0 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
107f0 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
10800 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 34 34 35  owsort label-445
10810 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 32 20  ..SELECT - col2 
10820 2a 20 2b 20 63 6f 6c 32 20 2f 20 63 6f 6c 32 20  * + col2 / col2 
10830 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a  FROM tab1 cor0..
10840 2d 2d 2d 2d 0d 0a 2d 35 34 0d 0a 2d 35 37 0d 0a  ----..-54..-57..
10850 2d 39 36 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  -96....onlyif my
10860 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70  sql # use DIV op
10870 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67  erator for integ
10880 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65  er division..que
10890 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
108a0 65 6c 2d 34 34 36 0d 0a 53 45 4c 45 43 54 20 2b  el-446..SELECT +
108b0 20 33 35 20 44 49 56 20 2b 20 63 6f 6c 31 20 41   35 DIV + col1 A
108c0 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30  S col1 FROM tab0
108d0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
108e0 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a 73 6b 69 70 69  0..0..0....skipi
108f0 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
10900 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
10910 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
10920 34 34 36 0d 0a 53 45 4c 45 43 54 20 2b 20 33 35  446..SELECT + 35
10930 20 2f 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c   / + col1 AS col
10940 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  1 FROM tab0 AS c
10950 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d  or0..----..0..0.
10960 0a 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  .0....query I ro
10970 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
10980 53 54 49 4e 43 54 20 2d 20 2b 20 63 6f 6c 30 20  STINCT - + col0 
10990 2a 20 2d 20 36 31 20 46 52 4f 4d 20 74 61 62 32  * - 61 FROM tab2
109a0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
109b0 34 32 37 0d 0a 34 37 35 38 0d 0a 34 38 31 39 0d  427..4758..4819.
109c0 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
109d0 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79  # support for My
109e0 53 51 4c 20 73 70 65 63 69 66 69 63 20 73 79 73  SQL specific sys
109f0 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79  tem types and sy
10a00 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f  ntax..query I ro
10a10 77 73 6f 72 74 20 6c 61 62 65 6c 2d 34 34 38 0d  wsort label-448.
10a20 0a 53 45 4c 45 43 54 20 41 4c 4c 20 43 41 53 54  .SELECT ALL CAST
10a30 28 20 4e 55 4c 4c 20 41 53 20 53 49 47 4e 45 44  ( NULL AS SIGNED
10a40 20 29 20 2a 20 2b 20 63 6f 6c 32 20 63 6f 6c 30   ) * + col2 col0
10a50 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
10a60 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a  r0..----..NULL..
10a70 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b  NULL..NULL....sk
10a80 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20  ipif postgresql 
10a90 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71  # PostgreSQL req
10aa0 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65  uires AS when re
10ab0 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f  naming output co
10ac0 6c 75 6d 6e 73 0d 0a 73 6b 69 70 69 66 20 6d 79  lumns..skipif my
10ad0 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
10ae0 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
10af0 77 73 6f 72 74 20 6c 61 62 65 6c 2d 34 34 38 0d  wsort label-448.
10b00 0a 53 45 4c 45 43 54 20 41 4c 4c 20 43 41 53 54  .SELECT ALL CAST
10b10 20 28 20 4e 55 4c 4c 20 41 53 20 49 4e 54 45 47   ( NULL AS INTEG
10b20 45 52 20 29 20 2a 20 2b 20 63 6f 6c 32 20 63 6f  ER ) * + col2 co
10b30 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l0 FROM tab2 AS 
10b40 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c  cor0..----..NULL
10b50 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a  ..NULL..NULL....
10b60 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
10b70 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
10b80 20 2b 20 28 20 63 6f 6c 32 20 29 20 2a 20 63 6f   + ( col2 ) * co
10b90 6c 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  l0 AS col1 FROM 
10ba0 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab2 cor0..----.
10bb0 0a 31 38 39 0d 0a 32 30 32 38 0d 0a 33 30 30 32  .189..2028..3002
10bc0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
10bd0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 28 20 63 6f  ort..SELECT ( co
10be0 6c 31 20 29 20 2b 20 2d 20 63 6f 6c 30 20 46 52  l1 ) + - col0 FR
10bf0 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
10c00 0a 2d 2d 2d 2d 0d 0a 2d 35 34 0d 0a 2d 36 37 0d  .----..-54..-67.
10c10 0a 32 33 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  .23....skipif my
10c20 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
10c30 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
10c40 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 28 20  wsort..SELECT ( 
10c50 63 6f 6c 31 20 29 20 2a 20 2d 20 43 41 53 54 20  col1 ) * - CAST 
10c60 28 20 63 6f 6c 30 20 41 53 20 52 45 41 4c 20 29  ( col0 AS REAL )
10c70 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
10c80 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
10c90 0d 0a 2d 31 33 34 33 0d 0a 2d 32 31 37 0d 0a 2d  ..-1343..-217..-
10ca0 34 36 30 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20  4602....query I 
10cb0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
10cc0 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 2a 20 63 6f  + cor0.col0 * co
10cd0 72 30 2e 63 6f 6c 31 20 2b 20 2d 20 63 6f 6c 30  r0.col1 + - col0
10ce0 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
10cf0 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
10d00 0d 0a 32 30 34 30 0d 0a 33 33 36 30 0d 0a 38 30  ..2040..3360..80
10d10 31 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  10....query I ro
10d20 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
10d30 53 54 49 4e 43 54 20 28 20 2b 20 31 31 20 29 20  STINCT ( + 11 ) 
10d40 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d  FROM tab2..----.
10d50 0a 31 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .11....query I r
10d60 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
10d70 4c 4c 20 2d 20 35 37 20 41 53 20 63 6f 6c 32 20  LL - 57 AS col2 
10d80 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d  FROM tab1..----.
10d90 0a 2d 35 37 0d 0a 2d 35 37 0d 0a 2d 35 37 0d 0a  .-57..-57..-57..
10da0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
10db0 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 30  t..SELECT + col0
10dc0 20 2a 20 63 6f 6c 32 20 2a 20 63 6f 6c 31 20 41   * col2 * col1 A
10dd0 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32  S col0 FROM tab2
10de0 0d 0a 2d 2d 2d 2d 0d 0a 31 31 39 36 35 32 0d 0a  ..----..119652..
10df0 35 31 30 33 34 0d 0a 35 38 35 39 0d 0a 0d 0a 71  51034..5859....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 2b 20 74 61 62 32 2e 63 6f  SELECT + tab2.co
10e20 6c 32 20 2b 20 63 6f 6c 30 20 2a 20 63 6f 6c 32  l2 + col0 * col2
10e30 20 46 52 4f 4d 20 74 61 62 32 20 57 48 45 52 45   FROM tab2 WHERE
10e40 20 4e 4f 54 20 28 20 4e 55 4c 4c 20 3c 3d 20 28   NOT ( NULL <= (
10e50 20 4e 55 4c 4c 20 29 20 29 20 41 4e 44 20 63 6f   NULL ) ) AND co
10e60 6c 31 20 3c 3d 20 4e 55 4c 4c 0d 0a 2d 2d 2d 2d  l1 <= NULL..----
10e70 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
10e80 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
10e90 63 6f 6c 32 20 2b 20 2b 20 74 61 62 31 2e 63 6f  col2 + + tab1.co
10ea0 6c 31 20 2a 20 63 6f 6c 32 20 2b 20 2d 20 63 6f  l1 * col2 + - co
10eb0 6c 32 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  l2 AS col0 FROM 
10ec0 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 32 34 38  tab1..----..1248
10ed0 0d 0a 31 34 30 34 0d 0a 35 37 30 0d 0a 0d 0a 71  ..1404..570....q
10ee0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
10ef0 53 45 4c 45 43 54 20 41 4c 4c 20 74 61 62 31 2e  SELECT ALL tab1.
10f00 63 6f 6c 31 20 2a 20 63 6f 6c 31 20 2a 20 63 6f  col1 * col1 * co
10f10 6c 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  l0 AS col1 FROM 
10f20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 33 35 32  tab1..----..1352
10f30 30 0d 0a 32 30 32 38 0d 0a 36 34 30 30 0d 0a 0d  0..2028..6400...
10f40 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
10f50 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
10f60 54 20 74 61 62 32 2e 63 6f 6c 32 20 2a 20 2b 20  T tab2.col2 * + 
10f70 74 61 62 32 2e 63 6f 6c 30 20 46 52 4f 4d 20 74  tab2.col0 FROM t
10f80 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 38 39 0d 0a  ab2..----..189..
10f90 32 30 32 38 0d 0a 33 30 30 32 0d 0a 0d 0a 71 75  2028..3002....qu
10fa0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
10fb0 45 4c 45 43 54 20 41 4c 4c 20 2b 20 2d 20 63 6f  ELECT ALL + - co
10fc0 6c 32 20 2a 20 63 6f 6c 30 20 2b 20 2b 20 63 6f  l2 * col0 + + co
10fd0 6c 30 20 2a 20 2b 20 63 6f 6c 31 20 41 53 20 63  l0 * + col1 AS c
10fe0 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol2 FROM tab2 AS
10ff0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 36   cor0..----..-16
11000 35 39 0d 0a 32 35 37 34 0d 0a 32 38 0d 0a 0d 0a  59..2574..28....
11010 71 75 65 72 79 20 49 49 49 49 49 49 20 72 6f 77  query IIIIII row
11020 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
11030 20 2a 20 46 52 4f 4d 20 74 61 62 31 2c 20 74 61   * FROM tab1, ta
11040 62 30 20 41 53 20 63 6f 72 30 20 57 48 45 52 45  b0 AS cor0 WHERE
11050 20 4e 4f 54 20 74 61 62 31 2e 63 6f 6c 31 20 3c   NOT tab1.col1 <
11060 3e 20 4e 55 4c 4c 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a  > NULL..----....
11070 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
11080 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 31 20 2a  .SELECT + col1 *
11090 20 63 6f 72 30 2e 63 6f 6c 32 20 2a 20 63 6f 6c   cor0.col2 * col
110a0 31 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  1 AS col1 FROM t
110b0 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab1 cor0..----..
110c0 31 36 32 32 34 0d 0a 33 36 35 30 34 0d 0a 35 37  16224..36504..57
110d0 30 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73  00....skipif pos
110e0 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72  tgresql # Postgr
110f0 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53  eSQL requires AS
11100 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f   when renaming o
11110 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71  utput columns..q
11120 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
11130 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
11140 2d 20 34 31 20 63 6f 6c 32 20 46 52 4f 4d 20 74  - 41 col2 FROM t
11150 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 31 0d 0a  ab0..----..-41..
11160 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
11170 74 0d 0a 53 45 4c 45 43 54 20 28 20 31 30 20 29  t..SELECT ( 10 )
11180 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
11190 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 0d 0a 31 30  b0..----..10..10
111a0 0d 0a 31 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 70  ..10....skipif p
111b0 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74  ostgresql # Post
111c0 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20  greSQL requires 
111d0 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67  AS when renaming
111e0 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d   output columns.
111f0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
11200 0d 0a 53 45 4c 45 43 54 20 2d 20 28 20 63 6f 6c  ..SELECT - ( col
11210 31 20 29 20 2a 20 63 6f 6c 30 20 63 6f 6c 31 20  1 ) * col0 col1 
11220 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d  FROM tab0..----.
11230 0a 2d 32 30 36 34 0d 0a 2d 33 33 39 35 0d 0a 2d  .-2064..-3395..-
11240 38 30 39 39 0d 0a 0d 0a 73 6b 69 70 69 66 20 70  8099....skipif p
11250 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74  ostgresql # Post
11260 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20  greSQL requires 
11270 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67  AS when renaming
11280 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d   output columns.
11290 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
112a0 0d 0a 53 45 4c 45 43 54 20 2d 20 2b 20 28 20 2b  ..SELECT - + ( +
112b0 20 63 6f 72 30 2e 63 6f 6c 31 20 29 20 2b 20 2d   cor0.col1 ) + -
112c0 20 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c 32 20 63   col2 * - col2 c
112d0 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol2 FROM tab0 AS
112e0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 39 36   cor0..----..-96
112f0 0d 0a 31 30 30 33 0d 0a 36 36 33 33 0d 0a 0d 0a  ..1003..6633....
11300 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
11310 0a 53 45 4c 45 43 54 20 2d 20 31 31 20 41 53 20  .SELECT - 11 AS 
11320 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 2c 20  col2 FROM tab1, 
11330 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
11340 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73  --..9 values has
11350 68 69 6e 67 20 74 6f 20 30 35 63 63 39 38 39 31  hing to 05cc9891
11360 32 32 64 37 37 32 34 63 37 61 62 65 66 61 62 61  22d7724c7abefaba
11370 39 36 32 35 65 66 33 64 0d 0a 0d 0a 71 75 65 72  9625ef3d....quer
11380 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
11390 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63  ECT DISTINCT + c
113a0 6f 6c 32 20 2b 20 74 61 62 31 2e 63 6f 6c 31 20  ol2 + tab1.col1 
113b0 2b 20 74 61 62 31 2e 63 6f 6c 32 20 46 52 4f 4d  + tab1.col2 FROM
113c0 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 32 34   tab1..----..124
113d0 0d 0a 31 33 34 0d 0a 32 30 35 0d 0a 0d 0a 71 75  ..134..205....qu
113e0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
113f0 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d  ELECT DISTINCT -
11400 20 63 6f 6c 31 20 2a 20 63 6f 6c 30 20 2b 20 2d   col1 * col0 + -
11410 20 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46 52   col0 AS col2 FR
11420 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d  OM tab1..----..-
11430 31 31 32 30 0d 0a 2d 37 30 34 0d 0a 2d 38 31 0d  1120..-704..-81.
11440 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
11450 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
11460 4e 43 54 20 2b 20 31 35 20 2b 20 63 6f 6c 30 20  NCT + 15 + col0 
11470 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d  FROM tab2..----.
11480 0a 32 32 0d 0a 39 33 0d 0a 39 34 0d 0a 0d 0a 71  .22..93..94....q
11490 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
114a0 53 45 4c 45 43 54 20 2b 20 63 6f 6c 32 20 2a 20  SELECT + col2 * 
114b0 63 6f 6c 31 20 2b 20 63 6f 6c 30 20 2a 20 2d 20  col1 + col0 * - 
114c0 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46 52 4f  col1 AS col1 FRO
114d0 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 33  M tab2..----..-3
114e0 30 36 38 0d 0a 2d 36 39 37 0d 0a 36 32 30 0d 0a  068..-697..620..
114f0 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
11500 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f   use DIV operato
11510 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69  r for integer di
11520 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20  vision..query I 
11530 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 34 37  rowsort label-47
11540 32 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 30 20 2b  2..SELECT col0 +
11550 20 2b 20 63 6f 6c 32 20 2b 20 2b 20 63 6f 6c 30   + col2 + + col0
11560 20 44 49 56 20 63 6f 6c 32 20 46 52 4f 4d 20 74   DIV col2 FROM t
11570 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
11580 2d 0d 0a 31 37 32 0d 0a 35 37 0d 0a 37 31 0d 0a  -..172..57..71..
11590 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
115a0 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
115b0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
115c0 20 6c 61 62 65 6c 2d 34 37 32 0d 0a 53 45 4c 45   label-472..SELE
115d0 43 54 20 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c 32  CT col0 + + col2
115e0 20 2b 20 2b 20 63 6f 6c 30 20 2f 20 63 6f 6c 32   + + col0 / col2
115f0 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
11600 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 37 32 0d 0a 35  r0..----..172..5
11610 37 0d 0a 37 31 0d 0a 0d 0a 71 75 65 72 79 20 49  7..71....query I
11620 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
11630 20 2b 20 28 20 2d 20 63 6f 6c 31 20 29 20 2a 20   + ( - col1 ) * 
11640 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46 52 4f  col1 AS col1 FRO
11650 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
11660 2d 2d 2d 2d 0d 0a 2d 31 30 30 0d 0a 2d 31 36 39  ----..-100..-169
11670 0d 0a 2d 36 37 36 0d 0a 0d 0a 73 6b 69 70 69 66  ..-676....skipif
11680 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f   postgresql # Po
11690 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65  stgreSQL require
116a0 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69  s AS when renami
116b0 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e  ng output column
116c0 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  s..query I rowso
116d0 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 36  rt..SELECT ALL 6
116e0 36 20 2b 20 2b 20 63 6f 6c 32 20 2a 20 2d 20 63  6 + + col2 * - c
116f0 6f 6c 30 20 2a 20 2d 20 74 61 62 31 2e 63 6f 6c  ol0 * - tab1.col
11700 30 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31  0 col2 FROM tab1
11710 0d 0a 2d 2d 2d 2d 0d 0a 32 33 33 35 33 38 0d 0a  ..----..233538..
11720 35 35 32 0d 0a 36 31 34 34 36 36 0d 0a 0d 0a 71  552..614466....q
11730 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
11740 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 30 20  SELECT ALL col0 
11750 2b 20 2b 20 63 6f 6c 32 20 2b 20 2d 20 63 6f 6c  + + col2 + - col
11760 30 20 2a 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20  0 * + col0 FROM 
11770 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
11780 2d 2d 0d 0a 2d 33 39 37 35 0d 0a 2d 36 32 32 34  --..-3975..-6224
11790 0d 0a 34 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..48....query I 
117a0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
117b0 44 49 53 54 49 4e 43 54 20 2d 20 2b 20 63 6f 6c  DISTINCT - + col
117c0 32 20 2a 20 63 6f 72 30 2e 63 6f 6c 31 20 2b 20  2 * cor0.col1 + 
117d0 2d 20 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c 31 20  - col0 * - col1 
117e0 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
117f0 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
11800 0a 2d 36 32 30 0d 0a 33 30 36 38 0d 0a 36 39 37  .-620..3068..697
11810 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
11820 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61   # use DIV opera
11830 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20  tor for integer 
11840 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20  division..query 
11850 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
11860 34 37 37 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  477..SELECT ALL 
11870 63 6f 72 30 2e 63 6f 6c 30 20 44 49 56 20 2b 20  cor0.col0 DIV + 
11880 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 63  col0 FROM tab0 c
11890 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 0d 0a 31 0d  or0..----..1..1.
118a0 0a 31 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  .1....skipif mys
118b0 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
118c0 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
118d0 73 6f 72 74 20 6c 61 62 65 6c 2d 34 37 37 0d 0a  sort label-477..
118e0 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 72 30 2e  SELECT ALL cor0.
118f0 63 6f 6c 30 20 2f 20 2b 20 63 6f 6c 30 20 46 52  col0 / + col0 FR
11900 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d  OM tab0 cor0..--
11910 2d 2d 0d 0a 31 0d 0a 31 0d 0a 31 0d 0a 0d 0a 71  --..1..1..1....q
11920 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
11930 53 45 4c 45 43 54 20 2d 20 63 6f 6c 30 20 2a 20  SELECT - col0 * 
11940 63 6f 6c 30 20 2b 20 2d 20 63 6f 72 30 2e 63 6f  col0 + - cor0.co
11950 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l1 FROM tab0 AS 
11960 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 32  cor0..----..-132
11970 32 0d 0a 2d 36 36 32 0d 0a 2d 38 30 31 32 0d 0a  2..-662..-8012..
11980 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
11990 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
119a0 43 54 20 2d 20 63 6f 6c 31 20 2a 20 2b 20 63 6f  CT - col1 * + co
119b0 6c 30 20 2b 20 2b 20 63 6f 6c 30 20 41 53 20 63  l0 + + col0 AS c
119c0 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol2 FROM tab2 AS
119d0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32   cor0..----..-12
119e0 36 34 0d 0a 2d 32 31 30 0d 0a 2d 34 35 32 34 0d  64..-210..-4524.
119f0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
11a00 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b  rt..SELECT ALL +
11a10 20 32 31 20 2a 20 2d 20 63 6f 6c 30 20 2b 20 2b   21 * - col0 + +
11a20 20 63 6f 6c 32 20 2a 20 63 6f 6c 32 20 41 53 20   col2 * col2 AS 
11a30 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41  col1 FROM tab1 A
11a40 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 39  S cor0..----..19
11a50 30 35 0d 0a 32 38 35 33 0d 0a 37 35 33 36 0d 0a  05..2853..7536..
11a60 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
11a70 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f   use DIV operato
11a80 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69  r for integer di
11a90 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20  vision..query I 
11aa0 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 34 38  rowsort label-48
11ab0 31 0d 0a 53 45 4c 45 43 54 20 34 30 20 2b 20 63  1..SELECT 40 + c
11ac0 6f 6c 31 20 44 49 56 20 63 6f 6c 30 20 2b 20 63  ol1 DIV col0 + c
11ad0 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  ol0 AS col1 FROM
11ae0 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
11af0 2d 2d 2d 0d 0a 31 33 30 0d 0a 36 37 0d 0a 37 37  ---..130..67..77
11b00 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
11b10 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
11b20 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
11b30 72 74 20 6c 61 62 65 6c 2d 34 38 31 0d 0a 53 45  rt label-481..SE
11b40 4c 45 43 54 20 34 30 20 2b 20 63 6f 6c 31 20 2f  LECT 40 + col1 /
11b50 20 63 6f 6c 30 20 2b 20 63 6f 6c 30 20 41 53 20   col0 + col0 AS 
11b60 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41  col1 FROM tab0 A
11b70 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33  S cor0..----..13
11b80 30 0d 0a 36 37 0d 0a 37 37 0d 0a 0d 0a 71 75 65  0..67..77....que
11b90 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
11ba0 4c 45 43 54 20 41 4c 4c 20 2d 20 39 32 20 2a 20  LECT ALL - 92 * 
11bb0 2d 20 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46  - col1 AS col0 F
11bc0 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d  ROM tab0 cor0..-
11bd0 2d 2d 2d 0d 0a 37 39 31 32 0d 0a 38 33 37 32 0d  ---..7912..8372.
11be0 0a 38 39 32 34 0d 0a 0d 0a 73 6b 69 70 69 66 20  .8924....skipif 
11bf0 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73  postgresql # Pos
11c00 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73  tgreSQL requires
11c10 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e   AS when renamin
11c20 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73  g output columns
11c30 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
11c40 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 31  t..SELECT + col1
11c50 20 2a 20 2b 20 63 6f 6c 32 20 2a 20 2d 20 63 6f   * + col2 * - co
11c60 6c 32 20 2d 20 63 6f 6c 30 20 63 6f 6c 31 20 46  l2 - col0 col1 F
11c70 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab2..----..
11c80 2d 32 32 36 30 36 0d 0a 2d 32 34 36 32 37 0d 0a  -22606..-24627..
11c90 2d 33 39 39 36 32 0d 0a 0d 0a 71 75 65 72 79 20  -39962....query 
11ca0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
11cb0 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 30 20  T DISTINCT col0 
11cc0 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
11cd0 31 20 57 48 45 52 45 20 4e 4f 54 20 4e 55 4c 4c  1 WHERE NOT NULL
11ce0 20 4e 4f 54 20 42 45 54 57 45 45 4e 20 28 20 2d   NOT BETWEEN ( -
11cf0 20 63 6f 6c 30 20 29 20 41 4e 44 20 4e 55 4c 4c   col0 ) AND NULL
11d00 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a 71 75 65 72 79 20  ..----....query 
11d10 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
11d20 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c  T DISTINCT + col
11d30 31 20 2a 20 2d 20 74 61 62 31 2e 63 6f 6c 30 20  1 * - tab1.col0 
11d40 2a 20 74 61 62 31 2e 63 6f 6c 31 20 41 53 20 63  * tab1.col1 AS c
11d50 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d  ol2 FROM tab1..-
11d60 2d 2d 2d 0d 0a 2d 31 33 35 32 30 0d 0a 2d 32 30  ---..-13520..-20
11d70 32 38 0d 0a 2d 36 34 30 30 0d 0a 0d 0a 71 75 65  28..-6400....que
11d80 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
11d90 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 74 61  LECT DISTINCT ta
11da0 62 30 2e 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c 30  b0.col0 * - col0
11db0 20 2f 20 63 6f 6c 30 20 2d 20 63 6f 6c 30 20 2a   / col0 - col0 *
11dc0 20 2d 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62   - col2 FROM tab
11dd0 30 20 57 48 45 52 45 20 4e 4f 54 20 4e 55 4c 4c  0 WHERE NOT NULL
11de0 20 49 4e 20 28 20 63 6f 6c 31 20 2a 20 2d 20 63   IN ( col1 * - c
11df0 6f 6c 32 20 2b 20 2d 20 63 6f 6c 30 20 29 0d 0a  ol2 + - col0 )..
11e00 2d 2d 2d 2d 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ----....query I 
11e10 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
11e20 41 4c 4c 20 2b 20 74 61 62 30 2e 63 6f 6c 32 20  ALL + tab0.col2 
11e30 2a 20 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c 32 20  * col0 * - col2 
11e40 2d 20 2b 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61  - + col2 FROM ta
11e50 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 36 31 36 39  b0..----..-26169
11e60 0d 0a 2d 33 36 0d 0a 2d 35 39 38 35 31 38 0d 0a  ..-36..-598518..
11e70 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
11e80 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20  t..SELECT ALL - 
11e90 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46 52 4f  col2 AS col1 FRO
11ea0 4d 20 74 61 62 32 20 57 48 45 52 45 20 4e 4f 54  M tab2 WHERE NOT
11eb0 20 4e 55 4c 4c 20 4e 4f 54 20 49 4e 20 28 20 63   NULL NOT IN ( c
11ec0 6f 6c 31 20 29 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a 71  ol1 )..----....q
11ed0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
11ee0 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c  SELECT ALL - col
11ef0 31 20 2b 20 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c  1 + col0 * + col
11f00 31 20 2a 20 2d 20 63 6f 6c 32 20 2b 20 2b 20 63  1 * - col2 + + c
11f10 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  ol0 AS col2 FROM
11f20 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
11f30 2d 2d 2d 0d 0a 2d 33 36 34 32 36 0d 0a 2d 34 32  ---..-36426..-42
11f40 33 35 0d 0a 2d 39 39 37 37 33 0d 0a 0d 0a 71 75  35..-99773....qu
11f50 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
11f60 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d  ELECT DISTINCT -
11f70 20 63 6f 6c 32 20 2d 20 2d 20 63 6f 6c 31 20 41   col2 - - col1 A
11f80 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32  S col0 FROM tab2
11f90 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 31   cor0..----..-21
11fa0 0d 0a 33 33 0d 0a 34 0d 0a 0d 0a 71 75 65 72 79  ..33..4....query
11fb0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
11fc0 43 54 20 63 6f 6c 32 20 2a 20 2d 20 63 6f 72 30  CT col2 * - cor0
11fd0 2e 63 6f 6c 30 20 2d 20 2d 20 63 6f 6c 32 20 2a  .col0 - - col2 *
11fe0 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20   col2 FROM tab2 
11ff0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
12000 31 33 35 32 0d 0a 2d 31 35 35 38 0d 0a 35 34 30  1352..-1558..540
12010 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
12020 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f  ort..SELECT - co
12030 72 30 2e 63 6f 6c 32 20 2b 20 63 6f 6c 31 20 2a  r0.col2 + col1 *
12040 20 63 6f 72 30 2e 63 6f 6c 32 20 46 52 4f 4d 20   cor0.col2 FROM 
12050 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
12060 2d 2d 0d 0a 31 31 35 32 0d 0a 31 33 35 30 0d 0a  --..1152..1350..
12070 35 31 33 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f  513....skipif po
12080 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67  stgresql # Postg
12090 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41  reSQL requires A
120a0 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20  S when renaming 
120b0 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a  output columns..
120c0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
120d0 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
120e0 20 63 6f 6c 31 20 2a 20 63 6f 6c 31 20 2b 20 2b   col1 * col1 + +
120f0 20 63 6f 6c 30 20 2b 20 63 6f 6c 30 20 63 6f 6c   col0 + col0 col
12100 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  1 FROM tab2 AS c
12110 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 36 33 37 0d  or0..----..3637.
12120 0a 34 34 37 0d 0a 39 37 35 0d 0a 0d 0a 71 75 65  .447..975....que
12130 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
12140 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f  LECT DISTINCT co
12150 6c 31 20 2b 20 2d 20 63 6f 6c 30 20 2a 20 63 6f  l1 + - col0 * co
12160 6c 30 20 2b 20 2b 20 63 6f 6c 32 20 2a 20 63 6f  l0 + + col2 * co
12170 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l0 FROM tab0 AS 
12180 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 39  cor0..----..-109
12190 33 0d 0a 2d 35 33 32 0d 0a 33 30 32 0d 0a 0d 0a  3..-532..302....
121a0 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75  onlyif mysql # u
121b0 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20  se DIV operator 
121c0 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69  for integer divi
121d0 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f  sion..query I ro
121e0 77 73 6f 72 74 20 6c 61 62 65 6c 2d 34 39 35 0d  wsort label-495.
121f0 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 30  .SELECT ALL col0
12200 20 2a 20 63 6f 6c 31 20 2b 20 63 6f 6c 31 20 44   * col1 + col1 D
12210 49 56 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20  IV col0 AS col0 
12220 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a  FROM tab1 cor0..
12230 2d 2d 2d 2d 0d 0a 31 30 34 30 0d 0a 36 34 30 0d  ----..1040..640.
12240 0a 38 36 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  .86....skipif my
12250 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
12260 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
12270 77 73 6f 72 74 20 6c 61 62 65 6c 2d 34 39 35 0d  wsort label-495.
12280 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 30  .SELECT ALL col0
12290 20 2a 20 63 6f 6c 31 20 2b 20 63 6f 6c 31 20 2f   * col1 + col1 /
122a0 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46 52   col0 AS col0 FR
122b0 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d  OM tab1 cor0..--
122c0 2d 2d 0d 0a 31 30 34 30 0d 0a 36 34 30 0d 0a 38  --..1040..640..8
122d0 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  6....query I row
122e0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63  sort..SELECT - c
122f0 6f 6c 30 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20  ol0 + cor0.col0 
12300 2a 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61  * + col0 FROM ta
12310 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
12320 0d 0a 31 31 39 30 0d 0a 35 35 32 0d 0a 37 38 33  ..1190..552..783
12330 32 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74  2....skipif post
12340 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65  gresql # Postgre
12350 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20  SQL requires AS 
12360 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75  when renaming ou
12370 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75  tput columns..qu
12380 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
12390 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 63  ELECT DISTINCT c
123a0 6f 6c 30 20 2b 20 2d 20 63 6f 6c 30 20 2a 20 2b  ol0 + - col0 * +
123b0 20 63 6f 6c 32 20 63 6f 6c 31 20 46 52 4f 4d 20   col2 col1 FROM 
123c0 74 61 62 32 20 41 53 20 63 6f 72 30 20 57 48 45  tab2 AS cor0 WHE
123d0 52 45 20 4e 4f 54 20 4e 55 4c 4c 20 3c 3e 20 28  RE NOT NULL <> (
123e0 20 63 6f 6c 30 20 29 0d 0a 2d 2d 2d 2d 0d 0a 0d   col0 )..----...
123f0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
12400 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
12410 54 20 2d 20 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c  T - col0 * + col
12420 32 20 2d 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f  2 - + col0 AS co
12430 6c 31 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d  l1 FROM tab1..--
12440 2d 2d 0d 0a 2d 31 36 35 0d 0a 2d 33 37 31 32 0d  --..-165..-3712.
12450 0a 2d 37 37 36 30 0d 0a 0d 0a 71 75 65 72 79 20  .-7760....query 
12460 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
12470 54 20 2d 20 74 61 62 31 2e 63 6f 6c 32 20 2b 20  T - tab1.col2 + 
12480 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 57  col0 FROM tab1 W
12490 48 45 52 45 20 4e 4f 54 20 4e 55 4c 4c 20 3c 20  HERE NOT NULL < 
124a0 4e 55 4c 4c 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a 71 75  NULL..----....qu
124b0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
124c0 45 4c 45 43 54 20 2d 20 63 6f 6c 30 20 2b 20 63  ELECT - col0 + c
124d0 6f 6c 31 20 2a 20 2b 20 63 6f 6c 30 20 2a 20 2d  ol1 * + col0 * -
124e0 20 74 61 62 30 2e 63 6f 6c 32 20 46 52 4f 4d 20   tab0.col2 FROM 
124f0 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 34 33  tab0..----..-343
12500 30 0d 0a 2d 36 36 34 32 30 37 0d 0a 2d 36 38 31  0..-664207..-681
12510 33 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  36....query I ro
12520 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
12530 4c 20 2b 20 63 6f 6c 31 20 2a 20 63 6f 6c 31 20  L + col1 * col1 
12540 2d 20 2d 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61  - - col1 FROM ta
12550 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 31 30 0d 0a 31  b1..----..110..1
12560 38 32 0d 0a 37 30 32 0d 0a 0d 0a 71 75 65 72 79  82..702....query
12570 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
12580 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 30 20 2a 20  CT ALL - col0 * 
12590 2d 20 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c 31 20  - col0 * + col1 
125a0 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
125b0 32 0d 0a 2d 2d 2d 2d 0d 0a 31 30 36 30 39 37 0d  2..----..106097.
125c0 0a 31 35 31 39 0d 0a 33 35 38 39 35 36 0d 0a 0d  .1519..358956...
125d0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
125e0 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63  ..SELECT ALL - c
125f0 6f 6c 31 20 2a 20 63 6f 6c 32 20 2a 20 63 6f 6c  ol1 * col2 * col
12600 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  2 AS col2 FROM t
12610 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 39 38  ab1..----..-1198
12620 30 38 0d 0a 2d 33 32 34 39 30 0d 0a 2d 37 35 38  08..-32490..-758
12630 31 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  16....query I ro
12640 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
12650 53 54 49 4e 43 54 20 2d 20 74 61 62 30 2e 63 6f  STINCT - tab0.co
12660 6c 31 20 2a 20 2b 20 63 6f 6c 32 20 41 53 20 63  l1 * + col2 AS c
12670 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d  ol1 FROM tab0..-
12680 2d 2d 2d 0d 0a 2d 32 38 33 38 0d 0a 2d 37 34 36  ---..-2838..-746
12690 32 0d 0a 2d 39 37 0d 0a 0d 0a 71 75 65 72 79 20  2..-97....query 
126a0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
126b0 54 20 2d 20 63 6f 6c 31 20 2b 20 2b 20 63 6f 6c  T - col1 + + col
126c0 30 20 2a 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20  0 * + col1 FROM 
126d0 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 39 37 38  tab0..----..1978
126e0 0d 0a 33 32 39 38 0d 0a 38 30 30 38 0d 0a 0d 0a  ..3298..8008....
126f0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
12700 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 32 20 2a  .SELECT - col2 *
12710 20 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c 30 20 2b   col0 * + col0 +
12720 20 2d 20 63 6f 6c 30 20 2b 20 63 6f 6c 31 20 46   - col0 + col1 F
12730 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab0..----..
12740 2d 31 31 36 33 0d 0a 2d 31 38 39 34 36 0d 0a 2d  -1163..-18946..-
12750 36 34 39 35 32 30 0d 0a 0d 0a 71 75 65 72 79 20  649520....query 
12760 49 49 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  III rowsort..SEL
12770 45 43 54 20 2a 20 46 52 4f 4d 20 74 61 62 32 20  ECT * FROM tab2 
12780 57 48 45 52 45 20 4e 4f 54 20 4e 55 4c 4c 20 4e  WHERE NOT NULL N
12790 4f 54 20 49 4e 20 28 20 2b 20 63 6f 6c 31 20 2b  OT IN ( + col1 +
127a0 20 2b 20 63 6f 6c 32 20 29 0d 0a 2d 2d 2d 2d 0d   + col2 )..----.
127b0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
127c0 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
127d0 4e 43 54 20 2b 20 63 6f 6c 30 20 2b 20 2b 20 63  NCT + col0 + + c
127e0 6f 6c 30 20 2a 20 63 6f 6c 32 20 46 52 4f 4d 20  ol0 * col2 FROM 
127f0 74 61 62 30 20 57 48 45 52 45 20 28 20 4e 55 4c  tab0 WHERE ( NUL
12800 4c 20 29 20 42 45 54 57 45 45 4e 20 28 20 63 6f  L ) BETWEEN ( co
12810 6c 30 20 2a 20 63 6f 6c 32 20 2a 20 63 6f 6c 32  l0 * col2 * col2
12820 20 2d 20 2d 20 63 6f 6c 30 20 29 20 41 4e 44 20   - - col0 ) AND 
12830 2d 20 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c 30 20  - col2 * - col0 
12840 2b 20 2b 20 63 6f 6c 31 0d 0a 2d 2d 2d 2d 0d 0a  + + col1..----..
12850 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
12860 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
12870 43 54 20 63 6f 6c 32 20 2b 20 2b 20 63 6f 6c 31  CT col2 + + col1
12880 20 2a 20 2b 20 63 6f 6c 31 20 2a 20 2b 20 63 6f   * + col1 * + co
12890 6c 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d  l1 FROM tab0..--
128a0 2d 2d 0d 0a 36 33 36 30 38 39 0d 0a 37 35 33 36  --..636089..7536
128b0 35 33 0d 0a 39 31 32 36 37 34 0d 0a 0d 0a 71 75  53..912674....qu
128c0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
128d0 45 4c 45 43 54 20 74 61 62 31 2e 63 6f 6c 30 20  ELECT tab1.col0 
128e0 2a 20 2d 20 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c  * - col0 * - col
128f0 30 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d  0 FROM tab1..---
12900 2d 0d 0a 32 36 32 31 34 34 0d 0a 32 37 0d 0a 35  -..262144..27..5
12910 31 32 30 30 30 0d 0a 0d 0a 71 75 65 72 79 20 49  12000....query I
12920 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
12930 20 2b 20 2b 20 63 6f 6c 30 20 2d 20 2d 20 63 6f   + + col0 - - co
12940 6c 31 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  l1 AS col0 FROM 
12950 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
12960 2d 2d 0d 0a 31 33 37 0d 0a 33 38 0d 0a 39 36 0d  --..137..38..96.
12970 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
12980 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b  rt..SELECT ALL +
12990 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 2a 20 63   + cor0.col1 * c
129a0 6f 72 30 2e 63 6f 6c 32 20 46 52 4f 4d 20 74 61  or0.col2 FROM ta
129b0 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  b2 cor0..----..1
129c0 35 33 34 0d 0a 36 34 36 0d 0a 38 33 37 0d 0a 0d  534..646..837...
129d0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
129e0 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 32 20  ..SELECT - col2 
129f0 2a 20 63 6f 6c 32 20 2d 20 2d 20 63 6f 6c 32 20  * col2 - - col2 
12a00 2a 20 2d 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61  * - col2 FROM ta
12a10 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
12a20 0d 0a 2d 31 38 34 33 32 0d 0a 2d 35 38 33 32 0d  ..-18432..-5832.
12a30 0a 2d 36 34 39 38 0d 0a 0d 0a 71 75 65 72 79 20  .-6498....query 
12a40 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
12a50 54 20 2b 20 63 6f 6c 31 20 2a 20 63 6f 6c 31 20  T + col1 * col1 
12a60 2b 20 2b 20 63 6f 6c 32 20 2b 20 63 6f 6c 31 20  + + col2 + col1 
12a70 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
12a80 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
12a90 0a 31 36 37 0d 0a 32 37 38 0d 0a 37 35 36 0d 0a  .167..278..756..
12aa0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
12ab0 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 30  t..SELECT + col0
12ac0 20 2a 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 2a   * + cor0.col1 *
12ad0 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20   col1 FROM tab2 
12ae0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32  AS cor0..----..2
12af0 32 38 33 31 0d 0a 32 37 31 35 31 38 0d 0a 36 37  2831..271518..67
12b00 32 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  27....query I ro
12b10 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
12b20 53 54 49 4e 43 54 20 2d 20 63 6f 72 30 2e 63 6f  STINCT - cor0.co
12b30 6c 31 20 2a 20 2d 20 63 6f 6c 31 20 2b 20 63 6f  l1 * - col1 + co
12b40 6c 31 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  l1 AS col0 FROM 
12b50 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
12b60 2d 2d 0d 0a 31 31 30 0d 0a 31 38 32 0d 0a 37 30  --..110..182..70
12b70 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  2....query I row
12b80 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
12b90 54 49 4e 43 54 20 2b 20 2d 20 63 6f 6c 31 20 2a  TINCT + - col1 *
12ba0 20 63 6f 6c 30 20 2d 20 63 6f 6c 31 20 41 53 20   col0 - col1 AS 
12bb0 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41  col0 FROM tab1 A
12bc0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
12bd0 30 34 0d 0a 2d 31 30 35 33 0d 0a 2d 36 35 30 0d  04..-1053..-650.
12be0 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72  ...skipif postgr
12bf0 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51  esql # PostgreSQ
12c00 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68  L requires AS wh
12c10 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70  en renaming outp
12c20 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72  ut columns..quer
12c30 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
12c40 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63  ECT DISTINCT + c
12c50 6f 6c 30 20 2b 20 2d 20 63 6f 6c 32 20 63 6f 6c  ol0 + - col2 col
12c60 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  1 FROM tab2 AS c
12c70 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 30 0d 0a  or0..----..-20..
12c80 34 31 0d 0a 35 32 0d 0a 0d 0a 73 6b 69 70 69 66  41..52....skipif
12c90 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f   postgresql # Po
12ca0 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65  stgreSQL require
12cb0 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69  s AS when renami
12cc0 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e  ng output column
12cd0 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  s..query I rowso
12ce0 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
12cf0 4e 43 54 20 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c  NCT col1 * - col
12d00 31 20 2a 20 63 6f 72 30 2e 63 6f 6c 30 20 63 6f  1 * cor0.col0 co
12d10 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l1 FROM tab0 AS 
12d20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 37 37  cor0..----..-177
12d30 35 30 34 0d 0a 2d 33 32 39 33 31 35 0d 0a 2d 37  504..-329315..-7
12d40 33 37 30 30 39 0d 0a 0d 0a 71 75 65 72 79 20 49  37009....query I
12d50 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
12d60 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 30 20 2d   DISTINCT col0 -
12d70 20 63 6f 6c 30 20 2a 20 63 6f 6c 31 20 41 53 20   col0 * col1 AS 
12d80 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 0d 0a  col0 FROM tab1..
12d90 2d 2d 2d 2d 0d 0a 2d 35 37 36 0d 0a 2d 37 35 0d  ----..-576..-75.
12da0 0a 2d 39 36 30 0d 0a 0d 0a 71 75 65 72 79 20 49  .-960....query I
12db0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
12dc0 20 2b 20 63 6f 6c 30 20 2d 20 2b 20 74 61 62 32   + col0 - + tab2
12dd0 2e 63 6f 6c 32 20 2a 20 74 61 62 32 2e 63 6f 6c  .col2 * tab2.col
12de0 32 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d  2 FROM tab2..---
12df0 2d 0d 0a 2d 31 33 36 35 0d 0a 2d 35 39 38 0d 0a  -..-1365..-598..
12e00 2d 37 32 32 0d 0a 0d 0a 73 6b 69 70 69 66 20 70  -722....skipif p
12e10 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74  ostgresql # Post
12e20 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20  greSQL requires 
12e30 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67  AS when renaming
12e40 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d   output columns.
12e50 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
12e60 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 32 20 2d 20  ..SELECT col2 - 
12e70 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c 32 20 63 6f  col1 * + col2 co
12e80 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l0 FROM tab2 AS 
12e90 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 35 30  cor0..----..-150
12ea0 38 0d 0a 2d 36 30 38 0d 0a 2d 38 31 30 0d 0a 0d  8..-608..-810...
12eb0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
12ec0 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63  ..SELECT ALL + c
12ed0 6f 6c 30 20 2a 20 2b 20 63 6f 6c 30 20 2b 20 2b  ol0 * + col0 + +
12ee0 20 74 61 62 31 2e 63 6f 6c 30 20 46 52 4f 4d 20   tab1.col0 FROM 
12ef0 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 32 0d 0a  tab1..----..12..
12f00 34 31 36 30 0d 0a 36 34 38 30 0d 0a 0d 0a 71 75  4160..6480....qu
12f10 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
12f20 45 4c 45 43 54 20 41 4c 4c 20 2d 20 74 61 62 32  ELECT ALL - tab2
12f30 2e 63 6f 6c 31 20 2a 20 63 6f 6c 30 20 2d 20 2b  .col1 * col0 - +
12f40 20 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c 30 20 46   col2 * + col0 F
12f50 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab2..----..
12f60 2d 34 30 36 0d 0a 2d 34 33 34 35 0d 0a 2d 36 36  -406..-4345..-66
12f70 33 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  30....query I ro
12f80 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
12f90 74 61 62 32 2e 63 6f 6c 30 20 2a 20 2d 20 74 61  tab2.col0 * - ta
12fa0 62 32 2e 63 6f 6c 31 20 2b 20 2b 20 63 6f 6c 30  b2.col1 + + col0
12fb0 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
12fc0 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 34 32 32 0d 0a  b2..----..1422..
12fd0 32 32 34 0d 0a 34 36 38 30 0d 0a 0d 0a 71 75 65  224..4680....que
12fe0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
12ff0 4c 45 43 54 20 2d 20 63 6f 6c 32 20 2a 20 2b 20  LECT - col2 * + 
13000 63 6f 6c 32 20 2a 20 2b 20 74 61 62 30 2e 63 6f  col2 * + tab0.co
13010 6c 32 20 2b 20 63 6f 6c 32 20 46 52 4f 4d 20 74  l2 + col2 FROM t
13020 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 35 39 30  ab0..----..-3590
13030 34 0d 0a 2d 35 35 31 32 38 36 0d 0a 30 0d 0a 0d  4..-551286..0...
13040 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
13050 0d 0a 53 45 4c 45 43 54 20 2b 20 2d 20 63 6f 6c  ..SELECT + - col
13060 30 20 2b 20 2b 20 38 20 41 53 20 63 6f 6c 32 20  0 + + 8 AS col2 
13070 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
13080 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 36 0d 0a 2d 32  0..----..-16..-2
13090 37 0d 0a 2d 38 31 0d 0a 0d 0a 71 75 65 72 79 20  7..-81....query 
130a0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
130b0 54 20 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c 32 20  T col0 * - col2 
130c0 2b 20 28 20 63 6f 72 30 2e 63 6f 6c 30 20 2b 20  + ( cor0.col0 + 
130d0 63 6f 6c 31 20 29 20 2a 20 28 20 2b 20 38 36 20  col1 ) * ( + 86 
130e0 29 20 2a 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61  ) * col2 FROM ta
130f0 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
13100 0d 0a 31 31 33 31 37 0d 0a 31 32 36 32 30 36 32  ..11317..1262062
13110 0d 0a 33 31 31 33 38 38 0d 0a 0d 0a 71 75 65 72  ..311388....quer
13120 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
13130 45 43 54 20 41 4c 4c 20 28 20 2b 20 63 6f 6c 32  ECT ALL ( + col2
13140 20 29 20 2a 20 2b 20 63 6f 6c 32 20 46 52 4f 4d   ) * + col2 FROM
13150 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 0d 0a   tab0..----..1..
13160 31 30 38 39 0d 0a 36 37 32 34 0d 0a 0d 0a 71 75  1089..6724....qu
13170 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
13180 45 4c 45 43 54 20 63 6f 6c 30 20 2a 20 2b 20 32  ELECT col0 * + 2
13190 35 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 41 53  5 + cor0.col0 AS
131a0 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20   col1 FROM tab0 
131b0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32  AS cor0..----..2
131c0 33 31 34 0d 0a 36 32 34 0d 0a 39 31 30 0d 0a 0d  314..624..910...
131d0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
131e0 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
131f0 54 20 2d 20 63 6f 6c 32 20 2a 20 2b 20 28 20 63  T - col2 * + ( c
13200 6f 6c 32 20 29 20 46 52 4f 4d 20 74 61 62 31 20  ol2 ) FROM tab1 
13210 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 39 31  cor0..----..-291
13220 36 0d 0a 2d 33 32 34 39 0d 0a 2d 39 32 31 36 0d  6..-3249..-9216.
13230 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
13240 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c  rt..SELECT + col
13250 32 20 2a 20 38 36 20 2b 20 2b 20 28 20 2b 20 63  2 * 86 + + ( + c
13260 6f 6c 32 20 29 20 46 52 4f 4d 20 74 61 62 32 20  ol2 ) FROM tab2 
13270 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32  AS cor0..----..2
13280 32 36 32 0d 0a 32 33 34 39 0d 0a 33 33 30 36 0d  262..2349..3306.
13290 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
132a0 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b  rt..SELECT ALL +
132b0 20 2d 20 63 6f 72 30 2e 63 6f 6c 31 20 2a 20 63   - cor0.col1 * c
132c0 6f 6c 30 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f  ol0 + col0 AS co
132d0 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l0 FROM tab0 AS 
132e0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 30 34  cor0..----..-204
132f0 30 0d 0a 2d 33 33 36 30 0d 0a 2d 38 30 31 30 0d  0..-3360..-8010.
13300 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
13310 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 32 20  rt..SELECT col2 
13320 2a 20 33 35 20 46 52 4f 4d 20 74 61 62 32 20 41  * 35 FROM tab2 A
13330 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33  S cor0..----..13
13340 33 30 0d 0a 39 31 30 0d 0a 39 34 35 0d 0a 0d 0a  30..910..945....
13350 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
13360 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
13370 20 63 6f 6c 31 20 2b 20 63 6f 6c 31 20 2a 20 31   col1 + col1 * 1
13380 35 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  5 AS col1 FROM t
13390 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 36 30 0d 0a  ab1..----..160..
133a0 32 30 38 0d 0a 34 31 36 0d 0a 0d 0a 6f 6e 6c 79  208..416....only
133b0 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44  if mysql # use D
133c0 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20  IV operator for 
133d0 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e  integer division
133e0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
133f0 74 20 6c 61 62 65 6c 2d 35 33 36 0d 0a 53 45 4c  t label-536..SEL
13400 45 43 54 20 2d 20 63 6f 6c 32 20 44 49 56 20 2b  ECT - col2 DIV +
13410 20 28 20 63 6f 6c 30 20 29 20 2b 20 63 6f 6c 31   ( col0 ) + col1
13420 20 2a 20 43 41 53 54 28 20 63 6f 6c 31 20 41 53   * CAST( col1 AS
13430 20 53 49 47 4e 45 44 20 29 20 2a 20 2d 20 63 6f   SIGNED ) * - co
13440 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l2 FROM tab2 AS 
13450 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 39  cor0..----..-109
13460 38 32 0d 0a 2d 32 35 39 35 30 0d 0a 2d 39 30 35  82..-25950..-905
13470 30 36 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  06....skipif mys
13480 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
13490 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
134a0 73 6f 72 74 20 6c 61 62 65 6c 2d 35 33 36 0d 0a  sort label-536..
134b0 53 45 4c 45 43 54 20 2d 20 63 6f 6c 32 20 2f 20  SELECT - col2 / 
134c0 2b 20 28 20 63 6f 6c 30 20 29 20 2b 20 63 6f 6c  + ( col0 ) + col
134d0 31 20 2a 20 43 41 53 54 20 28 20 63 6f 6c 31 20  1 * CAST ( col1 
134e0 41 53 20 49 4e 54 45 47 45 52 20 29 20 2a 20 2d  AS INTEGER ) * -
134f0 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20   col2 FROM tab2 
13500 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
13510 31 30 39 38 32 0d 0a 2d 32 35 39 35 30 0d 0a 2d  10982..-25950..-
13520 39 30 35 30 36 0d 0a 0d 0a 71 75 65 72 79 20 49  90506....query I
13530 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
13540 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 32 20 2a   DISTINCT col2 *
13550 20 2b 20 31 34 20 46 52 4f 4d 20 74 61 62 32 0d   + 14 FROM tab2.
13560 0a 2d 2d 2d 2d 0d 0a 33 36 34 0d 0a 33 37 38 0d  .----..364..378.
13570 0a 35 33 32 0d 0a 0d 0a 73 6b 69 70 69 66 20 70  .532....skipif p
13580 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74  ostgresql # Post
13590 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20  greSQL requires 
135a0 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67  AS when renaming
135b0 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d   output columns.
135c0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
135d0 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
135e0 54 20 2d 20 63 6f 72 30 2e 63 6f 6c 31 20 63 6f  T - cor0.col1 co
135f0 6c 30 20 46 52 4f 4d 20 74 61 62 30 2c 20 74 61  l0 FROM tab0, ta
13600 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
13610 0d 0a 2d 31 30 0d 0a 2d 31 33 0d 0a 2d 32 36 0d  ..-10..-13..-26.
13620 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
13630 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
13640 4e 43 54 20 2b 20 2d 20 63 6f 72 30 2e 63 6f 6c  NCT + - cor0.col
13650 30 20 2a 20 2b 20 63 6f 6c 32 20 41 53 20 63 6f  0 * + col2 AS co
13660 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l2 FROM tab0 AS 
13670 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 35 0d  cor0..----..-35.
13680 0a 2d 37 32 39 38 0d 0a 2d 37 39 32 0d 0a 0d 0a  .-7298..-792....
13690 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
136a0 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
136b0 20 2d 20 63 6f 6c 30 20 2a 20 2b 20 32 30 20 41   - col0 * + 20 A
136c0 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31  S col1 FROM tab1
136d0 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32 38 30 0d 0a 2d  ..----..-1280..-
136e0 31 36 30 30 0d 0a 2d 36 30 0d 0a 0d 0a 71 75 65  1600..-60....que
136f0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
13700 4c 45 43 54 20 2d 20 2b 20 63 6f 72 30 2e 63 6f  LECT - + cor0.co
13710 6c 30 20 2a 20 2b 20 63 6f 72 30 2e 63 6f 6c 31  l0 * + cor0.col1
13720 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
13730 72 30 20 43 52 4f 53 53 20 4a 4f 49 4e 20 74 61  r0 CROSS JOIN ta
13740 62 31 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d  b1 AS cor1..----
13750 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68 69  ..9 values hashi
13760 6e 67 20 74 6f 20 37 35 61 36 30 38 62 66 32 62  ng to 75a608bf2b
13770 61 32 33 36 64 32 34 66 31 34 36 61 63 34 61 66  a236d24f146ac4af
13780 66 39 65 63 35 32 0d 0a 0d 0a 71 75 65 72 79 20  f9ec52....query 
13790 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
137a0 54 20 41 4c 4c 20 2d 20 33 33 20 2b 20 63 6f 72  T ALL - 33 + cor
137b0 30 2e 63 6f 6c 32 20 2a 20 63 6f 72 30 2e 63 6f  0.col2 * cor0.co
137c0 6c 32 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  l2 AS col1 FROM 
137d0 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
137e0 2d 2d 0d 0a 2d 33 32 0d 0a 31 30 35 36 0d 0a 36  --..-32..1056..6
137f0 36 39 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  691....query I r
13800 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
13810 20 28 20 63 6f 6c 30 20 29 20 2b 20 63 6f 6c 32   ( col0 ) + col2
13820 20 2a 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62   * col0 FROM tab
13830 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
13840 0a 31 39 36 0d 0a 32 31 30 36 0d 0a 33 30 38 31  .196..2106..3081
13850 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
13860 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
13870 49 4e 43 54 20 2b 20 33 36 20 2a 20 2d 20 63 6f  INCT + 36 * - co
13880 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l2 FROM tab2 AS 
13890 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 36  cor0..----..-136
138a0 38 0d 0a 2d 39 33 36 0d 0a 2d 39 37 32 0d 0a 0d  8..-936..-972...
138b0 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
138c0 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72  use DIV operator
138d0 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76   for integer div
138e0 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72  ision..query I r
138f0 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 35 34 35  owsort label-545
13900 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 30 20  ..SELECT - col0 
13910 2b 20 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c 31 20  + col1 * + col1 
13920 44 49 56 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61  DIV col1 FROM ta
13930 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
13940 0d 0a 32 0d 0a 36 32 0d 0a 36 32 0d 0a 0d 0a 73  ..2..62..62....s
13950 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
13960 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
13970 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
13980 62 65 6c 2d 35 34 35 0d 0a 53 45 4c 45 43 54 20  bel-545..SELECT 
13990 2d 20 63 6f 6c 30 20 2b 20 63 6f 6c 31 20 2a 20  - col0 + col1 * 
139a0 2b 20 63 6f 6c 31 20 2f 20 63 6f 6c 31 20 46 52  + col1 / col1 FR
139b0 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
139c0 0a 2d 2d 2d 2d 0d 0a 32 0d 0a 36 32 0d 0a 36 32  .----..2..62..62
139d0 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
139e0 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61   # use DIV opera
139f0 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20  tor for integer 
13a00 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20  division..query 
13a10 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
13a20 35 34 36 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  546..SELECT ALL 
13a30 2b 20 2d 20 34 34 20 44 49 56 20 63 6f 6c 30 20  + - 44 DIV col0 
13a40 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
13a50 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 36 0d 0a 30 0d 0a  0..----..-6..0..
13a60 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  0....skipif mysq
13a70 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
13a80 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
13a90 6f 72 74 20 6c 61 62 65 6c 2d 35 34 36 0d 0a 53  ort label-546..S
13aa0 45 4c 45 43 54 20 41 4c 4c 20 2b 20 2d 20 34 34  ELECT ALL + - 44
13ab0 20 2f 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62   / col0 FROM tab
13ac0 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
13ad0 0a 2d 36 0d 0a 30 0d 0a 30 0d 0a 0d 0a 71 75 65  .-6..0..0....que
13ae0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
13af0 4c 45 43 54 20 41 4c 4c 20 39 36 20 46 52 4f 4d  LECT ALL 96 FROM
13b00 20 74 61 62 32 2c 20 74 61 62 32 20 41 53 20 63   tab2, tab2 AS c
13b10 6f 72 30 2c 20 74 61 62 32 20 41 53 20 63 6f 72  or0, tab2 AS cor
13b20 31 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75  1..----..27 valu
13b30 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 66 31  es hashing to f1
13b40 64 39 37 38 63 32 64 35 62 66 63 36 66 32 36 65  d978c2d5bfc6f26e
13b50 30 39 30 37 61 63 37 37 37 62 65 38 33 65 0d 0a  0907ac777be83e..
13b60 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
13b70 74 0d 0a 53 45 4c 45 43 54 20 2d 20 37 30 20 2a  t..SELECT - 70 *
13b80 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 41 53 20   - cor0.col2 AS 
13b90 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 63  col1 FROM tab1 c
13ba0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 37 38 30 0d  or0..----..3780.
13bb0 0a 33 39 39 30 0d 0a 36 37 32 30 0d 0a 0d 0a 71  .3990..6720....q
13bc0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
13bd0 53 45 4c 45 43 54 20 2b 20 32 30 20 2a 20 2d 20  SELECT + 20 * - 
13be0 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41  col2 FROM tab2 A
13bf0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 35  S cor0..----..-5
13c00 32 30 0d 0a 2d 35 34 30 0d 0a 2d 37 36 30 0d 0a  20..-540..-760..
13c10 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
13c20 74 0d 0a 53 45 4c 45 43 54 20 2d 20 37 31 20 2b  t..SELECT - 71 +
13c30 20 2b 20 63 6f 6c 32 20 2a 20 63 6f 6c 30 20 2a   + col2 * col0 *
13c40 20 2d 20 33 20 41 53 20 63 6f 6c 30 20 46 52 4f   - 3 AS col0 FRO
13c50 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
13c60 2d 2d 2d 2d 0d 0a 2d 31 37 36 0d 0a 2d 32 31 39  ----..-176..-219
13c70 36 35 0d 0a 2d 32 34 34 37 0d 0a 0d 0a 71 75 65  65..-2447....que
13c80 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
13c90 4c 45 43 54 20 41 4c 4c 20 2d 20 74 61 62 32 2e  LECT ALL - tab2.
13ca0 63 6f 6c 30 20 2a 20 28 20 2b 20 63 6f 6c 30 20  col0 * ( + col0 
13cb0 29 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d  ) FROM tab2..---
13cc0 2d 0d 0a 2d 34 39 0d 0a 2d 36 30 38 34 0d 0a 2d  -..-49..-6084..-
13cd0 36 32 34 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20  6241....query I 
13ce0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
13cf0 44 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c 31 20  DISTINCT + col1 
13d00 2a 20 28 20 2d 20 63 6f 6c 32 20 29 20 2a 20 2d  * ( - col2 ) * -
13d10 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46 52   col0 AS col0 FR
13d20 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 33  OM tab0..----..3
13d30 33 39 35 0d 0a 36 36 34 31 31 38 0d 0a 36 38 31  395..664118..681
13d40 31 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  12....query I ro
13d50 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 28 20  wsort..SELECT ( 
13d60 2b 20 33 37 20 29 20 46 52 4f 4d 20 74 61 62 30  + 37 ) FROM tab0
13d70 2c 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  , tab0 AS cor0..
13d80 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68  ----..9 values h
13d90 61 73 68 69 6e 67 20 74 6f 20 61 31 30 62 30 33  ashing to a10b03
13da0 65 37 32 38 36 30 62 39 34 39 62 64 66 66 35 33  e72860b949bdff53
13db0 38 32 37 37 30 30 61 39 61 38 0d 0a 0d 0a 6f 6e  827700a9a8....on
13dc0 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70  lyif mysql # sup
13dd0 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73  port for MySQL s
13de0 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20 74  pecific system t
13df0 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d  ypes and syntax.
13e00 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
13e10 20 6c 61 62 65 6c 2d 35 35 34 0d 0a 53 45 4c 45   label-554..SELE
13e20 43 54 20 41 4c 4c 20 43 41 53 54 28 20 4e 55 4c  CT ALL CAST( NUL
13e30 4c 20 41 53 20 53 49 47 4e 45 44 20 29 20 2a 20  L AS SIGNED ) * 
13e40 74 61 62 30 2e 63 6f 6c 32 20 2a 20 63 6f 6c 31  tab0.col2 * col1
13e50 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d   FROM tab0..----
13e60 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55  ..NULL..NULL..NU
13e70 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  LL....skipif mys
13e80 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
13e90 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
13ea0 73 6f 72 74 20 6c 61 62 65 6c 2d 35 35 34 0d 0a  sort label-554..
13eb0 53 45 4c 45 43 54 20 41 4c 4c 20 43 41 53 54 20  SELECT ALL CAST 
13ec0 28 20 4e 55 4c 4c 20 41 53 20 49 4e 54 45 47 45  ( NULL AS INTEGE
13ed0 52 20 29 20 2a 20 74 61 62 30 2e 63 6f 6c 32 20  R ) * tab0.col2 
13ee0 2a 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30  * col1 FROM tab0
13ef0 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55  ..----..NULL..NU
13f00 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75 65 72  LL..NULL....quer
13f10 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
13f20 45 43 54 20 2b 20 2b 20 63 6f 6c 31 20 2b 20 2b  ECT + + col1 + +
13f30 20 63 6f 6c 30 20 2a 20 63 6f 6c 31 20 41 53 20   col0 * col1 AS 
13f40 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 63  col2 FROM tab0 c
13f50 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 31 35 30 0d  or0..----..2150.
13f60 0a 33 34 39 32 0d 0a 38 31 39 30 0d 0a 0d 0a 71  .3492..8190....q
13f70 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
13f80 53 45 4c 45 43 54 20 2b 20 2b 20 36 38 20 2a 20  SELECT + + 68 * 
13f90 2b 20 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46  + col2 AS col1 F
13fa0 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d  ROM tab1 cor0..-
13fb0 2d 2d 2d 0d 0a 33 36 37 32 0d 0a 33 38 37 36 0d  ---..3672..3876.
13fc0 0a 36 35 32 38 0d 0a 0d 0a 71 75 65 72 79 20 49  .6528....query I
13fd0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
13fe0 20 2d 20 2d 20 63 6f 6c 30 20 2a 20 63 6f 6c 32   - - col0 * col2
13ff0 20 2b 20 2b 20 63 6f 6c 31 20 2a 20 2d 20 63 6f   + + col1 * - co
14000 6c 30 20 2b 20 37 36 20 2a 20 63 6f 6c 32 20 41  l0 + 76 * col2 A
14010 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32  S col2 FROM tab2
14020 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
14030 2d 35 39 38 0d 0a 32 30 32 34 0d 0a 34 35 34 37  -598..2024..4547
14040 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67  ....skipif postg
14050 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53  resql # PostgreS
14060 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77  QL requires AS w
14070 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74  hen renaming out
14080 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 73 6b 69  put columns..ski
14090 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
140a0 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
140b0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
140c0 45 43 54 20 2d 20 2d 20 43 41 53 54 20 28 20 2d  ECT - - CAST ( -
140d0 20 63 6f 6c 30 20 41 53 20 52 45 41 4c 20 29 20   col0 AS REAL ) 
140e0 2a 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 63 6f  * + cor0.col2 co
140f0 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l1 FROM tab2 AS 
14100 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 38 39  cor0..----..-189
14110 0d 0a 2d 32 30 32 38 0d 0a 2d 33 30 30 32 0d 0a  ..-2028..-3002..
14120 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
14130 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f   use DIV operato
14140 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69  r for integer di
14150 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20  vision..query I 
14160 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 35 35  rowsort label-55
14170 39 0d 0a 53 45 4c 45 43 54 20 2d 20 35 39 20 44  9..SELECT - 59 D
14180 49 56 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 41  IV + cor0.col2 A
14190 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32  S col1 FROM tab2
141a0 2c 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  , tab1 AS cor0..
141b0 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68  ----..9 values h
141c0 61 73 68 69 6e 67 20 74 6f 20 62 32 65 32 32 35  ashing to b2e225
141d0 35 37 32 61 66 37 34 62 61 38 35 33 65 31 30 66  572af74ba853e10f
141e0 62 35 34 31 34 65 61 36 37 66 0d 0a 0d 0a 73 6b  b5414ea67f....sk
141f0 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
14200 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
14210 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
14220 65 6c 2d 35 35 39 0d 0a 53 45 4c 45 43 54 20 2d  el-559..SELECT -
14230 20 35 39 20 2f 20 2b 20 63 6f 72 30 2e 63 6f 6c   59 / + cor0.col
14240 32 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  2 AS col1 FROM t
14250 61 62 32 2c 20 74 61 62 31 20 41 53 20 63 6f 72  ab2, tab1 AS cor
14260 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65  0..----..9 value
14270 73 20 68 61 73 68 69 6e 67 20 74 6f 20 62 32 65  s hashing to b2e
14280 32 32 35 35 37 32 61 66 37 34 62 61 38 35 33 65  225572af74ba853e
14290 31 30 66 62 35 34 31 34 65 61 36 37 66 0d 0a 0d  10fb5414ea67f...
142a0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
142b0 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 30 20  ..SELECT - col0 
142c0 2a 20 63 6f 72 30 2e 63 6f 6c 30 20 2a 20 63 6f  * cor0.col0 * co
142d0 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l1 FROM tab1 AS 
142e0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 33 34  cor0..----..-234
142f0 0d 0a 2d 34 30 39 36 30 0d 0a 2d 38 33 32 30 30  ..-40960..-83200
14300 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
14310 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f  ort..SELECT - co
14320 6c 32 20 2b 20 63 6f 6c 31 20 2a 20 28 20 2d 20  l2 + col1 * ( - 
14330 34 32 20 29 20 2b 20 63 6f 6c 31 20 46 52 4f 4d  42 ) + col1 FROM
14340 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
14350 2d 2d 2d 0d 0a 2d 33 35 35 39 0d 0a 2d 33 38 31  ---..-3559..-381
14360 33 0d 0a 2d 33 39 37 38 0d 0a 0d 0a 71 75 65 72  3..-3978....quer
14370 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
14380 45 43 54 20 2b 20 2d 20 63 6f 72 30 2e 63 6f 6c  ECT + - cor0.col
14390 30 20 2b 20 39 37 20 41 53 20 63 6f 6c 30 20 46  0 + 97 AS col0 F
143a0 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
143b0 0d 0a 2d 2d 2d 2d 0d 0a 31 38 0d 0a 31 39 0d 0a  ..----..18..19..
143c0 39 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  90....query I ro
143d0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
143e0 4c 20 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c 31 20  L col0 + + col1 
143f0 2b 20 32 37 20 2a 20 2d 20 63 6f 6c 32 20 46 52  + 27 * - col2 FR
14400 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d  OM tab2..----..-
14410 35 36 35 0d 0a 2d 36 39 31 0d 0a 2d 39 33 30 0d  565..-691..-930.
14420 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
14430 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
14440 4e 43 54 20 2b 20 63 6f 6c 30 20 2b 20 2d 20 63  NCT + col0 + - c
14450 6f 6c 32 20 2b 20 2d 20 63 6f 6c 30 20 41 53 20  ol2 + - col0 AS 
14460 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a  col1 FROM tab0..
14470 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 2d 33 33 0d 0a 2d  ----..-1..-33..-
14480 38 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  82....query I ro
14490 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
144a0 63 6f 6c 31 20 2b 20 2b 20 63 6f 6c 30 20 2a 20  col1 + + col0 * 
144b0 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 46 52 4f 4d  + cor0.col1 FROM
144c0 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
144d0 2d 2d 2d 0d 0a 31 30 32 37 0d 0a 35 32 0d 0a 36  ---..1027..52..6
144e0 33 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  30....onlyif mys
144f0 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65  ql # use DIV ope
14500 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65  rator for intege
14510 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72  r division..quer
14520 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
14530 6c 2d 35 36 36 0d 0a 53 45 4c 45 43 54 20 2b 20  l-566..SELECT + 
14540 63 6f 6c 30 20 44 49 56 20 39 31 20 2b 20 2b 20  col0 DIV 91 + + 
14550 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41  col0 FROM tab1 A
14560 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 0d  S cor0..----..3.
14570 0a 36 34 0d 0a 38 30 0d 0a 0d 0a 73 6b 69 70 69  .64..80....skipi
14580 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
14590 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
145a0 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
145b0 35 36 36 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f  566..SELECT + co
145c0 6c 30 20 2f 20 39 31 20 2b 20 2b 20 63 6f 6c 30  l0 / 91 + + col0
145d0 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
145e0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 0d 0a 36 34 0d  r0..----..3..64.
145f0 0a 38 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .80....query I r
14600 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
14610 20 63 6f 6c 31 20 2a 20 2b 20 28 20 2d 20 63 6f   col1 * + ( - co
14620 6c 32 20 29 20 41 53 20 63 6f 6c 32 20 46 52 4f  l2 ) AS col2 FRO
14630 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
14640 2d 2d 2d 2d 0d 0a 32 38 33 38 0d 0a 37 34 36 32  ----..2838..7462
14650 0d 0a 39 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..97....query I 
14660 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
14670 44 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c 30 20  DISTINCT + col0 
14680 2b 20 2d 20 63 6f 72 30 2e 63 6f 6c 30 20 2a 20  + - cor0.col0 * 
14690 37 39 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  79 FROM tab2 AS 
146a0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 34 36  cor0..----..-546
146b0 0d 0a 2d 36 30 38 34 0d 0a 2d 36 31 36 32 0d 0a  ..-6084..-6162..
146c0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
146d0 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20  t..SELECT ALL + 
146e0 2b 20 33 30 20 2a 20 2d 20 63 6f 6c 31 20 41 53  + 30 * - col1 AS
146f0 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20   col2 FROM tab1 
14700 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
14710 33 30 30 0d 0a 2d 33 39 30 0d 0a 2d 37 38 30 0d  300..-390..-780.
14720 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
14730 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c  rt..SELECT - col
14740 31 20 2a 20 63 6f 72 30 2e 63 6f 6c 30 20 2b 20  1 * cor0.col0 + 
14750 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46 52 4f  col2 AS col2 FRO
14760 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
14770 2d 2d 2d 2d 0d 0a 2d 31 33 30 35 0d 0a 2d 31 39  ----..-1305..-19
14780 30 0d 0a 2d 34 35 37 36 0d 0a 0d 0a 71 75 65 72  0..-4576....quer
14790 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
147a0 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63  ECT DISTINCT + c
147b0 6f 6c 30 20 2b 20 2b 20 63 6f 72 30 2e 63 6f 6c  ol0 + + cor0.col
147c0 30 20 2a 20 2b 20 39 35 20 46 52 4f 4d 20 74 61  0 * + 95 FROM ta
147d0 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
147e0 0d 0a 32 33 30 34 0d 0a 33 33 36 30 0d 0a 38 35  ..2304..3360..85
147f0 34 34 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73  44....skipif pos
14800 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72  tgresql # Postgr
14810 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53  eSQL requires AS
14820 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f   when renaming o
14830 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71  utput columns..q
14840 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
14850 53 45 4c 45 43 54 20 63 6f 72 30 2e 63 6f 6c 32  SELECT cor0.col2
14860 20 2b 20 63 6f 6c 30 20 2a 20 2d 20 28 20 63 6f   + col0 * - ( co
14870 6c 30 20 29 20 63 6f 6c 30 20 46 52 4f 4d 20 74  l0 ) col0 FROM t
14880 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
14890 2d 0d 0a 2d 32 32 0d 0a 2d 36 30 35 38 0d 0a 2d  -..-22..-6058..-
148a0 36 32 30 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20  6203....query I 
148b0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
148c0 41 4c 4c 20 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c  ALL col2 * - col
148d0 32 20 2b 20 63 6f 6c 32 20 2d 20 2b 20 63 6f 6c  2 + col2 - + col
148e0 32 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  2 AS col0 FROM t
148f0 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab1 cor0..----..
14900 2d 32 39 31 36 0d 0a 2d 33 32 34 39 0d 0a 2d 39  -2916..-3249..-9
14910 32 31 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  216....query I r
14920 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
14930 4c 4c 20 39 37 20 41 53 20 63 6f 6c 32 20 46 52  LL 97 AS col2 FR
14940 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
14950 0a 2d 2d 2d 2d 0d 0a 39 37 0d 0a 39 37 0d 0a 39  .----..97..97..9
14960 37 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  7....onlyif mysq
14970 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72  l # use DIV oper
14980 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72  ator for integer
14990 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79   division..query
149a0 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
149b0 2d 35 37 35 0d 0a 53 45 4c 45 43 54 20 44 49 53  -575..SELECT DIS
149c0 54 49 4e 43 54 20 2d 20 2b 20 34 38 20 2a 20 63  TINCT - + 48 * c
149d0 6f 72 30 2e 63 6f 6c 31 20 2b 20 34 20 44 49 56  or0.col1 + 4 DIV
149e0 20 63 6f 6c 31 20 2b 20 2b 20 63 6f 6c 31 20 41   col1 + + col1 A
149f0 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30  S col2 FROM tab0
14a00 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
14a10 2d 34 30 34 32 0d 0a 2d 34 32 37 37 0d 0a 2d 34  -4042..-4277..-4
14a20 35 35 39 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  559....skipif my
14a30 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
14a40 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
14a50 77 73 6f 72 74 20 6c 61 62 65 6c 2d 35 37 35 0d  wsort label-575.
14a60 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
14a70 20 2d 20 2b 20 34 38 20 2a 20 63 6f 72 30 2e 63   - + 48 * cor0.c
14a80 6f 6c 31 20 2b 20 34 20 2f 20 63 6f 6c 31 20 2b  ol1 + 4 / col1 +
14a90 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20   + col1 AS col2 
14aa0 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
14ab0 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 30 34 32 0d 0a  0..----..-4042..
14ac0 2d 34 32 37 37 0d 0a 2d 34 35 35 39 0d 0a 0d 0a  -4277..-4559....
14ad0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
14ae0 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
14af0 20 28 20 63 6f 72 30 2e 63 6f 6c 31 20 29 20 2b   ( cor0.col1 ) +
14b00 20 2b 20 63 6f 6c 31 20 2a 20 63 6f 6c 30 20 2a   + col1 * col0 *
14b10 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20   col2 FROM tab0 
14b20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33  AS cor0..----..3
14b30 34 39 32 0d 0a 36 36 34 32 30 39 0d 0a 36 38 31  492..664209..681
14b40 39 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  98....query I ro
14b50 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
14b60 2b 20 32 35 20 2a 20 63 6f 6c 30 20 2a 20 63 6f  + 25 * col0 * co
14b70 6c 32 20 2b 20 2b 20 63 6f 6c 32 20 46 52 4f 4d  l2 + + col2 FROM
14b80 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
14b90 2d 2d 2d 0d 0a 31 38 32 35 33 32 0d 0a 31 39 38  ---..182532..198
14ba0 33 33 0d 0a 38 37 36 0d 0a 0d 0a 71 75 65 72 79  33..876....query
14bb0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
14bc0 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 2d 20  CT DISTINCT + - 
14bd0 38 36 20 2a 20 63 6f 6c 32 20 2b 20 2d 20 63 6f  86 * col2 + - co
14be0 72 30 2e 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20  r0.col0 AS col0 
14bf0 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
14c00 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 33 31 34 0d 0a  0..----..-2314..
14c10 2d 32 33 32 39 0d 0a 2d 33 33 34 37 0d 0a 0d 0a  -2329..-3347....
14c20 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
14c30 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f  .SELECT ALL + co
14c40 6c 31 20 2d 20 2b 20 63 6f 72 30 2e 63 6f 6c 32  l1 - + cor0.col2
14c50 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
14c60 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
14c70 0d 0a 2d 32 38 0d 0a 2d 34 37 0d 0a 2d 38 33 0d  ..-28..-47..-83.
14c80 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
14c90 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74  # use DIV operat
14ca0 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64  or for integer d
14cb0 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49  ivision..query I
14cc0 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 35   rowsort label-5
14cd0 38 30 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63  80..SELECT ALL c
14ce0 6f 6c 31 20 44 49 56 20 2d 20 35 33 20 63 6f 6c  ol1 DIV - 53 col
14cf0 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  0 FROM tab0 AS c
14d00 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 2d  or0..----..-1..-
14d10 31 0d 0a 2d 31 0d 0a 0d 0a 73 6b 69 70 69 66 20  1..-1....skipif 
14d20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73  postgresql # Pos
14d30 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73  tgreSQL requires
14d40 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e   AS when renamin
14d50 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73  g output columns
14d60 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
14d70 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
14d80 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
14d90 20 6c 61 62 65 6c 2d 35 38 30 0d 0a 53 45 4c 45   label-580..SELE
14da0 43 54 20 41 4c 4c 20 63 6f 6c 31 20 2f 20 2d 20  CT ALL col1 / - 
14db0 35 33 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  53 col0 FROM tab
14dc0 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
14dd0 0a 2d 31 0d 0a 2d 31 0d 0a 2d 31 0d 0a 0d 0a 71  .-1..-1..-1....q
14de0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
14df0 53 45 4c 45 43 54 20 2b 20 63 6f 6c 31 20 2b 20  SELECT + col1 + 
14e00 35 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  51 FROM tab0 AS 
14e10 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33 37 0d  cor0..----..137.
14e20 0a 31 34 32 0d 0a 31 34 38 0d 0a 0d 0a 71 75 65  .142..148....que
14e30 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
14e40 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f  LECT DISTINCT co
14e50 72 30 2e 63 6f 6c 32 20 2b 20 31 30 20 46 52 4f  r0.col2 + 10 FRO
14e60 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
14e70 2d 2d 2d 2d 0d 0a 31 31 0d 0a 34 33 0d 0a 39 32  ----..11..43..92
14e80 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67  ....skipif postg
14e90 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53  resql # PostgreS
14ea0 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77  QL requires AS w
14eb0 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74  hen renaming out
14ec0 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65  put columns..que
14ed0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
14ee0 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20  LECT DISTINCT - 
14ef0 2b 20 63 6f 6c 30 20 2b 20 2b 20 31 37 20 63 6f  + col0 + + 17 co
14f00 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l1 FROM tab0 AS 
14f10 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 38 0d  cor0..----..-18.
14f20 0a 2d 37 0d 0a 2d 37 32 0d 0a 0d 0a 71 75 65 72  .-7..-72....quer
14f30 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
14f40 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 32 20 2a  ECT ALL - col2 *
14f50 20 63 6f 6c 30 20 2a 20 63 6f 6c 30 20 46 52 4f   col0 * col0 FRO
14f60 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
14f70 2d 2d 2d 2d 0d 0a 2d 32 33 33 34 37 32 0d 0a 2d  ----..-233472..-
14f80 34 38 36 0d 0a 2d 36 31 34 34 30 30 0d 0a 0d 0a  486..-614400....
14f90 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
14fa0 0a 53 45 4c 45 43 54 20 41 4c 4c 20 36 31 20 41  .SELECT ALL 61 A
14fb0 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32  S col0 FROM tab2
14fc0 2c 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d  , tab1 cor0..---
14fd0 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68  -..9 values hash
14fe0 69 6e 67 20 74 6f 20 30 37 31 34 39 39 30 35 61  ing to 07149905a
14ff0 37 32 62 64 38 37 35 35 33 33 38 31 66 33 34 64  72bd87553381f34d
15000 31 39 65 64 32 39 30 0d 0a 0d 0a 71 75 65 72 79  19ed290....query
15010 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
15020 43 54 20 28 20 63 6f 6c 32 20 29 20 2a 20 63 6f  CT ( col2 ) * co
15030 6c 32 20 2b 20 2b 20 63 6f 6c 32 20 2a 20 2b 20  l2 + + col2 * + 
15040 63 6f 6c 30 20 2b 20 63 6f 6c 32 20 41 53 20 63  col0 + col2 AS c
15050 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol1 FROM tab0 AS
15060 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 34 31   cor0..----..141
15070 30 34 0d 0a 31 39 31 34 0d 0a 33 37 0d 0a 0d 0a  04..1914..37....
15080 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73  onlyif mysql # s
15090 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c  upport for MySQL
150a0 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d   specific system
150b0 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61   types and synta
150c0 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  x..query I rowso
150d0 72 74 20 6c 61 62 65 6c 2d 35 38 37 0d 0a 53 45  rt label-587..SE
150e0 4c 45 43 54 20 2d 20 2b 20 43 41 53 54 28 20 2b  LECT - + CAST( +
150f0 20 63 6f 6c 30 20 41 53 20 53 49 47 4e 45 44 20   col0 AS SIGNED 
15100 29 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32  ) col0 FROM tab2
15110 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
15120 2d 37 0d 0a 2d 37 38 0d 0a 2d 37 39 0d 0a 0d 0a  -7..-78..-79....
15130 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71  skipif postgresq
15140 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72  l # PostgreSQL r
15150 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20  equires AS when 
15160 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20  renaming output 
15170 63 6f 6c 75 6d 6e 73 0d 0a 73 6b 69 70 69 66 20  columns..skipif 
15180 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
15190 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
151a0 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 35 38  rowsort label-58
151b0 37 0d 0a 53 45 4c 45 43 54 20 2d 20 2b 20 43 41  7..SELECT - + CA
151c0 53 54 20 28 20 2b 20 63 6f 6c 30 20 41 53 20 49  ST ( + col0 AS I
151d0 4e 54 45 47 45 52 20 29 20 63 6f 6c 30 20 46 52  NTEGER ) col0 FR
151e0 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
151f0 0a 2d 2d 2d 2d 0d 0a 2d 37 0d 0a 2d 37 38 0d 0a  .----..-7..-78..
15200 2d 37 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  -79....query I r
15210 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
15220 20 63 6f 6c 32 20 2a 20 2d 20 34 20 2b 20 63 6f   col2 * - 4 + co
15230 6c 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  l2 AS col2 FROM 
15240 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
15250 2d 2d 0d 0a 2d 31 31 34 0d 0a 2d 37 38 0d 0a 2d  --..-114..-78..-
15260 38 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  81....query I ro
15270 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
15280 53 54 49 4e 43 54 20 2b 20 36 33 20 41 53 20 63  STINCT + 63 AS c
15290 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 2c 20 74  ol2 FROM tab1, t
152a0 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
152b0 2d 0d 0a 36 33 0d 0a 0d 0a 71 75 65 72 79 20 49  -..63....query I
152c0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
152d0 20 2d 20 63 6f 72 30 2e 63 6f 6c 31 20 2b 20 31   - cor0.col1 + 1
152e0 20 2b 20 63 6f 6c 31 20 2a 20 63 6f 6c 30 20 46   + col1 * col0 F
152f0 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
15300 0d 0a 2d 2d 2d 2d 0d 0a 31 39 37 39 0d 0a 33 32  ..----..1979..32
15310 39 39 0d 0a 38 30 30 39 0d 0a 0d 0a 71 75 65 72  99..8009....quer
15320 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
15330 45 43 54 20 2b 20 63 6f 6c 32 20 2d 20 63 6f 6c  ECT + col2 - col
15340 31 20 2a 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61  1 * col0 FROM ta
15350 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 30 33 31 0d  b0..----..-2031.
15360 0a 2d 33 33 39 34 0d 0a 2d 38 30 31 37 0d 0a 0d  .-3394..-8017...
15370 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
15380 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 33 39 20  ..SELECT ALL 39 
15390 2a 20 33 32 20 2d 20 63 6f 6c 31 20 46 52 4f 4d  * 32 - col1 FROM
153a0 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 31 38   tab2..----..118
153b0 39 0d 0a 31 32 31 37 0d 0a 31 32 33 31 0d 0a 0d  9..1217..1231...
153c0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
153d0 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 32 20 2a 20  ..SELECT col2 * 
153e0 38 39 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d  89 FROM tab0..--
153f0 2d 2d 0d 0a 32 39 33 37 0d 0a 37 32 39 38 0d 0a  --..2937..7298..
15400 38 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  89....query I ro
15410 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
15420 53 54 49 4e 43 54 20 63 6f 6c 31 20 2b 20 2d 20  STINCT col1 + - 
15430 34 36 20 2d 20 2d 20 63 6f 6c 30 20 2a 20 34 34  46 - - col0 * 44
15440 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d   FROM tab0..----
15450 0d 0a 31 30 39 36 0d 0a 31 35 39 31 0d 0a 33 39  ..1096..1591..39
15460 36 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  61....query I ro
15470 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
15480 53 54 49 4e 43 54 20 2b 20 63 6f 6c 31 20 2a 20  STINCT + col1 * 
15490 35 36 20 2b 20 63 6f 6c 32 20 2b 20 63 6f 6c 31  56 + col2 + col1
154a0 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
154b0 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 35 33 36 0d 0a  b1..----..1536..
154c0 36 32 37 0d 0a 38 33 37 0d 0a 0d 0a 73 6b 69 70  627..837....skip
154d0 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20  if postgresql # 
154e0 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69  PostgreSQL requi
154f0 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61  res AS when rena
15500 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75  ming output colu
15510 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  mns..query I row
15520 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
15530 20 63 6f 6c 30 20 2a 20 2d 20 74 61 62 30 2e 63   col0 * - tab0.c
15540 6f 6c 31 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61  ol1 col1 FROM ta
15550 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 30 36 34 0d  b0..----..-2064.
15560 0a 2d 33 33 39 35 0d 0a 2d 38 30 39 39 0d 0a 0d  .-3395..-8099...
15570 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
15580 0d 0a 53 45 4c 45 43 54 20 28 20 63 6f 6c 30 20  ..SELECT ( col0 
15590 29 20 2a 20 2d 20 63 6f 6c 32 20 2b 20 36 39 20  ) * - col2 + 69 
155a0 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46  + col0 AS col0 F
155b0 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab2..----..
155c0 2d 31 31 33 0d 0a 2d 31 38 38 31 0d 0a 2d 32 38  -113..-1881..-28
155d0 35 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  54....query I ro
155e0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
155f0 63 6f 6c 31 20 2b 20 2d 20 33 20 2b 20 2b 20 63  col1 + - 3 + + c
15600 6f 6c 31 20 2a 20 74 61 62 30 2e 63 6f 6c 31 20  ol1 * tab0.col1 
15610 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d  FROM tab0..----.
15620 0a 37 33 30 37 0d 0a 38 31 38 37 0d 0a 39 33 30  .7307..8187..930
15630 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  9....query I row
15640 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
15650 54 49 4e 43 54 20 2b 20 28 20 63 6f 6c 31 20 29  TINCT + ( col1 )
15660 20 2b 20 2b 20 63 6f 6c 30 20 2a 20 2b 20 63 6f   + + col0 * + co
15670 6c 30 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  l0 AS col0 FROM 
15680 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 33 35 0d 0a  tab1..----..35..
15690 34 31 30 36 0d 0a 36 34 31 33 0d 0a 0d 0a 71 75  4106..6413....qu
156a0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
156b0 45 4c 45 43 54 20 2d 20 2b 20 63 6f 6c 30 20 2a  ELECT - + col0 *
156c0 20 2d 20 63 6f 6c 30 20 2b 20 2b 20 28 20 2b 20   - col0 + + ( + 
156d0 63 6f 6c 30 20 29 20 2d 20 2d 20 63 6f 6c 31 20  col0 ) - - col1 
156e0 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
156f0 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
15700 0a 36 32 32 31 0d 0a 36 33 33 37 0d 0a 38 37 0d  .6221..6337..87.
15710 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
15720 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
15730 4e 43 54 20 2b 20 38 31 20 2d 20 2d 20 63 6f 6c  NCT + 81 - - col
15740 32 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  2 AS col0 FROM t
15750 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 30 37 0d 0a  ab2..----..107..
15760 31 30 38 0d 0a 31 31 39 0d 0a 0d 0a 73 6b 69 70  108..119....skip
15770 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20  if postgresql # 
15780 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69  PostgreSQL requi
15790 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61  res AS when rena
157a0 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75  ming output colu
157b0 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  mns..query I row
157c0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2b  sort..SELECT + +
157d0 20 63 6f 72 30 2e 63 6f 6c 31 20 63 6f 6c 31 20   cor0.col1 col1 
157e0 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
157f0 30 20 43 52 4f 53 53 20 4a 4f 49 4e 20 74 61 62  0 CROSS JOIN tab
15800 32 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d  2 AS cor1..----.
15810 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e  .9 values hashin
15820 67 20 74 6f 20 33 36 36 65 63 35 33 39 61 66 30  g to 366ec539af0
15830 66 33 37 62 64 31 35 31 39 62 63 35 36 38 66 33  f37bd1519bc568f3
15840 64 36 37 37 35 0d 0a 0d 0a 73 6b 69 70 69 66 20  d6775....skipif 
15850 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73  postgresql # Pos
15860 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73  tgreSQL requires
15870 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e   AS when renamin
15880 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73  g output columns
15890 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
158a0 74 0d 0a 53 45 4c 45 43 54 20 2d 20 38 38 20 2b  t..SELECT - 88 +
158b0 20 63 6f 6c 30 20 2d 20 63 6f 6c 32 20 2a 20 63   col0 - col2 * c
158c0 6f 6c 30 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61  ol0 col0 FROM ta
158d0 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
158e0 0d 0a 2d 37 32 39 37 0d 0a 2d 38 35 36 0d 0a 2d  ..-7297..-856..-
158f0 38 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  88....query I ro
15900 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
15910 2d 20 37 35 20 46 52 4f 4d 20 74 61 62 30 2c 20  - 75 FROM tab0, 
15920 74 61 62 32 2c 20 74 61 62 31 20 41 53 20 63 6f  tab2, tab1 AS co
15930 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c  r0..----..27 val
15940 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 65  ues hashing to e
15950 36 31 62 35 39 37 39 35 32 30 34 63 33 34 38 31  61b59795204c3481
15960 30 33 61 35 38 63 30 61 38 65 34 63 65 31 36 0d  03a58c0a8e4ce16.
15970 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
15980 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
15990 4e 43 54 20 2d 20 63 6f 6c 31 20 2a 20 2b 20 63  NCT - col1 * + c
159a0 6f 6c 32 20 2b 20 2d 20 74 61 62 32 2e 63 6f 6c  ol2 + - tab2.col
159b0 31 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  1 AS col0 FROM t
159c0 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 35 39 33  ab2..----..-1593
159d0 0d 0a 2d 36 36 33 0d 0a 2d 38 36 38 0d 0a 0d 0a  ..-663..-868....
159e0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
159f0 0a 53 45 4c 45 43 54 20 32 32 20 2a 20 2b 20 63  .SELECT 22 * + c
15a00 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  ol2 AS col2 FROM
15a10 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 38 30   tab0..----..180
15a20 34 0d 0a 32 32 0d 0a 37 32 36 0d 0a 0d 0a 71 75  4..22..726....qu
15a30 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
15a40 45 4c 45 43 54 20 2d 20 2b 20 63 6f 6c 31 20 2a  ELECT - + col1 *
15a50 20 63 6f 72 30 2e 63 6f 6c 31 20 2b 20 63 6f 72   cor0.col1 + cor
15a60 30 2e 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46  0.col0 AS col0 F
15a70 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
15a80 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 31 30 0d 0a 2d 33  ..----..-210..-3
15a90 34 30 33 0d 0a 2d 39 35 34 0d 0a 0d 0a 71 75 65  403..-954....que
15aa0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
15ab0 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20  LECT DISTINCT + 
15ac0 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c 31 20 2b 20  col1 * + col1 + 
15ad0 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46 52 4f  col2 AS col0 FRO
15ae0 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
15af0 2d 2d 2d 2d 0d 0a 33 32 37 0d 0a 33 35 30 37 0d  ----..327..3507.
15b00 0a 39 38 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .988....query I 
15b10 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
15b20 41 4c 4c 20 2d 20 2d 20 63 6f 6c 32 20 2a 20 63  ALL - - col2 * c
15b30 6f 6c 30 20 2a 20 2d 20 63 6f 72 30 2e 63 6f 6c  ol0 * - cor0.col
15b40 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  2 FROM tab1 AS c
15b50 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 30 37 39  or0..----..-2079
15b60 33 36 0d 0a 2d 37 33 37 32 38 30 0d 0a 2d 38 37  36..-737280..-87
15b70 34 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  48....query I ro
15b80 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
15b90 4c 20 2b 20 28 20 2d 20 63 6f 6c 30 20 29 20 2a  L + ( - col0 ) *
15ba0 20 32 33 20 2b 20 2b 20 31 30 20 2a 20 63 6f 6c   23 + + 10 * col
15bb0 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  0 FROM tab0 AS c
15bc0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 35 37  or0..----..-1157
15bd0 0d 0a 2d 33 31 32 0d 0a 2d 34 35 35 0d 0a 0d 0a  ..-312..-455....
15be0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
15bf0 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
15c00 20 2b 20 2d 20 34 30 20 2d 20 2d 20 63 6f 6c 32   + - 40 - - col2
15c10 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
15c20 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
15c30 0d 0a 31 34 0d 0a 31 37 0d 0a 35 36 0d 0a 0d 0a  ..14..17..56....
15c40 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75  onlyif mysql # u
15c50 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20  se DIV operator 
15c60 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69  for integer divi
15c70 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f  sion..query I ro
15c80 77 73 6f 72 74 20 6c 61 62 65 6c 2d 36 31 32 0d  wsort label-612.
15c90 0a 53 45 4c 45 43 54 20 2d 20 2d 20 63 6f 6c 32  .SELECT - - col2
15ca0 20 2a 20 2d 20 63 6f 6c 32 20 2b 20 28 20 2d 20   * - col2 + ( - 
15cb0 63 6f 6c 30 20 29 20 44 49 56 20 2b 20 63 6f 6c  col0 ) DIV + col
15cc0 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  0 FROM tab1 AS c
15cd0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 39 31 37  or0..----..-2917
15ce0 0d 0a 2d 33 32 35 30 0d 0a 2d 39 32 31 37 0d 0a  ..-3250..-9217..
15cf0 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
15d00 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
15d10 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
15d20 20 6c 61 62 65 6c 2d 36 31 32 0d 0a 53 45 4c 45   label-612..SELE
15d30 43 54 20 2d 20 2d 20 63 6f 6c 32 20 2a 20 2d 20  CT - - col2 * - 
15d40 63 6f 6c 32 20 2b 20 28 20 2d 20 63 6f 6c 30 20  col2 + ( - col0 
15d50 29 20 2f 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20  ) / + col0 FROM 
15d60 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
15d70 2d 2d 0d 0a 2d 32 39 31 37 0d 0a 2d 33 32 35 30  --..-2917..-3250
15d80 0d 0a 2d 39 32 31 37 0d 0a 0d 0a 71 75 65 72 79  ..-9217....query
15d90 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
15da0 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 30  CT DISTINCT col0
15db0 20 2a 20 2b 20 36 39 20 2a 20 38 35 20 46 52 4f   * + 69 * 85 FRO
15dc0 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
15dd0 2d 2d 2d 2d 0d 0a 31 34 30 37 36 30 0d 0a 32 30  ----..140760..20
15de0 35 32 37 35 0d 0a 35 32 31 39 38 35 0d 0a 0d 0a  5275..521985....
15df0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
15e00 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
15e10 20 63 6f 72 30 2e 63 6f 6c 30 20 2a 20 63 6f 6c   cor0.col0 * col
15e20 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  0 AS col1 FROM t
15e30 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab1 cor0..----..
15e40 34 30 39 36 0d 0a 36 34 30 30 0d 0a 39 0d 0a 0d  4096..6400..9...
15e50 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
15e60 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 33  ..SELECT ALL - 3
15e70 38 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  8 AS col0 FROM t
15e80 61 62 30 2c 20 74 61 62 32 20 41 53 20 63 6f 72  ab0, tab2 AS cor
15e90 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65  0..----..9 value
15ea0 73 20 68 61 73 68 69 6e 67 20 74 6f 20 65 35 37  s hashing to e57
15eb0 31 35 34 31 61 65 34 30 63 62 30 64 64 61 63 61  1541ae40cb0ddaca
15ec0 31 36 65 31 31 66 34 33 35 39 35 30 37 0d 0a 0d  16e11f4359507...
15ed0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
15ee0 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c  ..SELECT ALL col
15ef0 30 20 2b 20 2b 20 39 37 20 2a 20 63 6f 6c 30 20  0 + + 97 * col0 
15f00 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
15f10 30 0d 0a 2d 2d 2d 2d 0d 0a 32 33 35 32 0d 0a 33  0..----..2352..3
15f20 34 33 30 0d 0a 38 37 32 32 0d 0a 0d 0a 71 75 65  430..8722....que
15f30 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
15f40 4c 45 43 54 20 2d 20 63 6f 72 30 2e 63 6f 6c 31  LECT - cor0.col1
15f50 20 2a 20 35 32 20 41 53 20 63 6f 6c 31 20 46 52   * 52 AS col1 FR
15f60 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
15f70 0a 2d 2d 2d 2d 0d 0a 2d 31 33 35 32 0d 0a 2d 35  .----..-1352..-5
15f80 32 30 0d 0a 2d 36 37 36 0d 0a 0d 0a 71 75 65 72  20..-676....quer
15f90 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
15fa0 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 2d  ECT DISTINCT - -
15fb0 20 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c 31 20 2a   col0 + - col1 *
15fc0 20 2b 20 63 6f 6c 31 20 2b 20 63 6f 6c 31 20 41   + col1 + col1 A
15fd0 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30  S col1 FROM tab0
15fe0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
15ff0 2d 37 32 38 36 0d 0a 2d 38 31 30 31 0d 0a 2d 39  -7286..-8101..-9
16000 32 37 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  277....query I r
16010 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
16020 4c 4c 20 2d 20 28 20 2b 20 35 33 20 29 20 41 53  LL - ( + 53 ) AS
16030 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20   col1 FROM tab0 
16040 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
16050 35 33 0d 0a 2d 35 33 0d 0a 2d 35 33 0d 0a 0d 0a  53..-53..-53....
16060 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71  skipif postgresq
16070 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72  l # PostgreSQL r
16080 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20  equires AS when 
16090 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20  renaming output 
160a0 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49  columns..query I
160b0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
160c0 20 41 4c 4c 20 63 6f 72 30 2e 63 6f 6c 31 20 2a   ALL cor0.col1 *
160d0 20 63 6f 6c 31 20 2b 20 63 6f 6c 32 20 63 6f 6c   col1 + col2 col
160e0 30 20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30  0 FROM tab1 cor0
160f0 0d 0a 2d 2d 2d 2d 0d 0a 31 35 37 0d 0a 32 36 35  ..----..157..265
16100 0d 0a 37 33 30 0d 0a 0d 0a 71 75 65 72 79 20 49  ..730....query I
16110 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
16120 20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c 30   DISTINCT - col0
16130 20 2a 20 34 35 20 2a 20 63 6f 6c 32 20 46 52 4f   * 45 * col2 FRO
16140 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
16150 2d 2d 2d 2d 0d 0a 2d 31 36 34 31 36 30 0d 0a 2d  ----..-164160..-
16160 33 34 35 36 30 30 0d 0a 2d 37 32 39 30 0d 0a 0d  345600..-7290...
16170 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
16180 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51  support for MySQ
16190 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65  L specific syste
161a0 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74  m types and synt
161b0 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ax..query I rows
161c0 6f 72 74 20 6c 61 62 65 6c 2d 36 32 32 0d 0a 53  ort label-622..S
161d0 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d  ELECT DISTINCT -
161e0 20 2d 20 43 41 53 54 28 20 2b 20 63 6f 6c 30 20   - CAST( + col0 
161f0 41 53 20 53 49 47 4e 45 44 20 29 20 46 52 4f 4d  AS SIGNED ) FROM
16200 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
16210 2d 2d 2d 0d 0a 37 0d 0a 37 38 0d 0a 37 39 0d 0a  ---..7..78..79..
16220 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
16230 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
16240 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
16250 20 6c 61 62 65 6c 2d 36 32 32 0d 0a 53 45 4c 45   label-622..SELE
16260 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 2d 20  CT DISTINCT - - 
16270 43 41 53 54 20 28 20 2b 20 63 6f 6c 30 20 41 53  CAST ( + col0 AS
16280 20 49 4e 54 45 47 45 52 20 29 20 46 52 4f 4d 20   INTEGER ) FROM 
16290 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
162a0 2d 2d 0d 0a 37 0d 0a 37 38 0d 0a 37 39 0d 0a 0d  --..7..78..79...
162b0 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73  .skipif postgres
162c0 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20  ql # PostgreSQL 
162d0 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e  requires AS when
162e0 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74   renaming output
162f0 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20   columns..query 
16300 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
16310 54 20 44 49 53 54 49 4e 43 54 20 2b 20 2b 20 63  T DISTINCT + + c
16320 6f 6c 32 20 2b 20 2b 20 32 37 20 2a 20 63 6f 6c  ol2 + + 27 * col
16330 32 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32  2 col0 FROM tab2
16340 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
16350 31 30 36 34 0d 0a 37 32 38 0d 0a 37 35 36 0d 0a  1064..728..756..
16360 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65  ..skipif postgre
16370 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c  sql # PostgreSQL
16380 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65   requires AS whe
16390 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75  n renaming outpu
163a0 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79  t columns..query
163b0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
163c0 43 54 20 37 34 20 63 6f 6c 31 20 46 52 4f 4d 20  CT 74 col1 FROM 
163d0 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
163e0 2d 2d 0d 0a 37 34 0d 0a 37 34 0d 0a 37 34 0d 0a  --..74..74..74..
163f0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
16400 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
16410 43 54 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 2a  CT + cor0.col2 *
16420 20 2b 20 63 6f 6c 30 20 2b 20 63 6f 6c 30 20 46   + col0 + col0 F
16430 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
16440 0d 0a 2d 2d 2d 2d 0d 0a 37 30 0d 0a 37 33 38 37  ..----..70..7387
16450 0d 0a 38 31 36 0d 0a 0d 0a 71 75 65 72 79 20 49  ..816....query I
16460 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
16470 20 2b 20 63 6f 6c 30 20 2b 20 34 32 20 46 52 4f   + col0 + 42 FRO
16480 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
16490 2d 2d 2d 2d 0d 0a 31 32 30 0d 0a 31 32 31 0d 0a  ----..120..121..
164a0 34 39 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  49....onlyif mys
164b0 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65  ql # use DIV ope
164c0 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65  rator for intege
164d0 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72  r division..quer
164e0 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
164f0 6c 2d 36 32 37 0d 0a 53 45 4c 45 43 54 20 44 49  l-627..SELECT DI
16500 53 54 49 4e 43 54 20 2d 20 2d 20 63 6f 6c 31 20  STINCT - - col1 
16510 2b 20 36 36 20 44 49 56 20 2b 20 63 6f 6c 31 20  + 66 DIV + col1 
16520 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 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 36 0d 0a 31 38 0d 0a 32 38 0d 0a 0d 0a 73  .16..18..28....s
16550 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
16560 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
16570 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
16580 62 65 6c 2d 36 32 37 0d 0a 53 45 4c 45 43 54 20  bel-627..SELECT 
16590 44 49 53 54 49 4e 43 54 20 2d 20 2d 20 63 6f 6c  DISTINCT - - col
165a0 31 20 2b 20 36 36 20 2f 20 2b 20 63 6f 6c 31 20  1 + 66 / + col1 
165b0 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
165c0 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
165d0 0a 31 36 0d 0a 31 38 0d 0a 32 38 0d 0a 0d 0a 71  .16..18..28....q
165e0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
165f0 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
16600 2d 20 33 20 2b 20 2d 20 63 6f 6c 32 20 46 52 4f  - 3 + - col2 FRO
16610 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
16620 2d 2d 2d 2d 0d 0a 2d 35 37 0d 0a 2d 36 30 0d 0a  ----..-57..-60..
16630 2d 39 39 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  -99....onlyif my
16640 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70  sql # use DIV op
16650 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67  erator for integ
16660 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65  er division..que
16670 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
16680 65 6c 2d 36 32 39 0d 0a 53 45 4c 45 43 54 20 2d  el-629..SELECT -
16690 20 63 6f 6c 30 20 44 49 56 20 28 20 2d 20 63 6f   col0 DIV ( - co
166a0 72 30 2e 63 6f 6c 32 20 2b 20 2d 20 33 36 20 29  r0.col2 + - 36 )
166b0 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
166c0 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30  b1 cor0..----..0
166d0 0d 0a 30 0d 0a 30 0d 0a 0d 0a 73 6b 69 70 69 66  ..0..0....skipif
166e0 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
166f0 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
16700 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 36   rowsort label-6
16710 32 39 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c  29..SELECT - col
16720 30 20 2f 20 28 20 2d 20 63 6f 72 30 2e 63 6f 6c  0 / ( - cor0.col
16730 32 20 2b 20 2d 20 33 36 20 29 20 41 53 20 63 6f  2 + - 36 ) AS co
16740 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72  l0 FROM tab1 cor
16750 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30  0..----..0..0..0
16760 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
16770 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61   # use DIV opera
16780 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20  tor for integer 
16790 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20  division..query 
167a0 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
167b0 36 33 30 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  630..SELECT ALL 
167c0 2d 20 74 61 62 31 2e 63 6f 6c 30 20 44 49 56 20  - tab1.col0 DIV 
167d0 2d 20 34 31 20 46 52 4f 4d 20 74 61 62 31 0d 0a  - 41 FROM tab1..
167e0 2d 2d 2d 2d 0d 0a 30 0d 0a 31 0d 0a 31 0d 0a 0d  ----..0..1..1...
167f0 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
16800 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
16810 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
16820 6c 61 62 65 6c 2d 36 33 30 0d 0a 53 45 4c 45 43  label-630..SELEC
16830 54 20 41 4c 4c 20 2d 20 74 61 62 31 2e 63 6f 6c  T ALL - tab1.col
16840 30 20 2f 20 2d 20 34 31 20 46 52 4f 4d 20 74 61  0 / - 41 FROM ta
16850 62 31 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 31 0d 0a  b1..----..0..1..
16860 31 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74  1....skipif post
16870 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65  gresql # Postgre
16880 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20  SQL requires AS 
16890 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75  when renaming ou
168a0 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75  tput columns..qu
168b0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
168c0 45 4c 45 43 54 20 2d 20 63 6f 72 30 2e 63 6f 6c  ELECT - cor0.col
168d0 32 20 2a 20 2d 20 28 20 2b 20 63 6f 6c 31 20 29  2 * - ( + col1 )
168e0 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20   col2 FROM tab1 
168f0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
16900 32 34 38 0d 0a 31 34 30 34 0d 0a 35 37 30 0d 0a  248..1404..570..
16910 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
16920 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20  t..SELECT ALL - 
16930 2d 20 63 6f 6c 32 20 2d 20 2d 20 28 20 2b 20 63  - col2 - - ( + c
16940 6f 6c 32 20 2b 20 2d 20 63 6f 6c 31 20 29 20 46  ol2 + - col1 ) F
16950 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
16960 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 30 0d 0a 2d 39 35  ..----..-20..-95
16970 0d 0a 37 33 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  ..73....onlyif m
16980 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f  ysql # use DIV o
16990 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65  perator for inte
169a0 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75  ger division..qu
169b0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
169c0 62 65 6c 2d 36 33 33 0d 0a 53 45 4c 45 43 54 20  bel-633..SELECT 
169d0 44 49 53 54 49 4e 43 54 20 2b 20 36 35 20 2a 20  DISTINCT + 65 * 
169e0 2b 20 63 6f 6c 31 20 44 49 56 20 2b 20 63 6f 6c  + col1 DIV + col
169f0 31 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  1 AS col0 FROM t
16a00 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab2 cor0..----..
16a10 36 35 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  65....skipif mys
16a20 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
16a30 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
16a40 73 6f 72 74 20 6c 61 62 65 6c 2d 36 33 33 0d 0a  sort label-633..
16a50 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
16a60 2b 20 36 35 20 2a 20 2b 20 63 6f 6c 31 20 2f 20  + 65 * + col1 / 
16a70 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46  + col1 AS col0 F
16a80 52 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d  ROM tab2 cor0..-
16a90 2d 2d 2d 0d 0a 36 35 0d 0a 0d 0a 6f 6e 6c 79 69  ---..65....onlyi
16aa0 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72  f mysql # suppor
16ab0 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63  t for MySQL spec
16ac0 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65  ific system type
16ad0 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75  s and syntax..qu
16ae0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
16af0 62 65 6c 2d 36 33 34 0d 0a 53 45 4c 45 43 54 20  bel-634..SELECT 
16b00 44 49 53 54 49 4e 43 54 20 2d 20 43 41 53 54 28  DISTINCT - CAST(
16b10 20 2b 20 63 6f 6c 30 20 41 53 20 53 49 47 4e 45   + col0 AS SIGNE
16b20 44 20 29 20 2b 20 2b 20 63 6f 6c 30 20 46 52 4f  D ) + + col0 FRO
16b30 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
16b40 2d 2d 2d 2d 0d 0a 30 0d 0a 0d 0a 73 6b 69 70 69  ----..0....skipi
16b50 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
16b60 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
16b70 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
16b80 36 33 34 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  634..SELECT DIST
16b90 49 4e 43 54 20 2d 20 43 41 53 54 20 28 20 2b 20  INCT - CAST ( + 
16ba0 63 6f 6c 30 20 41 53 20 49 4e 54 45 47 45 52 20  col0 AS INTEGER 
16bb0 29 20 2b 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20  ) + + col0 FROM 
16bc0 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
16bd0 2d 2d 0d 0a 30 0d 0a 0d 0a 71 75 65 72 79 20 49  --..0....query I
16be0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
16bf0 20 2d 20 2b 20 28 20 2d 20 33 34 20 29 20 41 53   - + ( - 34 ) AS
16c00 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20   col2 FROM tab0 
16c10 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33  AS cor0..----..3
16c20 34 0d 0a 33 34 0d 0a 33 34 0d 0a 0d 0a 71 75 65  4..34..34....que
16c30 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
16c40 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 31 20  LECT ALL + col1 
16c50 2a 20 63 6f 6c 32 20 2b 20 63 6f 6c 31 20 2b 20  * col2 + col1 + 
16c60 63 6f 6c 32 20 2a 20 63 6f 6c 30 20 41 53 20 63  col2 * col0 AS c
16c70 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol2 FROM tab0 AS
16c80 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 34 38   cor0..----..148
16c90 35 31 0d 0a 32 32 39 0d 0a 33 37 31 36 0d 0a 0d  51..229..3716...
16ca0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
16cb0 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63  ..SELECT ALL - c
16cc0 6f 6c 31 20 2b 20 2b 20 63 6f 6c 32 20 2a 20 2d  ol1 + + col2 * -
16cd0 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20   col1 FROM tab1 
16ce0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
16cf0 31 32 36 31 0d 0a 2d 31 34 33 30 0d 0a 2d 35 38  1261..-1430..-58
16d00 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  0....query I row
16d10 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
16d20 54 49 4e 43 54 20 37 37 20 2a 20 2d 20 63 6f 6c  TINCT 77 * - col
16d30 31 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d  1 FROM tab2..---
16d40 2d 0d 0a 2d 31 33 30 39 0d 0a 2d 32 33 38 37 0d  -..-1309..-2387.
16d50 0a 2d 34 35 34 33 0d 0a 0d 0a 71 75 65 72 79 20  .-4543....query 
16d60 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
16d70 54 20 63 6f 72 30 2e 63 6f 6c 30 20 2a 20 63 6f  T cor0.col0 * co
16d80 6c 30 20 2b 20 2b 20 63 6f 6c 30 20 41 53 20 63  l0 + + col0 AS c
16d90 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol2 FROM tab1 AS
16da0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 0d   cor0..----..12.
16db0 0a 34 31 36 30 0d 0a 36 34 38 30 0d 0a 0d 0a 71  .4160..6480....q
16dc0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
16dd0 53 45 4c 45 43 54 20 2b 20 31 37 20 41 53 20 63  SELECT + 17 AS c
16de0 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol0 FROM tab2 AS
16df0 20 63 6f 72 30 20 43 52 4f 53 53 20 4a 4f 49 4e   cor0 CROSS JOIN
16e00 20 74 61 62 30 20 63 6f 72 31 0d 0a 2d 2d 2d 2d   tab0 cor1..----
16e10 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68 69  ..9 values hashi
16e20 6e 67 20 74 6f 20 34 33 32 39 38 65 34 33 33 36  ng to 43298e4336
16e30 35 66 63 63 62 35 31 34 36 65 61 33 32 30 30 33  5fccb5146ea32003
16e40 37 35 33 63 39 32 0d 0a 0d 0a 71 75 65 72 79 20  753c92....query 
16e50 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
16e60 54 20 63 6f 72 30 2e 63 6f 6c 32 20 41 53 20 63  T cor0.col2 AS c
16e70 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 2c 20 74  ol2 FROM tab1, t
16e80 61 62 30 20 41 53 20 63 6f 72 30 2c 20 74 61 62  ab0 AS cor0, tab
16e90 32 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 32 37  2 cor1..----..27
16ea0 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20   values hashing 
16eb0 74 6f 20 37 37 38 36 37 31 38 62 64 38 30 34 32  to 7786718bd8042
16ec0 30 32 32 35 33 37 33 37 38 64 34 30 65 63 38 37  022537378d40ec87
16ed0 34 37 35 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  475....onlyif my
16ee0 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f  sql # support fo
16ef0 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63  r MySQL specific
16f00 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e   system types an
16f10 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20  d syntax..query 
16f20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
16f30 36 34 32 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f  642..SELECT - co
16f40 6c 30 20 2a 20 2b 20 43 41 53 54 28 20 4e 55 4c  l0 * + CAST( NUL
16f50 4c 20 41 53 20 44 45 43 49 4d 41 4c 20 29 20 41  L AS DECIMAL ) A
16f60 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30  S col2 FROM tab0
16f70 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
16f80 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c  NULL..NULL..NULL
16f90 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
16fa0 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
16fb0 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
16fc0 72 74 20 6c 61 62 65 6c 2d 36 34 32 0d 0a 53 45  rt label-642..SE
16fd0 4c 45 43 54 20 2d 20 63 6f 6c 30 20 2a 20 2b 20  LECT - col0 * + 
16fe0 43 41 53 54 20 28 20 4e 55 4c 4c 20 41 53 20 52  CAST ( NULL AS R
16ff0 45 41 4c 20 29 20 41 53 20 63 6f 6c 32 20 46 52  EAL ) AS col2 FR
17000 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
17010 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c  .----..NULL..NUL
17020 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69  L..NULL....skipi
17030 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50  f postgresql # P
17040 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72  ostgreSQL requir
17050 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d  es AS when renam
17060 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d  ing output colum
17070 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ns..query I rows
17080 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2d 20  ort..SELECT - - 
17090 63 6f 6c 31 20 2b 20 37 33 20 63 6f 6c 32 20 46  col1 + 73 col2 F
170a0 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
170b0 0d 0a 2d 2d 2d 2d 0d 0a 31 30 34 0d 0a 31 33 32  ..----..104..132
170c0 0d 0a 39 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..90....query I 
170d0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
170e0 44 49 53 54 49 4e 43 54 20 2b 20 2b 20 63 6f 6c  DISTINCT + + col
170f0 32 20 2a 20 2d 20 63 6f 6c 31 20 2b 20 2b 20 63  2 * - col1 + + c
17100 6f 72 30 2e 63 6f 6c 31 20 2b 20 63 6f 6c 30 20  or0.col1 + col0 
17110 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
17120 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 37 32 38 0d 0a  0..----..-2728..
17130 2d 37 32 38 32 0d 0a 33 35 0d 0a 0d 0a 6f 6e 6c  -7282..35....onl
17140 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70  yif mysql # supp
17150 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70  ort for MySQL sp
17160 65 63 69 66 69 63 20 73 79 73 74 65 6d 20 74 79  ecific system ty
17170 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a  pes and syntax..
17180 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
17190 6c 61 62 65 6c 2d 36 34 35 0d 0a 53 45 4c 45 43  label-645..SELEC
171a0 54 20 41 4c 4c 20 43 41 53 54 28 20 4e 55 4c 4c  T ALL CAST( NULL
171b0 20 41 53 20 53 49 47 4e 45 44 20 29 20 2a 20 63   AS SIGNED ) * c
171c0 6f 6c 31 20 2d 20 63 6f 6c 30 20 41 53 20 63 6f  ol1 - col0 AS co
171d0 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l0 FROM tab0 AS 
171e0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c  cor0..----..NULL
171f0 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a  ..NULL..NULL....
17200 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
17210 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
17220 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
17230 61 62 65 6c 2d 36 34 35 0d 0a 53 45 4c 45 43 54  abel-645..SELECT
17240 20 41 4c 4c 20 43 41 53 54 20 28 20 4e 55 4c 4c   ALL CAST ( NULL
17250 20 41 53 20 49 4e 54 45 47 45 52 20 29 20 2a 20   AS INTEGER ) * 
17260 63 6f 6c 31 20 2d 20 63 6f 6c 30 20 41 53 20 63  col1 - col0 AS c
17270 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol0 FROM tab0 AS
17280 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c   cor0..----..NUL
17290 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d  L..NULL..NULL...
172a0 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
172b0 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51  support for MySQ
172c0 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65  L specific syste
172d0 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74  m types and synt
172e0 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ax..query I rows
172f0 6f 72 74 20 6c 61 62 65 6c 2d 36 34 36 0d 0a 53  ort label-646..S
17300 45 4c 45 43 54 20 2d 20 2d 20 63 6f 6c 31 20 2a  ELECT - - col1 *
17310 20 2d 20 28 20 63 6f 6c 32 20 29 20 2b 20 2b 20   - ( col2 ) + + 
17320 43 41 53 54 28 20 2d 20 63 6f 6c 32 20 41 53 20  CAST( - col2 AS 
17330 53 49 47 4e 45 44 20 29 20 46 52 4f 4d 20 74 61  SIGNED ) FROM ta
17340 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  b0 cor0..----..-
17350 32 38 37 31 0d 0a 2d 37 35 34 34 0d 0a 2d 39 38  2871..-7544..-98
17360 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
17370 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
17380 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
17390 72 74 20 6c 61 62 65 6c 2d 36 34 36 0d 0a 53 45  rt label-646..SE
173a0 4c 45 43 54 20 2d 20 2d 20 63 6f 6c 31 20 2a 20  LECT - - col1 * 
173b0 2d 20 28 20 63 6f 6c 32 20 29 20 2b 20 2b 20 43  - ( col2 ) + + C
173c0 41 53 54 20 28 20 2d 20 63 6f 6c 32 20 41 53 20  AST ( - col2 AS 
173d0 49 4e 54 45 47 45 52 20 29 20 46 52 4f 4d 20 74  INTEGER ) FROM t
173e0 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab0 cor0..----..
173f0 2d 32 38 37 31 0d 0a 2d 37 35 34 34 0d 0a 2d 39  -2871..-7544..-9
17400 38 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  8....onlyif mysq
17410 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20  l # support for 
17420 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63 20 73  MySQL specific s
17430 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20  ystem types and 
17440 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20  syntax..query I 
17450 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 36 34  rowsort label-64
17460 37 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  7..SELECT DISTIN
17470 43 54 20 43 41 53 54 28 20 2d 20 36 34 20 41 53  CT CAST( - 64 AS
17480 20 53 49 47 4e 45 44 20 29 20 2a 20 2b 20 63 6f   SIGNED ) * + co
17490 6c 32 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  l2 col2 FROM tab
174a0 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
174b0 0a 2d 32 31 31 32 0d 0a 2d 35 32 34 38 0d 0a 2d  .-2112..-5248..-
174c0 36 34 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73  64....skipif pos
174d0 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72  tgresql # Postgr
174e0 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53  eSQL requires AS
174f0 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f   when renaming o
17500 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 73  utput columns..s
17510 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
17520 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
17530 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
17540 62 65 6c 2d 36 34 37 0d 0a 53 45 4c 45 43 54 20  bel-647..SELECT 
17550 44 49 53 54 49 4e 43 54 20 43 41 53 54 20 28 20  DISTINCT CAST ( 
17560 2d 20 36 34 20 41 53 20 49 4e 54 45 47 45 52 20  - 64 AS INTEGER 
17570 29 20 2a 20 2b 20 63 6f 6c 32 20 63 6f 6c 32 20  ) * + col2 col2 
17580 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
17590 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 31 31 32 0d 0a  0..----..-2112..
175a0 2d 35 32 34 38 0d 0a 2d 36 34 0d 0a 0d 0a 71 75  -5248..-64....qu
175b0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
175c0 45 4c 45 43 54 20 2b 20 63 6f 6c 32 20 2d 20 38  ELECT + col2 - 8
175d0 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  0 FROM tab2 AS c
175e0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 32 0d 0a  or0..----..-42..
175f0 2d 35 33 0d 0a 2d 35 34 0d 0a 0d 0a 71 75 65 72  -53..-54....quer
17600 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
17610 45 43 54 20 63 6f 6c 32 20 2d 20 2d 20 63 6f 6c  ECT col2 - - col
17620 30 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  0 AS col0 FROM t
17630 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab1 cor0..----..
17640 31 32 31 0d 0a 31 37 36 0d 0a 35 37 0d 0a 0d 0a  121..176..57....
17650 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75  onlyif mysql # u
17660 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20  se DIV operator 
17670 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69  for integer divi
17680 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f  sion..query I ro
17690 77 73 6f 72 74 20 6c 61 62 65 6c 2d 36 35 30 0d  wsort label-650.
176a0 0a 53 45 4c 45 43 54 20 2b 20 2b 20 34 20 2a 20  .SELECT + + 4 * 
176b0 2b 20 63 6f 6c 32 20 2a 20 63 6f 6c 31 20 2b 20  + col2 * col1 + 
176c0 38 37 20 44 49 56 20 38 35 20 46 52 4f 4d 20 74  87 DIV 85 FROM t
176d0 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
176e0 2d 0d 0a 32 35 38 35 0d 0a 33 33 34 39 0d 0a 36  -..2585..3349..6
176f0 31 33 37 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  137....skipif my
17700 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
17710 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
17720 77 73 6f 72 74 20 6c 61 62 65 6c 2d 36 35 30 0d  wsort label-650.
17730 0a 53 45 4c 45 43 54 20 2b 20 2b 20 34 20 2a 20  .SELECT + + 4 * 
17740 2b 20 63 6f 6c 32 20 2a 20 63 6f 6c 31 20 2b 20  + col2 * col1 + 
17750 38 37 20 2f 20 38 35 20 46 52 4f 4d 20 74 61 62  87 / 85 FROM tab
17760 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
17770 0a 32 35 38 35 0d 0a 33 33 34 39 0d 0a 36 31 33  .2585..3349..613
17780 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  7....query I row
17790 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
177a0 20 2b 20 63 6f 6c 30 20 2a 20 63 6f 6c 30 20 2d   + col0 * col0 -
177b0 20 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46 52   col1 AS col1 FR
177c0 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
177d0 0a 2d 2d 2d 2d 0d 0a 31 38 0d 0a 36 30 32 35 0d  .----..18..6025.
177e0 0a 36 32 32 34 0d 0a 0d 0a 73 6b 69 70 69 66 20  .6224....skipif 
177f0 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73  postgresql # Pos
17800 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73  tgreSQL requires
17810 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e   AS when renamin
17820 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73  g output columns
17830 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
17840 74 0d 0a 53 45 4c 45 43 54 20 2b 20 28 20 2b 20  t..SELECT + ( + 
17850 63 6f 6c 32 20 29 20 2b 20 63 6f 6c 30 20 63 6f  col2 ) + col0 co
17860 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l1 FROM tab0 AS 
17870 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 37 31 0d  cor0..----..171.
17880 0a 33 36 0d 0a 35 37 0d 0a 0d 0a 6f 6e 6c 79 69  .36..57....onlyi
17890 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72  f mysql # suppor
178a0 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63  t for MySQL spec
178b0 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65  ific system type
178c0 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75  s and syntax..qu
178d0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
178e0 62 65 6c 2d 36 35 33 0d 0a 53 45 4c 45 43 54 20  bel-653..SELECT 
178f0 44 49 53 54 49 4e 43 54 20 2d 20 2d 20 28 20 2b  DISTINCT - - ( +
17900 20 63 6f 6c 31 20 29 20 2b 20 2b 20 63 6f 6c 31   col1 ) + + col1
17910 20 2b 20 2b 20 43 41 53 54 28 20 4e 55 4c 4c 20   + + CAST( NULL 
17920 41 53 20 53 49 47 4e 45 44 20 29 20 41 53 20 63  AS SIGNED ) AS c
17930 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol0 FROM tab2 AS
17940 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c   cor0..----..NUL
17950 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  L....skipif mysq
17960 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
17970 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
17980 6f 72 74 20 6c 61 62 65 6c 2d 36 35 33 0d 0a 53  ort label-653..S
17990 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d  ELECT DISTINCT -
179a0 20 2d 20 28 20 2b 20 63 6f 6c 31 20 29 20 2b 20   - ( + col1 ) + 
179b0 2b 20 63 6f 6c 31 20 2b 20 2b 20 43 41 53 54 20  + col1 + + CAST 
179c0 28 20 4e 55 4c 4c 20 41 53 20 49 4e 54 45 47 45  ( NULL AS INTEGE
179d0 52 20 29 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  R ) AS col0 FROM
179e0 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
179f0 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 6f 6e 6c  ---..NULL....onl
17a00 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20  yif mysql # use 
17a10 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72  DIV operator for
17a20 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f   integer divisio
17a30 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  n..query I rowso
17a40 72 74 20 6c 61 62 65 6c 2d 36 35 34 0d 0a 53 45  rt label-654..SE
17a50 4c 45 43 54 20 2b 20 63 6f 6c 30 20 2b 20 63 6f  LECT + col0 + co
17a60 6c 32 20 44 49 56 20 2d 20 28 20 63 6f 6c 32 20  l2 DIV - ( col2 
17a70 2a 20 2d 20 63 6f 6c 31 20 29 20 46 52 4f 4d 20  * - col1 ) FROM 
17a80 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
17a90 2d 2d 0d 0a 33 0d 0a 36 34 0d 0a 38 30 0d 0a 0d  --..3..64..80...
17aa0 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
17ab0 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
17ac0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
17ad0 6c 61 62 65 6c 2d 36 35 34 0d 0a 53 45 4c 45 43  label-654..SELEC
17ae0 54 20 2b 20 63 6f 6c 30 20 2b 20 63 6f 6c 32 20  T + col0 + col2 
17af0 2f 20 2d 20 28 20 63 6f 6c 32 20 2a 20 2d 20 63  / - ( col2 * - c
17b00 6f 6c 31 20 29 20 46 52 4f 4d 20 74 61 62 31 20  ol1 ) FROM tab1 
17b10 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33  AS cor0..----..3
17b20 0d 0a 36 34 0d 0a 38 30 0d 0a 0d 0a 73 6b 69 70  ..64..80....skip
17b30 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20  if postgresql # 
17b40 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69  PostgreSQL requi
17b50 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61  res AS when rena
17b60 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75  ming output colu
17b70 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  mns..query I row
17b80 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 35 35 20  sort..SELECT 55 
17b90 2b 20 2d 20 63 6f 72 30 2e 63 6f 6c 30 20 63 6f  + - cor0.col0 co
17ba0 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l0 FROM tab1 AS 
17bb0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 35 0d  cor0..----..-25.
17bc0 0a 2d 39 0d 0a 35 32 0d 0a 0d 0a 73 6b 69 70 69  .-9..52....skipi
17bd0 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50  f postgresql # P
17be0 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72  ostgreSQL requir
17bf0 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d  es AS when renam
17c00 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d  ing output colum
17c10 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ns..query I rows
17c20 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 31  ort..SELECT col1
17c30 20 2a 20 2d 20 63 6f 6c 30 20 2b 20 63 6f 6c 30   * - col0 + col0
17c40 20 2a 20 2b 20 63 6f 6c 30 20 2b 20 2d 20 63 6f   * + col0 + - co
17c50 6c 31 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  l1 col0 FROM tab
17c60 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 39  1 cor0..----..-9
17c70 35 0d 0a 33 34 34 36 0d 0a 35 33 34 37 0d 0a 0d  5..3446..5347...
17c80 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
17c90 0d 0a 53 45 4c 45 43 54 20 2b 20 2b 20 63 6f 72  ..SELECT + + cor
17ca0 30 2e 63 6f 6c 32 20 2a 20 63 6f 6c 31 20 2b 20  0.col2 * col1 + 
17cb0 32 35 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  25 FROM tab2 AS 
17cc0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 35 35 39  cor0..----..1559
17cd0 0d 0a 36 37 31 0d 0a 38 36 32 0d 0a 0d 0a 71 75  ..671..862....qu
17ce0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
17cf0 45 4c 45 43 54 20 2b 20 36 31 20 2a 20 63 6f 6c  ELECT + 61 * col
17d00 32 20 2a 20 63 6f 6c 31 20 2d 20 33 33 20 46 52  2 * col1 - 33 FR
17d10 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
17d20 0a 2d 2d 2d 2d 0d 0a 33 39 33 37 33 0d 0a 35 31  .----..39373..51
17d30 30 32 34 0d 0a 39 33 35 34 31 0d 0a 0d 0a 73 6b  024..93541....sk
17d40 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20  ipif postgresql 
17d50 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71  # PostgreSQL req
17d60 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65  uires AS when re
17d70 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f  naming output co
17d80 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72  lumns..query I r
17d90 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
17da0 20 2b 20 28 20 63 6f 6c 31 20 29 20 2b 20 63 6f   + ( col1 ) + co
17db0 6c 32 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  l2 col1 FROM tab
17dc0 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
17dd0 0a 35 35 0d 0a 35 38 0d 0a 38 35 0d 0a 0d 0a 71  .55..58..85....q
17de0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
17df0 53 45 4c 45 43 54 20 2d 20 63 6f 6c 31 20 2a 20  SELECT - col1 * 
17e00 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 2b 20 2d 20  + cor0.col1 + - 
17e10 39 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  9 AS col1 FROM t
17e20 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
17e30 2d 0d 0a 2d 32 39 38 0d 0a 2d 33 34 39 30 0d 0a  -..-298..-3490..
17e40 2d 39 37 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  -970....onlyif m
17e50 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f  ysql # use DIV o
17e60 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65  perator for inte
17e70 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75  ger division..qu
17e80 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
17e90 62 65 6c 2d 36 36 31 0d 0a 53 45 4c 45 43 54 20  bel-661..SELECT 
17ea0 2b 20 63 6f 6c 32 20 2a 20 2d 20 63 6f 72 30 2e  + col2 * - cor0.
17eb0 63 6f 6c 32 20 2b 20 39 39 20 44 49 56 20 2d 20  col2 + 99 DIV - 
17ec0 63 6f 6c 31 20 2d 20 2d 20 63 6f 6c 32 20 41 53  col1 - - col2 AS
17ed0 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20   col1 FROM tab2 
17ee0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
17ef0 31 34 31 31 0d 0a 2d 36 35 31 0d 0a 2d 37 30 35  1411..-651..-705
17f00 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
17f10 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
17f20 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
17f30 72 74 20 6c 61 62 65 6c 2d 36 36 31 0d 0a 53 45  rt label-661..SE
17f40 4c 45 43 54 20 2b 20 63 6f 6c 32 20 2a 20 2d 20  LECT + col2 * - 
17f50 63 6f 72 30 2e 63 6f 6c 32 20 2b 20 39 39 20 2f  cor0.col2 + 99 /
17f60 20 2d 20 63 6f 6c 31 20 2d 20 2d 20 63 6f 6c 32   - col1 - - col2
17f70 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
17f80 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
17f90 0d 0a 2d 31 34 31 31 0d 0a 2d 36 35 31 0d 0a 2d  ..-1411..-651..-
17fa0 37 30 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  705....query I r
17fb0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
17fc0 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c 30 20 2a  ISTINCT - col0 *
17fd0 20 63 6f 6c 30 20 2b 20 63 6f 6c 30 20 2a 20 38   col0 + col0 * 8
17fe0 20 2a 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62   * col0 FROM tab
17ff0 31 0d 0a 2d 2d 2d 2d 0d 0a 32 38 36 37 32 0d 0a  1..----..28672..
18000 34 34 38 30 30 0d 0a 36 33 0d 0a 0d 0a 6f 6e 6c  44800..63....onl
18010 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20  yif mysql # use 
18020 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72  DIV operator for
18030 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f   integer divisio
18040 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  n..query I rowso
18050 72 74 20 6c 61 62 65 6c 2d 36 36 33 0d 0a 53 45  rt label-663..SE
18060 4c 45 43 54 20 2b 20 63 6f 72 30 2e 63 6f 6c 31  LECT + cor0.col1
18070 20 44 49 56 20 2b 20 63 6f 6c 31 20 2b 20 33 33   DIV + col1 + 33
18080 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
18090 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 34 0d 0a 33 34  r0..----..34..34
180a0 0d 0a 33 34 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  ..34....skipif m
180b0 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
180c0 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
180d0 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 36 36 33  owsort label-663
180e0 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 72 30 2e  ..SELECT + cor0.
180f0 63 6f 6c 31 20 2f 20 2b 20 63 6f 6c 31 20 2b 20  col1 / + col1 + 
18100 33 33 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  33 FROM tab1 AS 
18110 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 34 0d 0a  cor0..----..34..
18120 33 34 0d 0a 33 34 0d 0a 0d 0a 71 75 65 72 79 20  34..34....query 
18130 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
18140 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 32 20  T DISTINCT col2 
18150 2a 20 2d 20 63 6f 6c 32 20 2b 20 28 20 2b 20 63  * - col2 + ( + c
18160 6f 6c 30 20 2b 20 2b 20 63 6f 6c 31 20 2a 20 63  ol0 + + col1 * c
18170 6f 6c 32 20 29 20 46 52 4f 4d 20 74 61 62 31 20  ol2 ) FROM tab1 
18180 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
18190 31 35 30 39 0d 0a 2d 32 36 31 35 0d 0a 2d 37 38  1509..-2615..-78
181a0 38 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  88....query I ro
181b0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
181c0 53 54 49 4e 43 54 20 2d 20 2b 20 63 6f 6c 31 20  STINCT - + col1 
181d0 2d 20 2b 20 63 6f 6c 32 20 41 53 20 63 6f 6c 30  - + col2 AS col0
181e0 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
181f0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 39 0d 0a  r0..----..-119..
18200 2d 31 37 33 0d 0a 2d 39 38 0d 0a 0d 0a 71 75 65  -173..-98....que
18210 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
18220 4c 45 43 54 20 2b 20 36 34 20 2a 20 63 6f 6c 30  LECT + 64 * col0
18230 20 2b 20 2b 20 28 20 63 6f 6c 30 20 29 20 46 52   + + ( col0 ) FR
18240 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
18250 0a 2d 2d 2d 2d 0d 0a 34 35 35 0d 0a 35 30 37 30  .----..455..5070
18260 0d 0a 35 31 33 35 0d 0a 0d 0a 71 75 65 72 79 20  ..5135....query 
18270 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
18280 54 20 41 4c 4c 20 2b 20 2d 20 63 6f 72 30 2e 63  T ALL + - cor0.c
18290 6f 6c 31 20 2b 20 2d 20 63 6f 6c 31 20 41 53 20  ol1 + - col1 AS 
182a0 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41  col1 FROM tab1 A
182b0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32  S cor0..----..-2
182c0 30 0d 0a 2d 32 36 0d 0a 2d 35 32 0d 0a 0d 0a 71  0..-26..-52....q
182d0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
182e0 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c  SELECT ALL + col
182f0 30 20 2b 20 63 6f 6c 32 20 2d 20 30 20 46 52 4f  0 + col2 - 0 FRO
18300 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
18310 2d 2d 2d 2d 0d 0a 31 30 34 0d 0a 31 31 37 0d 0a  ----..104..117..
18320 33 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  34....query I ro
18330 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
18340 33 30 20 2a 20 2b 20 63 6f 72 30 2e 63 6f 6c 32  30 * + cor0.col2
18350 20 2b 20 2d 20 35 31 20 2a 20 2b 20 63 6f 6c 31   + - 51 * + col1
18360 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
18370 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  b1 cor0..----..1
18380 32 30 30 0d 0a 32 32 31 37 0d 0a 32 39 34 0d 0a  200..2217..294..
18390 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
183a0 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 37 37  t..SELECT ALL 77
183b0 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 20   FROM tab0 cor0 
183c0 43 52 4f 53 53 20 4a 4f 49 4e 20 74 61 62 30 20  CROSS JOIN tab0 
183d0 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 39  AS cor1..----..9
183e0 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20   values hashing 
183f0 74 6f 20 30 35 31 62 66 31 30 63 35 30 65 30 36  to 051bf10c50e06
18400 31 64 37 34 61 64 30 61 34 64 32 30 35 61 31 63  1d74ad0a4d205a1c
18410 36 32 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  622....query I r
18420 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
18430 4c 4c 20 2d 20 63 6f 6c 32 20 2a 20 2b 20 32 33  LL - col2 * + 23
18440 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62   + col0 FROM tab
18450 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 35  2 cor0..----..-5
18460 32 30 0d 0a 2d 36 31 34 0d 0a 2d 37 39 35 0d 0a  20..-614..-795..
18470 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
18480 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f  t..SELECT ALL co
18490 6c 31 20 2a 20 63 6f 6c 31 20 2b 20 2b 20 30 20  l1 * col1 + + 0 
184a0 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d  FROM tab2..----.
184b0 0a 32 38 39 0d 0a 33 34 38 31 0d 0a 39 36 31 0d  .289..3481..961.
184c0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
184d0 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2b 20 38  rt..SELECT - + 8
184e0 32 20 2b 20 63 6f 6c 32 20 41 53 20 63 6f 6c 30  2 + col2 AS col0
184f0 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
18500 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 39 0d 0a 2d  r0..----..-49..-
18510 38 31 0d 0a 30 0d 0a 0d 0a 73 6b 69 70 69 66 20  81..0....skipif 
18520 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73  postgresql # Pos
18530 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73  tgreSQL requires
18540 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e   AS when renamin
18550 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73  g output columns
18560 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
18570 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2b 20 63 6f  t..SELECT - + co
18580 72 30 2e 63 6f 6c 30 20 2b 20 63 6f 6c 30 20 63  r0.col0 + col0 c
18590 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 63 6f  ol1 FROM tab1 co
185a0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a  r0..----..0..0..
185b0 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  0....onlyif mysq
185c0 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72  l # use DIV oper
185d0 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72  ator for integer
185e0 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79   division..query
185f0 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
18600 2d 36 37 35 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  -675..SELECT ALL
18610 20 35 20 44 49 56 20 35 35 20 46 52 4f 4d 20 74   5 DIV 55 FROM t
18620 61 62 32 2c 20 74 61 62 30 20 63 6f 72 30 0d 0a  ab2, tab0 cor0..
18630 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68  ----..9 values h
18640 61 73 68 69 6e 67 20 74 6f 20 38 62 37 35 31 33  ashing to 8b7513
18650 36 62 32 62 35 31 63 37 37 33 34 35 63 30 33 38  6b2b51c77345c038
18660 30 34 65 63 31 63 64 61 35 63 0d 0a 0d 0a 73 6b  04ec1cda5c....sk
18670 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
18680 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
18690 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
186a0 65 6c 2d 36 37 35 0d 0a 53 45 4c 45 43 54 20 41  el-675..SELECT A
186b0 4c 4c 20 35 20 2f 20 35 35 20 46 52 4f 4d 20 74  LL 5 / 55 FROM t
186c0 61 62 32 2c 20 74 61 62 30 20 63 6f 72 30 0d 0a  ab2, tab0 cor0..
186d0 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68  ----..9 values h
186e0 61 73 68 69 6e 67 20 74 6f 20 38 62 37 35 31 33  ashing to 8b7513
186f0 36 62 32 62 35 31 63 37 37 33 34 35 63 30 33 38  6b2b51c77345c038
18700 30 34 65 63 31 63 64 61 35 63 0d 0a 0d 0a 71 75  04ec1cda5c....qu
18710 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
18720 45 4c 45 43 54 20 41 4c 4c 20 2d 20 39 34 20 2a  ELECT ALL - 94 *
18730 20 2b 20 34 39 20 46 52 4f 4d 20 74 61 62 31 0d   + 49 FROM tab1.
18740 0a 2d 2d 2d 2d 0d 0a 2d 34 36 30 36 0d 0a 2d 34  .----..-4606..-4
18750 36 30 36 0d 0a 2d 34 36 30 36 0d 0a 0d 0a 6f 6e  606..-4606....on
18760 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
18770 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
18780 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
18790 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
187a0 6f 72 74 20 6c 61 62 65 6c 2d 36 37 37 0d 0a 53  ort label-677..S
187b0 45 4c 45 43 54 20 2b 20 33 30 20 44 49 56 20 2d  ELECT + 30 DIV -
187c0 20 74 61 62 30 2e 63 6f 6c 31 20 46 52 4f 4d 20   tab0.col1 FROM 
187d0 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30  tab0..----..0..0
187e0 0d 0a 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  ..0....skipif my
187f0 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
18800 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
18810 77 73 6f 72 74 20 6c 61 62 65 6c 2d 36 37 37 0d  wsort label-677.
18820 0a 53 45 4c 45 43 54 20 2b 20 33 30 20 2f 20 2d  .SELECT + 30 / -
18830 20 74 61 62 30 2e 63 6f 6c 31 20 46 52 4f 4d 20   tab0.col1 FROM 
18840 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30  tab0..----..0..0
18850 0d 0a 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  ..0....onlyif my
18860 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f  sql # support fo
18870 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63  r MySQL specific
18880 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e   system types an
18890 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20  d syntax..query 
188a0 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
188b0 36 37 38 0d 0a 53 45 4c 45 43 54 20 2d 20 43 41  678..SELECT - CA
188c0 53 54 28 20 2b 20 63 6f 6c 32 20 41 53 20 53 49  ST( + col2 AS SI
188d0 47 4e 45 44 20 29 20 2a 20 2d 20 63 6f 6c 32 20  GNED ) * - col2 
188e0 2a 20 2d 20 34 30 20 46 52 4f 4d 20 74 61 62 32  * - 40 FROM tab2
188f0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
18900 2d 32 37 30 34 30 0d 0a 2d 32 39 31 36 30 0d 0a  -27040..-29160..
18910 2d 35 37 37 36 30 0d 0a 0d 0a 73 6b 69 70 69 66  -57760....skipif
18920 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
18930 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
18940 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 36   rowsort label-6
18950 37 38 0d 0a 53 45 4c 45 43 54 20 2d 20 43 41 53  78..SELECT - CAS
18960 54 20 28 20 2b 20 63 6f 6c 32 20 41 53 20 49 4e  T ( + col2 AS IN
18970 54 45 47 45 52 20 29 20 2a 20 2d 20 63 6f 6c 32  TEGER ) * - col2
18980 20 2a 20 2d 20 34 30 20 46 52 4f 4d 20 74 61 62   * - 40 FROM tab
18990 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
189a0 0a 2d 32 37 30 34 30 0d 0a 2d 32 39 31 36 30 0d  .-27040..-29160.
189b0 0a 2d 35 37 37 36 30 0d 0a 0d 0a 71 75 65 72 79  .-57760....query
189c0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
189d0 43 54 20 41 4c 4c 20 63 6f 72 31 2e 63 6f 6c 30  CT ALL cor1.col0
189e0 20 2b 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 46   + + cor0.col1 F
189f0 52 4f 4d 20 74 61 62 32 2c 20 74 61 62 32 20 41  ROM tab2, tab2 A
18a00 53 20 63 6f 72 30 2c 20 74 61 62 31 20 41 53 20  S cor0, tab1 AS 
18a10 63 6f 72 31 2c 20 74 61 62 30 2c 20 74 61 62 32  cor1, tab0, tab2
18a20 20 63 6f 72 32 0d 0a 2d 2d 2d 2d 0d 0a 32 34 33   cor2..----..243
18a30 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20   values hashing 
18a40 74 6f 20 39 65 38 30 33 34 32 62 30 61 37 33 30  to 9e80342b0a730
18a50 37 61 30 37 62 38 37 38 33 36 30 65 32 63 30 63  7a07b878360e2c0c
18a60 35 61 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  5a4....query I r
18a70 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
18a80 20 63 6f 72 31 2e 63 6f 6c 31 20 41 53 20 63 6f   cor1.col1 AS co
18a90 6c 32 20 46 52 4f 4d 20 74 61 62 31 2c 20 74 61  l2 FROM tab1, ta
18aa0 62 30 20 41 53 20 63 6f 72 30 2c 20 74 61 62 30  b0 AS cor0, tab0
18ab0 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a   AS cor1..----..
18ac0 32 37 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e  27 values hashin
18ad0 67 20 74 6f 20 64 34 63 36 37 33 62 37 34 34 34  g to d4c673b7444
18ae0 65 62 39 39 32 37 65 63 36 33 31 37 35 62 34 33  eb9927ec63175b43
18af0 63 36 62 38 34 0d 0a 0d 0a 71 75 65 72 79 20 49  c6b84....query I
18b00 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
18b10 20 2b 20 63 6f 6c 32 20 2a 20 2b 20 63 6f 72 30   + col2 * + cor0
18b20 2e 63 6f 6c 31 20 2d 20 39 31 20 46 52 4f 4d 20  .col1 - 91 FROM 
18b30 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
18b40 2d 2d 0d 0a 32 37 34 37 0d 0a 36 0d 0a 37 33 37  --..2747..6..737
18b50 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  1....query I row
18b60 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
18b70 54 49 4e 43 54 20 2d 20 2d 20 63 6f 6c 30 20 2b  TINCT - - col0 +
18b80 20 2d 20 28 20 2b 20 28 20 63 6f 6c 30 20 29 20   - ( + ( col0 ) 
18b90 29 20 2a 20 2b 20 28 20 63 6f 6c 31 20 29 20 41  ) * + ( col1 ) A
18ba0 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32  S col1 FROM tab2
18bb0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32   cor0..----..-12
18bc0 36 34 0d 0a 2d 32 31 30 0d 0a 2d 34 35 32 34 0d  64..-210..-4524.
18bd0 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72  ...skipif postgr
18be0 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51  esql # PostgreSQ
18bf0 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68  L requires AS wh
18c00 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70  en renaming outp
18c10 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72  ut columns..quer
18c20 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
18c30 45 43 54 20 2d 20 2b 20 63 6f 6c 31 20 2d 20 2d  ECT - + col1 - -
18c40 20 63 6f 6c 30 20 63 6f 6c 32 20 46 52 4f 4d 20   col0 col2 FROM 
18c50 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
18c60 2d 2d 0d 0a 2d 32 33 0d 0a 35 34 0d 0a 36 37 0d  --..-23..54..67.
18c70 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
18c80 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b  rt..SELECT ALL +
18c90 20 2b 20 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c 30   + col0 * - col0
18ca0 20 2b 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 46   + + cor0.col2 F
18cb0 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
18cc0 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32 32 34 0d 0a 2d  ..----..-1224..-
18cd0 35 34 33 0d 0a 2d 37 38 33 39 0d 0a 0d 0a 71 75  543..-7839....qu
18ce0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
18cf0 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 63  ELECT DISTINCT c
18d00 6f 72 30 2e 63 6f 6c 32 20 2b 20 36 33 20 46 52  or0.col2 + 63 FR
18d10 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
18d20 0a 2d 2d 2d 2d 0d 0a 31 30 31 0d 0a 38 39 0d 0a  .----..101..89..
18d30 39 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  90....query I ro
18d40 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
18d50 63 6f 6c 30 20 2a 20 63 6f 72 30 2e 63 6f 6c 32  col0 * cor0.col2
18d60 20 2b 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 41   + + cor0.col1 A
18d70 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32  S col0 FROM tab2
18d80 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
18d90 2d 31 35 38 0d 0a 2d 31 39 36 39 0d 0a 2d 32 39  -158..-1969..-29
18da0 38 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  85....query I ro
18db0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f  wsort..SELECT co
18dc0 6c 32 20 2a 20 63 6f 72 30 2e 63 6f 6c 30 20 2d  l2 * cor0.col0 -
18dd0 20 2d 20 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20   - col0 AS col2 
18de0 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
18df0 30 0d 0a 2d 2d 2d 2d 0d 0a 31 36 35 0d 0a 33 37  0..----..165..37
18e00 31 32 0d 0a 37 37 36 30 0d 0a 0d 0a 71 75 65 72  12..7760....quer
18e10 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
18e20 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63  ECT DISTINCT + c
18e30 6f 6c 30 20 2a 20 2d 20 33 39 20 2a 20 63 6f 6c  ol0 * - 39 * col
18e40 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  2 FROM tab0 AS c
18e50 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 36 35  or0..----..-1365
18e60 0d 0a 2d 32 38 34 36 32 32 0d 0a 2d 33 30 38 38  ..-284622..-3088
18e70 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  8....query I row
18e80 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
18e90 20 33 33 20 2b 20 63 6f 6c 32 20 46 52 4f 4d 20   33 + col2 FROM 
18ea0 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
18eb0 2d 2d 0d 0a 35 39 0d 0a 36 30 0d 0a 37 31 0d 0a  --..59..60..71..
18ec0 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65  ..skipif postgre
18ed0 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c  sql # PostgreSQL
18ee0 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65   requires AS whe
18ef0 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75  n renaming outpu
18f00 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79  t columns..query
18f10 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
18f20 43 54 20 2b 20 63 6f 6c 31 20 2b 20 2b 20 38 38  CT + col1 + + 88
18f30 20 2a 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 63   * - cor0.col2 c
18f40 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol1 FROM tab0 AS
18f50 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 38   cor0..----..-28
18f60 31 38 0d 0a 2d 37 31 32 35 0d 0a 39 0d 0a 0d 0a  18..-7125..9....
18f70 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
18f80 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f  .SELECT ALL + co
18f90 6c 30 20 2a 20 63 6f 72 30 2e 63 6f 6c 30 20 2b  l0 * cor0.col0 +
18fa0 20 2b 20 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20   + col2 AS col0 
18fb0 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
18fc0 30 0d 0a 2d 2d 2d 2d 0d 0a 34 31 35 33 0d 0a 36  0..----..4153..6
18fd0 33 0d 0a 36 34 39 36 0d 0a 0d 0a 6f 6e 6c 79 69  3..6496....onlyi
18fe0 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49  f mysql # use DI
18ff0 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69  V operator for i
19000 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d  nteger division.
19010 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
19020 20 6c 61 62 65 6c 2d 36 39 32 0d 0a 53 45 4c 45   label-692..SELE
19030 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63 6f  CT DISTINCT + co
19040 6c 32 20 44 49 56 20 2b 20 63 6f 6c 30 20 2d 20  l2 DIV + col0 - 
19050 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41  col1 FROM tab0 A
19060 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 38  S cor0..----..-8
19070 35 0d 0a 2d 39 31 0d 0a 2d 39 37 0d 0a 0d 0a 73  5..-91..-97....s
19080 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
19090 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
190a0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
190b0 62 65 6c 2d 36 39 32 0d 0a 53 45 4c 45 43 54 20  bel-692..SELECT 
190c0 44 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c 32 20  DISTINCT + col2 
190d0 2f 20 2b 20 63 6f 6c 30 20 2d 20 63 6f 6c 31 20  / + col0 - col1 
190e0 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
190f0 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 38 35 0d 0a 2d 39  0..----..-85..-9
19100 31 0d 0a 2d 39 37 0d 0a 0d 0a 73 6b 69 70 69 66  1..-97....skipif
19110 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f   postgresql # Po
19120 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65  stgreSQL require
19130 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69  s AS when renami
19140 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e  ng output column
19150 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  s..query I rowso
19160 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
19170 4e 43 54 20 2d 20 63 6f 72 30 2e 63 6f 6c 31 20  NCT - cor0.col1 
19180 2b 20 2b 20 36 32 20 2a 20 2d 20 63 6f 6c 31 20  + + 62 * - col1 
19190 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41  col0 FROM tab1 A
191a0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
191b0 36 33 38 0d 0a 2d 36 33 30 0d 0a 2d 38 31 39 0d  638..-630..-819.
191c0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
191d0 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 39  rt..SELECT ALL 9
191e0 34 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  4 AS col0 FROM t
191f0 61 62 31 2c 20 74 61 62 32 20 41 53 20 63 6f 72  ab1, tab2 AS cor
19200 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65  0..----..9 value
19210 73 20 68 61 73 68 69 6e 67 20 74 6f 20 62 30 66  s hashing to b0f
19220 66 62 37 35 32 37 66 34 66 62 66 34 34 66 33 30  fb7527f4fbf44f30
19230 39 34 35 65 31 63 63 62 35 38 63 32 34 0d 0a 0d  945e1ccb58c24...
19240 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
19250 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 2d  ..SELECT ALL + -
19260 20 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c 30 20 2b   col0 * - col0 +
19270 20 2d 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62   - col2 FROM tab
19280 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
19290 0a 2d 34 35 0d 0a 34 30 33 39 0d 0a 36 33 30 34  .-45..4039..6304
192a0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
192b0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
192c0 63 6f 72 31 2e 63 6f 6c 31 20 46 52 4f 4d 20 74  cor1.col1 FROM t
192d0 61 62 32 20 41 53 20 63 6f 72 30 20 43 52 4f 53  ab2 AS cor0 CROS
192e0 53 20 4a 4f 49 4e 20 74 61 62 32 20 63 6f 72 31  S JOIN tab2 cor1
192f0 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73  ..----..9 values
19300 20 68 61 73 68 69 6e 67 20 74 6f 20 63 36 31 64   hashing to c61d
19310 32 37 61 30 30 32 32 65 36 64 30 32 32 33 37 31  27a0022e6d022371
19320 64 63 35 38 38 31 39 61 62 32 37 32 0d 0a 0d 0a  dc58819ab272....
19330 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
19340 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
19350 20 2d 20 28 20 2d 20 63 6f 6c 32 20 29 20 2b 20   - ( - col2 ) + 
19360 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46  + col1 AS col0 F
19370 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
19380 0d 0a 2d 2d 2d 2d 0d 0a 31 30 39 0d 0a 36 37 0d  ..----..109..67.
19390 0a 38 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .80....query I r
193a0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
193b0 20 63 6f 6c 32 20 2b 20 63 6f 72 30 2e 63 6f 6c   col2 + cor0.col
193c0 30 20 2a 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20  0 * + cor0.col0 
193d0 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
193e0 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 32 36 0d 0a 36  0..----..1226..6
193f0 30 39 0d 0a 38 30 30 33 0d 0a 0d 0a 71 75 65 72  09..8003....quer
19400 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
19410 45 43 54 20 41 4c 4c 20 2d 20 2b 20 63 6f 6c 31  ECT ALL - + col1
19420 20 2a 20 2b 20 63 6f 6c 31 20 2b 20 2b 20 37 32   * + col1 + + 72
19430 20 46 52 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d   FROM tab2 cor0.
19440 0a 2d 2d 2d 2d 0d 0a 2d 32 31 37 0d 0a 2d 33 34  .----..-217..-34
19450 30 39 0d 0a 2d 38 38 39 0d 0a 0d 0a 73 6b 69 70  09..-889....skip
19460 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20  if postgresql # 
19470 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69  PostgreSQL requi
19480 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61  res AS when rena
19490 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75  ming output colu
194a0 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  mns..query I row
194b0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
194c0 20 2b 20 63 6f 6c 31 20 2a 20 2d 20 63 6f 72 30   + col1 * - cor0
194d0 2e 63 6f 6c 31 20 2b 20 2d 20 35 36 20 63 6f 6c  .col1 + - 56 col
194e0 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  1 FROM tab0 AS c
194f0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 37 34 35 32  or0..----..-7452
19500 0d 0a 2d 38 33 33 37 0d 0a 2d 39 34 36 35 0d 0a  ..-8337..-9465..
19510 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
19520 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
19530 43 54 20 39 36 20 2d 20 63 6f 72 30 2e 63 6f 6c  CT 96 - cor0.col
19540 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  0 FROM tab0 AS c
19550 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 36 31 0d 0a 37  or0..----..61..7
19560 0d 0a 37 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..72....query I 
19570 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
19580 41 4c 4c 20 2d 20 63 6f 6c 32 20 2a 20 2b 20 63  ALL - col2 * + c
19590 6f 6c 32 20 2b 20 2b 20 37 33 20 2a 20 2d 20 63  ol2 + + 73 * - c
195a0 6f 72 30 2e 63 6f 6c 30 20 46 52 4f 4d 20 74 61  or0.col0 FROM ta
195b0 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
195c0 0d 0a 2d 31 32 34 30 0d 0a 2d 36 33 37 30 0d 0a  ..-1240..-6370..
195d0 2d 37 32 31 31 0d 0a 0d 0a 71 75 65 72 79 20 49  -7211....query I
195e0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
195f0 20 41 4c 4c 20 63 6f 6c 31 20 2a 20 2b 20 63 6f   ALL col1 * + co
19600 6c 30 20 2b 20 2b 20 28 20 63 6f 72 30 2e 63 6f  l0 + + ( cor0.co
19610 6c 30 20 29 20 2a 20 28 20 2b 20 63 6f 6c 31 20  l0 ) * ( + col1 
19620 29 20 2a 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61  ) * col1 FROM ta
19630 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
19640 0d 0a 31 37 39 35 36 38 0d 0a 33 33 32 37 31 30  ..179568..332710
19650 0d 0a 37 34 35 31 30 38 0d 0a 0d 0a 71 75 65 72  ..745108....quer
19660 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
19670 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 31 20 2a  ECT ALL + col1 *
19680 20 2b 20 39 36 20 46 52 4f 4d 20 74 61 62 30 20   + 96 FROM tab0 
19690 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 38  AS cor0..----..8
196a0 32 35 36 0d 0a 38 37 33 36 0d 0a 39 33 31 32 0d  256..8736..9312.
196b0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
196c0 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
196d0 4e 43 54 20 2b 20 63 6f 6c 32 20 2a 20 63 6f 6c  NCT + col2 * col
196e0 32 20 2a 20 63 6f 6c 31 20 2b 20 63 6f 6c 31 20  2 * col1 + col1 
196f0 2a 20 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46  * col0 AS col2 F
19700 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
19710 0d 0a 2d 2d 2d 2d 0d 0a 33 34 39 32 0d 0a 36 31  ..----..3492..61
19720 39 39 38 33 0d 0a 39 35 37 31 38 0d 0a 0d 0a 73  9983..95718....s
19730 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c  kipif postgresql
19740 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65   # PostgreSQL re
19750 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72  quires AS when r
19760 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63  enaming output c
19770 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20  olumns..query I 
19780 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
19790 44 49 53 54 49 4e 43 54 20 63 6f 6c 31 20 2b 20  DISTINCT col1 + 
197a0 2b 20 37 34 20 63 6f 6c 31 20 46 52 4f 4d 20 74  + 74 col1 FROM t
197b0 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
197c0 2d 0d 0a 31 30 35 0d 0a 31 33 33 0d 0a 39 31 0d  -..105..133..91.
197d0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
197e0 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d  rt..SELECT ALL -
197f0 20 63 6f 6c 31 20 2d 20 63 6f 72 30 2e 63 6f 6c   col1 - cor0.col
19800 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  0 FROM tab2 AS c
19810 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 37 0d  or0..----..-137.
19820 0a 2d 33 38 0d 0a 2d 39 36 0d 0a 0d 0a 71 75 65  .-38..-96....que
19830 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
19840 4c 45 43 54 20 2b 20 63 6f 6c 32 20 2a 20 63 6f  LECT + col2 * co
19850 72 30 2e 63 6f 6c 32 20 2b 20 2d 20 63 6f 6c 31  r0.col2 + - col1
19860 20 2a 20 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20   * col0 AS col2 
19870 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
19880 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 37 35 0d 0a  0..----..-1375..
19890 2d 33 33 39 34 0d 0a 2d 39 37 35 0d 0a 0d 0a 71  -3394..-975....q
198a0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
198b0 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c  SELECT ALL + col
198c0 32 20 2a 20 2d 20 63 6f 6c 32 20 2a 20 2b 20 63  2 * - col2 * + c
198d0 6f 6c 32 20 2d 20 63 6f 6c 30 20 46 52 4f 4d 20  ol2 - col0 FROM 
198e0 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
198f0 2d 2d 0d 0a 2d 33 35 39 36 31 0d 0a 2d 33 36 0d  --..-35961..-36.
19900 0a 2d 35 35 31 34 35 37 0d 0a 0d 0a 71 75 65 72  .-551457....quer
19910 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
19920 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 2d  ECT DISTINCT - -
19930 20 63 6f 6c 30 20 2a 20 39 34 20 46 52 4f 4d 20   col0 * 94 FROM 
19940 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
19950 2d 2d 0d 0a 32 32 35 36 0d 0a 33 32 39 30 0d 0a  --..2256..3290..
19960 38 33 36 36 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  8366....onlyif m
19970 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f  ysql # use DIV o
19980 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65  perator for inte
19990 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75  ger division..qu
199a0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
199b0 62 65 6c 2d 37 31 31 0d 0a 53 45 4c 45 43 54 20  bel-711..SELECT 
199c0 39 38 20 44 49 56 20 63 6f 6c 32 20 2b 20 63 6f  98 DIV col2 + co
199d0 6c 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  l0 AS col1 FROM 
199e0 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 34 0d 0a 36  tab1..----..4..6
199f0 35 0d 0a 38 31 0d 0a 0d 0a 73 6b 69 70 69 66 20  5..81....skipif 
19a00 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
19a10 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
19a20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 37 31  rowsort label-71
19a30 31 0d 0a 53 45 4c 45 43 54 20 39 38 20 2f 20 63  1..SELECT 98 / c
19a40 6f 6c 32 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f  ol2 + col0 AS co
19a50 6c 31 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d  l1 FROM tab1..--
19a60 2d 2d 0d 0a 34 0d 0a 36 35 0d 0a 38 31 0d 0a 0d  --..4..65..81...
19a70 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
19a80 0d 0a 53 45 4c 45 43 54 20 74 61 62 30 2e 63 6f  ..SELECT tab0.co
19a90 6c 31 20 2a 20 63 6f 6c 32 20 2b 20 2d 20 28 20  l1 * col2 + - ( 
19aa0 74 61 62 30 2e 63 6f 6c 32 20 29 20 2a 20 2d 20  tab0.col2 ) * - 
19ab0 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a  col0 FROM tab0..
19ac0 2d 2d 2d 2d 0d 0a 31 33 32 0d 0a 31 34 37 36 30  ----..132..14760
19ad0 0d 0a 33 36 33 30 0d 0a 0d 0a 6f 6e 6c 79 69 66  ..3630....onlyif
19ae0 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56   mysql # use DIV
19af0 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e   operator for in
19b00 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a  teger division..
19b10 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
19b20 6c 61 62 65 6c 2d 37 31 33 0d 0a 53 45 4c 45 43  label-713..SELEC
19b30 54 20 2d 20 63 6f 72 30 2e 63 6f 6c 30 20 44 49  T - cor0.col0 DI
19b40 56 20 2b 20 63 6f 6c 30 20 63 6f 6c 31 20 46 52  V + col0 col1 FR
19b50 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
19b60 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 2d 31 0d 0a 2d  .----..-1..-1..-
19b70 31 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74  1....skipif post
19b80 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65  gresql # Postgre
19b90 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20  SQL requires AS 
19ba0 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75  when renaming ou
19bb0 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 73 6b  tput columns..sk
19bc0 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
19bd0 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
19be0 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
19bf0 65 6c 2d 37 31 33 0d 0a 53 45 4c 45 43 54 20 2d  el-713..SELECT -
19c00 20 63 6f 72 30 2e 63 6f 6c 30 20 2f 20 2b 20 63   cor0.col0 / + c
19c10 6f 6c 30 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61  ol0 col1 FROM ta
19c20 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
19c30 0d 0a 2d 31 0d 0a 2d 31 0d 0a 2d 31 0d 0a 0d 0a  ..-1..-1..-1....
19c40 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
19c50 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f  .SELECT ALL + co
19c60 6c 32 20 2a 20 33 38 20 2a 20 28 20 2b 20 63 6f  l2 * 38 * ( + co
19c70 6c 31 20 29 20 46 52 4f 4d 20 74 61 62 31 20 41  l1 ) FROM tab1 A
19c80 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 31  S cor0..----..21
19c90 36 36 30 0d 0a 34 37 34 32 34 0d 0a 35 33 33 35  660..47424..5335
19ca0 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  2....query I row
19cb0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
19cc0 20 2d 20 33 39 20 41 53 20 63 6f 6c 30 20 46 52   - 39 AS col0 FR
19cd0 4f 4d 20 74 61 62 30 2c 20 74 61 62 31 20 63 6f  OM tab0, tab1 co
19ce0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75  r0..----..9 valu
19cf0 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 35 30  es hashing to 50
19d00 34 64 31 34 39 33 39 64 35 38 61 65 62 34 61 31  4d14939d58aeb4a1
19d10 34 66 33 31 63 38 30 64 65 35 62 35 33 65 0d 0a  4f31c80de5b53e..
19d20 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
19d30 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
19d40 43 54 20 2b 20 63 6f 6c 31 20 2b 20 36 35 20 41  CT + col1 + 65 A
19d50 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30  S col2 FROM tab0
19d60 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
19d70 31 35 31 0d 0a 31 35 36 0d 0a 31 36 32 0d 0a 0d  151..156..162...
19d80 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
19d90 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
19da0 54 20 2b 20 32 20 2a 20 2b 20 63 6f 6c 31 20 46  T + 2 * + col1 F
19db0 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab2..----..
19dc0 31 31 38 0d 0a 33 34 0d 0a 36 32 0d 0a 0d 0a 71  118..34..62....q
19dd0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
19de0 53 45 4c 45 43 54 20 63 6f 6c 30 20 2a 20 28 20  SELECT col0 * ( 
19df0 2d 20 63 6f 6c 31 20 29 20 2b 20 63 6f 6c 32 20  - col1 ) + col2 
19e00 2a 20 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c 30 20  * col0 * - col0 
19e10 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d  FROM tab0..----.
19e20 0a 2d 32 31 30 37 32 0d 0a 2d 34 36 32 30 0d 0a  .-21072..-4620..
19e30 2d 36 35 37 36 32 31 0d 0a 0d 0a 73 6b 69 70 69  -657621....skipi
19e40 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50  f postgresql # P
19e50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72  ostgreSQL requir
19e60 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d  es AS when renam
19e70 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d  ing output colum
19e80 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ns..query I rows
19e90 6f 72 74 0d 0a 53 45 4c 45 43 54 20 33 38 20 2a  ort..SELECT 38 *
19ea0 20 2b 20 31 39 20 63 6f 6c 30 20 46 52 4f 4d 20   + 19 col0 FROM 
19eb0 74 61 62 32 2c 20 74 61 62 30 20 41 53 20 63 6f  tab2, tab0 AS co
19ec0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75  r0..----..9 valu
19ed0 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 32 31  es hashing to 21
19ee0 33 38 32 61 63 63 62 62 36 32 61 64 63 63 35 32  382accbb62adcc52
19ef0 65 63 62 37 62 66 39 33 36 62 33 32 62 31 0d 0a  ecb7bf936b32b1..
19f00 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
19f10 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
19f20 43 54 20 2b 20 63 6f 6c 32 20 2b 20 63 6f 6c 32  CT + col2 + col2
19f30 20 2a 20 31 37 20 41 53 20 63 6f 6c 32 20 46 52   * 17 AS col2 FR
19f40 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31  OM tab1..----..1
19f50 30 32 36 0d 0a 31 37 32 38 0d 0a 39 37 32 0d 0a  026..1728..972..
19f60 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
19f70 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20  t..SELECT ALL + 
19f80 63 6f 6c 30 20 2a 20 33 39 20 2b 20 32 39 20 2b  col0 * 39 + 29 +
19f90 20 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46 52   col2 AS col2 FR
19fa0 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 33  OM tab2..----..3
19fb0 30 39 37 0d 0a 33 31 34 38 0d 0a 33 32 39 0d 0a  097..3148..329..
19fc0 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
19fd0 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f   use DIV operato
19fe0 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69  r for integer di
19ff0 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20  vision..query I 
1a000 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 37 32  rowsort label-72
1a010 32 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 30  2..SELECT - col0
1a020 20 44 49 56 20 28 20 2b 20 63 6f 6c 32 20 29 20   DIV ( + col2 ) 
1a030 2d 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 41 53  - - cor0.col2 AS
1a040 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20   col2 FROM tab1 
1a050 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 35  AS cor0..----..5
1a060 34 0d 0a 35 36 0d 0a 39 36 0d 0a 0d 0a 73 6b 69  4..56..96....ski
1a070 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
1a080 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
1a090 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
1a0a0 6c 2d 37 32 32 0d 0a 53 45 4c 45 43 54 20 2d 20  l-722..SELECT - 
1a0b0 63 6f 6c 30 20 2f 20 28 20 2b 20 63 6f 6c 32 20  col0 / ( + col2 
1a0c0 29 20 2d 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20  ) - - cor0.col2 
1a0d0 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
1a0e0 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
1a0f0 0a 35 34 0d 0a 35 36 0d 0a 39 36 0d 0a 0d 0a 6f  .54..56..96....o
1a100 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73  nlyif mysql # us
1a110 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66  e DIV operator f
1a120 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73  or integer divis
1a130 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ion..query I row
1a140 73 6f 72 74 20 6c 61 62 65 6c 2d 37 32 33 0d 0a  sort label-723..
1a150 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
1a160 63 6f 6c 31 20 2d 20 63 6f 6c 30 20 44 49 56 20  col1 - col0 DIV 
1a170 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46 52 4f  col2 AS col1 FRO
1a180 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 33  M tab1..----..13
1a190 0d 0a 32 36 0d 0a 39 0d 0a 0d 0a 73 6b 69 70 69  ..26..9....skipi
1a1a0 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
1a1b0 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
1a1c0 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
1a1d0 37 32 33 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  723..SELECT DIST
1a1e0 49 4e 43 54 20 63 6f 6c 31 20 2d 20 63 6f 6c 30  INCT col1 - col0
1a1f0 20 2f 20 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20   / col2 AS col1 
1a200 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d  FROM tab1..----.
1a210 0a 31 33 0d 0a 32 36 0d 0a 39 0d 0a 0d 0a 71 75  .13..26..9....qu
1a220 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
1a230 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f 72 30  ELECT ALL - cor0
1a240 2e 63 6f 6c 30 20 2b 20 63 6f 72 30 2e 63 6f 6c  .col0 + cor0.col
1a250 32 20 2b 20 2b 20 63 6f 6c 31 20 2a 20 63 6f 6c  2 + + col1 * col
1a260 31 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  1 AS col2 FROM t
1a270 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
1a280 2d 0d 0a 31 38 35 0d 0a 37 32 37 0d 0a 39 33 0d  -..185..727..93.
1a290 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
1a2a0 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79  # support for My
1a2b0 53 51 4c 20 73 70 65 63 69 66 69 63 20 73 79 73  SQL specific sys
1a2c0 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79  tem types and sy
1a2d0 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f  ntax..query I ro
1a2e0 77 73 6f 72 74 20 6c 61 62 65 6c 2d 37 32 35 0d  wsort label-725.
1a2f0 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
1a300 20 2b 20 63 6f 6c 31 20 2b 20 2d 20 43 41 53 54   + col1 + - CAST
1a310 28 20 4e 55 4c 4c 20 41 53 20 53 49 47 4e 45 44  ( NULL AS SIGNED
1a320 20 29 20 2a 20 2d 20 63 6f 6c 30 20 46 52 4f 4d   ) * - col0 FROM
1a330 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
1a340 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69  ---..NULL....ski
1a350 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
1a360 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
1a370 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
1a380 6c 2d 37 32 35 0d 0a 53 45 4c 45 43 54 20 44 49  l-725..SELECT DI
1a390 53 54 49 4e 43 54 20 2b 20 63 6f 6c 31 20 2b 20  STINCT + col1 + 
1a3a0 2d 20 43 41 53 54 20 28 20 4e 55 4c 4c 20 41 53  - CAST ( NULL AS
1a3b0 20 49 4e 54 45 47 45 52 20 29 20 2a 20 2d 20 63   INTEGER ) * - c
1a3c0 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol0 FROM tab1 AS
1a3d0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c   cor0..----..NUL
1a3e0 4c 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  L....query I row
1a3f0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c  sort..SELECT col
1a400 31 20 2b 20 2d 20 37 30 20 46 52 4f 4d 20 74 61  1 + - 70 FROM ta
1a410 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 34 0d 0a 2d  b1..----..-44..-
1a420 35 37 0d 0a 2d 36 30 0d 0a 0d 0a 71 75 65 72 79  57..-60....query
1a430 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
1a440 43 54 20 2b 20 38 32 20 2b 20 2d 20 37 39 20 41  CT + 82 + - 79 A
1a450 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30  S col1 FROM tab0
1a460 0d 0a 2d 2d 2d 2d 0d 0a 33 0d 0a 33 0d 0a 33 0d  ..----..3..3..3.
1a470 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
1a480 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74  # use DIV operat
1a490 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64  or for integer d
1a4a0 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49  ivision..query I
1a4b0 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 37   rowsort label-7
1a4c0 32 38 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  28..SELECT DISTI
1a4d0 4e 43 54 20 28 20 74 61 62 30 2e 63 6f 6c 32 20  NCT ( tab0.col2 
1a4e0 29 20 2b 20 2b 20 63 6f 6c 31 20 44 49 56 20 33  ) + + col1 DIV 3
1a4f0 35 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d  5 FROM tab0..---
1a500 2d 0d 0a 33 0d 0a 33 35 0d 0a 38 34 0d 0a 0d 0a  -..3..35..84....
1a510 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
1a520 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
1a530 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
1a540 61 62 65 6c 2d 37 32 38 0d 0a 53 45 4c 45 43 54  abel-728..SELECT
1a550 20 44 49 53 54 49 4e 43 54 20 28 20 74 61 62 30   DISTINCT ( tab0
1a560 2e 63 6f 6c 32 20 29 20 2b 20 2b 20 63 6f 6c 31  .col2 ) + + col1
1a570 20 2f 20 33 35 20 46 52 4f 4d 20 74 61 62 30 0d   / 35 FROM tab0.
1a580 0a 2d 2d 2d 2d 0d 0a 33 0d 0a 33 35 0d 0a 38 34  .----..3..35..84
1a590 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
1a5a0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 28 20 2d 20  ort..SELECT ( - 
1a5b0 32 31 20 29 20 2b 20 2b 20 63 6f 6c 31 20 41 53  21 ) + + col1 AS
1a5c0 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 0d   col2 FROM tab0.
1a5d0 0a 2d 2d 2d 2d 0d 0a 36 35 0d 0a 37 30 0d 0a 37  .----..65..70..7
1a5e0 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  6....query I row
1a5f0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c  sort..SELECT col
1a600 31 20 2d 20 2b 20 63 6f 6c 31 20 2a 20 2d 20 74  1 - + col1 * - t
1a610 61 62 32 2e 63 6f 6c 32 20 41 53 20 63 6f 6c 31  ab2.col2 AS col1
1a620 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d   FROM tab2..----
1a630 0d 0a 31 35 39 33 0d 0a 36 36 33 0d 0a 38 36 38  ..1593..663..868
1a640 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
1a650 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
1a660 2b 20 37 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  + 7 AS col2 FROM
1a670 20 74 61 62 30 2c 20 74 61 62 31 2c 20 74 61 62   tab0, tab1, tab
1a680 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
1a690 0a 32 37 20 76 61 6c 75 65 73 20 68 61 73 68 69  .27 values hashi
1a6a0 6e 67 20 74 6f 20 34 65 37 32 65 39 65 33 33 64  ng to 4e72e9e33d
1a6b0 61 63 61 63 37 35 37 66 34 38 64 30 63 65 34 36  acac757f48d0ce46
1a6c0 30 39 34 36 30 37 0d 0a 0d 0a 71 75 65 72 79 20  094607....query 
1a6d0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
1a6e0 54 20 2b 20 31 38 20 2a 20 2b 20 63 6f 6c 32 20  T + 18 * + col2 
1a6f0 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
1a700 30 0d 0a 2d 2d 2d 2d 0d 0a 31 34 37 36 0d 0a 31  0..----..1476..1
1a710 38 0d 0a 35 39 34 0d 0a 0d 0a 71 75 65 72 79 20  8..594....query 
1a720 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
1a730 54 20 2d 20 74 61 62 31 2e 63 6f 6c 32 20 41 53  T - tab1.col2 AS
1a740 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 2c   col1 FROM tab1,
1a750 20 74 61 62 30 20 41 53 20 63 6f 72 30 2c 20 74   tab0 AS cor0, t
1a760 61 62 31 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d  ab1 AS cor1..---
1a770 2d 0d 0a 32 37 20 76 61 6c 75 65 73 20 68 61 73  -..27 values has
1a780 68 69 6e 67 20 74 6f 20 34 34 66 64 63 64 37 63  hing to 44fdcd7c
1a790 64 36 30 33 33 35 32 64 34 64 31 32 37 38 31 31  d603352d4d127811
1a7a0 64 31 36 34 63 63 31 65 0d 0a 0d 0a 73 6b 69 70  d164cc1e....skip
1a7b0 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20  if postgresql # 
1a7c0 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69  PostgreSQL requi
1a7d0 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61  res AS when rena
1a7e0 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75  ming output colu
1a7f0 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  mns..query I row
1a800 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
1a810 54 49 4e 43 54 20 38 20 2b 20 31 36 20 63 6f 6c  TINCT 8 + 16 col
1a820 31 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d  1 FROM tab2..---
1a830 2d 0d 0a 32 34 0d 0a 0d 0a 71 75 65 72 79 20 49  -..24....query I
1a840 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
1a850 20 35 36 20 2a 20 2b 20 63 6f 6c 30 20 2b 20 2d   56 * + col0 + -
1a860 20 63 6f 6c 30 20 2a 20 63 6f 6c 30 20 2b 20 63   col0 * col0 + c
1a870 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 63 6f  ol2 FROM tab1 co
1a880 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 38 32 34 0d  r0..----..-1824.
1a890 0a 2d 34 35 35 0d 0a 32 31 33 0d 0a 0d 0a 71 75  .-455..213....qu
1a8a0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
1a8b0 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 31  ELECT ALL + col1
1a8c0 20 2b 20 36 37 20 2a 20 2d 20 63 6f 6c 30 20 41   + 67 * - col0 A
1a8d0 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31  S col2 FROM tab1
1a8e0 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 37 35 0d 0a 2d 34  ..----..-175..-4
1a8f0 32 37 38 0d 0a 2d 35 33 34 37 0d 0a 0d 0a 71 75  278..-5347....qu
1a900 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
1a910 45 4c 45 43 54 20 37 37 20 2b 20 2b 20 63 6f 6c  ELECT 77 + + col
1a920 32 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d  2 FROM tab1..---
1a930 2d 0d 0a 31 33 31 0d 0a 31 33 34 0d 0a 31 37 33  -..131..134..173
1a940 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
1a950 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61   # use DIV opera
1a960 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20  tor for integer 
1a970 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20  division..query 
1a980 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
1a990 37 33 38 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 30  738..SELECT col0
1a9a0 20 44 49 56 20 63 6f 6c 32 20 2b 20 2d 20 33 31   DIV col2 + - 31
1a9b0 20 44 49 56 20 28 20 63 6f 6c 30 20 29 20 41 53   DIV ( col0 ) AS
1a9c0 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d   col0 FROM tab0.
1a9d0 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 31 0d 0a 33 35  .----..-1..1..35
1a9e0 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
1a9f0 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
1aa00 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
1aa10 72 74 20 6c 61 62 65 6c 2d 37 33 38 0d 0a 53 45  rt label-738..SE
1aa20 4c 45 43 54 20 63 6f 6c 30 20 2f 20 63 6f 6c 32  LECT col0 / col2
1aa30 20 2b 20 2d 20 33 31 20 2f 20 28 20 63 6f 6c 30   + - 31 / ( col0
1aa40 20 29 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20   ) AS col0 FROM 
1aa50 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a  tab0..----..-1..
1aa60 31 0d 0a 33 35 0d 0a 0d 0a 71 75 65 72 79 20 49  1..35....query I
1aa70 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
1aa80 20 2d 20 33 37 20 2b 20 2d 20 63 6f 6c 32 20 46   - 37 + - col2 F
1aa90 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d  ROM tab1 cor0..-
1aaa0 2d 2d 2d 0d 0a 2d 31 33 33 0d 0a 2d 39 31 0d 0a  ---..-133..-91..
1aab0 2d 39 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  -94....query I r
1aac0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
1aad0 49 53 54 49 4e 43 54 20 2b 20 2d 20 63 6f 6c 30  ISTINCT + - col0
1aae0 20 2a 20 63 6f 72 30 2e 63 6f 6c 32 20 2a 20 2d   * cor0.col2 * -
1aaf0 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20   col1 FROM tab1 
1ab00 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33  AS cor0..----..3
1ab10 36 34 38 30 0d 0a 34 32 31 32 0d 0a 39 39 38 34  6480..4212..9984
1ab20 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  0....onlyif mysq
1ab30 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20  l # support for 
1ab40 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63 20 73  MySQL specific s
1ab50 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20  ystem types and 
1ab60 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20  syntax..query I 
1ab70 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 37 34  rowsort label-74
1ab80 31 0d 0a 53 45 4c 45 43 54 20 2b 20 32 34 20 2b  1..SELECT + 24 +
1ab90 20 2b 20 63 6f 6c 30 20 2b 20 43 41 53 54 28 20   + col0 + CAST( 
1aba0 4e 55 4c 4c 20 41 53 20 44 45 43 49 4d 41 4c 20  NULL AS DECIMAL 
1abb0 29 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  ) AS col0 FROM t
1abc0 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
1abd0 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e  -..NULL..NULL..N
1abe0 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  ULL....skipif my
1abf0 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
1ac00 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
1ac10 77 73 6f 72 74 20 6c 61 62 65 6c 2d 37 34 31 0d  wsort label-741.
1ac20 0a 53 45 4c 45 43 54 20 2b 20 32 34 20 2b 20 2b  .SELECT + 24 + +
1ac30 20 63 6f 6c 30 20 2b 20 43 41 53 54 20 28 20 4e   col0 + CAST ( N
1ac40 55 4c 4c 20 41 53 20 52 45 41 4c 20 29 20 41 53  ULL AS REAL ) AS
1ac50 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20   col0 FROM tab0 
1ac60 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e  AS cor0..----..N
1ac70 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d  ULL..NULL..NULL.
1ac80 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
1ac90 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b  rt..SELECT ALL +
1aca0 20 63 6f 6c 31 20 2b 20 63 6f 6c 32 20 2a 20 36   col1 + col2 * 6
1acb0 38 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  8 FROM tab1 AS c
1acc0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 36 39 38 0d  or0..----..3698.
1acd0 0a 33 38 38 36 0d 0a 36 35 34 31 0d 0a 0d 0a 71  .3886..6541....q
1ace0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
1acf0 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 2b 20 28  SELECT ALL - + (
1ad00 20 2d 20 63 6f 6c 31 20 29 20 2b 20 2b 20 63 6f   - col1 ) + + co
1ad10 72 30 2e 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20  r0.col1 AS col2 
1ad20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
1ad30 30 0d 0a 2d 2d 2d 2d 0d 0a 32 30 0d 0a 32 36 0d  0..----..20..26.
1ad40 0a 35 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .52....query I r
1ad50 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
1ad60 4c 4c 20 2b 20 2b 20 28 20 2d 20 63 6f 6c 32 20  LL + + ( - col2 
1ad70 29 20 2a 20 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c  ) * col1 * + col
1ad80 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  2 FROM tab2 AS c
1ad90 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 32 35 39  or0..----..-2259
1ada0 39 0d 0a 2d 32 34 35 34 38 0d 0a 2d 33 39 38 38  9..-24548..-3988
1adb0 34 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  4....onlyif mysq
1adc0 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72  l # use DIV oper
1add0 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72  ator for integer
1ade0 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79   division..query
1adf0 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
1ae00 2d 37 34 35 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  -745..SELECT ALL
1ae10 20 2b 20 2b 20 36 31 20 44 49 56 20 63 6f 6c 30   + + 61 DIV col0
1ae20 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
1ae30 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a  r0..----..0..0..
1ae40 32 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  20....skipif mys
1ae50 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
1ae60 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
1ae70 73 6f 72 74 20 6c 61 62 65 6c 2d 37 34 35 0d 0a  sort label-745..
1ae80 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 2b 20 36  SELECT ALL + + 6
1ae90 31 20 2f 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61  1 / col0 FROM ta
1aea0 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
1aeb0 0d 0a 30 0d 0a 30 0d 0a 32 30 0d 0a 0d 0a 6f 6e  ..0..0..20....on
1aec0 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70  lyif mysql # sup
1aed0 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73  port for MySQL s
1aee0 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20 74  pecific system t
1aef0 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d  ypes and syntax.
1af00 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1af10 20 6c 61 62 65 6c 2d 37 34 36 0d 0a 53 45 4c 45   label-746..SELE
1af20 43 54 20 2d 20 2d 20 38 31 20 2b 20 63 6f 72 30  CT - - 81 + cor0
1af30 2e 63 6f 6c 32 20 2b 20 2d 20 43 41 53 54 28 20  .col2 + - CAST( 
1af40 2b 20 63 6f 6c 31 20 41 53 20 53 49 47 4e 45 44  + col1 AS SIGNED
1af50 20 29 20 2a 20 63 6f 72 30 2e 63 6f 6c 30 20 41   ) * cor0.col0 A
1af60 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31  S col0 FROM tab1
1af70 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 30   cor0..----..-50
1af80 32 0d 0a 2d 38 36 33 0d 0a 35 37 0d 0a 0d 0a 73  2..-863..57....s
1af90 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
1afa0 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
1afb0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
1afc0 62 65 6c 2d 37 34 36 0d 0a 53 45 4c 45 43 54 20  bel-746..SELECT 
1afd0 2d 20 2d 20 38 31 20 2b 20 63 6f 72 30 2e 63 6f  - - 81 + cor0.co
1afe0 6c 32 20 2b 20 2d 20 43 41 53 54 20 28 20 2b 20  l2 + - CAST ( + 
1aff0 63 6f 6c 31 20 41 53 20 49 4e 54 45 47 45 52 20  col1 AS INTEGER 
1b000 29 20 2a 20 63 6f 72 30 2e 63 6f 6c 30 20 41 53  ) * cor0.col0 AS
1b010 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20   col0 FROM tab1 
1b020 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 30 32  cor0..----..-502
1b030 0d 0a 2d 38 36 33 0d 0a 35 37 0d 0a 0d 0a 71 75  ..-863..57....qu
1b040 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
1b050 45 4c 45 43 54 20 63 6f 6c 32 20 2a 20 63 6f 6c  ELECT col2 * col
1b060 30 20 2b 20 2d 20 63 6f 6c 32 20 2a 20 63 6f 6c  0 + - col2 * col
1b070 30 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  0 AS col0 FROM t
1b080 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
1b090 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a 6f 6e  -..0..0..0....on
1b0a0 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
1b0b0 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
1b0c0 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
1b0d0 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
1b0e0 6f 72 74 20 6c 61 62 65 6c 2d 37 34 38 0d 0a 53  ort label-748..S
1b0f0 45 4c 45 43 54 20 2b 20 63 6f 6c 30 20 44 49 56  ELECT + col0 DIV
1b100 20 2d 20 63 6f 6c 31 20 2b 20 33 34 20 2d 20 2d   - col1 + 34 - -
1b110 20 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c 30 20 46   col2 * + col0 F
1b120 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
1b130 0d 0a 2d 2d 2d 2d 0d 0a 31 39 36 0d 0a 33 36 37  ..----..196..367
1b140 36 0d 0a 37 37 30 38 0d 0a 0d 0a 73 6b 69 70 69  6..7708....skipi
1b150 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
1b160 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
1b170 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
1b180 37 34 38 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f  748..SELECT + co
1b190 6c 30 20 2f 20 2d 20 63 6f 6c 31 20 2b 20 33 34  l0 / - col1 + 34
1b1a0 20 2d 20 2d 20 63 6f 6c 32 20 2a 20 2b 20 63 6f   - - col2 * + co
1b1b0 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l0 FROM tab1 AS 
1b1c0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 39 36 0d  cor0..----..196.
1b1d0 0a 33 36 37 36 0d 0a 37 37 30 38 0d 0a 0d 0a 71  .3676..7708....q
1b1e0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
1b1f0 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 74 61 62  SELECT ALL + tab
1b200 32 2e 63 6f 6c 30 20 2b 20 2d 20 74 61 62 32 2e  2.col0 + - tab2.
1b210 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46 52 4f  col2 AS col2 FRO
1b220 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 32  M tab2..----..-2
1b230 30 0d 0a 34 31 0d 0a 35 32 0d 0a 0d 0a 71 75 65  0..41..52....que
1b240 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
1b250 4c 45 43 54 20 63 6f 6c 30 20 2a 20 2d 20 63 6f  LECT col0 * - co
1b260 6c 31 20 2a 20 2b 20 63 6f 6c 30 20 41 53 20 63  l1 * + col0 AS c
1b270 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d  ol2 FROM tab0..-
1b280 2d 2d 2d 0d 0a 2d 31 31 38 38 32 35 0d 0a 2d 34  ---..-118825..-4
1b290 39 35 33 36 0d 0a 2d 37 32 30 38 31 31 0d 0a 0d  9536..-720811...
1b2a0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1b2b0 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
1b2c0 54 20 63 6f 6c 31 20 2b 20 2b 20 74 61 62 32 2e  T col1 + + tab2.
1b2d0 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46 52 4f  col1 AS col1 FRO
1b2e0 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 31  M tab2..----..11
1b2f0 38 0d 0a 33 34 0d 0a 36 32 0d 0a 0d 0a 71 75 65  8..34..62....que
1b300 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
1b310 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f  LECT DISTINCT co
1b320 6c 30 20 2b 20 2d 20 74 61 62 32 2e 63 6f 6c 31  l0 + - tab2.col1
1b330 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
1b340 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 34 0d 0a 31  b2..----..-24..1
1b350 39 0d 0a 36 32 0d 0a 0d 0a 71 75 65 72 79 20 49  9..62....query I
1b360 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
1b370 20 41 4c 4c 20 2d 20 63 6f 6c 32 20 2a 20 2b 20   ALL - col2 * + 
1b380 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c 32 20 46 52  col2 * + col2 FR
1b390 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d  OM tab1..----..-
1b3a0 31 35 37 34 36 34 0d 0a 2d 31 38 35 31 39 33 0d  157464..-185193.
1b3b0 0a 2d 38 38 34 37 33 36 0d 0a 0d 0a 71 75 65 72  .-884736....quer
1b3c0 79 20 49 49 49 20 72 6f 77 73 6f 72 74 0d 0a 53  y III rowsort..S
1b3d0 45 4c 45 43 54 20 2a 20 46 52 4f 4d 20 74 61 62  ELECT * FROM tab
1b3e0 32 20 57 48 45 52 45 20 4e 4f 54 20 4e 55 4c 4c  2 WHERE NOT NULL
1b3f0 20 42 45 54 57 45 45 4e 20 28 20 4e 55 4c 4c 20   BETWEEN ( NULL 
1b400 29 20 41 4e 44 20 63 6f 6c 31 20 2b 20 63 6f 6c  ) AND col1 + col
1b410 31 20 2f 20 2d 20 63 6f 6c 30 0d 0a 2d 2d 2d 2d  1 / - col0..----
1b420 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
1b430 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
1b440 31 31 20 2a 20 63 6f 6c 31 20 46 52 4f 4d 20 74  11 * col1 FROM t
1b450 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 30 31 0d  ab0..----..1001.
1b460 0a 31 30 36 37 0d 0a 39 34 36 0d 0a 0d 0a 6f 6e  .1067..946....on
1b470 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
1b480 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
1b490 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
1b4a0 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
1b4b0 6f 72 74 20 6c 61 62 65 6c 2d 37 35 36 0d 0a 53  ort label-756..S
1b4c0 45 4c 45 43 54 20 28 20 63 6f 6c 30 20 29 20 2b  ELECT ( col0 ) +
1b4d0 20 63 6f 6c 32 20 44 49 56 20 36 30 20 46 52 4f   col2 DIV 60 FRO
1b4e0 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
1b4f0 2d 2d 2d 2d 0d 0a 37 0d 0a 37 38 0d 0a 37 39 0d  ----..7..78..79.
1b500 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
1b510 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
1b520 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1b530 74 20 6c 61 62 65 6c 2d 37 35 36 0d 0a 53 45 4c  t label-756..SEL
1b540 45 43 54 20 28 20 63 6f 6c 30 20 29 20 2b 20 63  ECT ( col0 ) + c
1b550 6f 6c 32 20 2f 20 36 30 20 46 52 4f 4d 20 74 61  ol2 / 60 FROM ta
1b560 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
1b570 0d 0a 37 0d 0a 37 38 0d 0a 37 39 0d 0a 0d 0a 73  ..7..78..79....s
1b580 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c  kipif postgresql
1b590 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65   # PostgreSQL re
1b5a0 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72  quires AS when r
1b5b0 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63  enaming output c
1b5c0 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20  olumns..query I 
1b5d0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
1b5e0 44 49 53 54 49 4e 43 54 20 37 38 20 2b 20 63 6f  DISTINCT 78 + co
1b5f0 6c 31 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  l1 col0 FROM tab
1b600 31 0d 0a 2d 2d 2d 2d 0d 0a 31 30 34 0d 0a 38 38  1..----..104..88
1b610 0d 0a 39 31 0d 0a 0d 0a 71 75 65 72 79 20 49 49  ..91....query II
1b620 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
1b630 54 20 41 4c 4c 20 2a 20 46 52 4f 4d 20 74 61 62  T ALL * FROM tab
1b640 30 20 57 48 45 52 45 20 4e 4f 54 20 2d 20 63 6f  0 WHERE NOT - co
1b650 6c 30 20 4e 4f 54 20 49 4e 20 28 20 2b 20 63 6f  l0 NOT IN ( + co
1b660 6c 31 20 29 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a 71 75  l1 )..----....qu
1b670 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
1b680 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 32  ELECT ALL - col2
1b690 20 2d 20 2b 20 63 6f 6c 32 20 46 52 4f 4d 20 74   - + col2 FROM t
1b6a0 61 62 32 20 57 48 45 52 45 20 28 20 4e 55 4c 4c  ab2 WHERE ( NULL
1b6b0 20 29 20 3d 20 4e 55 4c 4c 0d 0a 2d 2d 2d 2d 0d   ) = NULL..----.
1b6c0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
1b6d0 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
1b6e0 4e 43 54 20 63 6f 6c 30 20 41 53 20 63 6f 6c 31  NCT col0 AS col1
1b6f0 20 46 52 4f 4d 20 74 61 62 31 20 57 48 45 52 45   FROM tab1 WHERE
1b700 20 4e 55 4c 4c 20 42 45 54 57 45 45 4e 20 4e 55   NULL BETWEEN NU
1b710 4c 4c 20 41 4e 44 20 63 6f 6c 30 0d 0a 2d 2d 2d  LL AND col0..---
1b720 2d 0d 0a 0d 0a 71 75 65 72 79 20 49 49 49 20 72  -....query III r
1b730 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
1b740 4c 4c 20 2a 20 46 52 4f 4d 20 74 61 62 31 20 57  LL * FROM tab1 W
1b750 48 45 52 45 20 4e 4f 54 20 63 6f 6c 31 20 42 45  HERE NOT col1 BE
1b760 54 57 45 45 4e 20 63 6f 6c 32 20 41 4e 44 20 28  TWEEN col2 AND (
1b770 20 4e 55 4c 4c 20 29 0d 0a 2d 2d 2d 2d 0d 0a 39   NULL )..----..9
1b780 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20   values hashing 
1b790 74 6f 20 38 64 36 36 39 32 65 36 64 34 31 35 30  to 8d6692e6d4150
1b7a0 35 63 33 61 64 34 32 64 39 31 39 62 64 39 65 63  5c3ad42d919bd9ec
1b7b0 64 30 64 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  d0d....query I r
1b7c0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
1b7d0 4c 4c 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74  LL + col0 FROM t
1b7e0 61 62 30 20 57 48 45 52 45 20 4e 4f 54 20 4e 55  ab0 WHERE NOT NU
1b7f0 4c 4c 20 3c 3d 20 4e 55 4c 4c 0d 0a 2d 2d 2d 2d  LL <= NULL..----
1b800 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
1b810 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
1b820 63 6f 6c 30 20 2a 20 63 6f 6c 30 20 2a 20 2d 20  col0 * col0 * - 
1b830 63 6f 6c 32 20 2b 20 74 61 62 30 2e 63 6f 6c 32  col2 + tab0.col2
1b840 20 2a 20 63 6f 6c 31 20 2a 20 2d 20 74 61 62 30   * col1 * - tab0
1b850 2e 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46 52  .col2 AS col2 FR
1b860 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  OM tab0..----..-
1b870 31 31 32 36 36 32 0d 0a 2d 31 32 36 31 34 30 36  112662..-1261406
1b880 0d 0a 2d 31 33 32 32 0d 0a 0d 0a 71 75 65 72 79  ..-1322....query
1b890 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
1b8a0 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 74 61  CT DISTINCT + ta
1b8b0 62 32 2e 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  b2.col2 FROM tab
1b8c0 32 20 57 48 45 52 45 20 4e 55 4c 4c 20 49 4e 20  2 WHERE NULL IN 
1b8d0 28 20 63 6f 6c 31 20 2b 20 2b 20 63 6f 6c 32 20  ( col1 + + col2 
1b8e0 2a 20 2b 20 63 6f 6c 30 20 2b 20 63 6f 6c 30 20  * + col0 + col0 
1b8f0 29 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a 71 75 65 72 79  )..----....query
1b900 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
1b910 43 54 20 41 4c 4c 20 2d 20 74 61 62 32 2e 63 6f  CT ALL - tab2.co
1b920 6c 31 20 2a 20 2d 20 63 6f 6c 30 20 2b 20 63 6f  l1 * - col0 + co
1b930 6c 31 20 2b 20 2d 20 74 61 62 32 2e 63 6f 6c 31  l1 + - tab2.col1
1b940 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
1b950 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 33 34 33 0d 0a  b2..----..1343..
1b960 32 31 37 0d 0a 34 36 30 32 0d 0a 0d 0a 6f 6e 6c  217..4602....onl
1b970 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20  yif mysql # use 
1b980 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72  DIV operator for
1b990 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f   integer divisio
1b9a0 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  n..query I rowso
1b9b0 72 74 20 6c 61 62 65 6c 2d 37 36 36 0d 0a 53 45  rt label-766..SE
1b9c0 4c 45 43 54 20 63 6f 6c 32 20 2b 20 2d 20 63 6f  LECT col2 + - co
1b9d0 6c 30 20 44 49 56 20 63 6f 6c 31 20 2b 20 2b 20  l0 DIV col1 + + 
1b9e0 63 6f 6c 32 20 2a 20 2d 20 74 61 62 32 2e 63 6f  col2 * - tab2.co
1b9f0 6c 32 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  l2 AS col0 FROM 
1ba00 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 34 31  tab2..----..-141
1ba10 30 0d 0a 2d 36 35 31 0d 0a 2d 37 30 32 0d 0a 0d  0..-651..-702...
1ba20 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
1ba30 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
1ba40 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
1ba50 6c 61 62 65 6c 2d 37 36 36 0d 0a 53 45 4c 45 43  label-766..SELEC
1ba60 54 20 63 6f 6c 32 20 2b 20 2d 20 63 6f 6c 30 20  T col2 + - col0 
1ba70 2f 20 63 6f 6c 31 20 2b 20 2b 20 63 6f 6c 32 20  / col1 + + col2 
1ba80 2a 20 2d 20 74 61 62 32 2e 63 6f 6c 32 20 41 53  * - tab2.col2 AS
1ba90 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 0d   col0 FROM tab2.
1baa0 0a 2d 2d 2d 2d 0d 0a 2d 31 34 31 30 0d 0a 2d 36  .----..-1410..-6
1bab0 35 31 0d 0a 2d 37 30 32 0d 0a 0d 0a 71 75 65 72  51..-702....quer
1bac0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
1bad0 45 43 54 20 2b 20 63 6f 6c 30 20 2a 20 74 61 62  ECT + col0 * tab
1bae0 31 2e 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c 32 20  1.col0 + - col2 
1baf0 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
1bb00 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 35 0d 0a 34 30  1..----..-45..40
1bb10 33 39 0d 0a 36 33 30 34 0d 0a 0d 0a 71 75 65 72  39..6304....quer
1bb20 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
1bb30 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 30 20 2b  ECT ALL - col0 +
1bb40 20 2b 20 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c 32   + col0 * - col2
1bb50 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
1bb60 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 39 36 0d 0a  b2..----..-196..
1bb70 2d 32 31 30 36 0d 0a 2d 33 30 38 31 0d 0a 0d 0a  -2106..-3081....
1bb80 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
1bb90 0a 53 45 4c 45 43 54 20 63 6f 6c 32 20 2a 20 2d  .SELECT col2 * -
1bba0 20 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c 30 20 46   col0 + - col0 F
1bbb0 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab0..----..
1bbc0 2d 37 30 0d 0a 2d 37 33 38 37 0d 0a 2d 38 31 36  -70..-7387..-816
1bbd0 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
1bbe0 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61   # use DIV opera
1bbf0 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20  tor for integer 
1bc00 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20  division..query 
1bc10 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
1bc20 37 37 30 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  770..SELECT ALL 
1bc30 74 61 62 30 2e 63 6f 6c 30 20 44 49 56 20 63 6f  tab0.col0 DIV co
1bc40 6c 32 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  l2 col1 FROM tab
1bc50 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 31 0d 0a 33  0..----..0..1..3
1bc60 35 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74  5....skipif post
1bc70 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65  gresql # Postgre
1bc80 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20  SQL requires AS 
1bc90 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75  when renaming ou
1bca0 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 73 6b  tput columns..sk
1bcb0 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
1bcc0 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
1bcd0 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
1bce0 65 6c 2d 37 37 30 0d 0a 53 45 4c 45 43 54 20 41  el-770..SELECT A
1bcf0 4c 4c 20 74 61 62 30 2e 63 6f 6c 30 20 2f 20 63  LL tab0.col0 / c
1bd00 6f 6c 32 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61  ol2 col1 FROM ta
1bd10 62 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 31 0d 0a  b0..----..0..1..
1bd20 33 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  35....query I ro
1bd30 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
1bd40 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c 32 20 2b 20  col0 * + col2 + 
1bd50 2d 20 63 6f 6c 31 20 2b 20 63 6f 6c 32 20 41 53  - col1 + col2 AS
1bd60 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20   col1 FROM tab0 
1bd70 57 48 45 52 45 20 4e 55 4c 4c 20 4e 4f 54 20 49  WHERE NULL NOT I
1bd80 4e 20 28 20 2b 20 63 6f 6c 31 20 29 0d 0a 2d 2d  N ( + col1 )..--
1bd90 2d 2d 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  --....onlyif mys
1bda0 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65  ql # use DIV ope
1bdb0 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65  rator for intege
1bdc0 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72  r division..quer
1bdd0 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
1bde0 6c 2d 37 37 32 0d 0a 53 45 4c 45 43 54 20 41 4c  l-772..SELECT AL
1bdf0 4c 20 2b 20 74 61 62 31 2e 63 6f 6c 31 20 44 49  L + tab1.col1 DI
1be00 56 20 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46  V col0 AS col2 F
1be10 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab1..----..
1be20 30 0d 0a 30 0d 0a 38 0d 0a 0d 0a 73 6b 69 70 69  0..0..8....skipi
1be30 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
1be40 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
1be50 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
1be60 37 37 32 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  772..SELECT ALL 
1be70 2b 20 74 61 62 31 2e 63 6f 6c 31 20 2f 20 63 6f  + tab1.col1 / co
1be80 6c 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  l0 AS col2 FROM 
1be90 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30  tab1..----..0..0
1bea0 0d 0a 38 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  ..8....onlyif my
1beb0 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70  sql # use DIV op
1bec0 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67  erator for integ
1bed0 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65  er division..que
1bee0 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
1bef0 65 6c 2d 37 37 33 0d 0a 53 45 4c 45 43 54 20 63  el-773..SELECT c
1bf00 6f 6c 31 20 44 49 56 20 2d 20 63 6f 6c 32 20 2b  ol1 DIV - col2 +
1bf10 20 63 6f 6c 30 20 63 6f 6c 31 20 46 52 4f 4d 20   col0 col1 FROM 
1bf20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 33 0d 0a 36  tab1..----..3..6
1bf30 34 0d 0a 38 30 0d 0a 0d 0a 73 6b 69 70 69 66 20  4..80....skipif 
1bf40 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73  postgresql # Pos
1bf50 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73  tgreSQL requires
1bf60 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e   AS when renamin
1bf70 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73  g output columns
1bf80 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
1bf90 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
1bfa0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1bfb0 20 6c 61 62 65 6c 2d 37 37 33 0d 0a 53 45 4c 45   label-773..SELE
1bfc0 43 54 20 63 6f 6c 31 20 2f 20 2d 20 63 6f 6c 32  CT col1 / - col2
1bfd0 20 2b 20 63 6f 6c 30 20 63 6f 6c 31 20 46 52 4f   + col0 col1 FRO
1bfe0 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 33 0d  M tab1..----..3.
1bff0 0a 36 34 0d 0a 38 30 0d 0a 0d 0a 71 75 65 72 79  .64..80....query
1c000 20 49 49 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45   III rowsort..SE
1c010 4c 45 43 54 20 41 4c 4c 20 2a 20 46 52 4f 4d 20  LECT ALL * FROM 
1c020 74 61 62 32 20 57 48 45 52 45 20 4e 4f 54 20 63  tab2 WHERE NOT c
1c030 6f 6c 32 20 49 4e 20 28 20 63 6f 6c 30 20 2a 20  ol2 IN ( col0 * 
1c040 2b 20 63 6f 6c 30 20 29 0d 0a 2d 2d 2d 2d 0d 0a  + col0 )..----..
1c050 39 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67  9 values hashing
1c060 20 74 6f 20 61 64 30 35 62 35 39 34 32 34 30 30   to ad05b5942400
1c070 64 35 65 37 61 32 31 62 33 32 33 62 33 64 61 36  d5e7a21b323b3da6
1c080 35 61 34 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20  5a45....query I 
1c090 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
1c0a0 2b 20 63 6f 6c 31 20 2b 20 2d 20 63 6f 6c 31 20  + col1 + - col1 
1c0b0 2b 20 2d 20 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c  + - col1 * + col
1c0c0 32 20 2a 20 63 6f 6c 31 20 41 53 20 63 6f 6c 30  2 * col1 AS col0
1c0d0 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d   FROM tab0..----
1c0e0 0d 0a 2d 32 34 34 30 36 38 0d 0a 2d 36 37 39 30  ..-244068..-6790
1c0f0 34 32 0d 0a 2d 39 34 30 39 0d 0a 0d 0a 71 75 65  42..-9409....que
1c100 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
1c110 4c 45 43 54 20 63 6f 6c 30 20 2b 20 2d 20 63 6f  LECT col0 + - co
1c120 6c 31 20 2b 20 74 61 62 31 2e 63 6f 6c 31 20 46  l1 + tab1.col1 F
1c130 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab1..----..
1c140 33 0d 0a 36 34 0d 0a 38 30 0d 0a 0d 0a 71 75 65  3..64..80....que
1c150 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
1c160 4c 45 43 54 20 63 6f 6c 32 20 2b 20 2b 20 63 6f  LECT col2 + + co
1c170 6c 31 20 2a 20 2b 20 63 6f 6c 32 20 2a 20 2b 20  l1 * + col2 * + 
1c180 63 6f 6c 30 20 2b 20 2b 20 74 61 62 32 2e 63 6f  col0 + + tab2.co
1c190 6c 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  l0 AS col1 FROM 
1c1a0 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 31 39 37  tab2..----..1197
1c1b0 35 36 0d 0a 35 31 31 35 31 0d 0a 35 38 39 33 0d  56..51151..5893.
1c1c0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
1c1d0 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b  rt..SELECT ALL +
1c1e0 20 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c 32 20 2b   col0 * + col2 +
1c1f0 20 63 6f 6c 31 20 2b 20 2b 20 63 6f 6c 30 20 2a   col1 + + col0 *
1c200 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62   + col0 FROM tab
1c210 31 0d 0a 2d 2d 2d 2d 0d 0a 31 34 30 39 33 0d 0a  1..----..14093..
1c220 31 39 37 0d 0a 37 37 35 34 0d 0a 0d 0a 6f 6e 6c  197..7754....onl
1c230 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20  yif mysql # use 
1c240 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72  DIV operator for
1c250 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f   integer divisio
1c260 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  n..query I rowso
1c270 72 74 20 6c 61 62 65 6c 2d 37 37 39 0d 0a 53 45  rt label-779..SE
1c280 4c 45 43 54 20 63 6f 6c 32 20 2a 20 63 6f 6c 30  LECT col2 * col0
1c290 20 44 49 56 20 63 6f 6c 31 20 46 52 4f 4d 20 74   DIV col1 FROM t
1c2a0 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 37 36 0d 0a  ab2..----..176..
1c2b0 33 34 0d 0a 36 0d 0a 0d 0a 73 6b 69 70 69 66 20  34..6....skipif 
1c2c0 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
1c2d0 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
1c2e0 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 37 37  rowsort label-77
1c2f0 39 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 32 20 2a  9..SELECT col2 *
1c300 20 63 6f 6c 30 20 2f 20 63 6f 6c 31 20 46 52 4f   col0 / col1 FRO
1c310 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 37  M tab2..----..17
1c320 36 0d 0a 33 34 0d 0a 36 0d 0a 0d 0a 6f 6e 6c 79  6..34..6....only
1c330 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44  if mysql # use D
1c340 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20  IV operator for 
1c350 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e  integer division
1c360 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1c370 74 20 6c 61 62 65 6c 2d 37 38 30 0d 0a 53 45 4c  t label-780..SEL
1c380 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63  ECT DISTINCT - c
1c390 6f 6c 31 20 2a 20 2b 20 63 6f 6c 31 20 2b 20 2d  ol1 * + col1 + -
1c3a0 20 63 6f 6c 32 20 2b 20 63 6f 6c 32 20 44 49 56   col2 + col2 DIV
1c3b0 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20   + col1 AS col0 
1c3c0 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d  FROM tab0..----.
1c3d0 0a 2d 37 34 32 39 0d 0a 2d 38 33 36 33 0d 0a 2d  .-7429..-8363..-
1c3e0 39 34 31 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  9410....skipif m
1c3f0 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
1c400 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
1c410 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 37 38 30  owsort label-780
1c420 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
1c430 54 20 2d 20 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c  T - col1 * + col
1c440 31 20 2b 20 2d 20 63 6f 6c 32 20 2b 20 63 6f 6c  1 + - col2 + col
1c450 32 20 2f 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f  2 / + col1 AS co
1c460 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d  l0 FROM tab0..--
1c470 2d 2d 0d 0a 2d 37 34 32 39 0d 0a 2d 38 33 36 33  --..-7429..-8363
1c480 0d 0a 2d 39 34 31 30 0d 0a 0d 0a 71 75 65 72 79  ..-9410....query
1c490 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
1c4a0 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 30  CT DISTINCT col0
1c4b0 20 2b 20 2d 20 63 6f 6c 31 20 2d 20 74 61 62 32   + - col1 - tab2
1c4c0 2e 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52  .col1 AS col0 FR
1c4d0 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d  OM tab2..----..-
1c4e0 34 30 0d 0a 2d 35 35 0d 0a 34 35 0d 0a 0d 0a 71  40..-55..45....q
1c4f0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
1c500 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
1c510 63 6f 6c 31 20 2b 20 63 6f 6c 30 20 2a 20 63 6f  col1 + col0 * co
1c520 6c 32 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  l2 AS col1 FROM 
1c530 74 61 62 32 20 57 48 45 52 45 20 63 6f 6c 30 20  tab2 WHERE col0 
1c540 2d 20 2b 20 63 6f 6c 32 20 3e 20 28 20 4e 55 4c  - + col2 > ( NUL
1c550 4c 20 29 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a 71 75 65  L )..----....que
1c560 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
1c570 4c 45 43 54 20 2d 20 63 6f 6c 31 20 2a 20 74 61  LECT - col1 * ta
1c580 62 32 2e 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c 32  b2.col1 * + col2
1c590 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d   FROM tab2..----
1c5a0 0d 0a 2d 31 30 39 38 32 0d 0a 2d 32 35 39 34 37  ..-10982..-25947
1c5b0 0d 0a 2d 39 30 35 30 36 0d 0a 0d 0a 71 75 65 72  ..-90506....quer
1c5c0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
1c5d0 45 43 54 20 41 4c 4c 20 2d 20 28 20 28 20 2b 20  ECT ALL - ( ( + 
1c5e0 63 6f 6c 32 20 29 20 29 20 41 53 20 63 6f 6c 30  col2 ) ) AS col0
1c5f0 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d   FROM tab2..----
1c600 0d 0a 2d 32 36 0d 0a 2d 32 37 0d 0a 2d 33 38 0d  ..-26..-27..-38.
1c610 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
1c620 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74  # use DIV operat
1c630 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64  or for integer d
1c640 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49  ivision..query I
1c650 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 37   rowsort label-7
1c660 38 35 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 28  85..SELECT ALL (
1c670 20 63 6f 6c 32 20 2b 20 2d 20 74 61 62 31 2e 63   col2 + - tab1.c
1c680 6f 6c 31 20 29 20 44 49 56 20 37 35 20 46 52 4f  ol1 ) DIV 75 FRO
1c690 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 30 0d  M tab1..----..0.
1c6a0 0a 30 0d 0a 31 0d 0a 0d 0a 73 6b 69 70 69 66 20  .0..1....skipif 
1c6b0 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
1c6c0 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
1c6d0 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 37 38  rowsort label-78
1c6e0 35 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 28 20  5..SELECT ALL ( 
1c6f0 63 6f 6c 32 20 2b 20 2d 20 74 61 62 31 2e 63 6f  col2 + - tab1.co
1c700 6c 31 20 29 20 2f 20 37 35 20 46 52 4f 4d 20 74  l1 ) / 75 FROM t
1c710 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d  ab1..----..0..0.
1c720 0a 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  .1....query I ro
1c730 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
1c740 63 6f 6c 30 20 2a 20 63 6f 6c 30 20 2b 20 63 6f  col0 * col0 + co
1c750 6c 30 20 2d 20 63 6f 72 30 2e 63 6f 6c 30 20 41  l0 - cor0.col0 A
1c760 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31  S col0 FROM tab1
1c770 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
1c780 2d 34 30 39 36 0d 0a 2d 36 34 30 30 0d 0a 2d 39  -4096..-6400..-9
1c790 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
1c7a0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
1c7b0 49 4e 43 54 20 2b 20 2b 20 28 20 63 6f 6c 31 20  INCT + + ( col1 
1c7c0 29 20 2a 20 63 6f 72 30 2e 63 6f 6c 31 20 46 52  ) * cor0.col1 FR
1c7d0 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d  OM tab1 cor0..--
1c7e0 2d 2d 0d 0a 31 30 30 0d 0a 31 36 39 0d 0a 36 37  --..100..169..67
1c7f0 36 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74  6....skipif post
1c800 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65  gresql # Postgre
1c810 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20  SQL requires AS 
1c820 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75  when renaming ou
1c830 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75  tput columns..qu
1c840 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
1c850 45 4c 45 43 54 20 2b 20 2d 20 63 6f 6c 32 20 2b  ELECT + - col2 +
1c860 20 2b 20 63 6f 6c 32 20 2d 20 32 20 63 6f 6c 30   + col2 - 2 col0
1c870 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
1c880 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 0d 0a 2d 32  r0..----..-2..-2
1c890 0d 0a 2d 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..-2....query I 
1c8a0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
1c8b0 44 49 53 54 49 4e 43 54 20 33 30 20 2a 20 63 6f  DISTINCT 30 * co
1c8c0 6c 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  l0 AS col1 FROM 
1c8d0 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 39 32 30  tab1..----..1920
1c8e0 0d 0a 32 34 30 30 0d 0a 39 30 0d 0a 0d 0a 71 75  ..2400..90....qu
1c8f0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
1c900 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d  ELECT DISTINCT -
1c910 20 39 30 20 2a 20 63 6f 6c 30 20 46 52 4f 4d 20   90 * col0 FROM 
1c920 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 31 36  tab0..----..-216
1c930 30 0d 0a 2d 33 31 35 30 0d 0a 2d 38 30 31 30 0d  0..-3150..-8010.
1c940 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
1c950 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2b 20 35  rt..SELECT - + 5
1c960 32 20 2b 20 63 6f 6c 32 20 41 53 20 63 6f 6c 31  2 + col2 AS col1
1c970 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
1c980 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 34 0d 0a 2d  r0..----..-14..-
1c990 32 35 0d 0a 2d 32 36 0d 0a 0d 0a 71 75 65 72 79  25..-26....query
1c9a0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
1c9b0 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63 6f  CT DISTINCT + co
1c9c0 72 30 2e 63 6f 6c 31 20 2a 20 63 6f 6c 32 20 2b  r0.col1 * col2 +
1c9d0 20 2b 20 34 30 20 2a 20 63 6f 6c 31 20 2a 20 63   + 40 * col1 * c
1c9e0 6f 72 30 2e 63 6f 6c 30 20 41 53 20 63 6f 6c 31  or0.col0 AS col1
1c9f0 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
1ca00 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 38 35 36 31 34  r0..----..185614
1ca10 0d 0a 35 34 33 36 36 0d 0a 39 35 31 37 0d 0a 0d  ..54366..9517...
1ca20 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1ca30 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 34  ..SELECT ALL + 4
1ca40 37 20 2a 20 63 6f 6c 31 20 2b 20 38 20 46 52 4f  7 * col1 + 8 FRO
1ca50 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
1ca60 2d 2d 2d 2d 0d 0a 31 32 33 30 0d 0a 34 37 38 0d  ----..1230..478.
1ca70 0a 36 31 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .619....query I 
1ca80 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
1ca90 63 6f 6c 30 20 2b 20 2b 20 28 20 63 6f 6c 32 20  col0 + + ( col2 
1caa0 29 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  ) FROM tab0 AS c
1cab0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 37 31 0d 0a  or0..----..171..
1cac0 33 36 0d 0a 35 37 0d 0a 0d 0a 71 75 65 72 79 20  36..57....query 
1cad0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
1cae0 54 20 74 61 62 31 2e 63 6f 6c 31 20 2b 20 28 20  T tab1.col1 + ( 
1caf0 63 6f 6c 31 20 29 20 46 52 4f 4d 20 74 61 62 31  col1 ) FROM tab1
1cb00 0d 0a 2d 2d 2d 2d 0d 0a 32 30 0d 0a 32 36 0d 0a  ..----..20..26..
1cb10 35 32 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  52....skipif mys
1cb20 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
1cb30 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
1cb40 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
1cb50 54 49 4e 43 54 20 2d 20 63 6f 6c 31 20 2a 20 43  TINCT - col1 * C
1cb60 41 53 54 20 28 20 2d 20 63 6f 6c 32 20 41 53 20  AST ( - col2 AS 
1cb70 52 45 41 4c 20 29 20 2b 20 63 6f 6c 30 20 2a 20  REAL ) + col0 * 
1cb80 28 20 2b 20 37 30 20 29 20 41 53 20 63 6f 6c 31  ( + 70 ) AS col1
1cb90 20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d   FROM tab1 cor0.
1cba0 0a 2d 2d 2d 2d 0d 0a 31 36 31 34 0d 0a 35 30 35  .----..1614..505
1cbb0 30 0d 0a 36 38 34 38 0d 0a 0d 0a 71 75 65 72 79  0..6848....query
1cbc0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
1cbd0 43 54 20 41 4c 4c 20 63 6f 6c 30 20 2b 20 2b 20  CT ALL col0 + + 
1cbe0 33 20 2a 20 2b 20 33 30 20 2a 20 2d 20 63 6f 6c  3 * + 30 * - col
1cbf0 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  2 FROM tab2 AS c
1cc00 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 32 36 32  or0..----..-2262
1cc10 0d 0a 2d 32 34 32 33 0d 0a 2d 33 33 34 31 0d 0a  ..-2423..-3341..
1cc20 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65  ..skipif postgre
1cc30 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c  sql # PostgreSQL
1cc40 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65   requires AS whe
1cc50 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75  n renaming outpu
1cc60 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79  t columns..query
1cc70 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
1cc80 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63 6f  CT DISTINCT + co
1cc90 6c 30 20 2a 20 2d 20 63 6f 72 30 2e 63 6f 6c 30  l0 * - cor0.col0
1cca0 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20   col1 FROM tab1 
1ccb0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
1ccc0 34 30 39 36 0d 0a 2d 36 34 30 30 0d 0a 2d 39 0d  4096..-6400..-9.
1ccd0 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
1cce0 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79  # support for My
1ccf0 53 51 4c 20 73 70 65 63 69 66 69 63 20 73 79 73  SQL specific sys
1cd00 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79  tem types and sy
1cd10 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f  ntax..query I ro
1cd20 77 73 6f 72 74 20 6c 61 62 65 6c 2d 37 39 39 0d  wsort label-799.
1cd30 0a 53 45 4c 45 43 54 20 2b 20 63 6f 72 30 2e 63  .SELECT + cor0.c
1cd40 6f 6c 32 20 2b 20 43 41 53 54 28 20 28 20 63 6f  ol2 + CAST( ( co
1cd50 6c 30 20 29 20 41 53 20 53 49 47 4e 45 44 20 29  l0 ) AS SIGNED )
1cd60 20 2a 20 43 41 53 54 28 20 63 6f 6c 30 20 41 53   * CAST( col0 AS
1cd70 20 53 49 47 4e 45 44 20 29 20 46 52 4f 4d 20 74   SIGNED ) FROM t
1cd80 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
1cd90 2d 0d 0a 36 31 31 30 0d 0a 36 32 37 39 0d 0a 37  -..6110..6279..7
1cda0 36 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  6....skipif mysq
1cdb0 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
1cdc0 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
1cdd0 6f 72 74 20 6c 61 62 65 6c 2d 37 39 39 0d 0a 53  ort label-799..S
1cde0 45 4c 45 43 54 20 2b 20 63 6f 72 30 2e 63 6f 6c  ELECT + cor0.col
1cdf0 32 20 2b 20 43 41 53 54 20 28 20 28 20 63 6f 6c  2 + CAST ( ( col
1ce00 30 20 29 20 41 53 20 49 4e 54 45 47 45 52 20 29  0 ) AS INTEGER )
1ce10 20 2a 20 43 41 53 54 20 28 20 63 6f 6c 30 20 41   * CAST ( col0 A
1ce20 53 20 49 4e 54 45 47 45 52 20 29 20 46 52 4f 4d  S INTEGER ) FROM
1ce30 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
1ce40 2d 2d 2d 0d 0a 36 31 31 30 0d 0a 36 32 37 39 0d  ---..6110..6279.
1ce50 0a 37 36 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  .76....onlyif my
1ce60 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f  sql # support fo
1ce70 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63  r MySQL specific
1ce80 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e   system types an
1ce90 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20  d syntax..query 
1cea0 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
1ceb0 38 30 30 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  800..SELECT ALL 
1cec0 2b 20 43 41 53 54 28 20 2d 20 31 35 20 41 53 20  + CAST( - 15 AS 
1ced0 53 49 47 4e 45 44 20 29 20 2a 20 63 6f 6c 30 20  SIGNED ) * col0 
1cee0 2b 20 2b 20 28 20 37 38 20 29 20 2b 20 2d 20 63  + + ( 78 ) + - c
1cef0 6f 6c 32 20 2a 20 2d 20 63 6f 6c 31 20 41 53 20  ol2 * - col1 AS 
1cf00 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 63  col1 FROM tab1 c
1cf10 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 31 32 0d  or0..----..-312.
1cf20 0a 31 32 36 0d 0a 31 34 33 37 0d 0a 0d 0a 73 6b  .126..1437....sk
1cf30 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
1cf40 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
1cf50 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
1cf60 65 6c 2d 38 30 30 0d 0a 53 45 4c 45 43 54 20 41  el-800..SELECT A
1cf70 4c 4c 20 2b 20 43 41 53 54 20 28 20 2d 20 31 35  LL + CAST ( - 15
1cf80 20 41 53 20 49 4e 54 45 47 45 52 20 29 20 2a 20   AS INTEGER ) * 
1cf90 63 6f 6c 30 20 2b 20 2b 20 28 20 37 38 20 29 20  col0 + + ( 78 ) 
1cfa0 2b 20 2d 20 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c  + - col2 * - col
1cfb0 31 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  1 AS col1 FROM t
1cfc0 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab1 cor0..----..
1cfd0 2d 33 31 32 0d 0a 31 32 36 0d 0a 31 34 33 37 0d  -312..126..1437.
1cfe0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
1cff0 72 74 0d 0a 53 45 4c 45 43 54 20 37 37 20 46 52  rt..SELECT 77 FR
1d000 4f 4d 20 74 61 62 30 2c 20 74 61 62 31 20 41 53  OM tab0, tab1 AS
1d010 20 63 6f 72 30 2c 20 74 61 62 31 20 41 53 20 63   cor0, tab1 AS c
1d020 6f 72 31 2c 20 74 61 62 31 20 41 53 20 63 6f 72  or1, tab1 AS cor
1d030 32 0d 0a 2d 2d 2d 2d 0d 0a 38 31 20 76 61 6c 75  2..----..81 valu
1d040 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 33 38  es hashing to 38
1d050 66 34 38 37 63 32 31 34 37 65 65 32 66 65 30 35  f487c2147ee2fe05
1d060 35 32 37 65 33 38 63 35 65 30 35 30 33 62 0d 0a  527e38c5e0503b..
1d070 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1d080 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 28 20  t..SELECT ALL ( 
1d090 2b 20 34 31 20 29 20 2a 20 2d 20 63 6f 6c 31 20  + 41 ) * - col1 
1d0a0 2b 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31  + col2 FROM tab1
1d0b0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
1d0c0 2d 31 30 31 32 0d 0a 2d 33 35 33 0d 0a 2d 34 33  -1012..-353..-43
1d0d0 37 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  7....onlyif mysq
1d0e0 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20  l # support for 
1d0f0 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63 20 73  MySQL specific s
1d100 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20  ystem types and 
1d110 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20  syntax..query I 
1d120 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 38 30  rowsort label-80
1d130 33 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20  3..SELECT ALL + 
1d140 43 41 53 54 28 20 63 6f 6c 30 20 41 53 20 53 49  CAST( col0 AS SI
1d150 47 4e 45 44 20 29 20 2a 20 63 6f 6c 30 20 2b 20  GNED ) * col0 + 
1d160 2d 20 63 6f 6c 32 20 2a 20 2d 20 63 6f 72 30 2e  - col2 * - cor0.
1d170 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41  col2 FROM tab0 A
1d180 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32  S cor0..----..12
1d190 32 36 0d 0a 31 34 36 34 35 0d 0a 31 36 36 35 0d  26..14645..1665.
1d1a0 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
1d1b0 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
1d1c0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1d1d0 74 20 6c 61 62 65 6c 2d 38 30 33 0d 0a 53 45 4c  t label-803..SEL
1d1e0 45 43 54 20 41 4c 4c 20 2b 20 43 41 53 54 20 28  ECT ALL + CAST (
1d1f0 20 63 6f 6c 30 20 41 53 20 49 4e 54 45 47 45 52   col0 AS INTEGER
1d200 20 29 20 2a 20 63 6f 6c 30 20 2b 20 2d 20 63 6f   ) * col0 + - co
1d210 6c 32 20 2a 20 2d 20 63 6f 72 30 2e 63 6f 6c 32  l2 * - cor0.col2
1d220 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
1d230 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 32 36 0d 0a  r0..----..1226..
1d240 31 34 36 34 35 0d 0a 31 36 36 35 0d 0a 0d 0a 71  14645..1665....q
1d250 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
1d260 53 45 4c 45 43 54 20 2d 20 2d 20 63 6f 72 30 2e  SELECT - - cor0.
1d270 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 2c 20  col1 FROM tab0, 
1d280 74 61 62 31 20 63 6f 72 30 2c 20 74 61 62 31 20  tab1 cor0, tab1 
1d290 41 53 20 63 6f 72 31 2c 20 74 61 62 32 2c 20 74  AS cor1, tab2, t
1d2a0 61 62 30 20 41 53 20 63 6f 72 32 0d 0a 2d 2d 2d  ab0 AS cor2..---
1d2b0 2d 0d 0a 32 34 33 20 76 61 6c 75 65 73 20 68 61  -..243 values ha
1d2c0 73 68 69 6e 67 20 74 6f 20 64 65 32 37 30 35 66  shing to de2705f
1d2d0 66 30 62 62 38 62 34 66 37 31 34 64 61 66 62 30  f0bb8b4f714dafb0
1d2e0 37 34 39 37 63 36 31 31 39 0d 0a 0d 0a 71 75 65  7497c6119....que
1d2f0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
1d300 4c 45 43 54 20 32 30 20 41 53 20 63 6f 6c 32 20  LECT 20 AS col2 
1d310 46 52 4f 4d 20 74 61 62 30 2c 20 74 61 62 30 20  FROM tab0, tab0 
1d320 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39  AS cor0..----..9
1d330 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20   values hashing 
1d340 74 6f 20 32 66 64 64 39 34 32 66 65 30 33 30 37  to 2fdd942fe0307
1d350 61 36 66 66 36 36 62 36 33 30 30 34 65 66 31 30  a6ff66b63004ef10
1d360 32 63 34 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f  2c4....skipif po
1d370 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67  stgresql # Postg
1d380 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41  reSQL requires A
1d390 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20  S when renaming 
1d3a0 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a  output columns..
1d3b0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
1d3c0 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 30  .SELECT ALL col0
1d3d0 20 2a 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 63   * + cor0.col2 c
1d3e0 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 63 6f  ol2 FROM tab1 co
1d3f0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 36 32 0d 0a 33  r0..----..162..3
1d400 36 34 38 0d 0a 37 36 38 30 0d 0a 0d 0a 71 75 65  648..7680....que
1d410 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
1d420 4c 45 43 54 20 33 36 20 2b 20 63 6f 6c 32 20 46  LECT 36 + col2 F
1d430 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
1d440 0d 0a 2d 2d 2d 2d 0d 0a 31 31 38 0d 0a 33 37 0d  ..----..118..37.
1d450 0a 36 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .69....query I r
1d460 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
1d470 49 53 54 49 4e 43 54 20 2d 20 28 20 63 6f 72 30  ISTINCT - ( cor0
1d480 2e 63 6f 6c 32 20 29 20 2a 20 63 6f 72 30 2e 63  .col2 ) * cor0.c
1d490 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol0 FROM tab2 AS
1d4a0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 38   cor0..----..-18
1d4b0 39 0d 0a 2d 32 30 32 38 0d 0a 2d 33 30 30 32 0d  9..-2028..-3002.
1d4c0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
1d4d0 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
1d4e0 4e 43 54 20 2b 20 28 20 2b 20 63 6f 6c 31 20 29  NCT + ( + col1 )
1d4f0 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
1d500 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 38  b0 cor0..----..8
1d510 36 0d 0a 39 31 0d 0a 39 37 0d 0a 0d 0a 71 75 65  6..91..97....que
1d520 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
1d530 4c 45 43 54 20 41 4c 4c 20 74 61 62 31 2e 63 6f  LECT ALL tab1.co
1d540 6c 31 20 2a 20 2b 20 28 20 74 61 62 31 2e 63 6f  l1 * + ( tab1.co
1d550 6c 30 20 29 20 41 53 20 63 6f 6c 30 20 46 52 4f  l0 ) AS col0 FRO
1d560 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 30  M tab1..----..10
1d570 34 30 0d 0a 36 34 30 0d 0a 37 38 0d 0a 0d 0a 71  40..640..78....q
1d580 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
1d590 53 45 4c 45 43 54 20 28 20 2d 20 63 6f 6c 30 20  SELECT ( - col0 
1d5a0 29 20 2b 20 2b 20 74 61 62 30 2e 63 6f 6c 31 20  ) + + tab0.col1 
1d5b0 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d  FROM tab0..----.
1d5c0 0a 32 0d 0a 36 32 0d 0a 36 32 0d 0a 0d 0a 71 75  .2..62..62....qu
1d5d0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
1d5e0 45 4c 45 43 54 20 41 4c 4c 20 2b 20 2b 20 63 6f  ELECT ALL + + co
1d5f0 6c 32 20 2d 20 2d 20 63 6f 6c 30 20 2a 20 63 6f  l2 - - col0 * co
1d600 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l1 FROM tab2 AS 
1d610 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33 38 31  cor0..----..1381
1d620 0d 0a 32 34 34 0d 0a 34 36 32 38 0d 0a 0d 0a 73  ..244..4628....s
1d630 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c  kipif postgresql
1d640 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65   # PostgreSQL re
1d650 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72  quires AS when r
1d660 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63  enaming output c
1d670 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20  olumns..query I 
1d680 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
1d690 44 49 53 54 49 4e 43 54 20 2b 20 34 33 20 2b 20  DISTINCT + 43 + 
1d6a0 2d 20 63 6f 6c 32 20 2b 20 63 6f 72 30 2e 63 6f  - col2 + cor0.co
1d6b0 6c 32 20 2a 20 63 6f 6c 31 20 63 6f 6c 32 20 46  l2 * col1 col2 F
1d6c0 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
1d6d0 0d 0a 2d 2d 2d 2d 0d 0a 31 33 39 0d 0a 32 38 34  ..----..139..284
1d6e0 38 0d 0a 37 34 32 33 0d 0a 0d 0a 71 75 65 72 79  8..7423....query
1d6f0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
1d700 43 54 20 2d 20 32 30 20 2b 20 63 6f 6c 30 20 46  CT - 20 + col0 F
1d710 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
1d720 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 37 0d 0a 34 34 0d  ..----..-17..44.
1d730 0a 36 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .60....query I r
1d740 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
1d750 4c 4c 20 2b 20 2b 20 33 35 20 41 53 20 63 6f 6c  LL + + 35 AS col
1d760 31 20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30  1 FROM tab1 cor0
1d770 0d 0a 2d 2d 2d 2d 0d 0a 33 35 0d 0a 33 35 0d 0a  ..----..35..35..
1d780 33 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  35....query I ro
1d790 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
1d7a0 34 20 2a 20 2d 20 63 6f 6c 32 20 46 52 4f 4d 20  4 * - col2 FROM 
1d7b0 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab2 cor0..----.
1d7c0 0a 2d 31 30 34 0d 0a 2d 31 30 38 0d 0a 2d 31 35  .-104..-108..-15
1d7d0 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  2....query I row
1d7e0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63  sort..SELECT + c
1d7f0 6f 72 30 2e 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c  or0.col2 * - col
1d800 30 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61  0 + col0 FROM ta
1d810 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
1d820 0d 0a 2d 31 38 32 0d 0a 2d 31 39 35 30 0d 0a 2d  ..-182..-1950..-
1d830 32 39 32 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20  2923....query I 
1d840 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
1d850 41 4c 4c 20 63 6f 6c 30 20 2a 20 63 6f 6c 31 20  ALL col0 * col1 
1d860 2b 20 63 6f 6c 32 20 2b 20 63 6f 6c 30 20 46 52  + col2 + col0 FR
1d870 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31  OM tab2..----..1
1d880 34 36 30 0d 0a 32 35 31 0d 0a 34 37 30 36 0d 0a  460..251..4706..
1d890 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1d8a0 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 30  t..SELECT - col0
1d8b0 20 2a 20 63 6f 6c 30 20 2b 20 31 20 2a 20 63 6f   * col0 + 1 * co
1d8c0 6c 32 20 2a 20 63 6f 6c 31 20 2b 20 63 6f 6c 32  l2 * col1 + col2
1d8d0 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d   FROM tab0 cor0.
1d8e0 0a 2d 2d 2d 2d 0d 0a 2d 31 31 32 37 0d 0a 2d 33  .----..-1127..-3
1d8f0 37 37 0d 0a 32 32 39 35 0d 0a 0d 0a 71 75 65 72  77..2295....quer
1d900 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
1d910 45 43 54 20 2b 20 63 6f 6c 32 20 2a 20 63 6f 6c  ECT + col2 * col
1d920 30 20 2b 20 2b 20 28 20 2d 20 63 6f 6c 30 20 29  0 + + ( - col0 )
1d930 20 2a 20 2d 20 63 6f 6c 32 20 2a 20 63 6f 6c 32   * - col2 * col2
1d940 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d   FROM tab2..----
1d950 0d 0a 31 31 37 30 37 38 0d 0a 35 32 39 32 0d 0a  ..117078..5292..
1d960 35 34 37 35 36 0d 0a 0d 0a 71 75 65 72 79 20 49  54756....query I
1d970 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
1d980 20 41 4c 4c 20 28 20 2b 20 63 6f 6c 32 20 29 20   ALL ( + col2 ) 
1d990 2a 20 63 6f 6c 32 20 2a 20 63 6f 6c 30 20 41 53  * col2 * col0 AS
1d9a0 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20   col0 FROM tab2 
1d9b0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
1d9c0 31 34 30 37 36 0d 0a 35 31 30 33 0d 0a 35 32 37  14076..5103..527
1d9d0 32 38 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  28....onlyif mys
1d9e0 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65  ql # use DIV ope
1d9f0 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65  rator for intege
1da00 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72  r division..quer
1da10 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
1da20 6c 2d 38 32 32 0d 0a 53 45 4c 45 43 54 20 2b 20  l-822..SELECT + 
1da30 2d 20 63 6f 6c 31 20 44 49 56 20 34 30 20 41 53  - col1 DIV 40 AS
1da40 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20   col2 FROM tab0 
1da50 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
1da60 32 0d 0a 2d 32 0d 0a 2d 32 0d 0a 0d 0a 73 6b 69  2..-2..-2....ski
1da70 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
1da80 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
1da90 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
1daa0 6c 2d 38 32 32 0d 0a 53 45 4c 45 43 54 20 2b 20  l-822..SELECT + 
1dab0 2d 20 63 6f 6c 31 20 2f 20 34 30 20 41 53 20 63  - col1 / 40 AS c
1dac0 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol2 FROM tab0 AS
1dad0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 0d   cor0..----..-2.
1dae0 0a 2d 32 0d 0a 2d 32 0d 0a 0d 0a 6f 6e 6c 79 69  .-2..-2....onlyi
1daf0 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72  f mysql # suppor
1db00 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63  t for MySQL spec
1db10 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65  ific system type
1db20 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75  s and syntax..qu
1db30 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
1db40 62 65 6c 2d 38 32 33 0d 0a 53 45 4c 45 43 54 20  bel-823..SELECT 
1db50 44 49 53 54 49 4e 43 54 20 2b 20 2b 20 43 41 53  DISTINCT + + CAS
1db60 54 28 20 4e 55 4c 4c 20 41 53 20 44 45 43 49 4d  T( NULL AS DECIM
1db70 41 4c 20 29 20 41 53 20 63 6f 6c 30 20 46 52 4f  AL ) AS col0 FRO
1db80 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab1 cor0..---
1db90 2d 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69  -..NULL....skipi
1dba0 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
1dbb0 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
1dbc0 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
1dbd0 38 32 33 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  823..SELECT DIST
1dbe0 49 4e 43 54 20 2b 20 2b 20 43 41 53 54 20 28 20  INCT + + CAST ( 
1dbf0 4e 55 4c 4c 20 41 53 20 52 45 41 4c 20 29 20 41  NULL AS REAL ) A
1dc00 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31  S col0 FROM tab1
1dc10 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c   cor0..----..NUL
1dc20 4c 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  L....onlyif mysq
1dc30 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20  l # support for 
1dc40 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63 20 73  MySQL specific s
1dc50 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20  ystem types and 
1dc60 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20  syntax..query I 
1dc70 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 38 32  rowsort label-82
1dc80 34 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20  4..SELECT ALL - 
1dc90 43 41 53 54 28 20 2d 20 63 6f 6c 31 20 41 53 20  CAST( - col1 AS 
1dca0 53 49 47 4e 45 44 20 29 20 41 53 20 63 6f 6c 31  SIGNED ) AS col1
1dcb0 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
1dcc0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 38 36 0d 0a 39 31  r0..----..86..91
1dcd0 0d 0a 39 37 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  ..97....skipif m
1dce0 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
1dcf0 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
1dd00 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 38 32 34  owsort label-824
1dd10 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 43  ..SELECT ALL - C
1dd20 41 53 54 20 28 20 2d 20 63 6f 6c 31 20 41 53 20  AST ( - col1 AS 
1dd30 49 4e 54 45 47 45 52 20 29 20 41 53 20 63 6f 6c  INTEGER ) AS col
1dd40 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  1 FROM tab0 AS c
1dd50 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 38 36 0d 0a 39  or0..----..86..9
1dd60 31 0d 0a 39 37 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  1..97....onlyif 
1dd70 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20  mysql # support 
1dd80 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66  for MySQL specif
1dd90 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20  ic system types 
1dda0 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72  and syntax..quer
1ddb0 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
1ddc0 6c 2d 38 32 35 0d 0a 53 45 4c 45 43 54 20 2b 20  l-825..SELECT + 
1ddd0 43 41 53 54 28 20 33 30 20 41 53 20 53 49 47 4e  CAST( 30 AS SIGN
1dde0 45 44 20 29 20 63 6f 6c 32 20 46 52 4f 4d 20 74  ED ) col2 FROM t
1ddf0 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
1de00 2d 0d 0a 33 30 0d 0a 33 30 0d 0a 33 30 0d 0a 0d  -..30..30..30...
1de10 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73  .skipif postgres
1de20 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20  ql # PostgreSQL 
1de30 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e  requires AS when
1de40 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74   renaming output
1de50 20 63 6f 6c 75 6d 6e 73 0d 0a 73 6b 69 70 69 66   columns..skipif
1de60 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
1de70 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
1de80 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 38   rowsort label-8
1de90 32 35 0d 0a 53 45 4c 45 43 54 20 2b 20 43 41 53  25..SELECT + CAS
1dea0 54 20 28 20 33 30 20 41 53 20 49 4e 54 45 47 45  T ( 30 AS INTEGE
1deb0 52 20 29 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61  R ) col2 FROM ta
1dec0 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
1ded0 0d 0a 33 30 0d 0a 33 30 0d 0a 33 30 0d 0a 0d 0a  ..30..30..30....
1dee0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
1def0 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
1df00 20 2d 20 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c 30   - col1 * - col0
1df10 20 2a 20 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20   * col2 AS col0 
1df20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
1df30 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 39 36 35 32 0d  0..----..119652.
1df40 0a 35 31 30 33 34 0d 0a 35 38 35 39 0d 0a 0d 0a  .51034..5859....
1df50 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
1df60 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 2d 20  .SELECT ALL + - 
1df70 63 6f 6c 31 20 2b 20 2d 20 63 6f 6c 32 20 2a 20  col1 + - col2 * 
1df80 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31  + col0 FROM tab1
1df90 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 38   cor0..----..-18
1dfa0 38 0d 0a 2d 33 36 35 38 0d 0a 2d 37 36 39 33 0d  8..-3658..-7693.
1dfb0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
1dfc0 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d  rt..SELECT ALL -
1dfd0 20 63 6f 6c 32 20 2d 20 63 6f 6c 32 20 2a 20 63   col2 - col2 * c
1dfe0 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol1 FROM tab2 AS
1dff0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 35   cor0..----..-15
1e000 36 30 0d 0a 2d 36 38 34 0d 0a 2d 38 36 34 0d 0a  60..-684..-864..
1e010 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1e020 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
1e030 43 54 20 63 6f 72 30 2e 63 6f 6c 32 20 2a 20 63  CT cor0.col2 * c
1e040 6f 6c 31 20 2a 20 2d 20 63 6f 6c 31 20 41 53 20  ol1 * - col1 AS 
1e050 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41  col2 FROM tab0 A
1e060 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32  S cor0..----..-2
1e070 34 34 30 36 38 0d 0a 2d 36 37 39 30 34 32 0d 0a  44068..-679042..
1e080 2d 39 34 30 39 0d 0a 0d 0a 71 75 65 72 79 20 49  -9409....query I
1e090 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
1e0a0 20 41 4c 4c 20 63 6f 6c 31 20 2b 20 63 6f 72 30   ALL col1 + cor0
1e0b0 2e 63 6f 6c 31 20 2a 20 63 6f 72 30 2e 63 6f 6c  .col1 * cor0.col
1e0c0 32 20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30  2 FROM tab1 cor0
1e0d0 0d 0a 2d 2d 2d 2d 0d 0a 31 32 36 31 0d 0a 31 34  ..----..1261..14
1e0e0 33 30 0d 0a 35 38 30 0d 0a 0d 0a 71 75 65 72 79  30..580....query
1e0f0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
1e100 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 32 20 2a 20  CT ALL - col2 * 
1e110 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c 30 20 41 53  col0 + - col0 AS
1e120 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20   col2 FROM tab1 
1e130 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 36 35  cor0..----..-165
1e140 0d 0a 2d 33 37 31 32 0d 0a 2d 37 37 36 30 0d 0a  ..-3712..-7760..
1e150 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1e160 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 32 20 2a  t..SELECT col2 *
1e170 20 2b 20 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c 32   + col2 * + col2
1e180 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
1e190 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
1e1a0 0d 0a 31 0d 0a 33 35 39 33 37 0d 0a 35 35 31 33  ..1..35937..5513
1e1b0 36 38 0d 0a 0d 0a 71 75 65 72 79 20 49 49 49 20  68....query III 
1e1c0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
1e1d0 2a 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  * FROM tab1 AS c
1e1e0 6f 72 30 20 57 48 45 52 45 20 4e 4f 54 20 2b 20  or0 WHERE NOT + 
1e1f0 63 6f 6c 32 20 2b 20 2b 20 63 6f 6c 32 20 3c 20  col2 + + col2 < 
1e200 28 20 4e 55 4c 4c 20 29 0d 0a 2d 2d 2d 2d 0d 0a  ( NULL )..----..
1e210 0d 0a 71 75 65 72 79 20 49 49 49 20 72 6f 77 73  ..query III rows
1e220 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2a 20 46 52  ort..SELECT * FR
1e230 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 20  OM tab0 AS cor0 
1e240 57 48 45 52 45 20 4e 4f 54 20 4e 55 4c 4c 20 3c  WHERE NOT NULL <
1e250 3e 20 28 20 63 6f 6c 31 20 29 0d 0a 2d 2d 2d 2d  > ( col1 )..----
1e260 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
1e270 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
1e280 49 4e 43 54 20 2b 20 63 6f 6c 31 20 2b 20 63 6f  INCT + col1 + co
1e290 6c 32 20 2a 20 63 6f 6c 30 20 2b 20 2b 20 63 6f  l2 * col0 + + co
1e2a0 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72  l1 FROM tab0 cor
1e2b0 30 0d 0a 2d 2d 2d 2d 0d 0a 32 32 39 0d 0a 37 34  0..----..229..74
1e2c0 38 30 0d 0a 39 36 34 0d 0a 0d 0a 71 75 65 72 79  80..964....query
1e2d0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
1e2e0 43 54 20 41 4c 4c 20 2b 20 2d 20 63 6f 72 30 2e  CT ALL + - cor0.
1e2f0 63 6f 6c 30 20 2a 20 63 6f 6c 32 20 2a 20 63 6f  col0 * col2 * co
1e300 6c 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  l0 AS col2 FROM 
1e310 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
1e320 2d 2d 0d 0a 2d 31 33 32 33 0d 0a 2d 31 35 38 31  --..-1323..-1581
1e330 38 34 0d 0a 2d 32 33 37 31 35 38 0d 0a 0d 0a 71  84..-237158....q
1e340 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
1e350 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 2d 20 63  SELECT ALL - - c
1e360 6f 6c 30 20 2b 20 2d 20 63 6f 6c 31 20 2b 20 2d  ol0 + - col1 + -
1e370 20 63 6f 72 30 2e 63 6f 6c 31 20 41 53 20 63 6f   cor0.col1 AS co
1e380 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l2 FROM tab1 AS 
1e390 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 39 0d  cor0..----..-49.
1e3a0 0a 34 34 0d 0a 35 34 0d 0a 0d 0a 71 75 65 72 79  .44..54....query
1e3b0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
1e3c0 43 54 20 2d 20 63 6f 6c 30 20 2a 20 63 6f 6c 31  CT - col0 * col1
1e3d0 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 2a 20 63   + cor0.col2 * c
1e3e0 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol1 FROM tab1 AS
1e3f0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 37 30   cor0..----..-70
1e400 0d 0a 31 33 32 36 0d 0a 32 30 38 0d 0a 0d 0a 73  ..1326..208....s
1e410 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c  kipif postgresql
1e420 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65   # PostgreSQL re
1e430 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72  quires AS when r
1e440 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63  enaming output c
1e450 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20  olumns..query I 
1e460 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
1e470 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c 31 20 2a 20  col1 * - col1 * 
1e480 63 6f 6c 30 20 2d 20 2b 20 63 6f 6c 32 20 63 6f  col0 - + col2 co
1e490 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l2 FROM tab2 AS 
1e4a0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 32 38  cor0..----..-228
1e4b0 36 39 0d 0a 2d 32 37 31 35 34 34 0d 0a 2d 36 37  69..-271544..-67
1e4c0 35 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  54....query I ro
1e4d0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
1e4e0 53 54 49 4e 43 54 20 2d 20 63 6f 6c 31 20 2b 20  STINCT - col1 + 
1e4f0 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c 32 20 41 53  col1 * - col2 AS
1e500 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 0d   col1 FROM tab2.
1e510 0a 2d 2d 2d 2d 0d 0a 2d 31 35 39 33 0d 0a 2d 36  .----..-1593..-6
1e520 36 33 0d 0a 2d 38 36 38 0d 0a 0d 0a 71 75 65 72  63..-868....quer
1e530 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
1e540 45 43 54 20 2d 20 63 6f 6c 31 20 2b 20 63 6f 6c  ECT - col1 + col
1e550 31 20 2a 20 74 61 62 32 2e 63 6f 6c 32 20 46 52  1 * tab2.col2 FR
1e560 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31  OM tab2..----..1
1e570 34 37 35 0d 0a 36 32 39 0d 0a 38 30 36 0d 0a 0d  475..629..806...
1e580 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1e590 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
1e5a0 54 20 2d 20 63 6f 6c 31 20 2a 20 63 6f 6c 32 20  T - col1 * col2 
1e5b0 2a 20 63 6f 6c 30 20 2b 20 63 6f 6c 31 20 46 52  * col0 + col1 FR
1e5c0 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  OM tab0..----..-
1e5d0 33 32 39 38 0d 0a 2d 36 36 34 30 32 37 0d 0a 2d  3298..-664027..-
1e5e0 36 38 30 32 36 0d 0a 0d 0a 71 75 65 72 79 20 49  68026....query I
1e5f0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
1e600 20 2d 20 2b 20 63 6f 6c 32 20 2b 20 2b 20 63 6f   - + col2 + + co
1e610 6c 32 20 2a 20 63 6f 6c 30 20 41 53 20 63 6f 6c  l2 * col0 AS col
1e620 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  1 FROM tab0 AS c
1e630 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 34 0d 0a 37  or0..----..34..7
1e640 32 31 36 0d 0a 37 35 39 0d 0a 0d 0a 73 6b 69 70  216..759....skip
1e650 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20  if postgresql # 
1e660 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69  PostgreSQL requi
1e670 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61  res AS when rena
1e680 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75  ming output colu
1e690 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  mns..query I row
1e6a0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63  sort..SELECT + c
1e6b0 6f 6c 30 20 2b 20 74 61 62 30 2e 63 6f 6c 32 20  ol0 + tab0.col2 
1e6c0 2a 20 2d 20 63 6f 6c 32 20 63 6f 6c 31 20 46 52  * - col2 col1 FR
1e6d0 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  OM tab0..----..-
1e6e0 31 30 36 35 0d 0a 2d 36 36 33 35 0d 0a 33 34 0d  1065..-6635..34.
1e6f0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
1e700 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
1e710 4e 43 54 20 2b 20 63 6f 6c 30 20 2b 20 2d 20 63  NCT + col0 + - c
1e720 6f 6c 30 20 2a 20 2d 20 63 6f 6c 31 20 46 52 4f  ol0 * - col1 FRO
1e730 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 32 30  M tab0..----..20
1e740 38 38 0d 0a 33 34 33 30 0d 0a 38 31 38 38 0d 0a  88..3430..8188..
1e750 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
1e760 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53   support for MyS
1e770 51 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74  QL specific syst
1e780 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e  em types and syn
1e790 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  tax..query I row
1e7a0 73 6f 72 74 20 6c 61 62 65 6c 2d 38 34 36 0d 0a  sort label-846..
1e7b0 53 45 4c 45 43 54 20 2b 20 63 6f 6c 32 20 2b 20  SELECT + col2 + 
1e7c0 2d 20 43 41 53 54 28 20 4e 55 4c 4c 20 41 53 20  - CAST( NULL AS 
1e7d0 53 49 47 4e 45 44 20 29 20 41 53 20 63 6f 6c 30  SIGNED ) AS col0
1e7e0 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d   FROM tab0 cor0.
1e7f0 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c  .----..NULL..NUL
1e800 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69  L..NULL....skipi
1e810 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
1e820 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
1e830 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
1e840 38 34 36 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f  846..SELECT + co
1e850 6c 32 20 2b 20 2d 20 43 41 53 54 20 28 20 4e 55  l2 + - CAST ( NU
1e860 4c 4c 20 41 53 20 49 4e 54 45 47 45 52 20 29 20  LL AS INTEGER ) 
1e870 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
1e880 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55  0 cor0..----..NU
1e890 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a  LL..NULL..NULL..
1e8a0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1e8b0 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 31 20 2b  t..SELECT col1 +
1e8c0 20 2b 20 38 36 20 2b 20 2b 20 63 6f 6c 31 20 41   + 86 + + col1 A
1e8d0 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32  S col0 FROM tab2
1e8e0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
1e8f0 31 32 30 0d 0a 31 34 38 0d 0a 32 30 34 0d 0a 0d  120..148..204...
1e900 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1e910 0d 0a 53 45 4c 45 43 54 20 31 32 20 2a 20 63 6f  ..SELECT 12 * co
1e920 6c 32 20 2b 20 2b 20 28 20 2b 20 63 6f 6c 31 20  l2 + + ( + col1 
1e930 29 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d  ) FROM tab2..---
1e940 2d 0d 0a 33 35 35 0d 0a 33 37 31 0d 0a 34 37 33  -..355..371..473
1e950 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
1e960 6f 72 74 0d 0a 53 45 4c 45 43 54 20 74 61 62 31  ort..SELECT tab1
1e970 2e 63 6f 6c 30 20 2a 20 32 35 20 46 52 4f 4d 20  .col0 * 25 FROM 
1e980 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 36 30 30  tab1..----..1600
1e990 0d 0a 32 30 30 30 0d 0a 37 35 0d 0a 0d 0a 71 75  ..2000..75....qu
1e9a0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
1e9b0 45 4c 45 43 54 20 63 6f 6c 30 20 2a 20 2d 20 35  ELECT col0 * - 5
1e9c0 31 20 2b 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f  1 + + col0 AS co
1e9d0 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l0 FROM tab0 AS 
1e9e0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32 30  cor0..----..-120
1e9f0 30 0d 0a 2d 31 37 35 30 0d 0a 2d 34 34 35 30 0d  0..-1750..-4450.
1ea00 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
1ea10 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74  # use DIV operat
1ea20 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64  or for integer d
1ea30 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49  ivision..query I
1ea40 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 38   rowsort label-8
1ea50 35 31 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c  51..SELECT - col
1ea60 31 20 44 49 56 20 2b 20 28 20 2d 20 63 6f 6c 32  1 DIV + ( - col2
1ea70 20 29 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74   ) + col0 FROM t
1ea80 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
1ea90 2d 0d 0a 33 0d 0a 36 34 0d 0a 38 30 0d 0a 0d 0a  -..3..64..80....
1eaa0 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
1eab0 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
1eac0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
1ead0 61 62 65 6c 2d 38 35 31 0d 0a 53 45 4c 45 43 54  abel-851..SELECT
1eae0 20 2d 20 63 6f 6c 31 20 2f 20 2b 20 28 20 2d 20   - col1 / + ( - 
1eaf0 63 6f 6c 32 20 29 20 2b 20 63 6f 6c 30 20 46 52  col2 ) + col0 FR
1eb00 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
1eb10 0a 2d 2d 2d 2d 0d 0a 33 0d 0a 36 34 0d 0a 38 30  .----..3..64..80
1eb20 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
1eb30 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61   # use DIV opera
1eb40 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20  tor for integer 
1eb50 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20  division..query 
1eb60 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
1eb70 38 35 32 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 30  852..SELECT col0
1eb80 20 44 49 56 20 2d 20 32 38 20 41 53 20 63 6f 6c   DIV - 28 AS col
1eb90 31 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d  1 FROM tab1..---
1eba0 2d 0d 0a 2d 32 0d 0a 2d 32 0d 0a 30 0d 0a 0d 0a  -..-2..-2..0....
1ebb0 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
1ebc0 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
1ebd0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
1ebe0 61 62 65 6c 2d 38 35 32 0d 0a 53 45 4c 45 43 54  abel-852..SELECT
1ebf0 20 63 6f 6c 30 20 2f 20 2d 20 32 38 20 41 53 20   col0 / - 28 AS 
1ec00 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 0d 0a  col1 FROM tab1..
1ec10 2d 2d 2d 2d 0d 0a 2d 32 0d 0a 2d 32 0d 0a 30 0d  ----..-2..-2..0.
1ec20 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
1ec30 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c  rt..SELECT + col
1ec40 32 20 2a 20 2d 20 28 20 2d 20 37 36 20 2b 20 63  2 * - ( - 76 + c
1ec50 6f 6c 30 20 29 20 41 53 20 63 6f 6c 32 20 46 52  ol0 ) AS col2 FR
1ec60 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  OM tab0..----..-
1ec70 31 30 36 36 0d 0a 31 37 31 36 0d 0a 34 31 0d 0a  1066..1716..41..
1ec80 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
1ec90 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f   use DIV operato
1eca0 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69  r for integer di
1ecb0 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20  vision..query I 
1ecc0 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 38 35  rowsort label-85
1ecd0 34 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20  4..SELECT ALL + 
1ece0 63 6f 6c 32 20 2a 20 63 6f 6c 32 20 44 49 56 20  col2 * col2 DIV 
1ecf0 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 0d 0a  col1 FROM tab1..
1ed00 2d 2d 2d 2d 0d 0a 31 31 32 0d 0a 33 32 34 0d 0a  ----..112..324..
1ed10 37 30 38 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  708....skipif my
1ed20 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
1ed30 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
1ed40 77 73 6f 72 74 20 6c 61 62 65 6c 2d 38 35 34 0d  wsort label-854.
1ed50 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f  .SELECT ALL + co
1ed60 6c 32 20 2a 20 63 6f 6c 32 20 2f 20 63 6f 6c 31  l2 * col2 / col1
1ed70 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d   FROM tab1..----
1ed80 0d 0a 31 31 32 0d 0a 33 32 34 0d 0a 37 30 38 0d  ..112..324..708.
1ed90 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72  ...skipif postgr
1eda0 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51  esql # PostgreSQ
1edb0 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68  L requires AS wh
1edc0 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70  en renaming outp
1edd0 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72  ut columns..quer
1ede0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
1edf0 45 43 54 20 41 4c 4c 20 2b 20 28 20 2b 20 63 6f  ECT ALL + ( + co
1ee00 6c 31 20 2b 20 2d 20 63 6f 6c 31 20 29 20 63 6f  l1 + - col1 ) co
1ee10 6c 32 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d  l2 FROM tab0..--
1ee20 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a 71  --..0..0..0....q
1ee30 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
1ee40 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 31 20  SELECT ALL col1 
1ee50 2a 20 2d 20 63 6f 6c 32 20 2b 20 2b 20 28 20 2b  * - col2 + + ( +
1ee60 20 63 6f 6c 31 20 29 20 2a 20 63 6f 6c 31 20 41   col1 ) * col1 A
1ee70 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31  S col1 FROM tab1
1ee80 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
1ee90 2d 31 30 37 39 0d 0a 2d 34 37 30 0d 0a 2d 37 32  -1079..-470..-72
1eea0 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  8....query I row
1eeb0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 37  sort..SELECT + 7
1eec0 30 20 2a 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20  0 * + cor0.col0 
1eed0 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a  FROM tab0 cor0..
1eee0 2d 2d 2d 2d 0d 0a 31 36 38 30 0d 0a 32 34 35 30  ----..1680..2450
1eef0 0d 0a 36 32 33 30 0d 0a 0d 0a 71 75 65 72 79 20  ..6230....query 
1ef00 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
1ef10 54 20 41 4c 4c 20 2b 20 2d 20 28 20 63 6f 6c 32  T ALL + - ( col2
1ef20 20 29 20 2b 20 2b 20 34 31 20 46 52 4f 4d 20 74   ) + + 41 FROM t
1ef30 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
1ef40 2d 0d 0a 31 34 0d 0a 31 35 0d 0a 33 0d 0a 0d 0a  -..14..15..3....
1ef50 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
1ef60 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f  .SELECT ALL - co
1ef70 6c 30 20 2a 20 2d 20 63 6f 6c 32 20 2b 20 2b 20  l0 * - col2 + + 
1ef80 36 37 20 2d 20 31 39 20 2a 20 2d 20 63 6f 6c 30  67 - 19 * - col0
1ef90 20 2a 20 2b 20 34 33 20 41 53 20 63 6f 6c 32 20   * + 43 AS col2 
1efa0 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
1efb0 30 0d 0a 2d 2d 2d 2d 0d 0a 32 36 38 30 0d 0a 35  0..----..2680..5
1efc0 36 30 30 33 0d 0a 37 33 31 30 37 0d 0a 0d 0a 71  6003..73107....q
1efd0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
1efe0 53 45 4c 45 43 54 20 2b 20 2b 20 35 31 20 2a 20  SELECT + + 51 * 
1eff0 63 6f 72 30 2e 63 6f 6c 30 20 2a 20 2b 20 63 6f  cor0.col0 * + co
1f000 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l1 FROM tab2 AS 
1f010 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 30 36  cor0..----..1106
1f020 37 0d 0a 32 33 34 37 30 32 0d 0a 36 38 34 39 33  7..234702..68493
1f030 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67  ....skipif postg
1f040 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53  resql # PostgreS
1f050 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77  QL requires AS w
1f060 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74  hen renaming out
1f070 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65  put columns..que
1f080 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
1f090 4c 45 43 54 20 28 20 63 6f 6c 30 20 2b 20 28 20  LECT ( col0 + ( 
1f0a0 63 6f 6c 31 20 29 20 29 20 63 6f 6c 30 20 46 52  col1 ) ) col0 FR
1f0b0 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 32  OM tab1..----..2
1f0c0 39 0d 0a 37 34 0d 0a 39 33 0d 0a 0d 0a 6f 6e 6c  9..74..93....onl
1f0d0 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20  yif mysql # use 
1f0e0 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72  DIV operator for
1f0f0 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f   integer divisio
1f100 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  n..query I rowso
1f110 72 74 20 6c 61 62 65 6c 2d 38 36 32 0d 0a 53 45  rt label-862..SE
1f120 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20  LECT DISTINCT + 
1f130 63 6f 6c 31 20 2a 20 63 6f 6c 30 20 44 49 56 20  col1 * col0 DIV 
1f140 2d 20 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46  - col1 AS col0 F
1f150 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab1..----..
1f160 2d 33 0d 0a 2d 36 34 0d 0a 2d 38 30 0d 0a 0d 0a  -3..-64..-80....
1f170 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
1f180 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
1f190 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
1f1a0 61 62 65 6c 2d 38 36 32 0d 0a 53 45 4c 45 43 54  abel-862..SELECT
1f1b0 20 44 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c 31   DISTINCT + col1
1f1c0 20 2a 20 63 6f 6c 30 20 2f 20 2d 20 63 6f 6c 31   * col0 / - col1
1f1d0 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
1f1e0 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 0d 0a 2d 36  b1..----..-3..-6
1f1f0 34 0d 0a 2d 38 30 0d 0a 0d 0a 6f 6e 6c 79 69 66  4..-80....onlyif
1f200 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56   mysql # use DIV
1f210 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e   operator for in
1f220 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a  teger division..
1f230 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
1f240 6c 61 62 65 6c 2d 38 36 33 0d 0a 53 45 4c 45 43  label-863..SELEC
1f250 54 20 2d 20 2b 20 63 6f 6c 31 20 2a 20 63 6f 6c  T - + col1 * col
1f260 32 20 44 49 56 20 63 6f 6c 30 20 41 53 20 63 6f  2 DIV col0 AS co
1f270 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l2 FROM tab2 AS 
1f280 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 39  cor0..----..-119
1f290 0d 0a 2d 31 39 0d 0a 2d 38 0d 0a 0d 0a 73 6b 69  ..-19..-8....ski
1f2a0 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
1f2b0 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
1f2c0 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
1f2d0 6c 2d 38 36 33 0d 0a 53 45 4c 45 43 54 20 2d 20  l-863..SELECT - 
1f2e0 2b 20 63 6f 6c 31 20 2a 20 63 6f 6c 32 20 2f 20  + col1 * col2 / 
1f2f0 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46 52 4f  col0 AS col2 FRO
1f300 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
1f310 2d 2d 2d 2d 0d 0a 2d 31 31 39 0d 0a 2d 31 39 0d  ----..-119..-19.
1f320 0a 2d 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .-8....query I r
1f330 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
1f340 20 63 6f 72 31 2e 63 6f 6c 31 20 46 52 4f 4d 20   cor1.col1 FROM 
1f350 74 61 62 32 20 41 53 20 63 6f 72 30 20 43 52 4f  tab2 AS cor0 CRO
1f360 53 53 20 4a 4f 49 4e 20 74 61 62 30 2c 20 74 61  SS JOIN tab0, ta
1f370 62 30 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d  b0 AS cor1..----
1f380 0d 0a 32 37 20 76 61 6c 75 65 73 20 68 61 73 68  ..27 values hash
1f390 69 6e 67 20 74 6f 20 64 34 63 36 37 33 62 37 34  ing to d4c673b74
1f3a0 34 34 65 62 39 39 32 37 65 63 36 33 31 37 35 62  44eb9927ec63175b
1f3b0 34 33 63 36 62 38 34 0d 0a 0d 0a 71 75 65 72 79  43c6b84....query
1f3c0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
1f3d0 43 54 20 2b 20 31 34 20 2b 20 2d 20 63 6f 72 30  CT + 14 + - cor0
1f3e0 2e 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 2c  .col1 FROM tab1,
1f3f0 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab1 cor0..----
1f400 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68 69  ..9 values hashi
1f410 6e 67 20 74 6f 20 36 63 38 65 30 39 36 35 63 36  ng to 6c8e0965c6
1f420 37 35 64 36 39 62 36 30 35 64 64 38 66 35 65 65  75d69b605dd8f5ee
1f430 38 33 36 33 30 31 0d 0a 0d 0a 73 6b 69 70 69 66  836301....skipif
1f440 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f   postgresql # Po
1f450 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65  stgreSQL require
1f460 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69  s AS when renami
1f470 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e  ng output column
1f480 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  s..query I rowso
1f490 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c  rt..SELECT - col
1f4a0 30 20 2a 20 28 20 2d 20 63 6f 6c 31 20 29 20 63  0 * ( - col1 ) c
1f4b0 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol1 FROM tab1 AS
1f4c0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 34   cor0..----..104
1f4d0 30 0d 0a 36 34 30 0d 0a 37 38 0d 0a 0d 0a 73 6b  0..640..78....sk
1f4e0 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20  ipif postgresql 
1f4f0 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71  # PostgreSQL req
1f500 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65  uires AS when re
1f510 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f  naming output co
1f520 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72  lumns..query I r
1f530 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
1f540 20 63 6f 6c 32 20 2a 20 2b 20 28 20 2d 20 63 6f   col2 * + ( - co
1f550 6c 30 20 29 20 63 6f 6c 31 20 46 52 4f 4d 20 74  l0 ) col1 FROM t
1f560 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab1 cor0..----..
1f570 2d 31 36 32 0d 0a 2d 33 36 34 38 0d 0a 2d 37 36  -162..-3648..-76
1f580 38 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  80....query I ro
1f590 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f  wsort..SELECT co
1f5a0 6c 32 20 2a 20 63 6f 6c 31 20 2b 20 63 6f 6c 31  l2 * col1 + col1
1f5b0 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
1f5c0 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  b0 cor0..----..1
1f5d0 39 34 0d 0a 32 39 32 34 0d 0a 37 35 35 33 0d 0a  94..2924..7553..
1f5e0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1f5f0 74 0d 0a 53 45 4c 45 43 54 20 31 20 2a 20 63 6f  t..SELECT 1 * co
1f600 6c 31 20 2b 20 2d 20 63 6f 6c 32 20 41 53 20 63  l1 + - col2 AS c
1f610 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol0 FROM tab0 AS
1f620 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 35 33 0d   cor0..----..53.
1f630 0a 39 0d 0a 39 36 0d 0a 0d 0a 71 75 65 72 79 20  .9..96....query 
1f640 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
1f650 54 20 2b 20 28 20 2b 20 28 20 63 6f 72 30 2e 63  T + ( + ( cor0.c
1f660 6f 6c 32 20 29 20 29 20 2b 20 2d 20 28 20 63 6f  ol2 ) ) + - ( co
1f670 6c 32 20 29 20 2a 20 2b 20 63 6f 6c 30 20 41 53  l2 ) * + col0 AS
1f680 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20   col0 FROM tab0 
1f690 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
1f6a0 33 34 0d 0a 2d 37 32 31 36 0d 0a 2d 37 35 39 0d  34..-7216..-759.
1f6b0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
1f6c0 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 30 20  rt..SELECT col0 
1f6d0 2a 20 28 20 2b 20 63 6f 6c 30 20 29 20 2b 20 2d  * ( + col0 ) + -
1f6e0 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20   col2 FROM tab1 
1f6f0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 35 0d  cor0..----..-45.
1f700 0a 34 30 33 39 0d 0a 36 33 30 34 0d 0a 0d 0a 71  .4039..6304....q
1f710 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
1f720 53 45 4c 45 43 54 20 2d 20 28 20 63 6f 6c 32 20  SELECT - ( col2 
1f730 29 20 2a 20 2d 20 63 6f 72 30 2e 63 6f 6c 30 20  ) * - cor0.col0 
1f740 2b 20 2b 20 28 20 63 6f 6c 32 20 29 20 2b 20 2b  + + ( col2 ) + +
1f750 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20   col2 FROM tab2 
1f760 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32  AS cor0..----..2
1f770 30 38 30 0d 0a 32 34 33 0d 0a 33 30 37 38 0d 0a  080..243..3078..
1f780 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1f790 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
1f7a0 43 54 20 2b 20 2b 20 37 34 20 46 52 4f 4d 20 74  CT + + 74 FROM t
1f7b0 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab1 cor0..----..
1f7c0 37 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  74....query I ro
1f7d0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
1f7e0 53 54 49 4e 43 54 20 34 39 20 2a 20 2b 20 63 6f  STINCT 49 * + co
1f7f0 72 30 2e 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20  r0.col2 AS col0 
1f800 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
1f810 30 0d 0a 2d 2d 2d 2d 0d 0a 32 36 34 36 0d 0a 32  0..----..2646..2
1f820 37 39 33 0d 0a 34 37 30 34 0d 0a 0d 0a 71 75 65  793..4704....que
1f830 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
1f840 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 30 20 2a 20  LECT ALL col0 * 
1f850 28 20 2b 20 63 6f 6c 30 20 2b 20 2d 20 39 34 20  ( + col0 + - 94 
1f860 29 20 2a 20 2b 20 28 20 2d 20 63 6f 6c 32 20 29  ) * + ( - col2 )
1f870 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
1f880 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
1f890 0d 0a 32 30 36 35 0d 0a 33 36 34 39 30 0d 0a 35  ..2065..36490..5
1f8a0 35 34 34 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  5440....onlyif m
1f8b0 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66  ysql # support f
1f8c0 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69  or MySQL specifi
1f8d0 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61  c system types a
1f8e0 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79  nd syntax..query
1f8f0 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
1f900 2d 38 37 36 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  -876..SELECT ALL
1f910 20 2b 20 43 41 53 54 28 20 2d 20 63 6f 6c 30 20   + CAST( - col0 
1f920 41 53 20 53 49 47 4e 45 44 20 29 20 41 53 20 63  AS SIGNED ) AS c
1f930 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol0 FROM tab1 AS
1f940 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 0d   cor0..----..-3.
1f950 0a 2d 36 34 0d 0a 2d 38 30 0d 0a 0d 0a 73 6b 69  .-64..-80....ski
1f960 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
1f970 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
1f980 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
1f990 6c 2d 38 37 36 0d 0a 53 45 4c 45 43 54 20 41 4c  l-876..SELECT AL
1f9a0 4c 20 2b 20 43 41 53 54 20 28 20 2d 20 63 6f 6c  L + CAST ( - col
1f9b0 30 20 41 53 20 49 4e 54 45 47 45 52 20 29 20 41  0 AS INTEGER ) A
1f9c0 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31  S col0 FROM tab1
1f9d0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
1f9e0 2d 33 0d 0a 2d 36 34 0d 0a 2d 38 30 0d 0a 0d 0a  -3..-64..-80....
1f9f0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
1fa00 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
1fa10 20 2b 20 33 39 20 2b 20 63 6f 6c 30 20 41 53 20   + 39 + col0 AS 
1fa20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41  col1 FROM tab2 A
1fa30 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31  S cor0..----..11
1fa40 37 0d 0a 31 31 38 0d 0a 34 36 0d 0a 0d 0a 71 75  7..118..46....qu
1fa50 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
1fa60 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 34  ELECT DISTINCT 4
1fa70 37 20 2b 20 2d 20 37 39 20 2a 20 63 6f 6c 30 20  7 + - 79 * col0 
1fa80 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a  FROM tab0 cor0..
1fa90 2d 2d 2d 2d 0d 0a 2d 31 38 34 39 0d 0a 2d 32 37  ----..-1849..-27
1faa0 31 38 0d 0a 2d 36 39 38 34 0d 0a 0d 0a 6f 6e 6c  18..-6984....onl
1fab0 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70  yif mysql # supp
1fac0 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70  ort for MySQL sp
1fad0 65 63 69 66 69 63 20 73 79 73 74 65 6d 20 74 79  ecific system ty
1fae0 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a  pes and syntax..
1faf0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
1fb00 6c 61 62 65 6c 2d 38 37 39 0d 0a 53 45 4c 45 43  label-879..SELEC
1fb10 54 20 41 4c 4c 20 63 6f 6c 30 20 2b 20 2d 20 63  T ALL col0 + - c
1fb20 6f 6c 32 20 2d 20 63 6f 6c 31 20 2a 20 43 41 53  ol2 - col1 * CAS
1fb30 54 28 20 2d 20 63 6f 6c 30 20 41 53 20 53 49 47  T( - col0 AS SIG
1fb40 4e 45 44 20 29 20 41 53 20 63 6f 6c 31 20 46 52  NED ) AS col1 FR
1fb50 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
1fb60 0a 2d 2d 2d 2d 0d 0a 31 33 38 34 0d 0a 31 39 37  .----..1384..197
1fb70 0d 0a 34 36 35 34 0d 0a 0d 0a 73 6b 69 70 69 66  ..4654....skipif
1fb80 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
1fb90 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
1fba0 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 38   rowsort label-8
1fbb0 37 39 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63  79..SELECT ALL c
1fbc0 6f 6c 30 20 2b 20 2d 20 63 6f 6c 32 20 2d 20 63  ol0 + - col2 - c
1fbd0 6f 6c 31 20 2a 20 43 41 53 54 20 28 20 2d 20 63  ol1 * CAST ( - c
1fbe0 6f 6c 30 20 41 53 20 49 4e 54 45 47 45 52 20 29  ol0 AS INTEGER )
1fbf0 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
1fc00 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
1fc10 0d 0a 31 33 38 34 0d 0a 31 39 37 0d 0a 34 36 35  ..1384..197..465
1fc20 34 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  4....onlyif mysq
1fc30 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72  l # use DIV oper
1fc40 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72  ator for integer
1fc50 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79   division..query
1fc60 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
1fc70 2d 38 38 30 0d 0a 53 45 4c 45 43 54 20 44 49 53  -880..SELECT DIS
1fc80 54 49 4e 43 54 20 2b 20 35 20 44 49 56 20 2d 20  TINCT + 5 DIV - 
1fc90 63 6f 6c 31 20 2b 20 63 6f 72 30 2e 63 6f 6c 31  col1 + cor0.col1
1fca0 20 2a 20 2d 20 63 6f 6c 31 20 41 53 20 63 6f 6c   * - col1 AS col
1fcb0 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  2 FROM tab1 AS c
1fcc0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 30 0d  or0..----..-100.
1fcd0 0a 2d 31 36 39 0d 0a 2d 36 37 36 0d 0a 0d 0a 73  .-169..-676....s
1fce0 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
1fcf0 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
1fd00 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
1fd10 62 65 6c 2d 38 38 30 0d 0a 53 45 4c 45 43 54 20  bel-880..SELECT 
1fd20 44 49 53 54 49 4e 43 54 20 2b 20 35 20 2f 20 2d  DISTINCT + 5 / -
1fd30 20 63 6f 6c 31 20 2b 20 63 6f 72 30 2e 63 6f 6c   col1 + cor0.col
1fd40 31 20 2a 20 2d 20 63 6f 6c 31 20 41 53 20 63 6f  1 * - col1 AS co
1fd50 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l2 FROM tab1 AS 
1fd60 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 30  cor0..----..-100
1fd70 0d 0a 2d 31 36 39 0d 0a 2d 36 37 36 0d 0a 0d 0a  ..-169..-676....
1fd80 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
1fd90 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 2d 20  .SELECT ALL - - 
1fda0 30 20 2a 20 2b 20 36 35 20 2b 20 63 6f 6c 30 20  0 * + 65 + col0 
1fdb0 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
1fdc0 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
1fdd0 0a 32 34 0d 0a 33 35 0d 0a 38 39 0d 0a 0d 0a 71  .24..35..89....q
1fde0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
1fdf0 53 45 4c 45 43 54 20 41 4c 4c 20 31 38 20 2b 20  SELECT ALL 18 + 
1fe00 2d 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30  - col1 FROM tab0
1fe10 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
1fe20 2d 36 38 0d 0a 2d 37 33 0d 0a 2d 37 39 0d 0a 0d  -68..-73..-79...
1fe30 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
1fe40 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51  support for MySQ
1fe50 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65  L specific syste
1fe60 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74  m types and synt
1fe70 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ax..query I rows
1fe80 6f 72 74 20 6c 61 62 65 6c 2d 38 38 33 0d 0a 53  ort label-883..S
1fe90 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 63  ELECT DISTINCT c
1fea0 6f 6c 32 20 2b 20 43 41 53 54 28 20 63 6f 6c 31  ol2 + CAST( col1
1feb0 20 41 53 20 53 49 47 4e 45 44 20 29 20 63 6f 6c   AS SIGNED ) col
1fec0 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d  0 FROM tab0..---
1fed0 2d 0d 0a 31 31 39 0d 0a 31 37 33 0d 0a 39 38 0d  -..119..173..98.
1fee0 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72  ...skipif postgr
1fef0 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51  esql # PostgreSQ
1ff00 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68  L requires AS wh
1ff10 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70  en renaming outp
1ff20 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 73 6b 69 70  ut columns..skip
1ff30 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
1ff40 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
1ff50 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
1ff60 2d 38 38 33 0d 0a 53 45 4c 45 43 54 20 44 49 53  -883..SELECT DIS
1ff70 54 49 4e 43 54 20 63 6f 6c 32 20 2b 20 43 41 53  TINCT col2 + CAS
1ff80 54 20 28 20 63 6f 6c 31 20 41 53 20 49 4e 54 45  T ( col1 AS INTE
1ff90 47 45 52 20 29 20 63 6f 6c 30 20 46 52 4f 4d 20  GER ) col0 FROM 
1ffa0 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 39 0d  tab0..----..119.
1ffb0 0a 31 37 33 0d 0a 39 38 0d 0a 0d 0a 71 75 65 72  .173..98....quer
1ffc0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
1ffd0 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63  ECT DISTINCT - c
1ffe0 6f 6c 31 20 2a 20 2d 20 63 6f 6c 31 20 2b 20 2b  ol1 * - col1 + +
1fff0 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 0d   col0 FROM tab1.
20000 0a 2d 2d 2d 2d 0d 0a 31 36 34 0d 0a 32 34 39 0d  .----..164..249.
20010 0a 36 37 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .679....query I 
20020 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
20030 2d 20 28 20 2d 20 36 39 20 29 20 41 53 20 63 6f  - ( - 69 ) AS co
20040 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l2 FROM tab0 AS 
20050 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 36 39 0d 0a  cor0..----..69..
20060 36 39 0d 0a 36 39 0d 0a 0d 0a 71 75 65 72 79 20  69..69....query 
20070 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
20080 54 20 44 49 53 54 49 4e 43 54 20 2d 20 31 33 20  T DISTINCT - 13 
20090 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
200a0 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  2 cor0..----..-1
200b0 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  3....query I row
200c0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2d  sort..SELECT + -
200d0 20 63 6f 72 30 2e 63 6f 6c 32 20 46 52 4f 4d 20   cor0.col2 FROM 
200e0 74 61 62 31 2c 20 74 61 62 30 2c 20 74 61 62 31  tab1, tab0, tab1
200f0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
20100 32 37 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e  27 values hashin
20110 67 20 74 6f 20 34 34 66 64 63 64 37 63 64 36 30  g to 44fdcd7cd60
20120 33 33 35 32 64 34 64 31 32 37 38 31 31 64 31 36  3352d4d127811d16
20130 34 63 63 31 65 0d 0a 0d 0a 71 75 65 72 79 20 49  4cc1e....query I
20140 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
20150 20 38 36 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f   86 + col0 AS co
20160 6c 30 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d  l0 FROM tab2..--
20170 2d 2d 0d 0a 31 36 34 0d 0a 31 36 35 0d 0a 39 33  --..164..165..93
20180 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
20190 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2d 20  ort..SELECT + - 
201a0 38 39 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74  89 + col1 FROM t
201b0 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
201c0 2d 0d 0a 2d 33 30 0d 0a 2d 35 38 0d 0a 2d 37 32  -..-30..-58..-72
201d0 0d 0a 0d 0a 71 75 65 72 79 20 49 49 49 49 49 49  ....query IIIIII
201e0 49 49 49 49 49 49 49 49 49 20 72 6f 77 73 6f 72  IIIIIIIII rowsor
201f0 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
20200 43 54 20 2a 20 46 52 4f 4d 20 74 61 62 32 2c 20  CT * FROM tab2, 
20210 74 61 62 32 20 41 53 20 63 6f 72 30 20 43 52 4f  tab2 AS cor0 CRO
20220 53 53 20 4a 4f 49 4e 20 74 61 62 30 2c 20 74 61  SS JOIN tab0, ta
20230 62 30 20 41 53 20 63 6f 72 31 2c 20 74 61 62 31  b0 AS cor1, tab1
20240 20 41 53 20 63 6f 72 32 0d 0a 2d 2d 2d 2d 0d 0a   AS cor2..----..
20250 33 36 34 35 20 76 61 6c 75 65 73 20 68 61 73 68  3645 values hash
20260 69 6e 67 20 74 6f 20 65 61 31 61 39 32 32 62 37  ing to ea1a922b7
20270 66 63 63 62 39 64 31 38 34 62 33 31 65 62 34 36  fccb9d184b31eb46
20280 38 39 65 30 36 33 62 0d 0a 0d 0a 71 75 65 72 79  89e063b....query
20290 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
202a0 43 54 20 32 31 20 2b 20 2b 20 63 6f 6c 32 20 41  CT 21 + + col2 A
202b0 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31  S col2 FROM tab1
202c0 0d 0a 2d 2d 2d 2d 0d 0a 31 31 37 0d 0a 37 35 0d  ..----..117..75.
202d0 0a 37 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .78....query I r
202e0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
202f0 49 53 54 49 4e 43 54 20 2d 20 32 32 20 2b 20 2b  ISTINCT - 22 + +
20300 20 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46 52   col2 AS col0 FR
20310 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
20320 0a 2d 2d 2d 2d 0d 0a 2d 32 31 0d 0a 31 31 0d 0a  .----..-21..11..
20330 36 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  60....query I ro
20340 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
20350 53 54 49 4e 43 54 20 2b 20 2d 20 63 6f 72 30 2e  STINCT + - cor0.
20360 63 6f 6c 32 20 2d 20 2b 20 33 34 20 41 53 20 63  col2 - + 34 AS c
20370 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol1 FROM tab0 AS
20380 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31   cor0..----..-11
20390 36 0d 0a 2d 33 35 0d 0a 2d 36 37 0d 0a 0d 0a 71  6..-35..-67....q
203a0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
203b0 53 45 4c 45 43 54 20 2b 20 2d 20 37 34 20 2a 20  SELECT + - 74 * 
203c0 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32  + col1 FROM tab2
203d0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
203e0 2d 31 32 35 38 0d 0a 2d 32 32 39 34 0d 0a 2d 34  -1258..-2294..-4
203f0 33 36 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  366....query I r
20400 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63  owsort..SELECT c
20410 6f 6c 31 20 2a 20 2d 20 28 20 63 6f 6c 30 20 29  ol1 * - ( col0 )
20420 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
20430 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
20440 0d 0a 2d 32 30 36 34 0d 0a 2d 33 33 39 35 0d 0a  ..-2064..-3395..
20450 2d 38 30 39 39 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  -8099....onlyif 
20460 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20  mysql # use DIV 
20470 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74  operator for int
20480 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71  eger division..q
20490 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
204a0 61 62 65 6c 2d 38 39 36 0d 0a 53 45 4c 45 43 54  abel-896..SELECT
204b0 20 63 6f 72 30 2e 63 6f 6c 30 20 2b 20 63 6f 6c   cor0.col0 + col
204c0 32 20 44 49 56 20 2d 20 63 6f 6c 30 20 46 52 4f  2 DIV - col0 FRO
204d0 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
204e0 2d 2d 2d 2d 0d 0a 2d 31 35 0d 0a 36 34 0d 0a 37  ----..-15..64..7
204f0 39 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  9....skipif mysq
20500 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
20510 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
20520 6f 72 74 20 6c 61 62 65 6c 2d 38 39 36 0d 0a 53  ort label-896..S
20530 45 4c 45 43 54 20 63 6f 72 30 2e 63 6f 6c 30 20  ELECT cor0.col0 
20540 2b 20 63 6f 6c 32 20 2f 20 2d 20 63 6f 6c 30 20  + col2 / - col0 
20550 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
20560 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 35 0d 0a 36 34  0..----..-15..64
20570 0d 0a 37 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..79....query I 
20580 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
20590 41 4c 4c 20 2b 20 2b 20 63 6f 72 31 2e 63 6f 6c  ALL + + cor1.col
205a0 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  2 FROM tab0 AS c
205b0 6f 72 30 20 43 52 4f 53 53 20 4a 4f 49 4e 20 74  or0 CROSS JOIN t
205c0 61 62 32 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a  ab2 cor1..----..
205d0 39 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67  9 values hashing
205e0 20 74 6f 20 35 39 31 31 62 61 63 35 31 34 34 31   to 5911bac51441
205f0 66 34 66 66 36 34 30 62 32 61 32 62 37 32 31 65  f4ff640b2a2b721e
20600 61 38 65 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20  a8e3....query I 
20610 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
20620 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c 31 20  DISTINCT - col1 
20630 2b 20 63 6f 6c 32 20 2a 20 2d 20 35 36 20 41 53  + col2 * - 56 AS
20640 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d   col0 FROM tab0.
20650 0a 2d 2d 2d 2d 0d 0a 2d 31 35 33 0d 0a 2d 31 39  .----..-153..-19
20660 33 34 0d 0a 2d 34 36 38 33 0d 0a 0d 0a 73 6b 69  34..-4683....ski
20670 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23  pif postgresql #
20680 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75   PostgreSQL requ
20690 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e  ires AS when ren
206a0 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c  aming output col
206b0 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f  umns..query I ro
206c0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
206d0 4c 20 2d 20 74 61 62 32 2e 63 6f 6c 30 20 2a 20  L - tab2.col0 * 
206e0 63 6f 6c 30 20 63 6f 6c 32 20 46 52 4f 4d 20 74  col0 col2 FROM t
206f0 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 39 0d 0a  ab2..----..-49..
20700 2d 36 30 38 34 0d 0a 2d 36 32 34 31 0d 0a 0d 0a  -6084..-6241....
20710 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71  skipif postgresq
20720 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72  l # PostgreSQL r
20730 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20  equires AS when 
20740 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20  renaming output 
20750 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49  columns..query I
20760 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
20770 20 44 49 53 54 49 4e 43 54 20 2d 20 74 61 62 31   DISTINCT - tab1
20780 2e 63 6f 6c 31 20 2b 20 2b 20 63 6f 6c 31 20 63  .col1 + + col1 c
20790 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d  ol2 FROM tab1..-
207a0 2d 2d 2d 0d 0a 30 0d 0a 0d 0a 71 75 65 72 79 20  ---..0....query 
207b0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
207c0 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c  T DISTINCT + col
207d0 32 20 2a 20 63 6f 6c 32 20 2b 20 63 6f 6c 31 20  2 * col2 + col1 
207e0 2a 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61  * + col1 FROM ta
207f0 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 36 39 30 0d 0a  b2..----..1690..
20800 31 37 33 33 0d 0a 34 31 35 37 0d 0a 0d 0a 6f 6e  1733..4157....on
20810 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
20820 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
20830 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
20840 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
20850 6f 72 74 20 6c 61 62 65 6c 2d 39 30 32 0d 0a 53  ort label-902..S
20860 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d  ELECT DISTINCT -
20870 20 63 6f 6c 31 20 44 49 56 20 2d 20 63 6f 6c 32   col1 DIV - col2
20880 20 2b 20 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c 31   + col2 * + col1
20890 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d   FROM tab0..----
208a0 0d 0a 31 39 34 0d 0a 32 38 34 30 0d 0a 37 34 36  ..194..2840..746
208b0 33 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  3....skipif mysq
208c0 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
208d0 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
208e0 6f 72 74 20 6c 61 62 65 6c 2d 39 30 32 0d 0a 53  ort label-902..S
208f0 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d  ELECT DISTINCT -
20900 20 63 6f 6c 31 20 2f 20 2d 20 63 6f 6c 32 20 2b   col1 / - col2 +
20910 20 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c 31 20 46   col2 * + col1 F
20920 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab0..----..
20930 31 39 34 0d 0a 32 38 34 30 0d 0a 37 34 36 33 0d  194..2840..7463.
20940 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
20950 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c  rt..SELECT - col
20960 32 20 2a 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20  2 * + cor0.col1 
20970 2b 20 2d 20 36 35 20 46 52 4f 4d 20 74 61 62 31  + - 65 FROM tab1
20980 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33   cor0..----..-13
20990 31 33 0d 0a 2d 31 34 36 39 0d 0a 2d 36 33 35 0d  13..-1469..-635.
209a0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
209b0 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
209c0 4e 43 54 20 63 6f 72 30 2e 63 6f 6c 31 20 2a 20  NCT cor0.col1 * 
209d0 28 20 63 6f 6c 32 20 29 20 41 53 20 63 6f 6c 31  ( col2 ) AS col1
209e0 20 46 52 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d   FROM tab2 cor0.
209f0 0a 2d 2d 2d 2d 0d 0a 31 35 33 34 0d 0a 36 34 36  .----..1534..646
20a00 0d 0a 38 33 37 0d 0a 0d 0a 71 75 65 72 79 20 49  ..837....query I
20a10 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
20a20 20 41 4c 4c 20 2d 20 63 6f 6c 30 20 2b 20 63 6f   ALL - col0 + co
20a30 6c 32 20 2a 20 2b 20 63 6f 6c 30 20 46 52 4f 4d  l2 * + col0 FROM
20a40 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
20a50 2d 2d 2d 0d 0a 31 38 32 0d 0a 31 39 35 30 0d 0a  ---..182..1950..
20a60 32 39 32 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20  2923....query I 
20a70 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
20a80 44 49 53 54 49 4e 43 54 20 2d 20 2d 20 63 6f 6c  DISTINCT - - col
20a90 30 20 2d 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20  0 - + cor0.col1 
20aa0 2a 20 28 20 63 6f 6c 31 20 29 20 41 53 20 63 6f  * ( col1 ) AS co
20ab0 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l1 FROM tab0 AS 
20ac0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 37 33 37  cor0..----..-737
20ad0 32 0d 0a 2d 38 31 39 32 0d 0a 2d 39 33 37 34 0d  2..-8192..-9374.
20ae0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
20af0 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b  rt..SELECT ALL +
20b00 20 63 6f 6c 32 20 2a 20 2b 20 35 32 20 2a 20 34   col2 * + 52 * 4
20b10 20 2d 20 63 6f 72 30 2e 63 6f 6c 31 20 2a 20 63   - cor0.col1 * c
20b20 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol2 FROM tab2 AS
20b30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 38 37   cor0..----..387
20b40 34 0d 0a 34 37 37 39 0d 0a 37 32 35 38 0d 0a 0d  4..4779..7258...
20b50 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
20b60 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51  support for MySQ
20b70 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65  L specific syste
20b80 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74  m types and synt
20b90 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ax..query I rows
20ba0 6f 72 74 20 6c 61 62 65 6c 2d 39 30 38 0d 0a 53  ort label-908..S
20bb0 45 4c 45 43 54 20 63 6f 6c 32 20 2a 20 2b 20 43  ELECT col2 * + C
20bc0 41 53 54 28 20 2d 20 63 6f 6c 31 20 2a 20 63 6f  AST( - col1 * co
20bd0 6c 32 20 41 53 20 53 49 47 4e 45 44 20 29 20 2b  l2 AS SIGNED ) +
20be0 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62   + col0 FROM tab
20bf0 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
20c00 0a 2d 32 32 35 39 32 0d 0a 2d 32 34 34 36 39 0d  .-22592..-24469.
20c10 0a 2d 33 39 38 30 36 0d 0a 0d 0a 73 6b 69 70 69  .-39806....skipi
20c20 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
20c30 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
20c40 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
20c50 39 30 38 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 32  908..SELECT col2
20c60 20 2a 20 2b 20 43 41 53 54 20 28 20 2d 20 63 6f   * + CAST ( - co
20c70 6c 31 20 2a 20 63 6f 6c 32 20 41 53 20 49 4e 54  l1 * col2 AS INT
20c80 45 47 45 52 20 29 20 2b 20 2b 20 63 6f 6c 30 20  EGER ) + + col0 
20c90 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
20ca0 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 32 35 39 32 0d  0..----..-22592.
20cb0 0a 2d 32 34 34 36 39 0d 0a 2d 33 39 38 30 36 0d  .-24469..-39806.
20cc0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
20cd0 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 32 20  rt..SELECT col2 
20ce0 2a 20 63 6f 6c 30 20 2a 20 2d 20 74 61 62 30 2e  * col0 * - tab0.
20cf0 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a  col1 FROM tab0..
20d00 2d 2d 2d 2d 0d 0a 2d 33 33 39 35 0d 0a 2d 36 36  ----..-3395..-66
20d10 34 31 31 38 0d 0a 2d 36 38 31 31 32 0d 0a 0d 0a  4118..-68112....
20d20 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73  onlyif mysql # s
20d30 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c  upport for MySQL
20d40 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d   specific system
20d50 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61   types and synta
20d60 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  x..query I rowso
20d70 72 74 20 6c 61 62 65 6c 2d 39 31 30 0d 0a 53 45  rt label-910..SE
20d80 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20  LECT DISTINCT - 
20d90 43 41 53 54 28 20 36 37 20 41 53 20 53 49 47 4e  CAST( 67 AS SIGN
20da0 45 44 20 29 20 2a 20 2b 20 74 61 62 31 2e 63 6f  ED ) * + tab1.co
20db0 6c 30 20 46 52 4f 4d 20 74 61 62 31 2c 20 74 61  l0 FROM tab1, ta
20dc0 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  b0 cor0..----..-
20dd0 32 30 31 0d 0a 2d 34 32 38 38 0d 0a 2d 35 33 36  201..-4288..-536
20de0 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  0....skipif mysq
20df0 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
20e00 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
20e10 6f 72 74 20 6c 61 62 65 6c 2d 39 31 30 0d 0a 53  ort label-910..S
20e20 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d  ELECT DISTINCT -
20e30 20 43 41 53 54 20 28 20 36 37 20 41 53 20 49 4e   CAST ( 67 AS IN
20e40 54 45 47 45 52 20 29 20 2a 20 2b 20 74 61 62 31  TEGER ) * + tab1
20e50 2e 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 2c  .col0 FROM tab1,
20e60 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab0 cor0..----
20e70 0d 0a 2d 32 30 31 0d 0a 2d 34 32 38 38 0d 0a 2d  ..-201..-4288..-
20e80 35 33 36 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20  5360....query I 
20e90 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
20ea0 44 49 53 54 49 4e 43 54 20 38 32 20 2a 20 63 6f  DISTINCT 82 * co
20eb0 72 30 2e 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20  r0.col0 AS col2 
20ec0 46 52 4f 4d 20 74 61 62 31 2c 20 74 61 62 31 20  FROM tab1, tab1 
20ed0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32  AS cor0..----..2
20ee0 34 36 0d 0a 35 32 34 38 0d 0a 36 35 36 30 0d 0a  46..5248..6560..
20ef0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
20f00 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20  t..SELECT ALL - 
20f10 63 6f 6c 32 20 2b 20 63 6f 6c 30 20 2a 20 34 37  col2 + col0 * 47
20f20 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d   FROM tab0..----
20f30 0d 0a 31 30 39 35 0d 0a 31 36 34 34 0d 0a 34 31  ..1095..1644..41
20f40 30 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  01....query I ro
20f50 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
20f60 4c 20 2d 20 63 6f 6c 31 20 2a 20 63 6f 6c 32 20  L - col1 * col2 
20f70 2b 20 74 61 62 32 2e 63 6f 6c 31 20 46 52 4f 4d  + tab2.col1 FROM
20f80 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 34   tab2..----..-14
20f90 37 35 0d 0a 2d 36 32 39 0d 0a 2d 38 30 36 0d 0a  75..-629..-806..
20fa0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
20fb0 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20  t..SELECT ALL + 
20fc0 2b 20 63 6f 6c 32 20 2a 20 2b 20 28 20 63 6f 72  + col2 * + ( cor
20fd0 30 2e 63 6f 6c 30 20 29 20 2b 20 63 6f 6c 30 20  0.col0 ) + col0 
20fe0 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
20ff0 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
21000 0a 31 36 35 0d 0a 33 37 31 32 0d 0a 37 37 36 30  .165..3712..7760
21010 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
21020 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f  ort..SELECT + co
21030 6c 30 20 2a 20 33 33 20 2a 20 2b 20 63 6f 6c 31  l0 * 33 * + col1
21040 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
21050 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
21060 0d 0a 31 35 31 38 36 36 0d 0a 34 34 33 31 39 0d  ..151866..44319.
21070 0a 37 31 36 31 0d 0a 0d 0a 71 75 65 72 79 20 49  .7161....query I
21080 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
21090 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 30 20 2a   DISTINCT col0 *
210a0 20 38 37 20 2b 20 36 37 20 2a 20 63 6f 6c 31 20   87 + 67 * col1 
210b0 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
210c0 30 0d 0a 2d 2d 2d 2d 0d 0a 32 30 30 33 0d 0a 36  0..----..2003..6
210d0 32 33 38 0d 0a 37 38 33 31 0d 0a 0d 0a 71 75 65  238..7831....que
210e0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
210f0 4c 45 43 54 20 2b 20 63 6f 6c 30 20 2d 20 2b 20  LECT + col0 - + 
21100 28 20 63 6f 72 30 2e 63 6f 6c 32 20 29 20 41 53  ( cor0.col2 ) AS
21110 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20   col1 FROM tab1 
21120 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 36 0d  cor0..----..-16.
21130 0a 2d 35 31 0d 0a 37 0d 0a 0d 0a 6f 6e 6c 79 69  .-51..7....onlyi
21140 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49  f mysql # use DI
21150 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69  V operator for i
21160 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d  nteger division.
21170 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
21180 20 6c 61 62 65 6c 2d 39 31 38 0d 0a 53 45 4c 45   label-918..SELE
21190 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 2d 20  CT DISTINCT + - 
211a0 63 6f 6c 31 20 2b 20 63 6f 72 30 2e 63 6f 6c 30  col1 + cor0.col0
211b0 20 44 49 56 20 2d 20 31 37 20 46 52 4f 4d 20 74   DIV - 17 FROM t
211c0 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
211d0 2d 0d 0a 2d 38 37 0d 0a 2d 39 36 0d 0a 2d 39 39  -..-87..-96..-99
211e0 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
211f0 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
21200 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
21210 72 74 20 6c 61 62 65 6c 2d 39 31 38 0d 0a 53 45  rt label-918..SE
21220 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20  LECT DISTINCT + 
21230 2d 20 63 6f 6c 31 20 2b 20 63 6f 72 30 2e 63 6f  - col1 + cor0.co
21240 6c 30 20 2f 20 2d 20 31 37 20 46 52 4f 4d 20 74  l0 / - 17 FROM t
21250 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
21260 2d 0d 0a 2d 38 37 0d 0a 2d 39 36 0d 0a 2d 39 39  -..-87..-96..-99
21270 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
21280 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d   # support for M
21290 79 53 51 4c 20 73 70 65 63 69 66 69 63 20 73 79  ySQL specific sy
212a0 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73  stem types and s
212b0 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72  yntax..query I r
212c0 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 39 31 39  owsort label-919
212d0 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
212e0 54 20 2d 20 63 6f 6c 30 20 2a 20 43 41 53 54 28  T - col0 * CAST(
212f0 20 32 34 20 41 53 20 53 49 47 4e 45 44 20 29 20   24 AS SIGNED ) 
21300 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 63 6f 6c 31  + cor0.col1 col1
21310 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
21320 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 35 32 36 0d  r0..----..-1526.
21330 0a 2d 31 39 30 37 0d 0a 2d 34 36 0d 0a 0d 0a 73  .-1907..-46....s
21340 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c  kipif postgresql
21350 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65   # PostgreSQL re
21360 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72  quires AS when r
21370 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63  enaming output c
21380 6f 6c 75 6d 6e 73 0d 0a 73 6b 69 70 69 66 20 6d  olumns..skipif m
21390 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
213a0 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
213b0 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 39 31 39  owsort label-919
213c0 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
213d0 54 20 2d 20 63 6f 6c 30 20 2a 20 43 41 53 54 20  T - col0 * CAST 
213e0 28 20 32 34 20 41 53 20 49 4e 54 45 47 45 52 20  ( 24 AS INTEGER 
213f0 29 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 63 6f  ) + cor0.col1 co
21400 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l1 FROM tab1 AS 
21410 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 35 32  cor0..----..-152
21420 36 0d 0a 2d 31 39 30 37 0d 0a 2d 34 36 0d 0a 0d  6..-1907..-46...
21430 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
21440 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 30 20 2b 20  ..SELECT col0 + 
21450 34 33 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  43 FROM tab2 AS 
21460 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 31 0d  cor0..----..121.
21470 0a 31 32 32 0d 0a 35 30 0d 0a 0d 0a 6f 6e 6c 79  .122..50....only
21480 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44  if mysql # use D
21490 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20  IV operator for 
214a0 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e  integer division
214b0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
214c0 74 20 6c 61 62 65 6c 2d 39 32 31 0d 0a 53 45 4c  t label-921..SEL
214d0 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 30 20 2b  ECT ALL + col0 +
214e0 20 63 6f 72 30 2e 63 6f 6c 31 20 2a 20 63 6f 72   cor0.col1 * cor
214f0 30 2e 63 6f 6c 32 20 44 49 56 20 63 6f 6c 30 20  0.col2 DIV col0 
21500 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
21510 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
21520 0a 34 37 31 0d 0a 37 32 0d 0a 39 35 0d 0a 0d 0a  .471..72..95....
21530 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
21540 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
21550 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
21560 61 62 65 6c 2d 39 32 31 0d 0a 53 45 4c 45 43 54  abel-921..SELECT
21570 20 41 4c 4c 20 2b 20 63 6f 6c 30 20 2b 20 63 6f   ALL + col0 + co
21580 72 30 2e 63 6f 6c 31 20 2a 20 63 6f 72 30 2e 63  r0.col1 * cor0.c
21590 6f 6c 32 20 2f 20 63 6f 6c 30 20 41 53 20 63 6f  ol2 / col0 AS co
215a0 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l1 FROM tab1 AS 
215b0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 34 37 31 0d  cor0..----..471.
215c0 0a 37 32 0d 0a 39 35 0d 0a 0d 0a 71 75 65 72 79  .72..95....query
215d0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
215e0 43 54 20 74 61 62 31 2e 63 6f 6c 30 20 2a 20 31  CT tab1.col0 * 1
215f0 20 2a 20 74 61 62 31 2e 63 6f 6c 30 20 46 52 4f   * tab1.col0 FRO
21600 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 34 30  M tab1..----..40
21610 39 36 0d 0a 36 34 30 30 0d 0a 39 0d 0a 0d 0a 71  96..6400..9....q
21620 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
21630 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 72 30 2e  SELECT ALL cor0.
21640 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 2c 20  col0 FROM tab0, 
21650 74 61 62 32 20 41 53 20 63 6f 72 30 2c 20 74 61  tab2 AS cor0, ta
21660 62 32 20 63 6f 72 31 2c 20 74 61 62 32 20 41 53  b2 cor1, tab2 AS
21670 20 63 6f 72 32 0d 0a 2d 2d 2d 2d 0d 0a 38 31 20   cor2..----..81 
21680 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74  values hashing t
21690 6f 20 30 35 38 33 35 66 32 39 64 64 39 63 64 34  o 05835f29dd9cd4
216a0 66 61 31 36 38 38 39 64 65 35 34 64 65 63 33 63  fa16889de54dec3c
216b0 62 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  b6....query I ro
216c0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
216d0 34 30 20 2b 20 2b 20 63 6f 72 30 2e 63 6f 6c 30  40 + + cor0.col0
216e0 20 2a 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74   * + col1 FROM t
216f0 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab2 cor0..----..
21700 31 33 30 33 0d 0a 31 37 37 0d 0a 34 35 36 32 0d  1303..177..4562.
21710 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
21720 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
21730 4e 43 54 20 2d 20 31 30 20 2b 20 2b 20 63 6f 6c  NCT - 10 + + col
21740 30 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30  0 FROM tab0 cor0
21750 0d 0a 2d 2d 2d 2d 0d 0a 31 34 0d 0a 32 35 0d 0a  ..----..14..25..
21760 37 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  79....query I ro
21770 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
21780 53 54 49 4e 43 54 20 28 20 2d 20 63 6f 6c 32 20  STINCT ( - col2 
21790 2b 20 2d 20 74 61 62 31 2e 63 6f 6c 31 20 29 20  + - tab1.col1 ) 
217a0 2a 20 63 6f 6c 30 20 2a 20 74 61 62 31 2e 63 6f  * col0 * tab1.co
217b0 6c 32 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d  l2 FROM tab1..--
217c0 2d 2d 0d 0a 2d 31 32 39 36 30 0d 0a 2d 32 34 34  --..-12960..-244
217d0 34 31 36 0d 0a 2d 38 33 37 31 32 30 0d 0a 0d 0a  416..-837120....
217e0 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75  onlyif mysql # u
217f0 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20  se DIV operator 
21800 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69  for integer divi
21810 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f  sion..query I ro
21820 77 73 6f 72 74 20 6c 61 62 65 6c 2d 39 32 37 0d  wsort label-927.
21830 0a 53 45 4c 45 43 54 20 63 6f 6c 30 20 2b 20 2b  .SELECT col0 + +
21840 20 63 6f 6c 30 20 44 49 56 20 2b 20 63 6f 6c 32   col0 DIV + col2
21850 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
21860 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
21870 0d 0a 33 0d 0a 36 35 0d 0a 38 30 0d 0a 0d 0a 73  ..3..65..80....s
21880 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
21890 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
218a0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
218b0 62 65 6c 2d 39 32 37 0d 0a 53 45 4c 45 43 54 20  bel-927..SELECT 
218c0 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c 30 20 2f 20  col0 + + col0 / 
218d0 2b 20 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46  + col2 AS col1 F
218e0 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
218f0 0d 0a 2d 2d 2d 2d 0d 0a 33 0d 0a 36 35 0d 0a 38  ..----..3..65..8
21900 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  0....onlyif mysq
21910 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20  l # support for 
21920 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63 20 73  MySQL specific s
21930 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20  ystem types and 
21940 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20  syntax..query I 
21950 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 39 32  rowsort label-92
21960 38 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 30  8..SELECT + col0
21970 20 2b 20 63 6f 6c 31 20 2b 20 2b 20 43 41 53 54   + col1 + + CAST
21980 28 20 2d 20 63 6f 6c 31 20 41 53 20 53 49 47 4e  ( - col1 AS SIGN
21990 45 44 20 29 20 2a 20 63 6f 6c 30 20 41 53 20 63  ED ) * col0 AS c
219a0 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d  ol0 FROM tab1..-
219b0 2d 2d 2d 0d 0a 2d 34 39 0d 0a 2d 35 36 36 0d 0a  ---..-49..-566..
219c0 2d 39 34 37 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  -947....skipif m
219d0 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
219e0 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
219f0 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 39 32 38  owsort label-928
21a00 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 30 20  ..SELECT + col0 
21a10 2b 20 63 6f 6c 31 20 2b 20 2b 20 43 41 53 54 20  + col1 + + CAST 
21a20 28 20 2d 20 63 6f 6c 31 20 41 53 20 49 4e 54 45  ( - col1 AS INTE
21a30 47 45 52 20 29 20 2a 20 63 6f 6c 30 20 41 53 20  GER ) * col0 AS 
21a40 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 0d 0a  col0 FROM tab1..
21a50 2d 2d 2d 2d 0d 0a 2d 34 39 0d 0a 2d 35 36 36 0d  ----..-49..-566.
21a60 0a 2d 39 34 37 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  .-947....onlyif 
21a70 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20  mysql # use DIV 
21a80 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74  operator for int
21a90 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71  eger division..q
21aa0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
21ab0 61 62 65 6c 2d 39 32 39 0d 0a 53 45 4c 45 43 54  abel-929..SELECT
21ac0 20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c 31   DISTINCT - col1
21ad0 20 2b 20 74 61 62 30 2e 63 6f 6c 32 20 44 49 56   + tab0.col2 DIV
21ae0 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20   + col0 AS col1 
21af0 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d  FROM tab0..----.
21b00 0a 2d 38 35 0d 0a 2d 39 31 0d 0a 2d 39 37 0d 0a  .-85..-91..-97..
21b10 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
21b20 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
21b30 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
21b40 20 6c 61 62 65 6c 2d 39 32 39 0d 0a 53 45 4c 45   label-929..SELE
21b50 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f  CT DISTINCT - co
21b60 6c 31 20 2b 20 74 61 62 30 2e 63 6f 6c 32 20 2f  l1 + tab0.col2 /
21b70 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20   + col0 AS col1 
21b80 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d  FROM tab0..----.
21b90 0a 2d 38 35 0d 0a 2d 39 31 0d 0a 2d 39 37 0d 0a  .-85..-91..-97..
21ba0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
21bb0 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
21bc0 43 54 20 63 6f 6c 32 20 2a 20 63 6f 6c 32 20 2b  CT col2 * col2 +
21bd0 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20   + col0 AS col0 
21be0 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d  FROM tab2..----.
21bf0 0a 31 35 32 33 0d 0a 37 33 36 0d 0a 37 35 34 0d  .1523..736..754.
21c00 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
21c10 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 33  rt..SELECT ALL 3
21c20 33 20 46 52 4f 4d 20 74 61 62 31 2c 20 74 61 62  3 FROM tab1, tab
21c30 30 20 41 53 20 63 6f 72 30 2c 20 74 61 62 30 20  0 AS cor0, tab0 
21c40 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 32  AS cor1..----..2
21c50 37 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67  7 values hashing
21c60 20 74 6f 20 37 36 64 61 38 62 63 37 63 61 65 31   to 76da8bc7cae1
21c70 38 65 63 66 38 35 36 34 33 38 66 38 37 32 34 33  8ecf856438f87243
21c80 30 63 38 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20  0c80....query I 
21c90 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
21ca0 44 49 53 54 49 4e 43 54 20 2b 20 33 39 20 2b 20  DISTINCT + 39 + 
21cb0 2d 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30  - col0 FROM tab0
21cc0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
21cd0 2d 35 30 0d 0a 31 35 0d 0a 34 0d 0a 0d 0a 71 75  -50..15..4....qu
21ce0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
21cf0 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d  ELECT DISTINCT -
21d00 20 2d 20 34 35 20 2b 20 2b 20 63 6f 72 30 2e 63   - 45 + + cor0.c
21d10 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  ol1 AS col2 FROM
21d20 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
21d30 2d 2d 2d 0d 0a 31 33 31 0d 0a 31 33 36 0d 0a 31  ---..131..136..1
21d40 34 32 0d 0a 0d 0a 71 75 65 72 79 20 49 49 49 49  42....query IIII
21d50 49 49 49 49 49 49 49 49 49 49 49 20 72 6f 77 73  IIIIIIIIIII rows
21d60 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
21d70 49 4e 43 54 20 2a 20 46 52 4f 4d 20 74 61 62 30  INCT * FROM tab0
21d80 2c 20 74 61 62 31 20 63 6f 72 30 2c 20 74 61 62  , tab1 cor0, tab
21d90 30 20 63 6f 72 31 2c 20 74 61 62 32 2c 20 74 61  0 cor1, tab2, ta
21da0 62 31 20 41 53 20 63 6f 72 32 0d 0a 2d 2d 2d 2d  b1 AS cor2..----
21db0 0d 0a 33 36 34 35 20 76 61 6c 75 65 73 20 68 61  ..3645 values ha
21dc0 73 68 69 6e 67 20 74 6f 20 34 63 35 31 37 32 62  shing to 4c5172b
21dd0 61 61 61 62 36 38 32 66 39 39 37 62 64 30 39 64  aaab682f997bd09d
21de0 32 62 35 63 66 30 64 32 32 0d 0a 0d 0a 71 75 65  2b5cf0d22....que
21df0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
21e00 4c 45 43 54 20 2b 20 63 6f 6c 32 20 2d 20 2d 20  LECT + col2 - - 
21e10 28 20 28 20 63 6f 72 30 2e 63 6f 6c 32 20 29 20  ( ( cor0.col2 ) 
21e20 29 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  ) FROM tab1 AS c
21e30 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 38 0d 0a  or0..----..108..
21e40 31 31 34 0d 0a 31 39 32 0d 0a 0d 0a 71 75 65 72  114..192....quer
21e50 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
21e60 45 43 54 20 63 6f 6c 31 20 2a 20 63 6f 72 30 2e  ECT col1 * cor0.
21e70 63 6f 6c 32 20 2b 20 2b 20 32 33 20 46 52 4f 4d  col2 + + 23 FROM
21e80 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
21e90 2d 2d 2d 0d 0a 31 32 37 31 0d 0a 31 34 32 37 0d  ---..1271..1427.
21ea0 0a 35 39 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .593....query I 
21eb0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
21ec0 41 4c 4c 20 2b 20 63 6f 6c 30 20 2a 20 63 6f 6c  ALL + col0 * col
21ed0 31 20 2b 20 2b 20 31 34 20 46 52 4f 4d 20 74 61  1 + + 14 FROM ta
21ee0 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
21ef0 0d 0a 32 30 37 38 0d 0a 33 34 30 39 0d 0a 38 31  ..2078..3409..81
21f00 31 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  13....query I ro
21f10 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
21f20 4c 20 2d 20 2b 20 63 6f 6c 31 20 2b 20 2b 20 28  L - + col1 + + (
21f30 20 63 6f 6c 32 20 2b 20 2b 20 63 6f 72 30 2e 63   col2 + + cor0.c
21f40 6f 6c 32 20 29 20 41 53 20 63 6f 6c 30 20 46 52  ol2 ) AS col0 FR
21f50 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
21f60 0a 2d 2d 2d 2d 0d 0a 31 30 34 0d 0a 31 37 39 0d  .----..104..179.
21f70 0a 38 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .82....query I r
21f80 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
21f90 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c 31 20 2a  ISTINCT + col1 *
21fa0 20 63 6f 6c 31 20 2b 20 31 37 20 41 53 20 63 6f   col1 + 17 AS co
21fb0 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72  l1 FROM tab1 cor
21fc0 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 37 0d 0a 31 38  0..----..117..18
21fd0 36 0d 0a 36 39 33 0d 0a 0d 0a 6f 6e 6c 79 69 66  6..693....onlyif
21fe0 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74   mysql # support
21ff0 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69   for MySQL speci
22000 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73  fic system types
22010 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65   and syntax..que
22020 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
22030 65 6c 2d 39 34 30 0d 0a 53 45 4c 45 43 54 20 74  el-940..SELECT t
22040 61 62 31 2e 63 6f 6c 31 20 2b 20 63 6f 6c 32 20  ab1.col1 + col2 
22050 2b 20 43 41 53 54 28 20 2b 20 63 6f 6c 30 20 41  + CAST( + col0 A
22060 53 20 53 49 47 4e 45 44 20 29 20 46 52 4f 4d 20  S SIGNED ) FROM 
22070 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 33 31 0d  tab1..----..131.
22080 0a 31 38 39 0d 0a 38 33 0d 0a 0d 0a 73 6b 69 70  .189..83....skip
22090 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
220a0 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
220b0 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
220c0 2d 39 34 30 0d 0a 53 45 4c 45 43 54 20 74 61 62  -940..SELECT tab
220d0 31 2e 63 6f 6c 31 20 2b 20 63 6f 6c 32 20 2b 20  1.col1 + col2 + 
220e0 43 41 53 54 20 28 20 2b 20 63 6f 6c 30 20 41 53  CAST ( + col0 AS
220f0 20 49 4e 54 45 47 45 52 20 29 20 46 52 4f 4d 20   INTEGER ) FROM 
22100 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 33 31 0d  tab1..----..131.
22110 0a 31 38 39 0d 0a 38 33 0d 0a 0d 0a 71 75 65 72  .189..83....quer
22120 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
22130 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63  ECT DISTINCT + c
22140 6f 6c 32 20 2b 20 2d 20 63 6f 6c 32 20 2a 20 37  ol2 + - col2 * 7
22150 32 20 2d 20 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c  2 - col1 * + col
22160 32 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d  2 FROM tab2..---
22170 2d 0d 0a 2d 32 37 35 34 0d 0a 2d 33 33 34 34 0d  -..-2754..-3344.
22180 0a 2d 33 33 38 30 0d 0a 0d 0a 71 75 65 72 79 20  .-3380....query 
22190 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
221a0 54 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 41 53  T + cor0.col0 AS
221b0 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20   col1 FROM tab2 
221c0 63 6f 72 30 20 43 52 4f 53 53 20 4a 4f 49 4e 20  cor0 CROSS JOIN 
221d0 74 61 62 30 20 41 53 20 63 6f 72 31 0d 0a 2d 2d  tab0 AS cor1..--
221e0 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73  --..9 values has
221f0 68 69 6e 67 20 74 6f 20 39 35 62 39 36 63 61 31  hing to 95b96ca1
22200 64 62 65 32 65 33 39 61 30 66 61 37 38 66 35 30  dbe2e39a0fa78f50
22210 64 33 37 34 66 35 31 61 0d 0a 0d 0a 6f 6e 6c 79  d374f51a....only
22220 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44  if mysql # use D
22230 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20  IV operator for 
22240 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e  integer division
22250 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
22260 74 20 6c 61 62 65 6c 2d 39 34 33 0d 0a 53 45 4c  t label-943..SEL
22270 45 43 54 20 2b 20 2b 20 38 36 20 44 49 56 20 2d  ECT + + 86 DIV -
22280 20 36 37 20 46 52 4f 4d 20 74 61 62 31 20 41 53   67 FROM tab1 AS
22290 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d   cor0..----..-1.
222a0 0a 2d 31 0d 0a 2d 31 0d 0a 0d 0a 73 6b 69 70 69  .-1..-1....skipi
222b0 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
222c0 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
222d0 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
222e0 39 34 33 0d 0a 53 45 4c 45 43 54 20 2b 20 2b 20  943..SELECT + + 
222f0 38 36 20 2f 20 2d 20 36 37 20 46 52 4f 4d 20 74  86 / - 67 FROM t
22300 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
22310 2d 0d 0a 2d 31 0d 0a 2d 31 0d 0a 2d 31 0d 0a 0d  -..-1..-1..-1...
22320 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
22330 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72  use DIV operator
22340 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76   for integer div
22350 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72  ision..query I r
22360 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 39 34 34  owsort label-944
22370 0d 0a 53 45 4c 45 43 54 20 2b 20 28 20 2d 20 63  ..SELECT + ( - c
22380 6f 6c 31 20 29 20 44 49 56 20 63 6f 6c 32 20 41  ol1 ) DIV col2 A
22390 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31  S col0 FROM tab1
223a0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
223b0 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a 73 6b 69 70 69  0..0..0....skipi
223c0 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
223d0 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
223e0 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
223f0 39 34 34 0d 0a 53 45 4c 45 43 54 20 2b 20 28 20  944..SELECT + ( 
22400 2d 20 63 6f 6c 31 20 29 20 2f 20 63 6f 6c 32 20  - col1 ) / col2 
22410 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
22420 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
22430 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a 71 75 65 72  .0..0..0....quer
22440 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
22450 45 43 54 20 2b 20 2b 20 33 32 20 2a 20 63 6f 6c  ECT + + 32 * col
22460 31 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  1 AS col2 FROM t
22470 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
22480 2d 0d 0a 32 37 35 32 0d 0a 32 39 31 32 0d 0a 33  -..2752..2912..3
22490 31 30 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  104....query I r
224a0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
224b0 20 2b 20 37 37 20 46 52 4f 4d 20 74 61 62 31 20   + 77 FROM tab1 
224c0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
224d0 37 37 0d 0a 2d 37 37 0d 0a 2d 37 37 0d 0a 0d 0a  77..-77..-77....
224e0 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75  onlyif mysql # u
224f0 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20  se DIV operator 
22500 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69  for integer divi
22510 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f  sion..query I ro
22520 77 73 6f 72 74 20 6c 61 62 65 6c 2d 39 34 37 0d  wsort label-947.
22530 0a 53 45 4c 45 43 54 20 33 33 20 2b 20 63 6f 6c  .SELECT 33 + col
22540 32 20 44 49 56 20 2d 20 37 35 20 41 53 20 63 6f  2 DIV - 75 AS co
22550 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l1 FROM tab2 AS 
22560 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 33 0d 0a  cor0..----..33..
22570 33 33 0d 0a 33 33 0d 0a 0d 0a 73 6b 69 70 69 66  33..33....skipif
22580 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
22590 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
225a0 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 39   rowsort label-9
225b0 34 37 0d 0a 53 45 4c 45 43 54 20 33 33 20 2b 20  47..SELECT 33 + 
225c0 63 6f 6c 32 20 2f 20 2d 20 37 35 20 41 53 20 63  col2 / - 75 AS c
225d0 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol1 FROM tab2 AS
225e0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 33 0d   cor0..----..33.
225f0 0a 33 33 0d 0a 33 33 0d 0a 0d 0a 71 75 65 72 79  .33..33....query
22600 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
22610 43 54 20 2b 20 63 6f 6c 30 20 2b 20 63 6f 6c 32  CT + col0 + col2
22620 20 2a 20 31 34 20 46 52 4f 4d 20 74 61 62 30 20   * 14 FROM tab0 
22630 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
22640 32 33 37 0d 0a 34 38 36 0d 0a 34 39 0d 0a 0d 0a  237..486..49....
22650 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
22660 0a 53 45 4c 45 43 54 20 2b 20 2d 20 31 20 2a 20  .SELECT + - 1 * 
22670 2d 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30  - col2 FROM tab0
22680 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
22690 31 0d 0a 33 33 0d 0a 38 32 0d 0a 0d 0a 6f 6e 6c  1..33..82....onl
226a0 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20  yif mysql # use 
226b0 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72  DIV operator for
226c0 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f   integer divisio
226d0 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  n..query I rowso
226e0 72 74 20 6c 61 62 65 6c 2d 39 35 30 0d 0a 53 45  rt label-950..SE
226f0 4c 45 43 54 20 41 4c 4c 20 39 30 20 44 49 56 20  LECT ALL 90 DIV 
22700 63 6f 6c 31 20 2b 20 63 6f 6c 31 20 46 52 4f 4d  col1 + col1 FROM
22710 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
22720 2d 2d 2d 0d 0a 32 32 0d 0a 33 33 0d 0a 36 30 0d  ---..22..33..60.
22730 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
22740 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
22750 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
22760 74 20 6c 61 62 65 6c 2d 39 35 30 0d 0a 53 45 4c  t label-950..SEL
22770 45 43 54 20 41 4c 4c 20 39 30 20 2f 20 63 6f 6c  ECT ALL 90 / col
22780 31 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61  1 + col1 FROM ta
22790 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
227a0 0d 0a 32 32 0d 0a 33 33 0d 0a 36 30 0d 0a 0d 0a  ..22..33..60....
227b0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
227c0 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
227d0 20 2d 20 63 6f 6c 31 20 2b 20 63 6f 6c 32 20 2a   - col1 + col2 *
227e0 20 37 33 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d   73 AS col2 FROM
227f0 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
22800 2d 2d 2d 0d 0a 2d 32 34 0d 0a 32 33 32 33 0d 0a  ---..-24..2323..
22810 35 38 39 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20  5895....query I 
22820 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
22830 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c 32 20  DISTINCT - col2 
22840 2a 20 63 6f 6c 31 20 2b 20 63 6f 6c 30 20 2a 20  * col1 + col0 * 
22850 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41  col2 FROM tab2 A
22860 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 36  S cor0..----..-6
22870 34 38 0d 0a 32 33 35 36 0d 0a 34 39 34 0d 0a 0d  48..2356..494...
22880 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
22890 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63  ..SELECT ALL + c
228a0 6f 6c 30 20 2d 20 28 20 2d 20 31 35 20 29 20 2a  ol0 - ( - 15 ) *
228b0 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20   col1 FROM tab2 
228c0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33  AS cor0..----..3
228d0 33 34 0d 0a 34 37 32 0d 0a 39 36 33 0d 0a 0d 0a  34..472..963....
228e0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
228f0 0a 53 45 4c 45 43 54 20 74 61 62 31 2e 63 6f 6c  .SELECT tab1.col
22900 30 20 2a 20 2d 20 35 37 20 2a 20 63 6f 6c 30 20  0 * - 57 * col0 
22910 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
22920 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 33 33 34 37 32  1..----..-233472
22930 0d 0a 2d 33 36 34 38 30 30 0d 0a 2d 35 31 33 0d  ..-364800..-513.
22940 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
22950 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2b 20 63  rt..SELECT + + c
22960 6f 6c 30 20 2a 20 63 6f 6c 30 20 2b 20 39 20 46  ol0 * col0 + 9 F
22970 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
22980 0d 0a 2d 2d 2d 2d 0d 0a 35 38 0d 0a 36 30 39 33  ..----..58..6093
22990 0d 0a 36 32 35 30 0d 0a 0d 0a 71 75 65 72 79 20  ..6250....query 
229a0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
229b0 54 20 2d 20 63 6f 6c 31 20 2b 20 2d 20 63 6f 6c  T - col1 + - col
229c0 32 20 2a 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20  2 * - cor0.col2 
229d0 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
229e0 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
229f0 0a 31 34 32 37 0d 0a 36 31 37 0d 0a 36 39 38 0d  .1427..617..698.
22a00 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
22a10 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2b 20 37  rt..SELECT + + 7
22a20 20 2a 20 31 30 20 46 52 4f 4d 20 74 61 62 32 20   * 10 FROM tab2 
22a30 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 37 30 0d 0a  cor0..----..70..
22a40 37 30 0d 0a 37 30 0d 0a 0d 0a 71 75 65 72 79 20  70..70....query 
22a50 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
22a60 54 20 2d 20 63 6f 6c 32 20 2b 20 2b 20 63 6f 72  T - col2 + + cor
22a70 30 2e 63 6f 6c 32 20 2a 20 63 6f 72 30 2e 63 6f  0.col2 * cor0.co
22a80 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l1 FROM tab2 AS 
22a90 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 35 30 38  cor0..----..1508
22aa0 0d 0a 36 30 38 0d 0a 38 31 30 0d 0a 0d 0a 71 75  ..608..810....qu
22ab0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
22ac0 45 4c 45 43 54 20 2d 20 2b 20 63 6f 6c 31 20 2a  ELECT - + col1 *
22ad0 20 2d 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20   - col0 AS col0 
22ae0 46 52 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a  FROM tab2 cor0..
22af0 2d 2d 2d 2d 0d 0a 31 33 34 33 0d 0a 32 31 37 0d  ----..1343..217.
22b00 0a 34 36 30 32 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  .4602....onlyif 
22b10 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20  mysql # support 
22b20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66  for MySQL specif
22b30 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20  ic system types 
22b40 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72  and syntax..quer
22b50 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
22b60 6c 2d 39 36 30 0d 0a 53 45 4c 45 43 54 20 44 49  l-960..SELECT DI
22b70 53 54 49 4e 43 54 20 63 6f 72 30 2e 63 6f 6c 31  STINCT cor0.col1
22b80 20 2a 20 43 41 53 54 28 20 4e 55 4c 4c 20 41 53   * CAST( NULL AS
22b90 20 53 49 47 4e 45 44 20 29 20 46 52 4f 4d 20 74   SIGNED ) FROM t
22ba0 61 62 31 2c 20 74 61 62 30 2c 20 74 61 62 32 20  ab1, tab0, tab2 
22bb0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e  AS cor0..----..N
22bc0 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  ULL....skipif my
22bd0 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
22be0 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
22bf0 77 73 6f 72 74 20 6c 61 62 65 6c 2d 39 36 30 0d  wsort label-960.
22c00 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
22c10 20 63 6f 72 30 2e 63 6f 6c 31 20 2a 20 43 41 53   cor0.col1 * CAS
22c20 54 20 28 20 4e 55 4c 4c 20 41 53 20 49 4e 54 45  T ( NULL AS INTE
22c30 47 45 52 20 29 20 46 52 4f 4d 20 74 61 62 31 2c  GER ) FROM tab1,
22c40 20 74 61 62 30 2c 20 74 61 62 32 20 41 53 20 63   tab0, tab2 AS c
22c50 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d  or0..----..NULL.
22c60 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
22c70 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c  rt..SELECT + col
22c80 32 20 2a 20 2d 20 28 20 2b 20 32 35 20 29 20 46  2 * - ( + 25 ) F
22c90 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab2..----..
22ca0 2d 36 35 30 0d 0a 2d 36 37 35 0d 0a 2d 39 35 30  -650..-675..-950
22cb0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
22cc0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 32  ort..SELECT col2
22cd0 20 2a 20 2d 20 28 20 2b 20 63 6f 6c 30 20 29 20   * - ( + col0 ) 
22ce0 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
22cf0 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 35 0d 0a 2d 37  0..----..-35..-7
22d00 32 39 38 0d 0a 2d 37 39 32 0d 0a 0d 0a 71 75 65  298..-792....que
22d10 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
22d20 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 31 20  LECT ALL + col1 
22d30 2a 20 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c 32 20  * col0 * - col2 
22d40 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
22d50 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 36 34 38 30 0d  1..----..-36480.
22d60 0a 2d 34 32 31 32 0d 0a 2d 39 39 38 34 30 0d 0a  .-4212..-99840..
22d70 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
22d80 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
22d90 43 54 20 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c 30  CT col1 * - col0
22da0 20 2a 20 2d 20 63 6f 6c 30 20 41 53 20 63 6f 6c   * - col0 AS col
22db0 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  0 FROM tab0 AS c
22dc0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 38 38 32  or0..----..11882
22dd0 35 0d 0a 34 39 35 33 36 0d 0a 37 32 30 38 31 31  5..49536..720811
22de0 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
22df0 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61   # use DIV opera
22e00 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20  tor for integer 
22e10 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20  division..query 
22e20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
22e30 39 36 35 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  965..SELECT DIST
22e40 49 4e 43 54 20 2d 20 34 30 20 2a 20 63 6f 6c 31  INCT - 40 * col1
22e50 20 2a 20 63 6f 6c 30 20 2d 20 28 20 63 6f 72 30   * col0 - ( cor0
22e60 2e 63 6f 6c 31 20 29 20 44 49 56 20 63 6f 6c 30  .col1 ) DIV col0
22e70 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
22e80 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 35 36 30 30  r0..----..-25600
22e90 0d 0a 2d 33 31 32 38 0d 0a 2d 34 31 36 30 30 0d  ..-3128..-41600.
22ea0 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
22eb0 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
22ec0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
22ed0 74 20 6c 61 62 65 6c 2d 39 36 35 0d 0a 53 45 4c  t label-965..SEL
22ee0 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 34  ECT DISTINCT - 4
22ef0 30 20 2a 20 63 6f 6c 31 20 2a 20 63 6f 6c 30 20  0 * col1 * col0 
22f00 2d 20 28 20 63 6f 72 30 2e 63 6f 6c 31 20 29 20  - ( cor0.col1 ) 
22f10 2f 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31  / col0 FROM tab1
22f20 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
22f30 2d 32 35 36 30 30 0d 0a 2d 33 31 32 38 0d 0a 2d  -25600..-3128..-
22f40 34 31 36 30 30 0d 0a 0d 0a 73 6b 69 70 69 66 20  41600....skipif 
22f50 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73  postgresql # Pos
22f60 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73  tgreSQL requires
22f70 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e   AS when renamin
22f80 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73  g output columns
22f90 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
22fa0 74 0d 0a 53 45 4c 45 43 54 20 2d 20 36 32 20 2a  t..SELECT - 62 *
22fb0 20 63 6f 72 30 2e 63 6f 6c 30 20 2b 20 2b 20 63   cor0.col0 + + c
22fc0 6f 6c 32 20 2a 20 63 6f 6c 31 20 2a 20 63 6f 72  ol2 * col1 * cor
22fd0 30 2e 63 6f 6c 32 20 63 6f 6c 31 20 46 52 4f 4d  0.col2 col1 FROM
22fe0 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
22ff0 2d 2d 2d 0d 0a 31 39 36 35 30 0d 0a 32 32 31 36  ---..19650..2216
23000 35 0d 0a 33 35 30 34 38 0d 0a 0d 0a 71 75 65 72  5..35048....quer
23010 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
23020 45 43 54 20 36 35 20 46 52 4f 4d 20 74 61 62 30  ECT 65 FROM tab0
23030 2c 20 74 61 62 31 20 41 53 20 63 6f 72 30 2c 20  , tab1 AS cor0, 
23040 74 61 62 30 20 41 53 20 63 6f 72 31 0d 0a 2d 2d  tab0 AS cor1..--
23050 2d 2d 0d 0a 32 37 20 76 61 6c 75 65 73 20 68 61  --..27 values ha
23060 73 68 69 6e 67 20 74 6f 20 31 63 39 64 30 62 66  shing to 1c9d0bf
23070 39 36 63 64 33 33 36 31 39 34 32 66 61 64 61 64  96cd3361942fadad
23080 36 36 38 31 33 38 62 39 63 0d 0a 0d 0a 71 75 65  668138b9c....que
23090 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
230a0 4c 45 43 54 20 41 4c 4c 20 37 37 20 2b 20 63 6f  LECT ALL 77 + co
230b0 6c 31 20 2a 20 63 6f 6c 32 20 2a 20 63 6f 6c 32  l1 * col2 * col2
230c0 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
230d0 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
230e0 0d 0a 31 31 39 38 38 35 0d 0a 33 32 35 36 37 0d  ..119885..32567.
230f0 0a 37 35 38 39 33 0d 0a 0d 0a 73 6b 69 70 69 66  .75893....skipif
23100 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f   postgresql # Po
23110 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65  stgreSQL require
23120 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69  s AS when renami
23130 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e  ng output column
23140 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  s..query I rowso
23150 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2d 20 31  rt..SELECT - - 1
23160 32 20 2a 20 2b 20 63 6f 6c 30 20 2a 20 63 6f 6c  2 * + col0 * col
23170 31 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31  1 col1 FROM tab1
23180 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 34   cor0..----..124
23190 38 30 0d 0a 37 36 38 30 0d 0a 39 33 36 0d 0a 0d  80..7680..936...
231a0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
231b0 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
231c0 54 20 34 34 20 41 53 20 63 6f 6c 30 20 46 52 4f  T 44 AS col0 FRO
231d0 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
231e0 2d 2d 2d 2d 0d 0a 34 34 0d 0a 0d 0a 6f 6e 6c 79  ----..44....only
231f0 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f  if mysql # suppo
23200 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65  rt for MySQL spe
23210 63 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70  cific system typ
23220 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71  es and syntax..q
23230 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
23240 61 62 65 6c 2d 39 37 31 0d 0a 53 45 4c 45 43 54  abel-971..SELECT
23250 20 2b 20 43 41 53 54 28 20 2d 20 63 6f 6c 30 20   + CAST( - col0 
23260 41 53 20 53 49 47 4e 45 44 20 29 20 2a 20 63 6f  AS SIGNED ) * co
23270 6c 32 20 2a 20 2d 20 43 41 53 54 28 20 63 6f 6c  l2 * - CAST( col
23280 30 20 41 53 20 53 49 47 4e 45 44 20 29 20 41 53  0 AS SIGNED ) AS
23290 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20   col2 FROM tab0 
232a0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
232b0 32 32 35 0d 0a 31 39 30 30 38 0d 0a 36 34 39 35  225..19008..6495
232c0 32 32 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  22....skipif mys
232d0 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
232e0 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
232f0 73 6f 72 74 20 6c 61 62 65 6c 2d 39 37 31 0d 0a  sort label-971..
23300 53 45 4c 45 43 54 20 2b 20 43 41 53 54 20 28 20  SELECT + CAST ( 
23310 2d 20 63 6f 6c 30 20 41 53 20 49 4e 54 45 47 45  - col0 AS INTEGE
23320 52 20 29 20 2a 20 63 6f 6c 32 20 2a 20 2d 20 43  R ) * col2 * - C
23330 41 53 54 20 28 20 63 6f 6c 30 20 41 53 20 49 4e  AST ( col0 AS IN
23340 54 45 47 45 52 20 29 20 41 53 20 63 6f 6c 32 20  TEGER ) AS col2 
23350 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
23360 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 32 35 0d 0a 31  0..----..1225..1
23370 39 30 30 38 0d 0a 36 34 39 35 32 32 0d 0a 0d 0a  9008..649522....
23380 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
23390 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
233a0 20 63 6f 6c 30 20 2a 20 39 33 20 2b 20 2d 20 63   col0 * 93 + - c
233b0 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d  ol2 FROM tab0..-
233c0 2d 2d 2d 0d 0a 32 31 39 39 0d 0a 33 32 35 34 0d  ---..2199..3254.
233d0 0a 38 31 39 35 0d 0a 0d 0a 71 75 65 72 79 20 49  .8195....query I
233e0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
233f0 20 44 49 53 54 49 4e 43 54 20 36 38 20 2a 20 2b   DISTINCT 68 * +
23400 20 63 6f 6c 32 20 2b 20 74 61 62 30 2e 63 6f 6c   col2 + tab0.col
23410 32 20 2a 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61  2 * col0 FROM ta
23420 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 33 0d 0a 31  b0..----..103..1
23430 32 38 37 34 0d 0a 33 30 33 36 0d 0a 0d 0a 71 75  2874..3036....qu
23440 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
23450 45 4c 45 43 54 20 41 4c 4c 20 2d 20 2d 20 32 30  ELECT ALL - - 20
23460 20 2a 20 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c 30   * col0 + - col0
23470 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
23480 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33 33 0d 0a 31  r0..----..133..1
23490 34 38 32 0d 0a 31 35 30 31 0d 0a 0d 0a 6f 6e 6c  482..1501....onl
234a0 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70  yif mysql # supp
234b0 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70  ort for MySQL sp
234c0 65 63 69 66 69 63 20 73 79 73 74 65 6d 20 74 79  ecific system ty
234d0 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a  pes and syntax..
234e0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
234f0 6c 61 62 65 6c 2d 39 37 35 0d 0a 53 45 4c 45 43  label-975..SELEC
23500 54 20 41 4c 4c 20 43 41 53 54 28 20 2d 20 39 31  T ALL CAST( - 91
23510 20 41 53 20 53 49 47 4e 45 44 20 29 20 2b 20 2b   AS SIGNED ) + +
23520 20 63 6f 6c 30 20 63 6f 6c 31 20 46 52 4f 4d 20   col0 col1 FROM 
23530 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 0d 0a  tab0..----..-2..
23540 2d 35 36 0d 0a 2d 36 37 0d 0a 0d 0a 73 6b 69 70  -56..-67....skip
23550 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20  if postgresql # 
23560 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69  PostgreSQL requi
23570 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61  res AS when rena
23580 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75  ming output colu
23590 6d 6e 73 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  mns..skipif mysq
235a0 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
235b0 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
235c0 6f 72 74 20 6c 61 62 65 6c 2d 39 37 35 0d 0a 53  ort label-975..S
235d0 45 4c 45 43 54 20 41 4c 4c 20 43 41 53 54 20 28  ELECT ALL CAST (
235e0 20 2d 20 39 31 20 41 53 20 49 4e 54 45 47 45 52   - 91 AS INTEGER
235f0 20 29 20 2b 20 2b 20 63 6f 6c 30 20 63 6f 6c 31   ) + + col0 col1
23600 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d   FROM tab0..----
23610 0d 0a 2d 32 0d 0a 2d 35 36 0d 0a 2d 36 37 0d 0a  ..-2..-56..-67..
23620 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
23630 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 31  t..SELECT + col1
23640 20 2b 20 63 6f 6c 31 20 2a 20 63 6f 6c 32 20 46   + col1 * col2 F
23650 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab1..----..
23660 31 32 36 31 0d 0a 31 34 33 30 0d 0a 35 38 30 0d  1261..1430..580.
23670 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
23680 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c  rt..SELECT - col
23690 32 20 2b 20 2d 20 34 34 20 41 53 20 63 6f 6c 31  2 + - 44 AS col1
236a0 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d   FROM tab1..----
236b0 0d 0a 2d 31 30 31 0d 0a 2d 31 34 30 0d 0a 2d 39  ..-101..-140..-9
236c0 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  8....query I row
236d0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c  sort..SELECT col
236e0 32 20 2a 20 2d 20 39 38 20 2b 20 63 6f 6c 30 20  2 * - 98 + col0 
236f0 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
23700 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 32 31 30 0d 0a  0..----..-3210..
23710 2d 36 33 0d 0a 2d 37 39 34 37 0d 0a 0d 0a 6f 6e  -63..-7947....on
23720 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
23730 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
23740 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
23750 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
23760 6f 72 74 20 6c 61 62 65 6c 2d 39 37 39 0d 0a 53  ort label-979..S
23770 45 4c 45 43 54 20 2b 20 63 6f 6c 30 20 2b 20 37  ELECT + col0 + 7
23780 36 20 2a 20 2d 20 39 34 20 2b 20 63 6f 72 30 2e  6 * - 94 + cor0.
23790 63 6f 6c 31 20 44 49 56 20 63 6f 6c 30 20 63 6f  col1 DIV col0 co
237a0 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l1 FROM tab0 AS 
237b0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 37 30 35  cor0..----..-705
237c0 34 0d 0a 2d 37 31 30 37 0d 0a 2d 37 31 31 37 0d  4..-7107..-7117.
237d0 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72  ...skipif postgr
237e0 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51  esql # PostgreSQ
237f0 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68  L requires AS wh
23800 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70  en renaming outp
23810 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 73 6b 69 70  ut columns..skip
23820 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
23830 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
23840 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
23850 2d 39 37 39 0d 0a 53 45 4c 45 43 54 20 2b 20 63  -979..SELECT + c
23860 6f 6c 30 20 2b 20 37 36 20 2a 20 2d 20 39 34 20  ol0 + 76 * - 94 
23870 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 2f 20 63 6f  + cor0.col1 / co
23880 6c 30 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  l0 col1 FROM tab
23890 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
238a0 0a 2d 37 30 35 34 0d 0a 2d 37 31 30 37 0d 0a 2d  .-7054..-7107..-
238b0 37 31 31 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20  7117....query I 
238c0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
238d0 41 4c 4c 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20  ALL + cor0.col0 
238e0 2b 20 2d 20 63 6f 72 30 2e 63 6f 6c 30 20 46 52  + - cor0.col0 FR
238f0 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
23900 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a  .----..0..0..0..
23910 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65  ..skipif postgre
23920 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c  sql # PostgreSQL
23930 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65   requires AS whe
23940 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75  n renaming outpu
23950 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79  t columns..query
23960 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
23970 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 33 36  CT DISTINCT + 36
23980 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 2c   col0 FROM tab2,
23990 20 74 61 62 30 2c 20 74 61 62 30 20 41 53 20 63   tab0, tab0 AS c
239a0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 36 0d 0a 0d  or0..----..36...
239b0 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
239c0 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51  support for MySQ
239d0 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65  L specific syste
239e0 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74  m types and synt
239f0 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ax..query I rows
23a00 6f 72 74 20 6c 61 62 65 6c 2d 39 38 32 0d 0a 53  ort label-982..S
23a10 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 63  ELECT DISTINCT c
23a20 6f 6c 31 20 2a 20 2d 20 43 41 53 54 28 20 4e 55  ol1 * - CAST( NU
23a30 4c 4c 20 41 53 20 53 49 47 4e 45 44 20 29 20 46  LL AS SIGNED ) F
23a40 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
23a50 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 0d 0a  ..----..NULL....
23a60 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
23a70 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
23a80 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
23a90 61 62 65 6c 2d 39 38 32 0d 0a 53 45 4c 45 43 54  abel-982..SELECT
23aa0 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 31 20 2a   DISTINCT col1 *
23ab0 20 2d 20 43 41 53 54 20 28 20 4e 55 4c 4c 20 41   - CAST ( NULL A
23ac0 53 20 49 4e 54 45 47 45 52 20 29 20 46 52 4f 4d  S INTEGER ) FROM
23ad0 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
23ae0 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75 65  ---..NULL....que
23af0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
23b00 4c 45 43 54 20 2d 20 63 6f 6c 30 20 2a 20 39 39  LECT - col0 * 99
23b10 20 2a 20 63 6f 6c 32 20 2d 20 2b 20 63 6f 6c 31   * col2 - + col1
23b20 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
23b30 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 38 37 34 32  r0..----..-18742
23b40 0d 0a 2d 32 30 30 38 33 31 0d 0a 2d 32 39 37 32  ..-200831..-2972
23b50 31 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  15....query I ro
23b60 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
23b70 53 54 49 4e 43 54 20 2b 20 63 6f 72 30 2e 63 6f  STINCT + cor0.co
23b80 6c 32 20 2a 20 2d 20 63 6f 6c 30 20 46 52 4f 4d  l2 * - col0 FROM
23b90 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
23ba0 2d 2d 2d 0d 0a 2d 31 36 32 0d 0a 2d 33 36 34 38  ---..-162..-3648
23bb0 0d 0a 2d 37 36 38 30 0d 0a 0d 0a 6f 6e 6c 79 69  ..-7680....onlyi
23bc0 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49  f mysql # use DI
23bd0 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69  V operator for i
23be0 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d  nteger division.
23bf0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
23c00 20 6c 61 62 65 6c 2d 39 38 35 0d 0a 53 45 4c 45   label-985..SELE
23c10 43 54 20 2d 20 31 33 20 44 49 56 20 2d 20 63 6f  CT - 13 DIV - co
23c20 6c 30 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d  l0 FROM tab1..--
23c30 2d 2d 0d 0a 30 0d 0a 30 0d 0a 34 0d 0a 0d 0a 73  --..0..0..4....s
23c40 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
23c50 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
23c60 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
23c70 62 65 6c 2d 39 38 35 0d 0a 53 45 4c 45 43 54 20  bel-985..SELECT 
23c80 2d 20 31 33 20 2f 20 2d 20 63 6f 6c 30 20 46 52  - 13 / - col0 FR
23c90 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 30  OM tab1..----..0
23ca0 0d 0a 30 0d 0a 34 0d 0a 0d 0a 71 75 65 72 79 20  ..0..4....query 
23cb0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
23cc0 54 20 41 4c 4c 20 28 20 74 61 62 30 2e 63 6f 6c  T ALL ( tab0.col
23cd0 30 20 29 20 2a 20 63 6f 6c 31 20 41 53 20 63 6f  0 ) * col1 AS co
23ce0 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d  l0 FROM tab0..--
23cf0 2d 2d 0d 0a 32 30 36 34 0d 0a 33 33 39 35 0d 0a  --..2064..3395..
23d00 38 30 39 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20  8099....query I 
23d10 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
23d20 41 4c 4c 20 63 6f 6c 30 20 2b 20 74 61 62 30 2e  ALL col0 + tab0.
23d30 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c 30 20 46 52  col0 * - col0 FR
23d40 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  OM tab0..----..-
23d50 31 31 39 30 0d 0a 2d 35 35 32 0d 0a 2d 37 38 33  1190..-552..-783
23d60 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  2....query I row
23d70 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63  sort..SELECT + c
23d80 6f 6c 32 20 2d 20 2b 20 28 20 63 6f 6c 32 20 29  ol2 - + ( col2 )
23d90 20 2a 20 2b 20 63 6f 6c 32 20 41 53 20 63 6f 6c   * + col2 AS col
23da0 32 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d  2 FROM tab0..---
23db0 2d 0d 0a 2d 31 30 35 36 0d 0a 2d 36 36 34 32 0d  -..-1056..-6642.
23dc0 0a 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  .0....onlyif mys
23dd0 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72  ql # support for
23de0 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63 20   MySQL specific 
23df0 73 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64  system types and
23e00 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49   syntax..query I
23e10 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 39   rowsort label-9
23e20 38 39 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b  89..SELECT ALL +
23e30 20 63 6f 6c 32 20 2a 20 2d 20 43 41 53 54 28 20   col2 * - CAST( 
23e40 4e 55 4c 4c 20 41 53 20 53 49 47 4e 45 44 20 29  NULL AS SIGNED )
23e50 20 2d 20 2d 20 37 31 20 46 52 4f 4d 20 74 61 62   - - 71 FROM tab
23e60 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
23e70 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c  .NULL..NULL..NUL
23e80 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  L....skipif mysq
23e90 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
23ea0 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
23eb0 6f 72 74 20 6c 61 62 65 6c 2d 39 38 39 0d 0a 53  ort label-989..S
23ec0 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 32  ELECT ALL + col2
23ed0 20 2a 20 2d 20 43 41 53 54 20 28 20 4e 55 4c 4c   * - CAST ( NULL
23ee0 20 41 53 20 49 4e 54 45 47 45 52 20 29 20 2d 20   AS INTEGER ) - 
23ef0 2d 20 37 31 20 46 52 4f 4d 20 74 61 62 30 20 41  - 71 FROM tab0 A
23f00 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55  S cor0..----..NU
23f10 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a  LL..NULL..NULL..
23f20 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
23f30 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f   use DIV operato
23f40 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69  r for integer di
23f50 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20  vision..query I 
23f60 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 39 39  rowsort label-99
23f70 30 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 30  0..SELECT + col0
23f80 20 2b 20 2b 20 36 31 20 2a 20 28 20 63 6f 6c 31   + + 61 * ( col1
23f90 20 29 20 44 49 56 20 63 6f 6c 30 20 46 52 4f 4d   ) DIV col0 FROM
23fa0 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
23fb0 2d 2d 2d 0d 0a 31 35 31 0d 0a 32 30 34 0d 0a 32  ---..151..204..2
23fc0 34 32 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  42....skipif mys
23fd0 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
23fe0 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
23ff0 73 6f 72 74 20 6c 61 62 65 6c 2d 39 39 30 0d 0a  sort label-990..
24000 53 45 4c 45 43 54 20 2b 20 63 6f 6c 30 20 2b 20  SELECT + col0 + 
24010 2b 20 36 31 20 2a 20 28 20 63 6f 6c 31 20 29 20  + 61 * ( col1 ) 
24020 2f 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30  / col0 FROM tab0
24030 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
24040 31 35 31 0d 0a 32 30 34 0d 0a 32 34 32 0d 0a 0d  151..204..242...
24050 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
24060 0d 0a 53 45 4c 45 43 54 20 2b 20 39 36 20 2a 20  ..SELECT + 96 * 
24070 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 0d 0a  col2 FROM tab0..
24080 2d 2d 2d 2d 0d 0a 33 31 36 38 0d 0a 37 38 37 32  ----..3168..7872
24090 0d 0a 39 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..96....query I 
240a0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
240b0 32 37 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  27 AS col2 FROM 
240c0 74 61 62 32 2c 20 74 61 62 31 2c 20 74 61 62 31  tab2, tab1, tab1
240d0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20   cor0..----..27 
240e0 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74  values hashing t
240f0 6f 20 31 61 33 63 65 66 35 63 33 33 62 38 66 38  o 1a3cef5c33b8f8
24100 37 66 66 65 64 65 64 33 37 38 66 64 32 30 37 37  7ffeded378fd2077
24110 35 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  53....query I ro
24120 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
24130 4c 20 2b 20 35 31 20 2b 20 2b 20 63 6f 6c 31 20  L + 51 + + col1 
24140 2a 20 63 6f 6c 31 20 2b 20 63 6f 6c 31 20 46 52  * col1 + col1 FR
24150 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31  OM tab2..----..1
24160 30 34 33 0d 0a 33 35 37 0d 0a 33 35 39 31 0d 0a  043..357..3591..
24170 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
24180 74 0d 0a 53 45 4c 45 43 54 20 28 20 31 32 20 2b  t..SELECT ( 12 +
24190 20 63 6f 72 30 2e 63 6f 6c 32 20 29 20 2a 20 2b   cor0.col2 ) * +
241a0 20 74 61 62 30 2e 63 6f 6c 30 20 46 52 4f 4d 20   tab0.col0 FROM 
241b0 74 61 62 30 2c 20 74 61 62 32 20 41 53 20 63 6f  tab0, tab2 AS co
241c0 72 30 2c 20 74 61 62 30 20 41 53 20 63 6f 72 31  r0, tab0 AS cor1
241d0 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75 65  ..----..27 value
241e0 73 20 68 61 73 68 69 6e 67 20 74 6f 20 66 36 36  s hashing to f66
241f0 63 33 62 65 33 35 62 62 64 64 33 38 63 64 62 66  c3be35bbdd38cdbf
24200 35 64 61 38 66 31 38 63 32 61 34 65 31 0d 0a 0d  5da8f18c2a4e1...
24210 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
24220 0d 0a 53 45 4c 45 43 54 20 31 37 20 2a 20 2b 20  ..SELECT 17 * + 
24230 63 6f 6c 31 20 2b 20 2d 20 28 20 74 61 62 32 2e  col1 + - ( tab2.
24240 63 6f 6c 30 20 29 20 46 52 4f 4d 20 74 61 62 32  col0 ) FROM tab2
24250 0d 0a 2d 2d 2d 2d 0d 0a 32 31 30 0d 0a 35 32 30  ..----..210..520
24260 0d 0a 39 32 35 0d 0a 0d 0a 71 75 65 72 79 20 49  ..925....query I
24270 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
24280 20 41 4c 4c 20 63 6f 72 30 2e 63 6f 6c 31 20 41   ALL cor0.col1 A
24290 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30  S col2 FROM tab0
242a0 2c 20 74 61 62 31 2c 20 74 61 62 30 20 63 6f 72  , tab1, tab0 cor
242b0 30 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75  0..----..27 valu
242c0 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 32 64  es hashing to 2d
242d0 36 64 33 30 33 31 64 66 65 39 30 65 30 63 30 32  6d3031dfe90e0c02
242e0 64 62 31 33 61 61 36 33 39 39 33 62 66 64 0d 0a  db13aa63993bfd..
242f0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
24300 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 30  t..SELECT - col0
24310 20 2b 20 63 6f 6c 30 20 2a 20 63 6f 6c 31 20 41   + col0 * col1 A
24320 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32  S col0 FROM tab2
24330 0d 0a 2d 2d 2d 2d 0d 0a 31 32 36 34 0d 0a 32 31  ..----..1264..21
24340 30 0d 0a 34 35 32 34 0d 0a 0d 0a 73 6b 69 70 69  0..4524....skipi
24350 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50  f postgresql # P
24360 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72  ostgreSQL requir
24370 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d  es AS when renam
24380 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d  ing output colum
24390 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ns..query I rows
243a0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f  ort..SELECT + co
243b0 6c 30 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 63  l0 + cor0.col1 c
243c0 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol2 FROM tab2 AS
243d0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33 37   cor0..----..137
243e0 0d 0a 33 38 0d 0a 39 36 0d 0a 0d 0a 71 75 65 72  ..38..96....quer
243f0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
24400 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 2d  ECT DISTINCT - -
24410 20 63 6f 72 30 2e 63 6f 6c 30 20 2b 20 2d 20 63   cor0.col0 + - c
24420 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  ol1 AS col0 FROM
24430 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
24440 2d 2d 2d 0d 0a 2d 32 34 0d 0a 31 39 0d 0a 36 32  ---..-24..19..62
24450 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
24460 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61   # use DIV opera
24470 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20  tor for integer 
24480 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20  division..query 
24490 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
244a0 31 30 30 30 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  1000..SELECT ALL
244b0 20 2d 20 2b 20 63 6f 6c 31 20 44 49 56 20 2d 20   - + col1 DIV - 
244c0 63 6f 6c 32 20 2b 20 63 6f 6c 31 20 46 52 4f 4d  col2 + col1 FROM
244d0 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab0 cor0..----
244e0 0d 0a 31 39 34 0d 0a 38 38 0d 0a 39 32 0d 0a 0d  ..194..88..92...
244f0 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
24500 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
24510 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
24520 6c 61 62 65 6c 2d 31 30 30 30 0d 0a 53 45 4c 45  label-1000..SELE
24530 43 54 20 41 4c 4c 20 2d 20 2b 20 63 6f 6c 31 20  CT ALL - + col1 
24540 2f 20 2d 20 63 6f 6c 32 20 2b 20 63 6f 6c 31 20  / - col2 + col1 
24550 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a  FROM tab0 cor0..
24560 2d 2d 2d 2d 0d 0a 31 39 34 0d 0a 38 38 0d 0a 39  ----..194..88..9
24570 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  2....query I row
24580 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2b  sort..SELECT - +
24590 20 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c 31 20 2b   col1 * + col1 +
245a0 20 2b 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62   + col2 FROM tab
245b0 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
245c0 0a 2d 32 35 31 0d 0a 2d 33 34 35 35 0d 0a 2d 39  .-251..-3455..-9
245d0 33 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  34....query I ro
245e0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
245f0 53 54 49 4e 43 54 20 2b 20 2b 20 34 37 20 2d 20  STINCT + + 47 - 
24600 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41  col0 FROM tab2 A
24610 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33  S cor0..----..-3
24620 31 0d 0a 2d 33 32 0d 0a 34 30 0d 0a 0d 0a 71 75  1..-32..40....qu
24630 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
24640 45 4c 45 43 54 20 2d 20 63 6f 6c 30 20 2a 20 63  ELECT - col0 * c
24650 6f 72 30 2e 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c  or0.col2 * - col
24660 30 20 2b 20 2d 20 34 35 20 46 52 4f 4d 20 74 61  0 + - 45 FROM ta
24670 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
24680 0d 0a 31 31 38 30 0d 0a 31 38 39 36 33 0d 0a 36  ..1180..18963..6
24690 34 39 34 37 37 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  49477....onlyif 
246a0 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20  mysql # use DIV 
246b0 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74  operator for int
246c0 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71  eger division..q
246d0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
246e0 61 62 65 6c 2d 31 30 30 34 0d 0a 53 45 4c 45 43  abel-1004..SELEC
246f0 54 20 44 49 53 54 49 4e 43 54 20 2d 20 32 20 2b  T DISTINCT - 2 +
24700 20 2b 20 63 6f 6c 31 20 44 49 56 20 2d 20 34 20   + col1 DIV - 4 
24710 2b 20 2d 20 63 6f 6c 30 20 63 6f 6c 32 20 46 52  + - col0 col2 FR
24720 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d  OM tab2 cor0..--
24730 2d 2d 0d 0a 2d 31 36 0d 0a 2d 38 35 0d 0a 2d 39  --..-16..-85..-9
24740 34 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74  4....skipif post
24750 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65  gresql # Postgre
24760 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20  SQL requires AS 
24770 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75  when renaming ou
24780 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 73 6b  tput columns..sk
24790 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
247a0 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
247b0 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
247c0 65 6c 2d 31 30 30 34 0d 0a 53 45 4c 45 43 54 20  el-1004..SELECT 
247d0 44 49 53 54 49 4e 43 54 20 2d 20 32 20 2b 20 2b  DISTINCT - 2 + +
247e0 20 63 6f 6c 31 20 2f 20 2d 20 34 20 2b 20 2d 20   col1 / - 4 + - 
247f0 63 6f 6c 30 20 63 6f 6c 32 20 46 52 4f 4d 20 74  col0 col2 FROM t
24800 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab2 cor0..----..
24810 2d 31 36 0d 0a 2d 38 35 0d 0a 2d 39 34 0d 0a 0d  -16..-85..-94...
24820 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
24830 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c  ..SELECT ALL col
24840 32 20 2a 20 37 36 20 46 52 4f 4d 20 74 61 62 30  2 * 76 FROM tab0
24850 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
24860 32 35 30 38 0d 0a 36 32 33 32 0d 0a 37 36 0d 0a  2508..6232..76..
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 2b 20 63 6f 6c 30  t..SELECT + col0
24890 20 2b 20 28 20 2b 20 63 6f 6c 31 20 29 20 2a 20   + ( + col1 ) * 
248a0 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 2a 20 63 6f  + cor0.col0 * co
248b0 6c 30 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  l0 AS col0 FROM 
248c0 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
248d0 2d 2d 0d 0a 31 31 38 38 36 30 0d 0a 34 39 35 36  --..118860..4956
248e0 30 0d 0a 37 32 30 39 30 30 0d 0a 0d 0a 71 75 65  0..720900....que
248f0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
24900 4c 45 43 54 20 2d 20 63 6f 6c 32 20 2b 20 2b 20  LECT - col2 + + 
24910 37 33 20 2b 20 2b 20 63 6f 6c 32 20 2a 20 2d 20  73 + + col2 * - 
24920 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46 52 4f  col0 AS col0 FRO
24930 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
24940 2d 2d 2d 2d 0d 0a 2d 31 34 33 0d 0a 2d 31 39 38  ----..-143..-198
24950 31 0d 0a 2d 32 39 36 37 0d 0a 0d 0a 71 75 65 72  1..-2967....quer
24960 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
24970 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63  ECT DISTINCT + c
24980 6f 6c 30 20 2a 20 33 32 20 41 53 20 63 6f 6c 31  ol0 * 32 AS col1
24990 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
249a0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 30 34 38 0d 0a  r0..----..2048..
249b0 32 35 36 30 0d 0a 39 36 0d 0a 0d 0a 71 75 65 72  2560..96....quer
249c0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
249d0 45 43 54 20 2b 20 34 30 20 2b 20 63 6f 6c 31 20  ECT + 40 + col1 
249e0 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d  FROM tab2..----.
249f0 0a 35 37 0d 0a 37 31 0d 0a 39 39 0d 0a 0d 0a 71  .57..71..99....q
24a00 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
24a10 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
24a20 2b 20 74 61 62 32 2e 63 6f 6c 30 20 2b 20 33 30  + tab2.col0 + 30
24a30 20 46 52 4f 4d 20 74 61 62 32 2c 20 74 61 62 31   FROM tab2, tab1
24a40 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
24a50 31 30 38 0d 0a 31 30 39 0d 0a 33 37 0d 0a 0d 0a  108..109..37....
24a60 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
24a70 0a 53 45 4c 45 43 54 20 2d 20 33 33 20 2a 20 2d  .SELECT - 33 * -
24a80 20 74 61 62 32 2e 63 6f 6c 30 20 2d 20 2d 20 63   tab2.col0 - - c
24a90 6f 6c 32 20 2a 20 63 6f 6c 30 20 2a 20 2d 20 63  ol2 * col0 * - c
24aa0 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d  ol2 FROM tab2..-
24ab0 2d 2d 2d 0d 0a 2d 31 31 31 34 36 39 0d 0a 2d 34  ---..-111469..-4
24ac0 38 37 32 0d 0a 2d 35 30 31 35 34 0d 0a 0d 0a 71  872..-50154....q
24ad0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
24ae0 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
24af0 63 6f 6c 32 20 2b 20 63 6f 6c 30 20 2a 20 28 20  col2 + col0 * ( 
24b00 63 6f 6c 31 20 2b 20 63 6f 6c 31 20 29 20 46 52  col1 + col1 ) FR
24b10 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31  OM tab1..----..1
24b20 33 33 37 0d 0a 32 31 30 0d 0a 32 31 37 36 0d 0a  337..210..2176..
24b30 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
24b40 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 30  t..SELECT + col0
24b50 20 2b 20 2b 20 63 6f 6c 32 20 2a 20 2d 20 39 36   + + col2 * - 96
24b60 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
24b70 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 31 34 34 0d  r0..----..-3144.
24b80 0a 2d 36 31 0d 0a 2d 37 37 38 33 0d 0a 0d 0a 71  .-61..-7783....q
24b90 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
24ba0 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 2b 20 63  SELECT ALL + + c
24bb0 6f 6c 30 20 2d 20 63 6f 6c 30 20 2a 20 63 6f 6c  ol0 - col0 * col
24bc0 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  0 FROM tab0 AS c
24bd0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 39 30  or0..----..-1190
24be0 0d 0a 2d 35 35 32 0d 0a 2d 37 38 33 32 0d 0a 0d  ..-552..-7832...
24bf0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
24c00 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 37 33 20  ..SELECT ALL 73 
24c10 2a 20 63 6f 6c 32 20 2b 20 2d 20 63 6f 6c 30 20  * col2 + - col0 
24c20 2a 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 46 52  * + cor0.col2 FR
24c30 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
24c40 0a 2d 2d 2d 2d 0d 0a 2d 36 37 32 0d 0a 33 37 38  .----..-672..378
24c50 30 0d 0a 35 31 33 0d 0a 0d 0a 71 75 65 72 79 20  0..513....query 
24c60 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
24c70 54 20 44 49 53 54 49 4e 43 54 20 28 20 2b 20 63  T DISTINCT ( + c
24c80 6f 6c 32 20 29 20 2a 20 63 6f 6c 31 20 46 52 4f  ol2 ) * col1 FRO
24c90 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab2 cor0..---
24ca0 2d 0d 0a 31 35 33 34 0d 0a 36 34 36 0d 0a 38 33  -..1534..646..83
24cb0 37 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  7....onlyif mysq
24cc0 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72  l # use DIV oper
24cd0 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72  ator for integer
24ce0 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79   division..query
24cf0 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
24d00 2d 31 30 31 37 0d 0a 53 45 4c 45 43 54 20 41 4c  -1017..SELECT AL
24d10 4c 20 2d 20 2d 20 33 39 20 2b 20 63 6f 6c 31 20  L - - 39 + col1 
24d20 44 49 56 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f  DIV + col0 AS co
24d30 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l0 FROM tab0 AS 
24d40 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 34 30 0d 0a  cor0..----..40..
24d50 34 31 0d 0a 34 32 0d 0a 0d 0a 73 6b 69 70 69 66  41..42....skipif
24d60 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
24d70 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
24d80 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
24d90 30 31 37 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  017..SELECT ALL 
24da0 2d 20 2d 20 33 39 20 2b 20 63 6f 6c 31 20 2f 20  - - 39 + col1 / 
24db0 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46  + col0 AS col0 F
24dc0 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
24dd0 0d 0a 2d 2d 2d 2d 0d 0a 34 30 0d 0a 34 31 0d 0a  ..----..40..41..
24de0 34 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  42....query I ro
24df0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
24e00 53 54 49 4e 43 54 20 2b 20 63 6f 6c 31 20 2d 20  STINCT + col1 - 
24e10 2d 20 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46  - col2 AS col1 F
24e20 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
24e30 0d 0a 2d 2d 2d 2d 0d 0a 35 35 0d 0a 35 38 0d 0a  ..----..55..58..
24e40 38 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  85....query I ro
24e50 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
24e60 4c 20 2d 20 63 6f 6c 31 20 2d 20 31 32 20 41 53  L - col1 - 12 AS
24e70 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20   col1 FROM tab0 
24e80 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
24e90 31 30 33 0d 0a 2d 31 30 39 0d 0a 2d 39 38 0d 0a  103..-109..-98..
24ea0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
24eb0 74 0d 0a 53 45 4c 45 43 54 20 2d 20 35 36 20 2d  t..SELECT - 56 -
24ec0 20 32 37 20 46 52 4f 4d 20 74 61 62 32 20 41 53   27 FROM tab2 AS
24ed0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 38 33   cor0..----..-83
24ee0 0d 0a 2d 38 33 0d 0a 2d 38 33 0d 0a 0d 0a 71 75  ..-83..-83....qu
24ef0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
24f00 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b  ELECT DISTINCT +
24f10 20 63 6f 6c 30 20 2a 20 2b 20 28 20 2b 20 63 6f   col0 * + ( + co
24f20 6c 31 20 29 20 2b 20 2d 20 63 6f 6c 31 20 41 53  l1 ) + - col1 AS
24f30 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20   col1 FROM tab1 
24f40 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
24f50 30 32 37 0d 0a 35 32 0d 0a 36 33 30 0d 0a 0d 0a  027..52..630....
24f60 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
24f70 0a 53 45 4c 45 43 54 20 2d 20 2d 20 28 20 2d 20  .SELECT - - ( - 
24f80 63 6f 6c 30 20 29 20 2b 20 63 6f 6c 30 20 2a 20  col0 ) + col0 * 
24f90 2d 20 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46  - col1 AS col2 F
24fa0 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
24fb0 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 34 32 32 0d 0a 2d  ..----..-1422..-
24fc0 32 32 34 0d 0a 2d 34 36 38 30 0d 0a 0d 0a 71 75  224..-4680....qu
24fd0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
24fe0 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 63  ELECT DISTINCT c
24ff0 6f 6c 30 20 2b 20 63 6f 6c 32 20 2a 20 63 6f 6c  ol0 + col2 * col
25000 31 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  1 AS col1 FROM t
25010 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab2 cor0..----..
25020 31 36 31 32 0d 0a 37 32 35 0d 0a 38 34 34 0d 0a  1612..725..844..
25030 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
25040 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
25050 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
25060 0d 0a 53 45 4c 45 43 54 20 43 41 53 54 20 28 20  ..SELECT CAST ( 
25070 2b 20 63 6f 6c 30 20 41 53 20 52 45 41 4c 20 29  + col0 AS REAL )
25080 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
25090 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 0d 0a 36 34 0d  r0..----..3..64.
250a0 0a 38 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .80....query I r
250b0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
250c0 4c 4c 20 2d 20 63 6f 72 30 2e 63 6f 6c 30 20 2b  LL - cor0.col0 +
250d0 20 2b 20 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c 30   + col0 * - col0
250e0 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
250f0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 36 0d 0a 2d  r0..----..-56..-
25100 36 31 36 32 0d 0a 2d 36 33 32 30 0d 0a 0d 0a 6f  6162..-6320....o
25110 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75  nlyif mysql # su
25120 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20  pport for MySQL 
25130 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20  specific system 
25140 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78  types and syntax
25150 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
25160 74 20 6c 61 62 65 6c 2d 31 30 32 36 0d 0a 53 45  t label-1026..SE
25170 4c 45 43 54 20 43 41 53 54 28 20 2b 20 36 32 20  LECT CAST( + 62 
25180 41 53 20 53 49 47 4e 45 44 20 29 20 2b 20 2b 20  AS SIGNED ) + + 
25190 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 63  col1 FROM tab1 c
251a0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 37 32 0d 0a 37  or0..----..72..7
251b0 35 0d 0a 38 38 0d 0a 0d 0a 73 6b 69 70 69 66 20  5..88....skipif 
251c0 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
251d0 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
251e0 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 30  rowsort label-10
251f0 32 36 0d 0a 53 45 4c 45 43 54 20 43 41 53 54 20  26..SELECT CAST 
25200 28 20 2b 20 36 32 20 41 53 20 49 4e 54 45 47 45  ( + 62 AS INTEGE
25210 52 20 29 20 2b 20 2b 20 63 6f 6c 31 20 46 52 4f  R ) + + col1 FRO
25220 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab1 cor0..---
25230 2d 0d 0a 37 32 0d 0a 37 35 0d 0a 38 38 0d 0a 0d  -..72..75..88...
25240 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
25250 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63  ..SELECT ALL - c
25260 6f 6c 30 20 2b 20 2b 20 28 20 63 6f 72 30 2e 63  ol0 + + ( cor0.c
25270 6f 6c 30 20 29 20 2a 20 2b 20 34 32 20 46 52 4f  ol0 ) * + 42 FRO
25280 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
25290 2d 2d 2d 2d 0d 0a 31 32 33 0d 0a 32 36 32 34 0d  ----..123..2624.
252a0 0a 33 32 38 30 0d 0a 0d 0a 71 75 65 72 79 20 49  .3280....query I
252b0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
252c0 20 44 49 53 54 49 4e 43 54 20 2b 20 2d 20 63 6f   DISTINCT + - co
252d0 6c 31 20 2d 20 63 6f 6c 32 20 41 53 20 63 6f 6c  l1 - col2 AS col
252e0 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  1 FROM tab2 AS c
252f0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 35 0d 0a  or0..----..-55..
25300 2d 35 38 0d 0a 2d 38 35 0d 0a 0d 0a 71 75 65 72  -58..-85....quer
25310 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
25320 45 43 54 20 63 6f 72 30 2e 63 6f 6c 32 20 2a 20  ECT cor0.col2 * 
25330 2d 20 35 31 20 2d 20 63 6f 6c 31 20 46 52 4f 4d  - 51 - col1 FROM
25340 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
25350 2d 2d 2d 0d 0a 2d 32 37 38 30 0d 0a 2d 32 39 31  ---..-2780..-291
25360 37 0d 0a 2d 34 39 30 39 0d 0a 0d 0a 73 6b 69 70  7..-4909....skip
25370 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20  if postgresql # 
25380 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69  PostgreSQL requi
25390 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61  res AS when rena
253a0 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75  ming output colu
253b0 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  mns..query I row
253c0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 31 30 20  sort..SELECT 10 
253d0 2b 20 2d 20 63 6f 6c 31 20 63 6f 6c 30 20 46 52  + - col1 col0 FR
253e0 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
253f0 0a 2d 2d 2d 2d 0d 0a 2d 31 36 0d 0a 2d 33 0d 0a  .----..-16..-3..
25400 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  0....onlyif mysq
25410 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72  l # use DIV oper
25420 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72  ator for integer
25430 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79   division..query
25440 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
25450 2d 31 30 33 31 0d 0a 53 45 4c 45 43 54 20 28 20  -1031..SELECT ( 
25460 37 37 20 29 20 2b 20 2d 20 63 6f 6c 31 20 44 49  77 ) + - col1 DI
25470 56 20 2b 20 39 20 41 53 20 63 6f 6c 31 20 46 52  V + 9 AS col1 FR
25480 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 37  OM tab1..----..7
25490 35 0d 0a 37 36 0d 0a 37 36 0d 0a 0d 0a 73 6b 69  5..76..76....ski
254a0 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
254b0 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
254c0 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
254d0 6c 2d 31 30 33 31 0d 0a 53 45 4c 45 43 54 20 28  l-1031..SELECT (
254e0 20 37 37 20 29 20 2b 20 2d 20 63 6f 6c 31 20 2f   77 ) + - col1 /
254f0 20 2b 20 39 20 41 53 20 63 6f 6c 31 20 46 52 4f   + 9 AS col1 FRO
25500 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 37 35  M tab1..----..75
25510 0d 0a 37 36 0d 0a 37 36 0d 0a 0d 0a 73 6b 69 70  ..76..76....skip
25520 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20  if postgresql # 
25530 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69  PostgreSQL requi
25540 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61  res AS when rena
25550 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75  ming output colu
25560 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  mns..query I row
25570 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63  sort..SELECT + c
25580 6f 72 30 2e 63 6f 6c 31 20 2a 20 63 6f 72 30 2e  or0.col1 * cor0.
25590 63 6f 6c 32 20 2b 20 63 6f 72 30 2e 63 6f 6c 30  col2 + cor0.col0
255a0 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20   col0 FROM tab2 
255b0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
255c0 36 31 32 0d 0a 37 32 35 0d 0a 38 34 34 0d 0a 0d  612..725..844...
255d0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
255e0 0d 0a 53 45 4c 45 43 54 20 63 6f 72 31 2e 63 6f  ..SELECT cor1.co
255f0 6c 30 20 46 52 4f 4d 20 74 61 62 32 2c 20 74 61  l0 FROM tab2, ta
25600 62 30 20 41 53 20 63 6f 72 30 2c 20 74 61 62 32  b0 AS cor0, tab2
25610 20 41 53 20 63 6f 72 31 2c 20 74 61 62 32 20 41   AS cor1, tab2 A
25620 53 20 63 6f 72 32 0d 0a 2d 2d 2d 2d 0d 0a 38 31  S cor2..----..81
25630 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20   values hashing 
25640 74 6f 20 30 35 38 33 35 66 32 39 64 64 39 63 64  to 05835f29dd9cd
25650 34 66 61 31 36 38 38 39 64 65 35 34 64 65 63 33  4fa16889de54dec3
25660 63 62 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  cb6....query I r
25670 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
25680 4c 4c 20 2b 20 63 6f 6c 32 20 2a 20 2b 20 63 6f  LL + col2 * + co
25690 6c 31 20 2b 20 35 20 46 52 4f 4d 20 74 61 62 32  l1 + 5 FROM tab2
256a0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
256b0 31 35 33 39 0d 0a 36 35 31 0d 0a 38 34 32 0d 0a  1539..651..842..
256c0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
256d0 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20  t..SELECT ALL - 
256e0 2b 20 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c 31 20  + col0 + - col1 
256f0 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
25700 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  0 cor0..----..-1
25710 31 30 0d 0a 2d 31 33 32 0d 0a 2d 31 38 30 0d 0a  10..-132..-180..
25720 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
25730 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
25740 43 54 20 33 32 20 2a 20 63 6f 6c 32 20 46 52 4f  CT 32 * col2 FRO
25750 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
25760 2d 2d 2d 2d 0d 0a 31 37 32 38 0d 0a 31 38 32 34  ----..1728..1824
25770 0d 0a 33 30 37 32 0d 0a 0d 0a 73 6b 69 70 69 66  ..3072....skipif
25780 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f   postgresql # Po
25790 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65  stgreSQL require
257a0 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69  s AS when renami
257b0 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e  ng output column
257c0 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  s..query I rowso
257d0 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 72 31 2e  rt..SELECT cor1.
257e0 63 6f 6c 32 20 63 6f 6c 30 20 46 52 4f 4d 20 74  col2 col0 FROM t
257f0 61 62 30 20 41 53 20 63 6f 72 30 20 43 52 4f 53  ab0 AS cor0 CROS
25800 53 20 4a 4f 49 4e 20 74 61 62 32 20 41 53 20 63  S JOIN tab2 AS c
25810 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c  or1..----..9 val
25820 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 35  ues hashing to 5
25830 39 31 31 62 61 63 35 31 34 34 31 66 34 66 66 36  911bac51441f4ff6
25840 34 30 62 32 61 32 62 37 32 31 65 61 38 65 33 0d  40b2a2b721ea8e3.
25850 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
25860 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c  rt..SELECT + col
25870 32 20 2a 20 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c  2 * col0 + - col
25880 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  0 AS col1 FROM t
25890 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
258a0 2d 0d 0a 31 35 39 0d 0a 33 35 38 34 0d 0a 37 36  -..159..3584..76
258b0 30 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  00....query I ro
258c0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 31 38  wsort..SELECT 18
258d0 20 2d 20 2d 20 63 6f 6c 32 20 2a 20 2b 20 31 34   - - col2 * + 14
258e0 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
258f0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33 36 32 0d 0a  r0..----..1362..
25900 37 37 34 0d 0a 38 31 36 0d 0a 0d 0a 71 75 65 72  774..816....quer
25910 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
25920 45 43 54 20 41 4c 4c 20 2d 20 63 6f 72 30 2e 63  ECT ALL - cor0.c
25930 6f 6c 32 20 2b 20 63 6f 6c 31 20 2a 20 2b 20 36  ol2 + col1 * + 6
25940 34 20 2b 20 2d 20 63 6f 6c 30 20 46 52 4f 4d 20  4 + - col0 FROM 
25950 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
25960 2d 2d 0d 0a 35 34 34 37 0d 0a 35 36 35 33 0d 0a  --..5447..5653..
25970 36 31 37 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20  6172....query I 
25980 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
25990 2d 20 2d 20 63 6f 6c 31 20 2b 20 63 6f 6c 31 20  - - col1 + col1 
259a0 2a 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32  * col0 FROM tab2
259b0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
259c0 31 33 36 30 0d 0a 32 34 38 0d 0a 34 36 36 31 0d  1360..248..4661.
259d0 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
259e0 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74  # use DIV operat
259f0 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64  or for integer d
25a00 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49  ivision..query I
25a10 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
25a20 30 34 32 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f  042..SELECT + co
25a30 72 30 2e 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c 32  r0.col2 * - col2
25a40 20 2d 20 2b 20 63 6f 6c 32 20 44 49 56 20 63 6f   - + col2 DIV co
25a50 6c 31 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  l1 col2 FROM tab
25a60 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
25a70 0a 2d 32 39 31 38 0d 0a 2d 33 32 35 34 0d 0a 2d  .-2918..-3254..-
25a80 39 32 32 33 0d 0a 0d 0a 73 6b 69 70 69 66 20 70  9223....skipif p
25a90 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74  ostgresql # Post
25aa0 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20  greSQL requires 
25ab0 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67  AS when renaming
25ac0 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d   output columns.
25ad0 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
25ae0 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
25af0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
25b00 6c 61 62 65 6c 2d 31 30 34 32 0d 0a 53 45 4c 45  label-1042..SELE
25b10 43 54 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 2a  CT + cor0.col2 *
25b20 20 2d 20 63 6f 6c 32 20 2d 20 2b 20 63 6f 6c 32   - col2 - + col2
25b30 20 2f 20 63 6f 6c 31 20 63 6f 6c 32 20 46 52 4f   / col1 col2 FRO
25b40 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
25b50 2d 2d 2d 2d 0d 0a 2d 32 39 31 38 0d 0a 2d 33 32  ----..-2918..-32
25b60 35 34 0d 0a 2d 39 32 32 33 0d 0a 0d 0a 73 6b 69  54..-9223....ski
25b70 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
25b80 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
25b90 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
25ba0 45 43 54 20 28 20 63 6f 6c 32 20 29 20 2f 20 43  ECT ( col2 ) / C
25bb0 41 53 54 20 28 20 2d 20 31 20 41 53 20 52 45 41  AST ( - 1 AS REA
25bc0 4c 20 29 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20  L ) + col1 FROM 
25bd0 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
25be0 2d 2d 0d 0a 2d 32 38 0d 0a 2d 34 37 0d 0a 2d 38  --..-28..-47..-8
25bf0 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  3....query I row
25c00 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 39 34 20  sort..SELECT 94 
25c10 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
25c20 30 2c 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  0, tab1 AS cor0.
25c30 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20  .----..9 values 
25c40 68 61 73 68 69 6e 67 20 74 6f 20 62 30 66 66 62  hashing to b0ffb
25c50 37 35 32 37 66 34 66 62 66 34 34 66 33 30 39 34  7527f4fbf44f3094
25c60 35 65 31 63 63 62 35 38 63 32 34 0d 0a 0d 0a 71  5e1ccb58c24....q
25c70 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
25c80 53 45 4c 45 43 54 20 36 37 20 2b 20 2d 20 63 6f  SELECT 67 + - co
25c90 6c 31 20 2a 20 2b 20 63 6f 6c 31 20 2b 20 74 61  l1 * + col1 + ta
25ca0 62 30 2e 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  b0.col2 FROM tab
25cb0 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 37 32 39 36 0d 0a  0..----..-7296..
25cc0 2d 38 31 33 32 0d 0a 2d 39 33 34 31 0d 0a 0d 0a  -8132..-9341....
25cd0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
25ce0 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
25cf0 20 2d 20 74 61 62 31 2e 63 6f 6c 32 20 41 53 20   - tab1.col2 AS 
25d00 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 2c 20  col1 FROM tab1, 
25d10 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
25d20 2d 2d 0d 0a 2d 35 34 0d 0a 2d 35 37 0d 0a 2d 39  --..-54..-57..-9
25d30 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  6....query I row
25d40 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
25d50 20 2d 20 63 6f 72 30 2e 63 6f 6c 30 20 2b 20 35   - cor0.col0 + 5
25d60 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  2 FROM tab2 AS c
25d70 6f 72 30 20 43 52 4f 53 53 20 4a 4f 49 4e 20 74  or0 CROSS JOIN t
25d80 61 62 31 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a  ab1 cor1..----..
25d90 39 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67  9 values hashing
25da0 20 74 6f 20 65 35 32 32 33 37 37 36 34 34 30 32   to e52237764402
25db0 36 32 38 35 66 63 66 31 61 31 32 37 33 62 34 66  6285fcf1a1273b4f
25dc0 64 35 32 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20  d522....query I 
25dd0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
25de0 41 4c 4c 20 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c  ALL col2 * - col
25df0 30 20 2b 20 63 6f 6c 31 20 2a 20 63 6f 6c 30 20  0 + col1 * col0 
25e00 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
25e10 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
25e20 0a 31 32 37 32 0d 0a 33 33 36 30 0d 0a 38 30 31  .1272..3360..801
25e30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
25e40 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61   # use DIV opera
25e50 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20  tor for integer 
25e60 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20  division..query 
25e70 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
25e80 31 30 34 39 0d 0a 53 45 4c 45 43 54 20 63 6f 6c  1049..SELECT col
25e90 31 20 2a 20 2b 20 63 6f 6c 30 20 2d 20 2d 20 39  1 * + col0 - - 9
25ea0 38 20 44 49 56 20 63 6f 6c 30 20 46 52 4f 4d 20  8 DIV col0 FROM 
25eb0 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
25ec0 2d 2d 0d 0a 31 33 34 34 0d 0a 32 33 31 0d 0a 34  --..1344..231..4
25ed0 36 30 33 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  603....skipif my
25ee0 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
25ef0 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
25f00 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 30 34 39  wsort label-1049
25f10 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 31 20 2a 20  ..SELECT col1 * 
25f20 2b 20 63 6f 6c 30 20 2d 20 2d 20 39 38 20 2f 20  + col0 - - 98 / 
25f30 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41  col0 FROM tab2 A
25f40 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33  S cor0..----..13
25f50 34 34 0d 0a 32 33 31 0d 0a 34 36 30 33 0d 0a 0d  44..231..4603...
25f60 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
25f70 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 28 20 63  ..SELECT ALL ( c
25f80 6f 6c 30 20 29 20 2a 20 2b 20 63 6f 6c 31 20 2b  ol0 ) * + col1 +
25f90 20 2d 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62   - col0 FROM tab
25fa0 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
25fb0 0a 35 37 36 0d 0a 37 35 0d 0a 39 36 30 0d 0a 0d  .576..75..960...
25fc0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
25fd0 0d 0a 53 45 4c 45 43 54 20 2d 20 33 34 20 41 53  ..SELECT - 34 AS
25fe0 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20   col2 FROM tab0 
25ff0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 34 0d  cor0..----..-34.
26000 0a 2d 33 34 0d 0a 2d 33 34 0d 0a 0d 0a 73 6b 69  .-34..-34....ski
26010 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23  pif postgresql #
26020 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75   PostgreSQL requ
26030 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e  ires AS when ren
26040 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c  aming output col
26050 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f  umns..query I ro
26060 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
26070 53 54 49 4e 43 54 20 2b 20 63 6f 6c 31 20 2d 20  STINCT + col1 - 
26080 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c 31 20 63 6f  col0 * - col1 co
26090 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l1 FROM tab1 AS 
260a0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 34 0d  cor0..----..104.
260b0 0a 31 30 35 33 0d 0a 36 35 30 0d 0a 0d 0a 71 75  .1053..650....qu
260c0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
260d0 45 4c 45 43 54 20 63 6f 72 30 2e 63 6f 6c 32 20  ELECT cor0.col2 
260e0 2a 20 2d 20 37 37 20 41 53 20 63 6f 6c 30 20 46  * - 77 AS col0 F
260f0 52 4f 4d 20 74 61 62 31 2c 20 74 61 62 31 20 63  ROM tab1, tab1 c
26100 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c  or0..----..9 val
26110 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 32  ues hashing to 2
26120 61 61 37 39 66 65 39 31 35 66 38 37 63 38 61 62  aa79fe915f87c8ab
26130 39 62 65 34 31 37 66 62 35 64 36 63 31 65 62 0d  9be417fb5d6c1eb.
26140 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
26150 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2d 20 39  rt..SELECT - - 9
26160 33 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  3 AS col2 FROM t
26170 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
26180 2d 0d 0a 39 33 0d 0a 39 33 0d 0a 39 33 0d 0a 0d  -..93..93..93...
26190 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
261a0 0d 0a 53 45 4c 45 43 54 20 2b 20 37 33 20 41 53  ..SELECT + 73 AS
261b0 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20   col0 FROM tab0 
261c0 63 6f 72 30 20 43 52 4f 53 53 20 4a 4f 49 4e 20  cor0 CROSS JOIN 
261d0 74 61 62 32 2c 20 74 61 62 31 20 41 53 20 63 6f  tab2, tab1 AS co
261e0 72 31 2c 20 74 61 62 32 20 41 53 20 63 6f 72 32  r1, tab2 AS cor2
261f0 0d 0a 2d 2d 2d 2d 0d 0a 38 31 20 76 61 6c 75 65  ..----..81 value
26200 73 20 68 61 73 68 69 6e 67 20 74 6f 20 39 66 30  s hashing to 9f0
26210 66 33 37 31 64 39 37 39 65 37 30 61 37 39 32 63  f371d979e70a792c
26220 38 35 39 37 63 36 35 35 39 66 30 65 32 0d 0a 0d  8597c6559f0e2...
26230 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
26240 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51  support for MySQ
26250 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65  L specific syste
26260 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74  m types and synt
26270 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ax..query I rows
26280 6f 72 74 20 6c 61 62 65 6c 2d 31 30 35 36 0d 0a  ort label-1056..
26290 53 45 4c 45 43 54 20 63 6f 6c 30 20 2b 20 2d 20  SELECT col0 + - 
262a0 43 41 53 54 28 20 63 6f 6c 30 20 41 53 20 53 49  CAST( col0 AS SI
262b0 47 4e 45 44 20 29 20 2a 20 2d 20 74 61 62 32 2e  GNED ) * - tab2.
262c0 63 6f 6c 30 20 63 6f 6c 31 20 46 52 4f 4d 20 74  col0 col1 FROM t
262d0 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 35 36 0d 0a 36  ab2..----..56..6
262e0 31 36 32 0d 0a 36 33 32 30 0d 0a 0d 0a 73 6b 69  162..6320....ski
262f0 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23  pif postgresql #
26300 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75   PostgreSQL requ
26310 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e  ires AS when ren
26320 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c  aming output col
26330 75 6d 6e 73 0d 0a 73 6b 69 70 69 66 20 6d 79 73  umns..skipif mys
26340 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
26350 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
26360 73 6f 72 74 20 6c 61 62 65 6c 2d 31 30 35 36 0d  sort label-1056.
26370 0a 53 45 4c 45 43 54 20 63 6f 6c 30 20 2b 20 2d  .SELECT col0 + -
26380 20 43 41 53 54 20 28 20 63 6f 6c 30 20 41 53 20   CAST ( col0 AS 
26390 49 4e 54 45 47 45 52 20 29 20 2a 20 2d 20 74 61  INTEGER ) * - ta
263a0 62 32 2e 63 6f 6c 30 20 63 6f 6c 31 20 46 52 4f  b2.col0 col1 FRO
263b0 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 35 36  M tab2..----..56
263c0 0d 0a 36 31 36 32 0d 0a 36 33 32 30 0d 0a 0d 0a  ..6162..6320....
263d0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
263e0 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 37 33  .SELECT ALL - 73
263f0 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
26400 72 30 20 43 52 4f 53 53 20 4a 4f 49 4e 20 74 61  r0 CROSS JOIN ta
26410 62 31 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d  b1 AS cor1..----
26420 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68 69  ..9 values hashi
26430 6e 67 20 74 6f 20 38 34 61 62 39 64 62 35 34 36  ng to 84ab9db546
26440 38 62 34 61 31 37 38 31 62 64 38 64 35 63 38 65  8b4a1781bd8d5c8e
26450 30 65 37 37 66 63 0d 0a 0d 0a 71 75 65 72 79 20  0e77fc....query 
26460 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
26470 54 20 41 4c 4c 20 2d 20 28 20 2d 20 34 38 20 29  T ALL - ( - 48 )
26480 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
26490 62 30 2c 20 74 61 62 31 20 41 53 20 63 6f 72 30  b0, tab1 AS cor0
264a0 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73  ..----..9 values
264b0 20 68 61 73 68 69 6e 67 20 74 6f 20 38 62 30 39   hashing to 8b09
264c0 63 63 32 63 39 39 63 32 31 30 32 30 33 36 31 36  cc2c99c210203616
264d0 32 64 30 36 33 65 30 65 35 61 34 62 0d 0a 0d 0a  2d063e0e5a4b....
264e0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
264f0 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
26500 20 28 20 2b 20 63 6f 6c 31 20 29 20 2a 20 63 6f   ( + col1 ) * co
26510 6c 32 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d  l2 FROM tab0..--
26520 2d 2d 0d 0a 32 38 33 38 0d 0a 37 34 36 32 0d 0a  --..2838..7462..
26530 39 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  97....query I ro
26540 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
26550 32 32 20 2a 20 2d 20 63 6f 6c 30 20 2a 20 63 6f  22 * - col0 * co
26560 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l2 FROM tab0 AS 
26570 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 36 30 35  cor0..----..1605
26580 35 36 0d 0a 31 37 34 32 34 0d 0a 37 37 30 0d 0a  56..17424..770..
26590 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
265a0 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
265b0 43 54 20 63 6f 6c 30 20 2a 20 63 6f 72 30 2e 63  CT col0 * cor0.c
265c0 6f 6c 30 20 2a 20 63 6f 6c 32 20 41 53 20 63 6f  ol0 * col2 AS co
265d0 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72  l2 FROM tab0 cor
265e0 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 32 35 0d 0a 31  0..----..1225..1
265f0 39 30 30 38 0d 0a 36 34 39 35 32 32 0d 0a 0d 0a  9008..649522....
26600 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71  skipif postgresq
26610 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72  l # PostgreSQL r
26620 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20  equires AS when 
26630 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20  renaming output 
26640 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49  columns..query I
26650 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
26660 20 2b 20 63 6f 6c 32 20 2b 20 2b 20 63 6f 6c 32   + col2 + + col2
26670 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d   col0 FROM tab0.
26680 0a 2d 2d 2d 2d 0d 0a 31 36 34 0d 0a 32 0d 0a 36  .----..164..2..6
26690 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  6....query I row
266a0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
266b0 20 2d 20 28 20 38 39 20 29 20 2a 20 63 6f 6c 32   - ( 89 ) * col2
266c0 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
266d0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 39 33 37 0d  r0..----..-2937.
266e0 0a 2d 37 32 39 38 0d 0a 2d 38 39 0d 0a 0d 0a 71  .-7298..-89....q
266f0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
26700 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
26710 2d 20 36 34 20 2a 20 2b 20 74 61 62 31 2e 63 6f  - 64 * + tab1.co
26720 6c 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  l0 AS col2 FROM 
26730 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 39 32  tab1..----..-192
26740 0d 0a 2d 34 30 39 36 0d 0a 2d 35 31 32 30 0d 0a  ..-4096..-5120..
26750 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65  ..skipif postgre
26760 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c  sql # PostgreSQL
26770 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65   requires AS whe
26780 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75  n renaming outpu
26790 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79  t columns..query
267a0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
267b0 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63 6f  CT DISTINCT + co
267c0 72 30 2e 63 6f 6c 30 20 2a 20 2b 20 31 36 20 63  r0.col0 * + 16 c
267d0 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 63 6f  ol0 FROM tab0 co
267e0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 34 32 34 0d 0a  r0..----..1424..
267f0 33 38 34 0d 0a 35 36 30 0d 0a 0d 0a 71 75 65 72  384..560....quer
26800 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
26810 45 43 54 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20  ECT + cor0.col2 
26820 2b 20 2d 20 63 6f 6c 32 20 2a 20 2b 20 31 36 20  + - col2 * + 16 
26830 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
26840 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 34 34 30 0d 0a  0..----..-1440..
26850 2d 38 31 30 0d 0a 2d 38 35 35 0d 0a 0d 0a 71 75  -810..-855....qu
26860 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
26870 45 4c 45 43 54 20 2b 20 63 6f 6c 31 20 2a 20 2d  ELECT + col1 * -
26880 20 63 6f 6c 30 20 2a 20 63 6f 72 30 2e 63 6f 6c   col0 * cor0.col
26890 32 20 46 52 4f 4d 20 74 61 62 32 20 63 6f 72 30  2 FROM tab2 cor0
268a0 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 39 36 35 32 0d  ..----..-119652.
268b0 0a 2d 35 31 30 33 34 0d 0a 2d 35 38 35 39 0d 0a  .-51034..-5859..
268c0 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65  ..skipif postgre
268d0 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c  sql # PostgreSQL
268e0 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65   requires AS whe
268f0 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75  n renaming outpu
26900 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79  t columns..query
26910 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
26920 43 54 20 63 6f 6c 32 20 2a 20 2b 20 63 6f 72 30  CT col2 * + cor0
26930 2e 63 6f 6c 32 20 63 6f 6c 32 20 46 52 4f 4d 20  .col2 col2 FROM 
26940 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
26950 2d 2d 0d 0a 31 0d 0a 31 30 38 39 0d 0a 36 37 32  --..1..1089..672
26960 34 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  4....onlyif mysq
26970 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72  l # use DIV oper
26980 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72  ator for integer
26990 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79   division..query
269a0 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
269b0 2d 31 30 36 39 0d 0a 53 45 4c 45 43 54 20 2d 20  -1069..SELECT - 
269c0 2d 20 63 6f 6c 31 20 2b 20 63 6f 6c 32 20 44 49  - col1 + col2 DI
269d0 56 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61  V + col0 FROM ta
269e0 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
269f0 0d 0a 31 37 0d 0a 33 34 0d 0a 35 39 0d 0a 0d 0a  ..17..34..59....
26a00 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
26a10 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
26a20 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
26a30 61 62 65 6c 2d 31 30 36 39 0d 0a 53 45 4c 45 43  abel-1069..SELEC
26a40 54 20 2d 20 2d 20 63 6f 6c 31 20 2b 20 63 6f 6c  T - - col1 + col
26a50 32 20 2f 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20  2 / + col0 FROM 
26a60 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
26a70 2d 2d 0d 0a 31 37 0d 0a 33 34 0d 0a 35 39 0d 0a  --..17..34..59..
26a80 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
26a90 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 30 20 2a  t..SELECT col0 *
26aa0 20 37 34 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d   74 AS col0 FROM
26ab0 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 37 37   tab0..----..177
26ac0 36 0d 0a 32 35 39 30 0d 0a 36 35 38 36 0d 0a 0d  6..2590..6586...
26ad0 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
26ae0 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72  use DIV operator
26af0 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76   for integer div
26b00 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72  ision..query I r
26b10 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 30 37  owsort label-107
26b20 31 0d 0a 53 45 4c 45 43 54 20 2d 20 74 61 62 30  1..SELECT - tab0
26b30 2e 63 6f 6c 31 20 44 49 56 20 2b 20 63 6f 6c 30  .col1 DIV + col0
26b40 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d   FROM tab0..----
26b50 0d 0a 2d 31 0d 0a 2d 32 0d 0a 2d 33 0d 0a 0d 0a  ..-1..-2..-3....
26b60 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
26b70 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
26b80 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
26b90 61 62 65 6c 2d 31 30 37 31 0d 0a 53 45 4c 45 43  abel-1071..SELEC
26ba0 54 20 2d 20 74 61 62 30 2e 63 6f 6c 31 20 2f 20  T - tab0.col1 / 
26bb0 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30  + col0 FROM tab0
26bc0 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 2d 32 0d 0a  ..----..-1..-2..
26bd0 2d 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  -3....query I ro
26be0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 74 61  wsort..SELECT ta
26bf0 62 31 2e 63 6f 6c 32 20 2a 20 33 34 20 41 53 20  b1.col2 * 34 AS 
26c00 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 2c 20  col0 FROM tab1, 
26c10 74 61 62 30 20 41 53 20 63 6f 72 30 2c 20 74 61  tab0 AS cor0, ta
26c20 62 31 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d  b1 AS cor1..----
26c30 0d 0a 32 37 20 76 61 6c 75 65 73 20 68 61 73 68  ..27 values hash
26c40 69 6e 67 20 74 6f 20 39 61 37 36 66 33 30 39 66  ing to 9a76f309f
26c50 33 39 31 62 62 33 36 62 36 36 65 65 62 33 31 61  391bb36b66eeb31a
26c60 39 33 30 39 64 65 30 0d 0a 0d 0a 71 75 65 72 79  9309de0....query
26c70 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
26c80 43 54 20 63 6f 72 30 2e 63 6f 6c 32 20 2a 20 63  CT cor0.col2 * c
26c90 6f 6c 31 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f  ol1 + col0 AS co
26ca0 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l0 FROM tab2 AS 
26cb0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 36 31 32  cor0..----..1612
26cc0 0d 0a 37 32 35 0d 0a 38 34 34 0d 0a 0d 0a 71 75  ..725..844....qu
26cd0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
26ce0 45 4c 45 43 54 20 2b 20 2b 20 63 6f 72 30 2e 63  ELECT + + cor0.c
26cf0 6f 6c 32 20 2b 20 2b 20 28 20 2b 20 63 6f 6c 32  ol2 + + ( + col2
26d00 20 2b 20 63 6f 6c 32 20 29 20 41 53 20 63 6f 6c   + col2 ) AS col
26d10 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  1 FROM tab1 AS c
26d20 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 36 32 0d 0a  or0..----..162..
26d30 31 37 31 0d 0a 32 38 38 0d 0a 0d 0a 71 75 65 72  171..288....quer
26d40 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
26d50 45 43 54 20 2b 20 28 20 2d 20 63 6f 6c 30 20 29  ECT + ( - col0 )
26d60 20 2d 20 2d 20 63 6f 6c 31 20 46 52 4f 4d 20 74   - - col1 FROM t
26d70 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
26d80 2d 0d 0a 2d 35 34 0d 0a 2d 36 37 0d 0a 32 33 0d  -..-54..-67..23.
26d90 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
26da0 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79  # support for My
26db0 53 51 4c 20 73 70 65 63 69 66 69 63 20 73 79 73  SQL specific sys
26dc0 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79  tem types and sy
26dd0 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f  ntax..query I ro
26de0 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 30 37 36  wsort label-1076
26df0 0d 0a 53 45 4c 45 43 54 20 43 41 53 54 28 20 4e  ..SELECT CAST( N
26e00 55 4c 4c 20 41 53 20 53 49 47 4e 45 44 20 29 20  ULL AS SIGNED ) 
26e10 2b 20 2d 20 63 6f 6c 30 20 41 53 20 63 6f 6c 32  + - col0 AS col2
26e20 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
26e30 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a  r0..----..NULL..
26e40 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b  NULL..NULL....sk
26e50 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
26e60 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
26e70 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
26e80 65 6c 2d 31 30 37 36 0d 0a 53 45 4c 45 43 54 20  el-1076..SELECT 
26e90 43 41 53 54 20 28 20 4e 55 4c 4c 20 41 53 20 49  CAST ( NULL AS I
26ea0 4e 54 45 47 45 52 20 29 20 2b 20 2d 20 63 6f 6c  NTEGER ) + - col
26eb0 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  0 AS col2 FROM t
26ec0 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
26ed0 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e  -..NULL..NULL..N
26ee0 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f  ULL....skipif po
26ef0 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67  stgresql # Postg
26f00 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41  reSQL requires A
26f10 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20  S when renaming 
26f20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a  output columns..
26f30 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
26f40 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 2d 20  .SELECT ALL + - 
26f50 36 34 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  64 col1 FROM tab
26f60 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 36  1 cor0..----..-6
26f70 34 0d 0a 2d 36 34 0d 0a 2d 36 34 0d 0a 0d 0a 6f  4..-64..-64....o
26f80 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75  nlyif mysql # su
26f90 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20  pport for MySQL 
26fa0 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20  specific system 
26fb0 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78  types and syntax
26fc0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
26fd0 74 20 6c 61 62 65 6c 2d 31 30 37 38 0d 0a 53 45  t label-1078..SE
26fe0 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 43 41  LECT DISTINCT CA
26ff0 53 54 28 20 4e 55 4c 4c 20 41 53 20 44 45 43 49  ST( NULL AS DECI
27000 4d 41 4c 20 29 20 2a 20 63 6f 6c 30 20 2b 20 63  MAL ) * col0 + c
27010 6f 6c 32 20 2a 20 28 20 2b 20 63 6f 6c 31 20 29  ol2 * ( + col1 )
27020 20 2a 20 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20   * col1 AS col0 
27030 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
27040 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 0d  0..----..NULL...
27050 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
27060 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
27070 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
27080 6c 61 62 65 6c 2d 31 30 37 38 0d 0a 53 45 4c 45  label-1078..SELE
27090 43 54 20 44 49 53 54 49 4e 43 54 20 43 41 53 54  CT DISTINCT CAST
270a0 20 28 20 4e 55 4c 4c 20 41 53 20 52 45 41 4c 20   ( NULL AS REAL 
270b0 29 20 2a 20 63 6f 6c 30 20 2b 20 63 6f 6c 32 20  ) * col0 + col2 
270c0 2a 20 28 20 2b 20 63 6f 6c 31 20 29 20 2a 20 63  * ( + col1 ) * c
270d0 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  ol1 AS col0 FROM
270e0 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
270f0 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75 65  ---..NULL....que
27100 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
27110 4c 45 43 54 20 2d 20 2b 20 32 39 20 2b 20 2d 20  LECT - + 29 + - 
27120 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c 31 20 2a 20  col2 * + col1 * 
27130 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41  col0 FROM tab2 A
27140 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
27150 31 39 36 38 31 0d 0a 2d 35 31 30 36 33 0d 0a 2d  19681..-51063..-
27160 35 38 38 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20  5888....query I 
27170 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
27180 44 49 53 54 49 4e 43 54 20 2d 20 33 31 20 2b 20  DISTINCT - 31 + 
27190 2d 20 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46  - col2 AS col1 F
271a0 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
271b0 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32 37 0d 0a 2d 38  ..----..-127..-8
271c0 35 0d 0a 2d 38 38 0d 0a 0d 0a 71 75 65 72 79 20  5..-88....query 
271d0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
271e0 54 20 2d 20 63 6f 6c 32 20 2a 20 63 6f 6c 31 20  T - col2 * col1 
271f0 2b 20 31 32 20 2b 20 2d 20 33 33 20 41 53 20 63  + 12 + - 33 AS c
27200 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol0 FROM tab2 AS
27210 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 35   cor0..----..-15
27220 35 35 0d 0a 2d 36 36 37 0d 0a 2d 38 35 38 0d 0a  55..-667..-858..
27230 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
27240 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f   use DIV operato
27250 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69  r for integer di
27260 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20  vision..query I 
27270 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 30  rowsort label-10
27280 38 32 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c  82..SELECT - col
27290 31 20 2a 20 63 6f 72 30 2e 63 6f 6c 31 20 44 49  1 * cor0.col1 DI
272a0 56 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 46 52  V + cor0.col1 FR
272b0 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
272c0 0a 2d 2d 2d 2d 0d 0a 2d 31 30 0d 0a 2d 31 33 0d  .----..-10..-13.
272d0 0a 2d 32 36 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  .-26....skipif m
272e0 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
272f0 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
27300 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 30 38  owsort label-108
27310 32 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 31  2..SELECT - col1
27320 20 2a 20 63 6f 72 30 2e 63 6f 6c 31 20 2f 20 2b   * cor0.col1 / +
27330 20 63 6f 72 30 2e 63 6f 6c 31 20 46 52 4f 4d 20   cor0.col1 FROM 
27340 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
27350 2d 2d 0d 0a 2d 31 30 0d 0a 2d 31 33 0d 0a 2d 32  --..-10..-13..-2
27360 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  6....query I row
27370 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 36  sort..SELECT - 6
27380 32 20 2a 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f  2 * + col0 AS co
27390 6c 30 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d  l0 FROM tab2..--
273a0 2d 2d 0d 0a 2d 34 33 34 0d 0a 2d 34 38 33 36 0d  --..-434..-4836.
273b0 0a 2d 34 38 39 38 0d 0a 0d 0a 71 75 65 72 79 20  .-4898....query 
273c0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
273d0 54 20 28 20 63 6f 6c 31 20 29 20 2a 20 63 6f 6c  T ( col1 ) * col
273e0 32 20 2a 20 2b 20 31 39 20 46 52 4f 4d 20 74 61  2 * + 19 FROM ta
273f0 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 30 38 33 30 0d  b1..----..10830.
27400 0a 32 33 37 31 32 0d 0a 32 36 36 37 36 0d 0a 0d  .23712..26676...
27410 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
27420 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72  use DIV operator
27430 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76   for integer div
27440 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72  ision..query I r
27450 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 30 38  owsort label-108
27460 35 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 32  5..SELECT - col2
27470 20 44 49 56 20 38 39 20 46 52 4f 4d 20 74 61 62   DIV 89 FROM tab
27480 32 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30  2..----..0..0..0
27490 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
274a0 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
274b0 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
274c0 72 74 20 6c 61 62 65 6c 2d 31 30 38 35 0d 0a 53  rt label-1085..S
274d0 45 4c 45 43 54 20 2d 20 63 6f 6c 32 20 2f 20 38  ELECT - col2 / 8
274e0 39 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d  9 FROM tab2..---
274f0 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a 73 6b  -..0..0..0....sk
27500 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20  ipif postgresql 
27510 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71  # PostgreSQL req
27520 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65  uires AS when re
27530 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f  naming output co
27540 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72  lumns..query I r
27550 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63  owsort..SELECT c
27560 6f 72 30 2e 63 6f 6c 32 20 63 6f 6c 30 20 46 52  or0.col2 col0 FR
27570 4f 4d 20 74 61 62 31 2c 20 74 61 62 32 20 63 6f  OM tab1, tab2 co
27580 72 30 2c 20 74 61 62 30 20 41 53 20 63 6f 72 31  r0, tab0 AS cor1
27590 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75 65  ..----..27 value
275a0 73 20 68 61 73 68 69 6e 67 20 74 6f 20 34 30 66  s hashing to 40f
275b0 64 38 63 63 30 64 65 39 32 65 61 36 38 64 37 33  d8cc0de92ea68d73
275c0 36 33 34 63 32 64 38 66 37 35 62 66 35 0d 0a 0d  634c2d8f75bf5...
275d0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
275e0 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 30 20  ..SELECT - col0 
275f0 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 2a 20 2b 20  + cor0.col0 * + 
27600 28 20 63 6f 72 30 2e 63 6f 6c 30 20 29 20 41 53  ( cor0.col0 ) AS
27610 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20   col0 FROM tab2 
27620 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 34  AS cor0..----..4
27630 32 0d 0a 36 30 30 36 0d 0a 36 31 36 32 0d 0a 0d  2..6006..6162...
27640 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73  .skipif postgres
27650 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20  ql # PostgreSQL 
27660 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e  requires AS when
27670 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74   renaming output
27680 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20   columns..query 
27690 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
276a0 54 20 2b 20 31 36 20 2b 20 2b 20 63 6f 6c 30 20  T + 16 + + col0 
276b0 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41  col1 FROM tab1 A
276c0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 39  S cor0..----..19
276d0 0d 0a 38 30 0d 0a 39 36 0d 0a 0d 0a 71 75 65 72  ..80..96....quer
276e0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
276f0 45 43 54 20 41 4c 4c 20 63 6f 6c 32 20 2a 20 2b  ECT ALL col2 * +
27700 20 63 6f 6c 30 20 2a 20 2d 20 74 61 62 32 2e 63   col0 * - tab2.c
27710 6f 6c 30 20 2b 20 39 38 20 46 52 4f 4d 20 74 61  ol0 + 98 FROM ta
27720 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32 32 35 0d  b2..----..-1225.
27730 0a 2d 31 35 38 30 38 36 0d 0a 2d 32 33 37 30 36  .-158086..-23706
27740 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  0....query I row
27750 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
27760 20 2d 20 31 32 20 2b 20 63 6f 6c 31 20 2a 20 2d   - 12 + col1 * -
27770 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46 52   col0 AS col0 FR
27780 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d  OM tab2..----..-
27790 31 33 35 35 0d 0a 2d 32 32 39 0d 0a 2d 34 36 31  1355..-229..-461
277a0 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  4....query I row
277b0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
277c0 54 49 4e 43 54 20 2d 20 63 6f 72 30 2e 63 6f 6c  TINCT - cor0.col
277d0 31 20 2b 20 63 6f 6c 31 20 2a 20 28 20 2d 20 63  1 + col1 * ( - c
277e0 6f 6c 30 20 29 20 41 53 20 63 6f 6c 31 20 46 52  ol0 ) AS col1 FR
277f0 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
27800 0a 2d 2d 2d 2d 0d 0a 2d 31 30 34 0d 0a 2d 31 30  .----..-104..-10
27810 35 33 0d 0a 2d 36 35 30 0d 0a 0d 0a 71 75 65 72  53..-650....quer
27820 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
27830 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 2d  ECT DISTINCT - -
27840 20 63 6f 72 30 2e 63 6f 6c 32 20 2a 20 2d 20 63   cor0.col2 * - c
27850 6f 6c 30 20 2b 20 36 33 20 2a 20 2b 20 63 6f 6c  ol0 + 63 * + col
27860 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  1 FROM tab2 AS c
27870 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 39 33 31  or0..----..-1931
27880 0d 0a 31 36 38 39 0d 0a 31 37 36 34 0d 0a 0d 0a  ..1689..1764....
27890 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71  skipif postgresq
278a0 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72  l # PostgreSQL r
278b0 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20  equires AS when 
278c0 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20  renaming output 
278d0 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49  columns..query I
278e0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
278f0 20 2b 20 2b 20 35 20 2a 20 63 6f 6c 32 20 2d 20   + + 5 * col2 - 
27900 63 6f 6c 32 20 2a 20 63 6f 6c 30 20 63 6f 6c 31  col2 * col0 col1
27910 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
27920 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 33 36 33 0d  r0..----..-3363.
27930 0a 2d 37 32 30 30 0d 0a 31 30 38 0d 0a 0d 0a 71  .-7200..108....q
27940 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
27950 53 45 4c 45 43 54 20 2b 20 63 6f 6c 30 20 2a 20  SELECT + col0 * 
27960 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 2d 20 2b 20  + cor0.col2 - + 
27970 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41  col2 FROM tab0 A
27980 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 34  S cor0..----..34
27990 0d 0a 37 32 31 36 0d 0a 37 35 39 0d 0a 0d 0a 71  ..7216..759....q
279a0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
279b0 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f 72  SELECT ALL + cor
279c0 30 2e 63 6f 6c 31 20 2b 20 63 6f 6c 30 20 2a 20  0.col1 + col0 * 
279d0 2d 20 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46  - col2 AS col2 F
279e0 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
279f0 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 35 38 0d 0a 2d 31  ..----..-158..-1
27a00 39 36 39 0d 0a 2d 32 39 38 35 0d 0a 0d 0a 71 75  969..-2985....qu
27a10 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
27a20 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 31  ELECT ALL - col1
27a30 20 2a 20 2d 20 63 6f 6c 31 20 2b 20 35 20 41 53   * - col1 + 5 AS
27a40 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20   col2 FROM tab1 
27a50 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
27a60 30 35 0d 0a 31 37 34 0d 0a 36 38 31 0d 0a 0d 0a  05..174..681....
27a70 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
27a80 0a 53 45 4c 45 43 54 20 2b 20 2d 20 63 6f 6c 30  .SELECT + - col0
27a90 20 2d 20 63 6f 6c 32 20 2a 20 63 6f 72 30 2e 63   - col2 * cor0.c
27aa0 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  ol2 AS col0 FROM
27ab0 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
27ac0 2d 2d 2d 0d 0a 2d 32 39 31 39 0d 0a 2d 33 33 31  ---..-2919..-331
27ad0 33 0d 0a 2d 39 32 39 36 0d 0a 0d 0a 73 6b 69 70  3..-9296....skip
27ae0 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20  if postgresql # 
27af0 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69  PostgreSQL requi
27b00 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61  res AS when rena
27b10 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75  ming output colu
27b20 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  mns..query I row
27b30 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
27b40 54 49 4e 43 54 20 63 6f 6c 32 20 2a 20 2d 20 63  TINCT col2 * - c
27b50 6f 72 30 2e 63 6f 6c 31 20 2b 20 63 6f 72 30 2e  or0.col1 + cor0.
27b60 63 6f 6c 32 20 63 6f 6c 31 20 46 52 4f 4d 20 74  col2 col1 FROM t
27b70 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
27b80 2d 0d 0a 2d 31 35 30 38 0d 0a 2d 36 30 38 0d 0a  -..-1508..-608..
27b90 2d 38 31 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20  -810....query I 
27ba0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
27bb0 44 49 53 54 49 4e 43 54 20 2d 20 2b 20 63 6f 6c  DISTINCT - + col
27bc0 31 20 2b 20 2d 20 63 6f 72 30 2e 63 6f 6c 31 20  1 + - cor0.col1 
27bd0 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 41 53 20 63  + cor0.col1 AS c
27be0 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 63 6f  ol1 FROM tab1 co
27bf0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 0d 0a 2d  r0..----..-10..-
27c00 31 33 0d 0a 2d 32 36 0d 0a 0d 0a 71 75 65 72 79  13..-26....query
27c10 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
27c20 43 54 20 41 4c 4c 20 2d 20 2d 20 63 6f 72 30 2e  CT ALL - - cor0.
27c30 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c 30 20 2a 20  col0 + - col0 * 
27c40 2d 20 28 20 63 6f 72 30 2e 63 6f 6c 32 20 29 20  - ( cor0.col2 ) 
27c50 2a 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31  * col2 FROM tab1
27c60 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
27c70 32 30 38 30 30 30 0d 0a 37 33 37 33 36 30 0d 0a  208000..737360..
27c80 38 37 35 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20  8751....query I 
27c90 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
27ca0 63 6f 72 30 2e 63 6f 6c 32 20 2a 20 2b 20 33 33  cor0.col2 * + 33
27cb0 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
27cc0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 35 34 0d 0a  r0..----..1254..
27cd0 38 35 38 0d 0a 38 39 31 0d 0a 0d 0a 71 75 65 72  858..891....quer
27ce0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
27cf0 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 31 20 2b  ECT ALL + col1 +
27d00 20 2b 20 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c 30   + col0 + - col0
27d10 20 2a 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c   * + col0 AS col
27d20 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  2 FROM tab1 AS c
27d30 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 30 32 32  or0..----..-4022
27d40 0d 0a 2d 36 33 30 37 0d 0a 32 30 0d 0a 0d 0a 71  ..-6307..20....q
27d50 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
27d60 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
27d70 63 6f 6c 31 20 2a 20 63 6f 72 30 2e 63 6f 6c 32  col1 * cor0.col2
27d80 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 41 53 20   + cor0.col0 AS 
27d90 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41  col1 FROM tab2 A
27da0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 36  S cor0..----..16
27db0 31 32 0d 0a 37 32 35 0d 0a 38 34 34 0d 0a 0d 0a  12..725..844....
27dc0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
27dd0 0a 53 45 4c 45 43 54 20 63 6f 6c 30 20 2b 20 63  .SELECT col0 + c
27de0 6f 6c 31 20 2a 20 63 6f 6c 31 20 2b 20 63 6f 6c  ol1 * col1 + col
27df0 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  0 AS col1 FROM t
27e00 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
27e10 2d 0d 0a 32 32 38 0d 0a 33 32 39 0d 0a 36 38 32  -..228..329..682
27e20 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
27e30 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
27e40 63 6f 6c 32 20 2b 20 2b 20 28 20 37 35 20 29 20  col2 + + ( 75 ) 
27e50 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
27e60 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 31 0d 0a 31 30  0..----..101..10
27e70 32 0d 0a 31 31 33 0d 0a 0d 0a 71 75 65 72 79 20  2..113....query 
27e80 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
27e90 54 20 2b 20 63 6f 6c 30 20 2b 20 38 35 20 2a 20  T + col0 + 85 * 
27ea0 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46 52 4f  col2 AS col1 FRO
27eb0 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab2 cor0..---
27ec0 2d 0d 0a 32 32 38 38 0d 0a 32 33 30 32 0d 0a 33  -..2288..2302..3
27ed0 33 30 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  309....query I r
27ee0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
27ef0 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c 31 20 2b  ISTINCT - col1 +
27f00 20 39 33 20 2a 20 2b 20 63 6f 6c 32 20 41 53 20   93 * + col2 AS 
27f10 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 63  col2 FROM tab1 c
27f20 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 34 39 39 36 0d  or0..----..4996.
27f30 0a 35 32 39 31 0d 0a 38 39 31 35 0d 0a 0d 0a 71  .5291..8915....q
27f40 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
27f50 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
27f60 2b 20 63 6f 6c 30 20 2a 20 37 20 2a 20 63 6f 72  + col0 * 7 * cor
27f70 30 2e 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46  0.col1 AS col2 F
27f80 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
27f90 0d 0a 2d 2d 2d 2d 0d 0a 31 35 31 39 0d 0a 33 32  ..----..1519..32
27fa0 32 31 34 0d 0a 39 34 30 31 0d 0a 0d 0a 71 75 65  214..9401....que
27fb0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
27fc0 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 31 20  LECT ALL - col1 
27fd0 2b 20 2b 20 35 32 20 2b 20 2b 20 63 6f 6c 32 20  + + 52 + + col2 
27fe0 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
27ff0 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
28000 0a 31 39 0d 0a 34 38 0d 0a 37 33 0d 0a 0d 0a 71  .19..48..73....q
28010 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
28020 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 28 20 2d  SELECT ALL + ( -
28030 20 63 6f 6c 32 20 29 20 2a 20 2b 20 28 20 63 6f   col2 ) * + ( co
28040 6c 31 20 29 20 2b 20 2b 20 74 61 62 31 2e 63 6f  l1 ) + + tab1.co
28050 6c 32 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  l2 AS col0 FROM 
28060 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 35  tab1..----..-115
28070 32 0d 0a 2d 31 33 35 30 0d 0a 2d 35 31 33 0d 0a  2..-1350..-513..
28080 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
28090 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20  t..SELECT ALL - 
280a0 31 33 20 2a 20 2d 20 63 6f 6c 32 20 41 53 20 63  13 * - col2 AS c
280b0 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d  ol0 FROM tab2..-
280c0 2d 2d 2d 0d 0a 33 33 38 0d 0a 33 35 31 0d 0a 34  ---..338..351..4
280d0 39 34 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  94....onlyif mys
280e0 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65  ql # use DIV ope
280f0 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65  rator for intege
28100 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72  r division..quer
28110 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
28120 6c 2d 31 31 31 32 0d 0a 53 45 4c 45 43 54 20 41  l-1112..SELECT A
28130 4c 4c 20 2b 20 31 30 20 2a 20 63 6f 6c 31 20 44  LL + 10 * col1 D
28140 49 56 20 32 31 20 41 53 20 63 6f 6c 32 20 46 52  IV 21 AS col2 FR
28150 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31  OM tab2..----..1
28160 34 0d 0a 32 38 0d 0a 38 0d 0a 0d 0a 73 6b 69 70  4..28..8....skip
28170 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
28180 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
28190 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
281a0 2d 31 31 31 32 0d 0a 53 45 4c 45 43 54 20 41 4c  -1112..SELECT AL
281b0 4c 20 2b 20 31 30 20 2a 20 63 6f 6c 31 20 2f 20  L + 10 * col1 / 
281c0 32 31 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  21 AS col2 FROM 
281d0 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 34 0d 0a  tab2..----..14..
281e0 32 38 0d 0a 38 0d 0a 0d 0a 71 75 65 72 79 20 49  28..8....query I
281f0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
28200 20 2d 20 32 34 20 2a 20 2b 20 34 32 20 41 53 20   - 24 * + 42 AS 
28210 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41  col1 FROM tab0 A
28220 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
28230 30 30 38 0d 0a 2d 31 30 30 38 0d 0a 2d 31 30 30  008..-1008..-100
28240 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  8....query I row
28250 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 28  sort..SELECT - (
28260 20 2b 20 63 6f 6c 32 20 29 20 2a 20 63 6f 6c 30   + col2 ) * col0
28270 20 2a 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62   * col2 FROM tab
28280 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
28290 0a 2d 31 31 34 30 37 36 0d 0a 2d 35 31 30 33 0d  .-114076..-5103.
282a0 0a 2d 35 32 37 32 38 0d 0a 0d 0a 71 75 65 72 79  .-52728....query
282b0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
282c0 43 54 20 2d 20 2d 20 33 38 20 2b 20 33 34 20 2a  CT - - 38 + 34 *
282d0 20 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46 52   col2 AS col2 FR
282e0 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
282f0 0a 2d 2d 2d 2d 0d 0a 31 38 37 34 0d 0a 31 39 37  .----..1874..197
28300 36 0d 0a 33 33 30 32 0d 0a 0d 0a 71 75 65 72 79  6..3302....query
28310 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
28320 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f  CT DISTINCT - co
28330 6c 30 20 2a 20 2d 20 35 37 20 2a 20 63 6f 6c 32  l0 * - 57 * col2
28340 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d   FROM tab2..----
28350 0d 0a 31 30 37 37 33 0d 0a 31 31 35 35 39 36 0d  ..10773..115596.
28360 0a 31 37 31 31 31 34 0d 0a 0d 0a 71 75 65 72 79  .171114....query
28370 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
28380 43 54 20 2b 20 34 37 20 2a 20 39 20 41 53 20 63  CT + 47 * 9 AS c
28390 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 2c 20 74  ol1 FROM tab0, t
283a0 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
283b0 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68  -..9 values hash
283c0 69 6e 67 20 74 6f 20 39 62 32 66 63 34 64 38 61  ing to 9b2fc4d8a
283d0 37 63 38 38 62 38 65 65 62 66 30 36 32 38 66 32  7c88b8eebf0628f2
283e0 65 32 66 38 64 62 37 0d 0a 0d 0a 6f 6e 6c 79 69  e2f8db7....onlyi
283f0 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72  f mysql # suppor
28400 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63  t for MySQL spec
28410 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65  ific system type
28420 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75  s and syntax..qu
28430 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
28440 62 65 6c 2d 31 31 31 38 0d 0a 53 45 4c 45 43 54  bel-1118..SELECT
28450 20 41 4c 4c 20 2b 20 43 41 53 54 28 20 4e 55 4c   ALL + CAST( NUL
28460 4c 20 41 53 20 53 49 47 4e 45 44 20 29 20 2a 20  L AS SIGNED ) * 
28470 2b 20 35 36 20 41 53 20 63 6f 6c 30 20 46 52 4f  + 56 AS col0 FRO
28480 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
28490 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c  ----..NULL..NULL
284a0 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66  ..NULL....skipif
284b0 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
284c0 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
284d0 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
284e0 31 31 38 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  118..SELECT ALL 
284f0 2b 20 43 41 53 54 20 28 20 4e 55 4c 4c 20 41 53  + CAST ( NULL AS
28500 20 49 4e 54 45 47 45 52 20 29 20 2a 20 2b 20 35   INTEGER ) * + 5
28510 36 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  6 AS col0 FROM t
28520 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
28530 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e  -..NULL..NULL..N
28540 55 4c 4c 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  ULL....query I r
28550 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
28560 20 63 6f 6c 31 20 2a 20 32 36 20 46 52 4f 4d 20   col1 * 26 FROM 
28570 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
28580 2d 2d 0d 0a 2d 32 32 33 36 0d 0a 2d 32 33 36 36  --..-2236..-2366
28590 0d 0a 2d 32 35 32 32 0d 0a 0d 0a 71 75 65 72 79  ..-2522....query
285a0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
285b0 43 54 20 2d 20 35 20 2a 20 2d 20 36 20 41 53 20  CT - 5 * - 6 AS 
285c0 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41  col0 FROM tab2 A
285d0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 30  S cor0..----..30
285e0 0d 0a 33 30 0d 0a 33 30 0d 0a 0d 0a 71 75 65 72  ..30..30....quer
285f0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
28600 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63  ECT DISTINCT - c
28610 6f 6c 32 20 2a 20 63 6f 72 30 2e 63 6f 6c 32 20  ol2 * cor0.col2 
28620 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
28630 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  0 cor0..----..-1
28640 0d 0a 2d 31 30 38 39 0d 0a 2d 36 37 32 34 0d 0a  ..-1089..-6724..
28650 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
28660 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
28670 43 54 20 2b 20 63 6f 6c 31 20 2a 20 2d 20 28 20  CT + col1 * - ( 
28680 28 20 2d 20 63 6f 6c 32 20 29 20 29 20 41 53 20  ( - col2 ) ) AS 
28690 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 0d 0a  col0 FROM tab2..
286a0 2d 2d 2d 2d 0d 0a 31 35 33 34 0d 0a 36 34 36 0d  ----..1534..646.
286b0 0a 38 33 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .837....query I 
286c0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
286d0 44 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c 31 20  DISTINCT + col1 
286e0 2d 20 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c 30 20  - col1 * + col0 
286f0 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
28700 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
28710 0a 2d 31 30 32 37 0d 0a 2d 35 32 0d 0a 2d 36 33  .-1027..-52..-63
28720 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  0....query I row
28730 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
28740 54 49 4e 43 54 20 2d 20 28 20 74 61 62 30 2e 63  TINCT - ( tab0.c
28750 6f 6c 30 20 29 20 41 53 20 63 6f 6c 31 20 46 52  ol0 ) AS col1 FR
28760 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  OM tab0..----..-
28770 32 34 0d 0a 2d 33 35 0d 0a 2d 38 39 0d 0a 0d 0a  24..-35..-89....
28780 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
28790 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f  .SELECT ALL - co
287a0 6c 32 20 2b 20 32 39 20 41 53 20 63 6f 6c 30 20  l2 + 29 AS col0 
287b0 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d  FROM tab2..----.
287c0 0a 2d 39 0d 0a 32 0d 0a 33 0d 0a 0d 0a 71 75 65  .-9..2..3....que
287d0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
287e0 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f  LECT DISTINCT co
287f0 6c 30 20 2b 20 2b 20 34 32 20 41 53 20 63 6f 6c  l0 + + 42 AS col
28800 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  0 FROM tab2 AS c
28810 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 30 0d 0a  or0..----..120..
28820 31 32 31 0d 0a 34 39 0d 0a 0d 0a 71 75 65 72 79  121..49....query
28830 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
28840 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63 6f  CT DISTINCT + co
28850 72 30 2e 63 6f 6c 31 20 2a 20 2b 20 63 6f 72 30  r0.col1 * + cor0
28860 2e 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46 52  .col0 AS col2 FR
28870 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d  OM tab0 cor0..--
28880 2d 2d 0d 0a 32 30 36 34 0d 0a 33 33 39 35 0d 0a  --..2064..3395..
28890 38 30 39 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20  8099....query I 
288a0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
288b0 44 49 53 54 49 4e 43 54 20 63 6f 6c 32 20 2a 20  DISTINCT col2 * 
288c0 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c 32 20 46 52  col0 + - col2 FR
288d0 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31  OM tab1..----..1
288e0 30 38 0d 0a 33 35 39 31 0d 0a 37 35 38 34 0d 0a  08..3591..7584..
288f0 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65  ..skipif postgre
28900 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c  sql # PostgreSQL
28910 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65   requires AS whe
28920 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75  n renaming outpu
28930 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79  t columns..query
28940 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
28950 43 54 20 2b 20 74 61 62 32 2e 63 6f 6c 32 20 2b  CT + tab2.col2 +
28960 20 74 61 62 32 2e 63 6f 6c 30 20 2b 20 2b 20 32   tab2.col0 + + 2
28970 33 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32  3 col0 FROM tab2
28980 0d 0a 2d 2d 2d 2d 0d 0a 31 32 37 0d 0a 31 34 30  ..----..127..140
28990 0d 0a 35 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..57....query I 
289a0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
289b0 74 61 62 30 2e 63 6f 6c 30 20 2b 20 63 6f 6c 30  tab0.col0 + col0
289c0 20 2b 20 39 39 20 2a 20 2b 20 63 6f 6c 32 20 2a   + 99 * + col2 *
289d0 20 2b 20 28 20 74 61 62 30 2e 63 6f 6c 32 20 29   + ( tab0.col2 )
289e0 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d   FROM tab0..----
289f0 0d 0a 31 30 37 38 35 39 0d 0a 31 36 39 0d 0a 36  ..107859..169..6
28a00 36 35 38 35 34 0d 0a 0d 0a 71 75 65 72 79 20 49  65854....query I
28a10 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
28a20 20 41 4c 4c 20 35 36 20 2a 20 2d 20 63 6f 6c 32   ALL 56 * - col2
28a30 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
28a40 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 34 35 36 0d  r0..----..-1456.
28a50 0a 2d 31 35 31 32 0d 0a 2d 32 31 32 38 0d 0a 0d  .-1512..-2128...
28a60 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
28a70 0d 0a 53 45 4c 45 43 54 20 2b 20 36 38 20 2a 20  ..SELECT + 68 * 
28a80 2d 20 63 6f 6c 30 20 2b 20 63 6f 6c 32 20 46 52  - col0 + col2 FR
28a90 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d  OM tab2 cor0..--
28aa0 2d 2d 0d 0a 2d 34 34 39 0d 0a 2d 35 32 37 38 0d  --..-449..-5278.
28ab0 0a 2d 35 33 33 34 0d 0a 0d 0a 71 75 65 72 79 20  .-5334....query 
28ac0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
28ad0 54 20 41 4c 4c 20 2d 20 2b 20 33 37 20 41 53 20  T ALL - + 37 AS 
28ae0 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41  col0 FROM tab0 A
28af0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33  S cor0..----..-3
28b00 37 0d 0a 2d 33 37 0d 0a 2d 33 37 0d 0a 0d 0a 71  7..-37..-37....q
28b10 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
28b20 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
28b30 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 2a 20 2b 20  + cor0.col2 * + 
28b40 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46 52 4f  col2 AS col2 FRO
28b50 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab0 cor0..---
28b60 2d 0d 0a 31 0d 0a 31 30 38 39 0d 0a 36 37 32 34  -..1..1089..6724
28b70 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
28b80 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d   # support for M
28b90 79 53 51 4c 20 73 70 65 63 69 66 69 63 20 73 79  ySQL specific sy
28ba0 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73  stem types and s
28bb0 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72  yntax..query I r
28bc0 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 31 33  owsort label-113
28bd0 35 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20  5..SELECT ALL + 
28be0 43 41 53 54 28 20 4e 55 4c 4c 20 41 53 20 53 49  CAST( NULL AS SI
28bf0 47 4e 45 44 20 29 20 2b 20 2d 20 37 39 20 41 53  GNED ) + - 79 AS
28c00 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20   col0 FROM tab2 
28c10 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e  AS cor0..----..N
28c20 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d  ULL..NULL..NULL.
28c30 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
28c40 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
28c50 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
28c60 74 20 6c 61 62 65 6c 2d 31 31 33 35 0d 0a 53 45  t label-1135..SE
28c70 4c 45 43 54 20 41 4c 4c 20 2b 20 43 41 53 54 20  LECT ALL + CAST 
28c80 28 20 4e 55 4c 4c 20 41 53 20 49 4e 54 45 47 45  ( NULL AS INTEGE
28c90 52 20 29 20 2b 20 2d 20 37 39 20 41 53 20 63 6f  R ) + - 79 AS co
28ca0 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l0 FROM tab2 AS 
28cb0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c  cor0..----..NULL
28cc0 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a  ..NULL..NULL....
28cd0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
28ce0 0a 53 45 4c 45 43 54 20 2b 20 33 34 20 2a 20 63  .SELECT + 34 * c
28cf0 6f 6c 31 20 2b 20 63 6f 6c 32 20 2a 20 2d 20 63  ol1 + col2 * - c
28d00 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  ol2 AS col0 FROM
28d10 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
28d20 2d 2d 2d 0d 0a 2d 33 36 33 30 0d 0a 31 38 33 35  ---..-3630..1835
28d30 0d 0a 33 32 39 37 0d 0a 0d 0a 71 75 65 72 79 20  ..3297....query 
28d40 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
28d50 54 20 2b 20 63 6f 6c 30 20 2a 20 37 34 20 2d 20  T + col0 * 74 - 
28d60 2d 20 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c 32 20  - col1 * - col2 
28d70 2a 20 2d 20 36 32 20 46 52 4f 4d 20 74 61 62 32  * - 62 FROM tab2
28d80 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
28d90 31 30 30 38 38 30 0d 0a 34 35 38 39 38 0d 0a 35  100880..45898..5
28da0 32 34 31 32 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  2412....onlyif m
28db0 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66  ysql # support f
28dc0 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69  or MySQL specifi
28dd0 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61  c system types a
28de0 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79  nd syntax..query
28df0 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
28e00 2d 31 31 33 38 0d 0a 53 45 4c 45 43 54 20 41 4c  -1138..SELECT AL
28e10 4c 20 43 41 53 54 28 20 4e 55 4c 4c 20 41 53 20  L CAST( NULL AS 
28e20 53 49 47 4e 45 44 20 29 20 2a 20 2d 20 63 6f 6c  SIGNED ) * - col
28e30 31 20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30  1 FROM tab1 cor0
28e40 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55  ..----..NULL..NU
28e50 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70  LL..NULL....skip
28e60 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
28e70 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
28e80 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
28e90 2d 31 31 33 38 0d 0a 53 45 4c 45 43 54 20 41 4c  -1138..SELECT AL
28ea0 4c 20 43 41 53 54 20 28 20 4e 55 4c 4c 20 41 53  L CAST ( NULL AS
28eb0 20 49 4e 54 45 47 45 52 20 29 20 2a 20 2d 20 63   INTEGER ) * - c
28ec0 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 63 6f  ol1 FROM tab1 co
28ed0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a  r0..----..NULL..
28ee0 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b  NULL..NULL....sk
28ef0 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20  ipif postgresql 
28f00 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71  # PostgreSQL req
28f10 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65  uires AS when re
28f20 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f  naming output co
28f30 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72  lumns..query I r
28f40 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
28f50 49 53 54 49 4e 43 54 20 2b 20 2b 20 36 33 20 63  ISTINCT + + 63 c
28f60 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol0 FROM tab2 AS
28f70 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 36 33 0d   cor0..----..63.
28f80 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
28f90 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2b 20 31  rt..SELECT - + 1
28fa0 39 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c 32  9 + col0 AS col2
28fb0 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
28fc0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 36 0d 0a 34  r0..----..-16..4
28fd0 35 0d 0a 36 31 0d 0a 0d 0a 71 75 65 72 79 20 49  5..61....query I
28fe0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
28ff0 20 44 49 53 54 49 4e 43 54 20 63 6f 72 30 2e 63   DISTINCT cor0.c
29000 6f 6c 32 20 2b 20 28 20 2b 20 63 6f 6c 31 20 29  ol2 + ( + col1 )
29010 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
29020 72 30 0d 0a 2d 2d 2d 2d 0d 0a 35 35 0d 0a 35 38  r0..----..55..58
29030 0d 0a 38 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..85....query I 
29040 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
29050 2d 20 63 6f 6c 31 20 2b 20 38 38 20 46 52 4f 4d  - col1 + 88 FROM
29060 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
29070 2d 2d 2d 0d 0a 32 39 0d 0a 35 37 0d 0a 37 31 0d  ---..29..57..71.
29080 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
29090 72 74 0d 0a 53 45 4c 45 43 54 20 28 20 36 31 20  rt..SELECT ( 61 
290a0 29 20 2a 20 63 6f 6c 32 20 41 53 20 63 6f 6c 32  ) * col2 AS col2
290b0 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
290c0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 30 31 33 0d 0a  r0..----..2013..
290d0 35 30 30 32 0d 0a 36 31 0d 0a 0d 0a 71 75 65 72  5002..61....quer
290e0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
290f0 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 28  ECT DISTINCT - (
29100 20 38 31 20 29 20 2b 20 63 6f 6c 31 20 41 53 20   81 ) + col1 AS 
29110 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41  col2 FROM tab1 A
29120 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 35  S cor0..----..-5
29130 35 0d 0a 2d 36 38 0d 0a 2d 37 31 0d 0a 0d 0a 71  5..-68..-71....q
29140 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
29150 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 28 20 2d  SELECT ALL + ( -
29160 20 63 6f 72 30 2e 63 6f 6c 32 20 29 20 2b 20 2d   cor0.col2 ) + -
29170 20 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46 52   col0 AS col2 FR
29180 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
29190 0a 2d 2d 2d 2d 0d 0a 2d 31 37 31 0d 0a 2d 33 36  .----..-171..-36
291a0 0d 0a 2d 35 37 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  ..-57....onlyif 
291b0 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20  mysql # use DIV 
291c0 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74  operator for int
291d0 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71  eger division..q
291e0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
291f0 61 62 65 6c 2d 31 31 34 36 0d 0a 53 45 4c 45 43  abel-1146..SELEC
29200 54 20 44 49 53 54 49 4e 43 54 20 2d 20 2d 20 63  T DISTINCT - - c
29210 6f 6c 32 20 44 49 56 20 2d 20 63 6f 6c 32 20 46  ol2 DIV - col2 F
29220 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d  ROM tab1 cor0..-
29230 2d 2d 2d 0d 0a 2d 31 0d 0a 0d 0a 73 6b 69 70 69  ---..-1....skipi
29240 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
29250 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
29260 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
29270 31 31 34 36 0d 0a 53 45 4c 45 43 54 20 44 49 53  1146..SELECT DIS
29280 54 49 4e 43 54 20 2d 20 2d 20 63 6f 6c 32 20 2f  TINCT - - col2 /
29290 20 2d 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62   - col2 FROM tab
292a0 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  1 cor0..----..-1
292b0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
292c0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
292d0 2d 20 63 6f 6c 30 20 2a 20 63 6f 6c 31 20 2b 20  - col0 * col1 + 
292e0 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41  col1 FROM tab1 A
292f0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
29300 30 32 37 0d 0a 2d 35 32 0d 0a 2d 36 33 30 0d 0a  027..-52..-630..
29310 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
29320 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53   support for MyS
29330 51 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74  QL specific syst
29340 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e  em types and syn
29350 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  tax..query I row
29360 73 6f 72 74 20 6c 61 62 65 6c 2d 31 31 34 38 0d  sort label-1148.
29370 0a 53 45 4c 45 43 54 20 2d 20 2b 20 28 20 2d 20  .SELECT - + ( - 
29380 63 6f 72 30 2e 63 6f 6c 31 20 29 20 2a 20 43 41  cor0.col1 ) * CA
29390 53 54 28 20 63 6f 72 30 2e 63 6f 6c 30 20 41 53  ST( cor0.col0 AS
293a0 20 53 49 47 4e 45 44 20 29 20 41 53 20 63 6f 6c   SIGNED ) AS col
293b0 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  0 FROM tab2 AS c
293c0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33 34 33 0d  or0..----..1343.
293d0 0a 32 31 37 0d 0a 34 36 30 32 0d 0a 0d 0a 73 6b  .217..4602....sk
293e0 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
293f0 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
29400 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
29410 65 6c 2d 31 31 34 38 0d 0a 53 45 4c 45 43 54 20  el-1148..SELECT 
29420 2d 20 2b 20 28 20 2d 20 63 6f 72 30 2e 63 6f 6c  - + ( - cor0.col
29430 31 20 29 20 2a 20 43 41 53 54 20 28 20 63 6f 72  1 ) * CAST ( cor
29440 30 2e 63 6f 6c 30 20 41 53 20 49 4e 54 45 47 45  0.col0 AS INTEGE
29450 52 20 29 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  R ) AS col0 FROM
29460 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
29470 2d 2d 2d 0d 0a 31 33 34 33 0d 0a 32 31 37 0d 0a  ---..1343..217..
29480 34 36 30 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20  4602....query I 
29490 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
294a0 44 49 53 54 49 4e 43 54 20 2d 20 2d 20 63 6f 6c  DISTINCT - - col
294b0 31 20 2a 20 2d 20 63 6f 6c 30 20 2a 20 63 6f 6c  1 * - col0 * col
294c0 31 20 2b 20 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c  1 + col2 * + col
294d0 30 20 2a 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20  0 * + col0 FROM 
294e0 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab2 cor0..----.
294f0 0a 2d 31 31 33 33 33 34 0d 0a 2d 35 34 30 34 0d  .-113334..-5404.
29500 0a 32 31 34 33 32 37 0d 0a 0d 0a 71 75 65 72 79  .214327....query
29510 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
29520 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63 6f  CT DISTINCT + co
29530 6c 30 20 2a 20 38 20 2b 20 2d 20 63 6f 6c 30 20  l0 * 8 + - col0 
29540 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
29550 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
29560 0a 32 31 0d 0a 34 34 38 0d 0a 35 36 30 0d 0a 0d  .21..448..560...
29570 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73  .skipif postgres
29580 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20  ql # PostgreSQL 
29590 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e  requires AS when
295a0 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74   renaming output
295b0 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20   columns..query 
295c0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
295d0 54 20 2d 20 2d 20 63 6f 6c 32 20 2a 20 2b 20 63  T - - col2 * + c
295e0 6f 6c 30 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61  ol0 col0 FROM ta
295f0 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
29600 0d 0a 33 35 0d 0a 37 32 39 38 0d 0a 37 39 32 0d  ..35..7298..792.
29610 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
29620 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 72 30 2e  rt..SELECT cor0.
29630 63 6f 6c 32 20 2a 20 33 34 20 46 52 4f 4d 20 74  col2 * 34 FROM t
29640 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
29650 2d 0d 0a 31 32 39 32 0d 0a 38 38 34 0d 0a 39 31  -..1292..884..91
29660 38 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  8....onlyif mysq
29670 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72  l # use DIV oper
29680 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72  ator for integer
29690 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79   division..query
296a0 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
296b0 2d 31 31 35 33 0d 0a 53 45 4c 45 43 54 20 44 49  -1153..SELECT DI
296c0 53 54 49 4e 43 54 20 2b 20 63 6f 6c 31 20 44 49  STINCT + col1 DI
296d0 56 20 2b 20 63 6f 6c 32 20 2b 20 2d 20 28 20 63  V + col2 + - ( c
296e0 6f 6c 32 20 29 20 41 53 20 63 6f 6c 32 20 46 52  ol2 ) AS col2 FR
296f0 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
29700 0a 2d 2d 2d 2d 0d 0a 2d 35 34 0d 0a 2d 35 37 0d  .----..-54..-57.
29710 0a 2d 39 36 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  .-96....skipif m
29720 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
29730 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
29740 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 31 35  owsort label-115
29750 33 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  3..SELECT DISTIN
29760 43 54 20 2b 20 63 6f 6c 31 20 2f 20 2b 20 63 6f  CT + col1 / + co
29770 6c 32 20 2b 20 2d 20 28 20 63 6f 6c 32 20 29 20  l2 + - ( col2 ) 
29780 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
29790 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
297a0 0a 2d 35 34 0d 0a 2d 35 37 0d 0a 2d 39 36 0d 0a  .-54..-57..-96..
297b0 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
297c0 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f   use DIV operato
297d0 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69  r for integer di
297e0 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20  vision..query I 
297f0 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 31  rowsort label-11
29800 35 34 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 72  54..SELECT - cor
29810 30 2e 63 6f 6c 32 20 44 49 56 20 34 31 20 2b 20  0.col2 DIV 41 + 
29820 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41  col0 FROM tab1 A
29830 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 0d  S cor0..----..2.
29840 0a 36 33 0d 0a 37 38 0d 0a 0d 0a 73 6b 69 70 69  .63..78....skipi
29850 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
29860 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
29870 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
29880 31 31 35 34 0d 0a 53 45 4c 45 43 54 20 2d 20 63  1154..SELECT - c
29890 6f 72 30 2e 63 6f 6c 32 20 2f 20 34 31 20 2b 20  or0.col2 / 41 + 
298a0 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41  col0 FROM tab1 A
298b0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 0d  S cor0..----..2.
298c0 0a 36 33 0d 0a 37 38 0d 0a 0d 0a 71 75 65 72 79  .63..78....query
298d0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
298e0 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f  CT DISTINCT - co
298f0 6c 30 20 2a 20 28 20 63 6f 6c 30 20 29 20 2a 20  l0 * ( col0 ) * 
29900 63 6f 6c 31 20 2b 20 2d 20 63 6f 6c 32 20 46 52  col1 + - col2 FR
29910 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
29920 0a 2d 2d 2d 2d 0d 0a 2d 31 30 36 31 33 35 0d 0a  .----..-106135..
29930 2d 31 35 34 36 0d 0a 2d 33 35 38 39 38 32 0d 0a  -1546..-358982..
29940 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
29950 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20  t..SELECT ALL + 
29960 2b 20 63 6f 6c 31 20 2b 20 2b 20 28 20 31 32 20  + col1 + + ( 12 
29970 29 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  ) FROM tab2 AS c
29980 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 39 0d 0a 34  or0..----..29..4
29990 33 0d 0a 37 31 0d 0a 0d 0a 71 75 65 72 79 20 49  3..71....query I
299a0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
299b0 20 2d 20 63 6f 6c 31 20 2b 20 34 30 20 41 53 20   - col1 + 40 AS 
299c0 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41  col2 FROM tab0 A
299d0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 34  S cor0..----..-4
299e0 36 0d 0a 2d 35 31 0d 0a 2d 35 37 0d 0a 0d 0a 71  6..-51..-57....q
299f0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
29a00 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 30 20  SELECT ALL col0 
29a10 2b 20 2d 20 39 20 41 53 20 63 6f 6c 31 20 46 52  + - 9 AS col1 FR
29a20 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
29a30 0a 2d 2d 2d 2d 0d 0a 2d 32 0d 0a 36 39 0d 0a 37  .----..-2..69..7
29a40 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  0....query I row
29a50 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
29a60 54 49 4e 43 54 20 28 20 63 6f 72 31 2e 63 6f 6c  TINCT ( cor1.col
29a70 30 20 29 20 2b 20 2d 20 38 39 20 46 52 4f 4d 20  0 ) + - 89 FROM 
29a80 74 61 62 30 20 41 53 20 63 6f 72 30 20 43 52 4f  tab0 AS cor0 CRO
29a90 53 53 20 4a 4f 49 4e 20 74 61 62 30 20 63 6f 72  SS JOIN tab0 cor
29aa0 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 34 0d 0a 2d 36  1..----..-54..-6
29ab0 35 0d 0a 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20  5..0....query I 
29ac0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
29ad0 41 4c 4c 20 2b 20 2d 20 63 6f 6c 30 20 2b 20 2b  ALL + - col0 + +
29ae0 20 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46 52   col0 AS col1 FR
29af0 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
29b00 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a  .----..0..0..0..
29b10 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
29b20 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f  t..SELECT ALL co
29b30 6c 31 20 2a 20 63 6f 6c 31 20 2b 20 2d 20 63 6f  l1 * col1 + - co
29b40 6c 30 20 2a 20 2b 20 63 6f 72 30 2e 63 6f 6c 31  l0 * + cor0.col1
29b50 20 2a 20 63 6f 72 30 2e 63 6f 6c 31 20 2d 20 2d   * cor0.col1 - -
29b60 20 32 36 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d   26 AS col1 FROM
29b70 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
29b80 2d 2d 2d 0d 0a 2d 31 33 32 36 0d 0a 2d 31 33 33  ---..-1326..-133
29b90 32 35 0d 0a 2d 36 32 37 34 0d 0a 0d 0a 6f 6e 6c  25..-6274....onl
29ba0 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20  yif mysql # use 
29bb0 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72  DIV operator for
29bc0 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f   integer divisio
29bd0 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  n..query I rowso
29be0 72 74 20 6c 61 62 65 6c 2d 31 31 36 32 0d 0a 53  rt label-1162..S
29bf0 45 4c 45 43 54 20 63 6f 6c 31 20 44 49 56 20 63  ELECT col1 DIV c
29c00 6f 6c 32 20 2b 20 63 6f 6c 32 20 41 53 20 63 6f  ol2 + col2 AS co
29c10 6c 30 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d  l0 FROM tab1..--
29c20 2d 2d 0d 0a 35 34 0d 0a 35 37 0d 0a 39 36 0d 0a  --..54..57..96..
29c30 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
29c40 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
29c50 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
29c60 20 6c 61 62 65 6c 2d 31 31 36 32 0d 0a 53 45 4c   label-1162..SEL
29c70 45 43 54 20 63 6f 6c 31 20 2f 20 63 6f 6c 32 20  ECT col1 / col2 
29c80 2b 20 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46  + col2 AS col0 F
29c90 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab1..----..
29ca0 35 34 0d 0a 35 37 0d 0a 39 36 0d 0a 0d 0a 71 75  54..57..96....qu
29cb0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
29cc0 45 4c 45 43 54 20 2d 20 63 6f 72 30 2e 63 6f 6c  ELECT - cor0.col
29cd0 31 20 2a 20 32 39 20 41 53 20 63 6f 6c 32 20 46  1 * 29 AS col2 F
29ce0 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
29cf0 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 34 39 34 0d 0a 2d  ..----..-2494..-
29d00 32 36 33 39 0d 0a 2d 32 38 31 33 0d 0a 0d 0a 71  2639..-2813....q
29d10 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
29d20 53 45 4c 45 43 54 20 2b 20 63 6f 6c 30 20 2b 20  SELECT + col0 + 
29d30 28 20 2b 20 63 6f 6c 32 20 29 20 2a 20 63 6f 6c  ( + col2 ) * col
29d40 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  0 AS col2 FROM t
29d50 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
29d60 2d 0d 0a 31 39 36 0d 0a 32 31 30 36 0d 0a 33 30  -..196..2106..30
29d70 38 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  81....query I ro
29d80 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f  wsort..SELECT co
29d90 6c 31 20 2b 20 2b 20 36 37 20 2a 20 74 61 62 32  l1 + + 67 * tab2
29da0 2e 63 6f 6c 30 20 2b 20 74 61 62 32 2e 63 6f 6c  .col0 + tab2.col
29db0 32 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d  2 FROM tab2..---
29dc0 2d 0d 0a 35 32 37 0d 0a 35 33 31 31 0d 0a 35 33  -..527..5311..53
29dd0 34 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  48....query I ro
29de0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f  wsort..SELECT co
29df0 6c 32 20 2b 20 63 6f 6c 30 20 2a 20 2d 20 63 6f  l2 + col0 * - co
29e00 6c 32 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  l2 AS col0 FROM 
29e10 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
29e20 2d 2d 0d 0a 2d 31 36 32 0d 0a 2d 32 30 30 32 0d  --..-162..-2002.
29e30 0a 2d 32 39 36 34 0d 0a 0d 0a 71 75 65 72 79 20  .-2964....query 
29e40 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
29e50 54 20 41 4c 4c 20 2b 20 32 38 20 46 52 4f 4d 20  T ALL + 28 FROM 
29e60 74 61 62 32 2c 20 74 61 62 31 20 41 53 20 63 6f  tab2, tab1 AS co
29e70 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75  r0..----..9 valu
29e80 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 61 61  es hashing to aa
29e90 64 33 32 32 33 32 63 34 32 38 62 33 65 63 62 35  d32232c428b3ecb5
29ea0 61 64 61 36 33 66 37 65 39 62 30 61 39 37 0d 0a  ada63f7e9b0a97..
29eb0 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65  ..skipif postgre
29ec0 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c  sql # PostgreSQL
29ed0 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65   requires AS whe
29ee0 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75  n renaming outpu
29ef0 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79  t columns..query
29f00 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
29f10 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 2d 20  CT DISTINCT - - 
29f20 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c 32 20 63 6f  col2 * + col2 co
29f30 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l2 FROM tab0 AS 
29f40 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 0d 0a 31  cor0..----..1..1
29f50 30 38 39 0d 0a 36 37 32 34 0d 0a 0d 0a 73 6b 69  089..6724....ski
29f60 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23  pif postgresql #
29f70 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75   PostgreSQL requ
29f80 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e  ires AS when ren
29f90 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c  aming output col
29fa0 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f  umns..query I ro
29fb0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
29fc0 4c 20 2b 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20  L + + cor0.col0 
29fd0 2d 20 63 6f 6c 30 20 63 6f 6c 30 20 46 52 4f 4d  - col0 col0 FROM
29fe0 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
29ff0 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a  ---..0..0..0....
2a000 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
2a010 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
2a020 20 2b 20 28 20 63 6f 6c 30 20 29 20 2a 20 38 35   + ( col0 ) * 85
2a030 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
2a040 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32  b1 cor0..----..2
2a050 35 35 0d 0a 35 34 34 30 0d 0a 36 38 30 30 0d 0a  55..5440..6800..
2a060 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2a070 74 0d 0a 53 45 4c 45 43 54 20 31 36 20 2a 20 2b  t..SELECT 16 * +
2a080 20 33 33 20 46 52 4f 4d 20 74 61 62 32 2c 20 74   33 FROM tab2, t
2a090 61 62 32 20 41 53 20 63 6f 72 30 2c 20 74 61 62  ab2 AS cor0, tab
2a0a0 31 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d  1 AS cor1..----.
2a0b0 0a 32 37 20 76 61 6c 75 65 73 20 68 61 73 68 69  .27 values hashi
2a0c0 6e 67 20 74 6f 20 31 31 39 65 34 66 36 66 31 34  ng to 119e4f6f14
2a0d0 64 63 62 37 63 39 64 30 38 38 32 33 39 35 66 31  dcb7c9d0882395f1
2a0e0 38 35 64 64 37 34 0d 0a 0d 0a 71 75 65 72 79 20  85dd74....query 
2a0f0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
2a100 54 20 2b 20 2d 20 28 20 2b 20 63 6f 72 30 2e 63  T + - ( + cor0.c
2a110 6f 6c 30 20 29 20 2b 20 2d 20 63 6f 6c 32 20 41  ol0 ) + - col2 A
2a120 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31  S col1 FROM tab1
2a130 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
2a140 2d 31 32 31 0d 0a 2d 31 37 36 0d 0a 2d 35 37 0d  -121..-176..-57.
2a150 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
2a160 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
2a170 4e 43 54 20 2d 20 63 6f 72 31 2e 63 6f 6c 31 20  NCT - cor1.col1 
2a180 46 52 4f 4d 20 74 61 62 31 2c 20 74 61 62 30 20  FROM tab1, tab0 
2a190 63 6f 72 30 2c 20 74 61 62 31 20 63 6f 72 31 0d  cor0, tab1 cor1.
2a1a0 0a 2d 2d 2d 2d 0d 0a 2d 31 30 0d 0a 2d 31 33 0d  .----..-10..-13.
2a1b0 0a 2d 32 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .-26....query I 
2a1c0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
2a1d0 41 4c 4c 20 38 38 20 2a 20 2d 20 74 61 62 31 2e  ALL 88 * - tab1.
2a1e0 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52 4f  col1 AS col0 FRO
2a1f0 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  M tab1..----..-1
2a200 31 34 34 0d 0a 2d 32 32 38 38 0d 0a 2d 38 38 30  144..-2288..-880
2a210 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
2a220 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2b 20  ort..SELECT - + 
2a230 35 30 20 46 52 4f 4d 20 74 61 62 32 2c 20 74 61  50 FROM tab2, ta
2a240 62 30 2c 20 74 61 62 31 20 41 53 20 63 6f 72 30  b0, tab1 AS cor0
2a250 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75 65  ..----..27 value
2a260 73 20 68 61 73 68 69 6e 67 20 74 6f 20 66 61 66  s hashing to faf
2a270 39 31 64 35 32 36 33 63 31 38 64 62 34 38 37 37  91d5263c18db4877
2a280 61 33 63 33 30 63 34 37 65 32 34 38 37 0d 0a 0d  a3c30c47e2487...
2a290 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
2a2a0 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72  use DIV operator
2a2b0 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76   for integer div
2a2c0 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72  ision..query I r
2a2d0 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 31 37  owsort label-117
2a2e0 36 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  6..SELECT DISTIN
2a2f0 43 54 20 63 6f 6c 31 20 44 49 56 20 63 6f 6c 30  CT col1 DIV col0
2a300 20 2d 20 28 20 63 6f 6c 32 20 29 20 2a 20 63 6f   - ( col2 ) * co
2a310 6c 30 20 2a 20 63 6f 6c 32 20 41 53 20 63 6f 6c  l0 * col2 AS col
2a320 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  0 FROM tab1 AS c
2a330 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 30 37 39  or0..----..-2079
2a340 33 36 0d 0a 2d 37 33 37 32 38 30 0d 0a 2d 38 37  36..-737280..-87
2a350 34 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  40....skipif mys
2a360 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
2a370 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
2a380 73 6f 72 74 20 6c 61 62 65 6c 2d 31 31 37 36 0d  sort label-1176.
2a390 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
2a3a0 20 63 6f 6c 31 20 2f 20 63 6f 6c 30 20 2d 20 28   col1 / col0 - (
2a3b0 20 63 6f 6c 32 20 29 20 2a 20 63 6f 6c 30 20 2a   col2 ) * col0 *
2a3c0 20 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46 52   col2 AS col0 FR
2a3d0 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
2a3e0 0a 2d 2d 2d 2d 0d 0a 2d 32 30 37 39 33 36 0d 0a  .----..-207936..
2a3f0 2d 37 33 37 32 38 30 0d 0a 2d 38 37 34 30 0d 0a  -737280..-8740..
2a400 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2a410 74 0d 0a 53 45 4c 45 43 54 20 32 38 20 2a 20 63  t..SELECT 28 * c
2a420 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  ol0 AS col0 FROM
2a430 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
2a440 2d 2d 2d 0d 0a 32 34 39 32 0d 0a 36 37 32 0d 0a  ---..2492..672..
2a450 39 38 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  980....query I r
2a460 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
2a470 4c 4c 20 2d 20 63 6f 6c 31 20 2a 20 2b 20 63 6f  LL - col1 * + co
2a480 6c 32 20 2d 20 28 20 2d 20 63 6f 6c 30 20 29 20  l2 - ( - col0 ) 
2a490 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
2a4a0 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
2a4b0 0a 2d 31 31 36 38 0d 0a 2d 31 34 30 31 0d 0a 2d  .-1168..-1401..-
2a4c0 35 30 36 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f  506....skipif po
2a4d0 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67  stgresql # Postg
2a4e0 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41  reSQL requires A
2a4f0 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20  S when renaming 
2a500 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a  output columns..
2a510 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
2a520 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 2d 20  .SELECT ALL - - 
2a530 63 6f 72 30 2e 63 6f 6c 32 20 63 6f 6c 30 20 46  cor0.col2 col0 F
2a540 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
2a550 0d 0a 2d 2d 2d 2d 0d 0a 35 34 0d 0a 35 37 0d 0a  ..----..54..57..
2a560 39 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  96....query I ro
2a570 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
2a580 4c 20 63 6f 72 30 2e 63 6f 6c 30 20 2a 20 2b 20  L cor0.col0 * + 
2a590 74 61 62 31 2e 63 6f 6c 32 20 41 53 20 63 6f 6c  tab1.col2 AS col
2a5a0 32 20 46 52 4f 4d 20 74 61 62 31 2c 20 74 61 62  2 FROM tab1, tab
2a5b0 30 2c 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  0, tab1 AS cor0.
2a5c0 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75 65 73  .----..27 values
2a5d0 20 68 61 73 68 69 6e 67 20 74 6f 20 31 31 66 62   hashing to 11fb
2a5e0 39 35 65 33 35 35 65 39 39 35 62 30 35 61 66 66  95e355e995b05aff
2a5f0 33 37 35 61 33 30 35 32 32 35 63 32 0d 0a 0d 0a  375a305225c2....
2a600 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
2a610 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 30 20 2a  .SELECT - col0 *
2a620 20 2b 20 63 6f 6c 31 20 2b 20 2b 20 63 6f 6c 30   + col1 + + col0
2a630 20 2a 20 63 6f 72 30 2e 63 6f 6c 31 20 2a 20 63   * cor0.col1 * c
2a640 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  ol1 AS col0 FROM
2a650 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
2a660 2d 2d 2d 0d 0a 31 32 34 38 30 0d 0a 31 39 35 30  ---..12480..1950
2a670 0d 0a 35 37 36 30 0d 0a 0d 0a 71 75 65 72 79 20  ..5760....query 
2a680 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
2a690 54 20 2d 20 34 36 20 2d 20 63 6f 6c 30 20 41 53  T - 46 - col0 AS
2a6a0 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20   col0 FROM tab0 
2a6b0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
2a6c0 31 33 35 0d 0a 2d 37 30 0d 0a 2d 38 31 0d 0a 0d  135..-70..-81...
2a6d0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2a6e0 0d 0a 53 45 4c 45 43 54 20 2d 20 36 20 2b 20 2d  ..SELECT - 6 + -
2a6f0 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20   col2 FROM tab1 
2a700 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 32  cor0..----..-102
2a710 0d 0a 2d 36 30 0d 0a 2d 36 33 0d 0a 0d 0a 73 6b  ..-60..-63....sk
2a720 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20  ipif postgresql 
2a730 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71  # PostgreSQL req
2a740 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65  uires AS when re
2a750 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f  naming output co
2a760 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72  lumns..query I r
2a770 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
2a780 20 63 6f 72 30 2e 63 6f 6c 31 20 2a 20 2b 20 63   cor0.col1 * + c
2a790 6f 6c 30 20 2b 20 2b 20 63 6f 6c 32 20 63 6f 6c  ol0 + + col2 col
2a7a0 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  1 FROM tab2 AS c
2a7b0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33 38 31 0d  or0..----..1381.
2a7c0 0a 32 34 34 0d 0a 34 36 32 38 0d 0a 0d 0a 71 75  .244..4628....qu
2a7d0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
2a7e0 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d  ELECT DISTINCT -
2a7f0 20 63 6f 6c 31 20 2a 20 2d 20 34 33 20 2a 20 63   col1 * - 43 * c
2a800 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d  ol1 FROM tab0..-
2a810 2d 2d 2d 0d 0a 33 31 38 30 32 38 0d 0a 33 35 36  ---..318028..356
2a820 30 38 33 0d 0a 34 30 34 35 38 37 0d 0a 0d 0a 73  083..404587....s
2a830 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c  kipif postgresql
2a840 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65   # PostgreSQL re
2a850 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72  quires AS when r
2a860 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63  enaming output c
2a870 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20  olumns..query I 
2a880 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
2a890 44 49 53 54 49 4e 43 54 20 39 34 20 63 6f 6c 30  DISTINCT 94 col0
2a8a0 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d   FROM tab0..----
2a8b0 0d 0a 39 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..94....query I 
2a8c0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
2a8d0 41 4c 4c 20 2b 20 2d 20 63 6f 72 30 2e 63 6f 6c  ALL + - cor0.col
2a8e0 30 20 2a 20 2b 20 63 6f 6c 32 20 2b 20 28 20 2b  0 * + col2 + ( +
2a8f0 20 63 6f 6c 32 20 29 20 2a 20 63 6f 6c 32 20 46   col2 ) * col2 F
2a900 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
2a910 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 34 0d 0a 2d 35 37  ..----..-34..-57
2a920 34 0d 0a 32 39 37 0d 0a 0d 0a 71 75 65 72 79 20  4..297....query 
2a930 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
2a940 54 20 44 49 53 54 49 4e 43 54 20 2d 20 32 36 20  T DISTINCT - 26 
2a950 2d 20 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46  - col1 AS col2 F
2a960 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
2a970 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 36 0d 0a 2d 33 39  ..----..-36..-39
2a980 0d 0a 2d 35 32 0d 0a 0d 0a 71 75 65 72 79 20 49  ..-52....query I
2a990 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
2a9a0 20 2b 20 38 34 20 2a 20 63 6f 6c 32 20 2d 20 2b   + 84 * col2 - +
2a9b0 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46 52   col0 AS col0 FR
2a9c0 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d  OM tab0 cor0..--
2a9d0 2d 2d 0d 0a 32 37 34 38 0d 0a 34 39 0d 0a 36 37  --..2748..49..67
2a9e0 39 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  99....query I ro
2a9f0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
2aa00 4c 20 2b 20 2b 20 63 6f 6c 32 20 2a 20 2b 20 63  L + + col2 * + c
2aa10 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  ol1 AS col0 FROM
2aa20 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
2aa30 2d 2d 2d 0d 0a 31 35 33 34 0d 0a 36 34 36 0d 0a  ---..1534..646..
2aa40 38 33 37 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  837....onlyif my
2aa50 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70  sql # use DIV op
2aa60 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67  erator for integ
2aa70 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65  er division..que
2aa80 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
2aa90 65 6c 2d 31 31 39 31 0d 0a 53 45 4c 45 43 54 20  el-1191..SELECT 
2aaa0 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 72 30 2e  DISTINCT - cor0.
2aab0 63 6f 6c 30 20 2a 20 63 6f 6c 31 20 44 49 56 20  col0 * col1 DIV 
2aac0 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41  col0 FROM tab2 A
2aad0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
2aae0 37 0d 0a 2d 33 31 0d 0a 2d 35 39 0d 0a 0d 0a 73  7..-31..-59....s
2aaf0 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
2ab00 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
2ab10 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
2ab20 62 65 6c 2d 31 31 39 31 0d 0a 53 45 4c 45 43 54  bel-1191..SELECT
2ab30 20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 72 30   DISTINCT - cor0
2ab40 2e 63 6f 6c 30 20 2a 20 63 6f 6c 31 20 2f 20 63  .col0 * col1 / c
2ab50 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol0 FROM tab2 AS
2ab60 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 37   cor0..----..-17
2ab70 0d 0a 2d 33 31 0d 0a 2d 35 39 0d 0a 0d 0a 71 75  ..-31..-59....qu
2ab80 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
2ab90 45 4c 45 43 54 20 41 4c 4c 20 63 6f 72 30 2e 63  ELECT ALL cor0.c
2aba0 6f 6c 32 20 2b 20 28 20 2d 20 36 33 20 29 20 41  ol2 + ( - 63 ) A
2abb0 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31  S col2 FROM tab1
2abc0 2c 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  , tab2 AS cor0..
2abd0 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68  ----..9 values h
2abe0 61 73 68 69 6e 67 20 74 6f 20 31 33 32 37 37 33  ashing to 132773
2abf0 30 39 34 34 33 35 66 34 64 65 66 63 61 38 36 66  094435f4defca86f
2ac00 37 33 35 38 63 35 39 34 66 66 0d 0a 0d 0a 73 6b  7358c594ff....sk
2ac10 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20  ipif postgresql 
2ac20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71  # PostgreSQL req
2ac30 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65  uires AS when re
2ac40 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f  naming output co
2ac50 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72  lumns..query I r
2ac60 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
2ac70 49 53 54 49 4e 43 54 20 74 61 62 31 2e 63 6f 6c  ISTINCT tab1.col
2ac80 30 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31  0 col2 FROM tab1
2ac90 2c 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  , tab2 AS cor0..
2aca0 2d 2d 2d 2d 0d 0a 33 0d 0a 36 34 0d 0a 38 30 0d  ----..3..64..80.
2acb0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
2acc0 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 34 38 20  rt..SELECT - 48 
2acd0 2a 20 2d 20 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c  * - col0 * + col
2ace0 31 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  1 AS col1 FROM t
2acf0 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 36 32 39 36  ab0..----..16296
2ad00 30 0d 0a 33 38 38 37 35 32 0d 0a 39 39 30 37 32  0..388752..99072
2ad10 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
2ad20 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
2ad30 49 4e 43 54 20 37 32 20 41 53 20 63 6f 6c 31 20  INCT 72 AS col1 
2ad40 46 52 4f 4d 20 74 61 62 32 2c 20 74 61 62 31 20  FROM tab2, tab1 
2ad50 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 37  AS cor0..----..7
2ad60 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  2....query I row
2ad70 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 74  sort..SELECT - t
2ad80 61 62 30 2e 63 6f 6c 31 20 2a 20 2b 20 28 20 63  ab0.col1 * + ( c
2ad90 6f 6c 32 20 2b 20 2d 20 63 6f 6c 31 20 29 20 2a  ol2 + - col1 ) *
2ada0 20 2b 20 74 61 62 30 2e 63 6f 6c 31 20 46 52 4f   + tab0.col1 FRO
2adb0 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 33 39  M tab0..----..39
2adc0 31 39 38 38 0d 0a 37 34 35 32 39 0d 0a 39 30 33  1988..74529..903
2add0 32 36 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  264....query I r
2ade0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
2adf0 20 39 32 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d   92 AS col1 FROM
2ae00 20 74 61 62 30 2c 20 74 61 62 32 2c 20 74 61 62   tab0, tab2, tab
2ae10 30 20 41 53 20 63 6f 72 30 2c 20 74 61 62 31 0d  0 AS cor0, tab1.
2ae20 0a 2d 2d 2d 2d 0d 0a 38 31 20 76 61 6c 75 65 73  .----..81 values
2ae30 20 68 61 73 68 69 6e 67 20 74 6f 20 63 66 63 66   hashing to cfcf
2ae40 30 31 32 63 65 31 61 38 64 64 36 30 61 37 34 32  012ce1a8dd60a742
2ae50 38 62 34 65 66 36 62 39 35 38 34 33 0d 0a 0d 0a  8b4ef6b95843....
2ae60 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
2ae70 0a 53 45 4c 45 43 54 20 2b 20 37 36 20 46 52 4f  .SELECT + 76 FRO
2ae80 4d 20 74 61 62 30 2c 20 74 61 62 31 20 63 6f 72  M tab0, tab1 cor
2ae90 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65  0..----..9 value
2aea0 73 20 68 61 73 68 69 6e 67 20 74 6f 20 33 30 62  s hashing to 30b
2aeb0 38 39 34 31 61 37 30 30 63 66 66 64 35 62 39 38  8941a700cffd5b98
2aec0 33 31 31 36 33 38 33 62 64 34 32 64 35 0d 0a 0d  3116383bd42d5...
2aed0 0a 71 75 65 72 79 20 49 49 49 49 49 49 49 49 49  .query IIIIIIIII
2aee0 49 49 49 49 49 49 49 49 49 20 72 6f 77 73 6f 72  IIIIIIIII rowsor
2aef0 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
2af00 43 54 20 2a 20 46 52 4f 4d 20 74 61 62 31 2c 20  CT * FROM tab1, 
2af10 74 61 62 30 20 41 53 20 63 6f 72 30 20 43 52 4f  tab0 AS cor0 CRO
2af20 53 53 20 4a 4f 49 4e 20 74 61 62 32 2c 20 74 61  SS JOIN tab2, ta
2af30 62 30 2c 20 74 61 62 30 20 41 53 20 63 6f 72 31  b0, tab0 AS cor1
2af40 2c 20 74 61 62 30 20 41 53 20 63 6f 72 32 0d 0a  , tab0 AS cor2..
2af50 2d 2d 2d 2d 0d 0a 31 33 31 32 32 20 76 61 6c 75  ----..13122 valu
2af60 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 32 66  es hashing to 2f
2af70 38 34 38 31 39 37 37 30 61 64 63 32 30 36 65 30  84819770adc206e0
2af80 37 32 32 66 32 30 34 33 63 66 30 39 36 37 0d 0a  722f2043cf0967..
2af90 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2afa0 74 0d 0a 53 45 4c 45 43 54 20 37 38 20 2a 20 28  t..SELECT 78 * (
2afb0 20 63 6f 6c 30 20 2a 20 63 6f 72 30 2e 63 6f 6c   col0 * cor0.col
2afc0 30 20 29 20 46 52 4f 4d 20 74 61 62 30 20 41 53  0 ) FROM tab0 AS
2afd0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 34 34 39   cor0..----..449
2afe0 32 38 0d 0a 36 31 37 38 33 38 0d 0a 39 35 35 35  28..617838..9555
2aff0 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  0....query I row
2b000 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 74  sort..SELECT - t
2b010 61 62 31 2e 63 6f 6c 31 20 2a 20 63 6f 6c 31 20  ab1.col1 * col1 
2b020 2a 20 28 20 2b 20 63 6f 6c 32 20 29 20 41 53 20  * ( + col2 ) AS 
2b030 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 0d 0a  col0 FROM tab1..
2b040 2d 2d 2d 2d 0d 0a 2d 31 36 32 32 34 0d 0a 2d 33  ----..-16224..-3
2b050 36 35 30 34 0d 0a 2d 35 37 30 30 0d 0a 0d 0a 71  6504..-5700....q
2b060 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
2b070 53 45 4c 45 43 54 20 63 6f 6c 31 20 2b 20 63 6f  SELECT col1 + co
2b080 6c 30 20 2b 20 35 35 20 46 52 4f 4d 20 74 61 62  l0 + 55 FROM tab
2b090 32 0d 0a 2d 2d 2d 2d 0d 0a 31 35 31 0d 0a 31 39  2..----..151..19
2b0a0 32 0d 0a 39 33 0d 0a 0d 0a 71 75 65 72 79 20 49  2..93....query I
2b0b0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
2b0c0 20 41 4c 4c 20 2b 20 63 6f 6c 31 20 2a 20 63 6f   ALL + col1 * co
2b0d0 6c 32 20 2a 20 63 6f 6c 31 20 2b 20 2b 20 63 6f  l2 * col1 + + co
2b0e0 6c 30 20 2a 20 63 6f 6c 32 20 46 52 4f 4d 20 74  l0 * col2 FROM t
2b0f0 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 32 33 39 30 34  ab1..----..23904
2b100 0d 0a 33 36 36 36 36 0d 0a 39 33 34 38 0d 0a 0d  ..36666..9348...
2b110 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
2b120 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72  use DIV operator
2b130 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76   for integer div
2b140 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72  ision..query I r
2b150 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 32 30  owsort label-120
2b160 34 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  4..SELECT DISTIN
2b170 43 54 20 37 33 20 44 49 56 20 2d 20 63 6f 6c 31  CT 73 DIV - col1
2b180 20 2b 20 36 38 20 2a 20 2b 20 32 35 20 41 53 20   + 68 * + 25 AS 
2b190 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 0d 0a  col1 FROM tab2..
2b1a0 2d 2d 2d 2d 0d 0a 31 36 39 36 0d 0a 31 36 39 38  ----..1696..1698
2b1b0 0d 0a 31 36 39 39 0d 0a 0d 0a 73 6b 69 70 69 66  ..1699....skipif
2b1c0 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
2b1d0 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
2b1e0 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
2b1f0 32 30 34 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  204..SELECT DIST
2b200 49 4e 43 54 20 37 33 20 2f 20 2d 20 63 6f 6c 31  INCT 73 / - col1
2b210 20 2b 20 36 38 20 2a 20 2b 20 32 35 20 41 53 20   + 68 * + 25 AS 
2b220 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 0d 0a  col1 FROM tab2..
2b230 2d 2d 2d 2d 0d 0a 31 36 39 36 0d 0a 31 36 39 38  ----..1696..1698
2b240 0d 0a 31 36 39 39 0d 0a 0d 0a 71 75 65 72 79 20  ..1699....query 
2b250 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
2b260 54 20 2b 20 33 36 20 41 53 20 63 6f 6c 31 20 46  T + 36 AS col1 F
2b270 52 4f 4d 20 74 61 62 31 2c 20 74 61 62 32 2c 20  ROM tab1, tab2, 
2b280 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
2b290 2d 2d 0d 0a 32 37 20 76 61 6c 75 65 73 20 68 61  --..27 values ha
2b2a0 73 68 69 6e 67 20 74 6f 20 34 64 31 38 39 32 65  shing to 4d1892e
2b2b0 38 38 30 31 32 35 64 63 39 30 33 34 35 37 32 31  880125dc90345721
2b2c0 31 35 31 61 63 62 32 32 63 0d 0a 0d 0a 71 75 65  151acb22c....que
2b2d0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
2b2e0 4c 45 43 54 20 39 34 20 2b 20 2d 20 74 61 62 31  LECT 94 + - tab1
2b2f0 2e 63 6f 6c 31 20 2b 20 2d 20 74 61 62 31 2e 63  .col1 + - tab1.c
2b300 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  ol0 AS col0 FROM
2b310 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 0d 0a   tab1..----..1..
2b320 32 30 0d 0a 36 35 0d 0a 0d 0a 71 75 65 72 79 20  20..65....query 
2b330 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
2b340 54 20 41 4c 4c 20 2d 20 63 6f 6c 32 20 2a 20 2b  T ALL - col2 * +
2b350 20 63 6f 72 30 2e 63 6f 6c 30 20 2a 20 63 6f 72   cor0.col0 * cor
2b360 30 2e 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46  0.col1 AS col2 F
2b370 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
2b380 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 39 36 35 32 0d  ..----..-119652.
2b390 0a 2d 35 31 30 33 34 0d 0a 2d 35 38 35 39 0d 0a  .-51034..-5859..
2b3a0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2b3b0 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
2b3c0 43 54 20 2d 20 2d 20 63 6f 6c 31 20 2a 20 2d 20  CT - - col1 * - 
2b3d0 63 6f 6c 32 20 2b 20 28 20 2b 20 63 6f 6c 30 20  col2 + ( + col0 
2b3e0 29 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  ) AS col0 FROM t
2b3f0 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
2b400 2d 0d 0a 2d 32 38 31 34 0d 0a 2d 36 32 0d 0a 2d  -..-2814..-62..-
2b410 37 33 37 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20  7373....query I 
2b420 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
2b430 41 4c 4c 20 2d 20 28 20 39 20 29 20 46 52 4f 4d  ALL - ( 9 ) FROM
2b440 20 74 61 62 31 2c 20 74 61 62 31 20 63 6f 72 30   tab1, tab1 cor0
2b450 2c 20 74 61 62 32 20 41 53 20 63 6f 72 31 0d 0a  , tab2 AS cor1..
2b460 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75 65 73 20  ----..27 values 
2b470 68 61 73 68 69 6e 67 20 74 6f 20 33 64 66 65 36  hashing to 3dfe6
2b480 38 39 65 31 36 63 65 33 61 38 37 38 37 37 64 34  89e16ce3a87877d4
2b490 30 66 33 34 39 65 36 63 37 62 35 0d 0a 0d 0a 71  0f349e6c7b5....q
2b4a0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
2b4b0 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 28 20 2b  SELECT ALL + ( +
2b4c0 20 63 6f 6c 30 20 29 20 2a 20 2b 20 37 36 20 2a   col0 ) * + 76 *
2b4d0 20 28 20 63 6f 6c 30 20 29 20 41 53 20 63 6f 6c   ( col0 ) AS col
2b4e0 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  1 FROM tab1 AS c
2b4f0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 31 31 32 39  or0..----..31129
2b500 36 0d 0a 34 38 36 34 30 30 0d 0a 36 38 34 0d 0a  6..486400..684..
2b510 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2b520 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 72 30  t..SELECT - cor0
2b530 2e 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c 30 20 2b  .col1 * + col0 +
2b540 20 2b 20 35 39 20 2a 20 2b 20 63 6f 72 30 2e 63   + 59 * + cor0.c
2b550 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  ol0 AS col2 FROM
2b560 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
2b570 2d 2d 2d 0d 0a 33 31 33 36 0d 0a 33 36 38 30 0d  ---..3136..3680.
2b580 0a 39 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .99....query I r
2b590 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
2b5a0 20 31 39 20 2a 20 63 6f 6c 30 20 2d 20 2d 20 34   19 * col0 - - 4
2b5b0 39 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  9 AS col1 FROM t
2b5c0 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab0 cor0..----..
2b5d0 2d 31 36 34 32 0d 0a 2d 34 30 37 0d 0a 2d 36 31  -1642..-407..-61
2b5e0 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  6....query I row
2b5f0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
2b600 54 49 4e 43 54 20 74 61 62 32 2e 63 6f 6c 30 20  TINCT tab2.col0 
2b610 2a 20 2b 20 28 20 2d 20 63 6f 6c 30 20 2a 20 63  * + ( - col0 * c
2b620 6f 6c 30 20 29 20 2b 20 2b 20 28 20 2b 20 74 61  ol0 ) + + ( + ta
2b630 62 32 2e 63 6f 6c 31 20 29 20 2a 20 63 6f 6c 30  b2.col1 ) * col0
2b640 20 2b 20 2b 20 32 33 20 2a 20 2d 20 32 33 20 41   + + 23 * - 23 A
2b650 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32  S col0 FROM tab2
2b660 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 37 30 34 37 39 0d  ..----..-470479.
2b670 0a 2d 34 39 32 32 32 35 0d 0a 2d 36 35 35 0d 0a  .-492225..-655..
2b680 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
2b690 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f   use DIV operato
2b6a0 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69  r for integer di
2b6b0 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20  vision..query I 
2b6c0 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 32  rowsort label-12
2b6d0 31 34 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 32 20  14..SELECT col2 
2b6e0 44 49 56 20 34 38 20 2d 20 2b 20 63 6f 6c 31 20  DIV 48 - + col1 
2b6f0 44 49 56 20 63 6f 6c 31 20 41 53 20 63 6f 6c 31  DIV col1 AS col1
2b700 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d   FROM tab0..----
2b710 0d 0a 2d 31 0d 0a 2d 31 0d 0a 30 0d 0a 0d 0a 73  ..-1..-1..0....s
2b720 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
2b730 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
2b740 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
2b750 62 65 6c 2d 31 32 31 34 0d 0a 53 45 4c 45 43 54  bel-1214..SELECT
2b760 20 63 6f 6c 32 20 2f 20 34 38 20 2d 20 2b 20 63   col2 / 48 - + c
2b770 6f 6c 31 20 2f 20 63 6f 6c 31 20 41 53 20 63 6f  ol1 / col1 AS co
2b780 6c 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d  l1 FROM tab0..--
2b790 2d 2d 0d 0a 2d 31 0d 0a 2d 31 0d 0a 30 0d 0a 0d  --..-1..-1..0...
2b7a0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2b7b0 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 32 20  ..SELECT + col2 
2b7c0 2b 20 2b 20 34 37 20 46 52 4f 4d 20 74 61 62 32  + + 47 FROM tab2
2b7d0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
2b7e0 37 33 0d 0a 37 34 0d 0a 38 35 0d 0a 0d 0a 6f 6e  73..74..85....on
2b7f0 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
2b800 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
2b810 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
2b820 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
2b830 6f 72 74 20 6c 61 62 65 6c 2d 31 32 31 36 0d 0a  ort label-1216..
2b840 53 45 4c 45 43 54 20 63 6f 6c 30 20 2b 20 63 6f  SELECT col0 + co
2b850 6c 30 20 44 49 56 20 63 6f 72 30 2e 63 6f 6c 32  l0 DIV cor0.col2
2b860 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
2b870 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
2b880 0d 0a 32 34 0d 0a 37 30 0d 0a 39 30 0d 0a 0d 0a  ..24..70..90....
2b890 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
2b8a0 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
2b8b0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
2b8c0 61 62 65 6c 2d 31 32 31 36 0d 0a 53 45 4c 45 43  abel-1216..SELEC
2b8d0 54 20 63 6f 6c 30 20 2b 20 63 6f 6c 30 20 2f 20  T col0 + col0 / 
2b8e0 63 6f 72 30 2e 63 6f 6c 32 20 41 53 20 63 6f 6c  cor0.col2 AS col
2b8f0 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  0 FROM tab0 AS c
2b900 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 34 0d 0a 37  or0..----..24..7
2b910 30 0d 0a 39 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  0..90....onlyif 
2b920 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20  mysql # use DIV 
2b930 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74  operator for int
2b940 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71  eger division..q
2b950 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
2b960 61 62 65 6c 2d 31 32 31 37 0d 0a 53 45 4c 45 43  abel-1217..SELEC
2b970 54 20 44 49 53 54 49 4e 43 54 20 63 6f 72 30 2e  T DISTINCT cor0.
2b980 63 6f 6c 32 20 44 49 56 20 63 6f 6c 30 20 41 53  col2 DIV col0 AS
2b990 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20   col1 FROM tab0 
2b9a0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30  AS cor0..----..0
2b9b0 0d 0a 31 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  ..1....skipif my
2b9c0 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
2b9d0 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
2b9e0 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 32 31 37  wsort label-1217
2b9f0 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
2ba00 54 20 63 6f 72 30 2e 63 6f 6c 32 20 2f 20 63 6f  T cor0.col2 / co
2ba10 6c 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  l0 AS col1 FROM 
2ba20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
2ba30 2d 2d 0d 0a 30 0d 0a 31 0d 0a 0d 0a 6f 6e 6c 79  --..0..1....only
2ba40 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44  if mysql # use D
2ba50 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20  IV operator for 
2ba60 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e  integer division
2ba70 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2ba80 74 20 6c 61 62 65 6c 2d 31 32 31 38 0d 0a 53 45  t label-1218..SE
2ba90 4c 45 43 54 20 2b 20 2d 20 31 34 20 44 49 56 20  LECT + - 14 DIV 
2baa0 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46  + col1 AS col0 F
2bab0 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
2bac0 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d  ..----..0..0..0.
2bad0 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
2bae0 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
2baf0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2bb00 74 20 6c 61 62 65 6c 2d 31 32 31 38 0d 0a 53 45  t label-1218..SE
2bb10 4c 45 43 54 20 2b 20 2d 20 31 34 20 2f 20 2b 20  LECT + - 14 / + 
2bb20 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52 4f  col1 AS col0 FRO
2bb30 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
2bb40 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d  ----..0..0..0...
2bb50 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
2bb60 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72  use DIV operator
2bb70 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76   for integer div
2bb80 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72  ision..query I r
2bb90 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 32 31  owsort label-121
2bba0 39 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20  9..SELECT ALL - 
2bbb0 43 41 53 54 28 20 63 6f 6c 32 20 41 53 20 53 49  CAST( col2 AS SI
2bbc0 47 4e 45 44 20 29 20 44 49 56 20 2d 20 63 6f 6c  GNED ) DIV - col
2bbd0 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  0 FROM tab1 AS c
2bbe0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 31 0d  or0..----..0..1.
2bbf0 0a 31 38 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  .18....skipif my
2bc00 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
2bc10 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
2bc20 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 32 31 39  wsort label-1219
2bc30 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 43  ..SELECT ALL - C
2bc40 41 53 54 20 28 20 63 6f 6c 32 20 41 53 20 49 4e  AST ( col2 AS IN
2bc50 54 45 47 45 52 20 29 20 2f 20 2d 20 63 6f 6c 30  TEGER ) / - col0
2bc60 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
2bc70 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 31 0d 0a  r0..----..0..1..
2bc80 31 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  18....query I ro
2bc90 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
2bca0 63 6f 6c 31 20 2a 20 28 20 63 6f 72 30 2e 63 6f  col1 * ( cor0.co
2bcb0 6c 31 20 29 20 41 53 20 63 6f 6c 31 20 46 52 4f  l1 ) AS col1 FRO
2bcc0 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
2bcd0 2d 2d 2d 2d 0d 0a 31 30 30 0d 0a 31 36 39 0d 0a  ----..100..169..
2bce0 36 37 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  676....query I r
2bcf0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
2bd00 4c 4c 20 28 20 34 38 20 29 20 2b 20 2b 20 63 6f  LL ( 48 ) + + co
2bd10 72 30 2e 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  r0.col2 FROM tab
2bd20 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
2bd30 0a 31 33 30 0d 0a 34 39 0d 0a 38 31 0d 0a 0d 0a  .130..49..81....
2bd40 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
2bd50 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
2bd60 20 2d 20 2d 20 28 20 28 20 63 6f 6c 31 20 29 20   - - ( ( col1 ) 
2bd70 29 20 2a 20 63 6f 6c 32 20 41 53 20 63 6f 6c 30  ) * col2 AS col0
2bd80 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
2bd90 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 34 38 0d 0a  r0..----..1248..
2bda0 31 34 30 34 0d 0a 35 37 30 0d 0a 0d 0a 6f 6e 6c  1404..570....onl
2bdb0 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20  yif mysql # use 
2bdc0 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72  DIV operator for
2bdd0 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f   integer divisio
2bde0 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  n..query I rowso
2bdf0 72 74 20 6c 61 62 65 6c 2d 31 32 32 33 0d 0a 53  rt label-1223..S
2be00 45 4c 45 43 54 20 41 4c 4c 20 2d 20 43 41 53 54  ELECT ALL - CAST
2be10 28 20 2b 20 63 6f 6c 30 20 41 53 20 53 49 47 4e  ( + col0 AS SIGN
2be20 45 44 20 29 20 2b 20 2b 20 63 6f 6c 30 20 44 49  ED ) + + col0 DI
2be30 56 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61  V + col1 FROM ta
2be40 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
2be50 0d 0a 2d 37 0d 0a 2d 37 35 0d 0a 2d 37 37 0d 0a  ..-7..-75..-77..
2be60 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
2be70 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
2be80 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2be90 20 6c 61 62 65 6c 2d 31 32 32 33 0d 0a 53 45 4c   label-1223..SEL
2bea0 45 43 54 20 41 4c 4c 20 2d 20 43 41 53 54 20 28  ECT ALL - CAST (
2beb0 20 2b 20 63 6f 6c 30 20 41 53 20 49 4e 54 45 47   + col0 AS INTEG
2bec0 45 52 20 29 20 2b 20 2b 20 63 6f 6c 30 20 2f 20  ER ) + + col0 / 
2bed0 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32  + col1 FROM tab2
2bee0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
2bef0 2d 37 0d 0a 2d 37 35 0d 0a 2d 37 37 0d 0a 0d 0a  -7..-75..-77....
2bf00 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
2bf10 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
2bf20 20 35 35 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d   55 AS col0 FROM
2bf30 20 74 61 62 30 2c 20 74 61 62 30 20 63 6f 72 30   tab0, tab0 cor0
2bf40 2c 20 74 61 62 30 20 41 53 20 63 6f 72 31 0d 0a  , tab0 AS cor1..
2bf50 2d 2d 2d 2d 0d 0a 35 35 0d 0a 0d 0a 73 6b 69 70  ----..55....skip
2bf60 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20  if postgresql # 
2bf70 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69  PostgreSQL requi
2bf80 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61  res AS when rena
2bf90 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75  ming output colu
2bfa0 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  mns..query I row
2bfb0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c  sort..SELECT col
2bfc0 31 20 2b 20 28 20 2b 20 63 6f 72 30 2e 63 6f 6c  1 + ( + cor0.col
2bfd0 30 20 29 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61  0 ) col0 FROM ta
2bfe0 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
2bff0 0d 0a 31 31 30 0d 0a 31 33 32 0d 0a 31 38 30 0d  ..110..132..180.
2c000 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
2c010 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79  # support for My
2c020 53 51 4c 20 73 70 65 63 69 66 69 63 20 73 79 73  SQL specific sys
2c030 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79  tem types and sy
2c040 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f  ntax..query I ro
2c050 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 32 32 36  wsort label-1226
2c060 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63  ..SELECT ALL + c
2c070 6f 6c 31 20 2a 20 2b 20 43 41 53 54 28 20 2b 20  ol1 * + CAST( + 
2c080 39 36 20 41 53 20 53 49 47 4e 45 44 20 29 20 63  96 AS SIGNED ) c
2c090 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol2 FROM tab0 AS
2c0a0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 38 32 35   cor0..----..825
2c0b0 36 0d 0a 38 37 33 36 0d 0a 39 33 31 32 0d 0a 0d  6..8736..9312...
2c0c0 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73  .skipif postgres
2c0d0 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20  ql # PostgreSQL 
2c0e0 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e  requires AS when
2c0f0 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74   renaming output
2c100 20 63 6f 6c 75 6d 6e 73 0d 0a 73 6b 69 70 69 66   columns..skipif
2c110 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
2c120 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
2c130 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
2c140 32 32 36 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  226..SELECT ALL 
2c150 2b 20 63 6f 6c 31 20 2a 20 2b 20 43 41 53 54 20  + col1 * + CAST 
2c160 28 20 2b 20 39 36 20 41 53 20 49 4e 54 45 47 45  ( + 96 AS INTEGE
2c170 52 20 29 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61  R ) col2 FROM ta
2c180 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
2c190 0d 0a 38 32 35 36 0d 0a 38 37 33 36 0d 0a 39 33  ..8256..8736..93
2c1a0 31 32 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  12....onlyif mys
2c1b0 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65  ql # use DIV ope
2c1c0 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65  rator for intege
2c1d0 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72  r division..quer
2c1e0 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
2c1f0 6c 2d 31 32 32 37 0d 0a 53 45 4c 45 43 54 20 44  l-1227..SELECT D
2c200 49 53 54 49 4e 43 54 20 63 6f 72 30 2e 63 6f 6c  ISTINCT cor0.col
2c210 30 20 44 49 56 20 2d 20 63 6f 6c 30 20 2b 20 2b  0 DIV - col0 + +
2c220 20 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c 30 20 2a   col1 * + col0 *
2c230 20 2d 20 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20   - col0 AS col1 
2c240 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
2c250 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 38 38 32 36  0..----..-118826
2c260 0d 0a 2d 34 39 35 33 37 0d 0a 2d 37 32 30 38 31  ..-49537..-72081
2c270 32 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  2....skipif mysq
2c280 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
2c290 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
2c2a0 6f 72 74 20 6c 61 62 65 6c 2d 31 32 32 37 0d 0a  ort label-1227..
2c2b0 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
2c2c0 63 6f 72 30 2e 63 6f 6c 30 20 2f 20 2d 20 63 6f  cor0.col0 / - co
2c2d0 6c 30 20 2b 20 2b 20 63 6f 6c 31 20 2a 20 2b 20  l0 + + col1 * + 
2c2e0 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c 30 20 41 53  col0 * - col0 AS
2c2f0 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20   col1 FROM tab0 
2c300 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
2c310 31 31 38 38 32 36 0d 0a 2d 34 39 35 33 37 0d 0a  118826..-49537..
2c320 2d 37 32 30 38 31 32 0d 0a 0d 0a 71 75 65 72 79  -720812....query
2c330 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
2c340 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 2b 20  CT DISTINCT - + 
2c350 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c 31 20 2b 20  col2 * + col1 + 
2c360 2d 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30  - col0 FROM tab0
2c370 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
2c380 2d 31 33 32 0d 0a 2d 32 38 36 32 0d 0a 2d 37 35  -132..-2862..-75
2c390 35 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  51....query I ro
2c3a0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
2c3b0 63 6f 6c 30 20 2a 20 39 38 20 41 53 20 63 6f 6c  col0 * 98 AS col
2c3c0 31 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d  1 FROM tab2..---
2c3d0 2d 0d 0a 2d 36 38 36 0d 0a 2d 37 36 34 34 0d 0a  -..-686..-7644..
2c3e0 2d 37 37 34 32 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  -7742....onlyif 
2c3f0 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20  mysql # use DIV 
2c400 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74  operator for int
2c410 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71  eger division..q
2c420 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
2c430 61 62 65 6c 2d 31 32 33 30 0d 0a 53 45 4c 45 43  abel-1230..SELEC
2c440 54 20 2b 20 63 6f 6c 30 20 44 49 56 20 28 20 31  T + col0 DIV ( 1
2c450 38 20 29 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  8 ) AS col1 FROM
2c460 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a   tab2..----..0..
2c470 34 0d 0a 34 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  4..4....skipif m
2c480 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
2c490 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
2c4a0 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 32 33  owsort label-123
2c4b0 30 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 30  0..SELECT + col0
2c4c0 20 2f 20 28 20 31 38 20 29 20 41 53 20 63 6f 6c   / ( 18 ) AS col
2c4d0 31 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d  1 FROM tab2..---
2c4e0 2d 0d 0a 30 0d 0a 34 0d 0a 34 0d 0a 0d 0a 6f 6e  -..0..4..4....on
2c4f0 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70  lyif mysql # sup
2c500 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73  port for MySQL s
2c510 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20 74  pecific system t
2c520 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d  ypes and syntax.
2c530 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2c540 20 6c 61 62 65 6c 2d 31 32 33 31 0d 0a 53 45 4c   label-1231..SEL
2c550 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63  ECT DISTINCT + c
2c560 6f 6c 30 20 2a 20 2b 20 28 20 39 30 20 29 20 2a  ol0 * + ( 90 ) *
2c570 20 2b 20 74 61 62 31 2e 63 6f 6c 32 20 2b 20 2d   + tab1.col2 + -
2c580 20 43 41 53 54 28 20 4e 55 4c 4c 20 41 53 20 44   CAST( NULL AS D
2c590 45 43 49 4d 41 4c 20 29 20 41 53 20 63 6f 6c 32  ECIMAL ) AS col2
2c5a0 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d   FROM tab1..----
2c5b0 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66  ..NULL....skipif
2c5c0 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
2c5d0 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
2c5e0 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
2c5f0 32 33 31 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  231..SELECT DIST
2c600 49 4e 43 54 20 2b 20 63 6f 6c 30 20 2a 20 2b 20  INCT + col0 * + 
2c610 28 20 39 30 20 29 20 2a 20 2b 20 74 61 62 31 2e  ( 90 ) * + tab1.
2c620 63 6f 6c 32 20 2b 20 2d 20 43 41 53 54 20 28 20  col2 + - CAST ( 
2c630 4e 55 4c 4c 20 41 53 20 52 45 41 4c 20 29 20 41  NULL AS REAL ) A
2c640 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31  S col2 FROM tab1
2c650 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 0d 0a  ..----..NULL....
2c660 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
2c670 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
2c680 20 63 6f 6c 32 20 2a 20 28 20 2b 20 74 61 62 30   col2 * ( + tab0
2c690 2e 63 6f 6c 31 20 29 20 2b 20 2b 20 63 6f 6c 31  .col1 ) + + col1
2c6a0 20 2a 20 2d 20 28 20 2b 20 74 61 62 30 2e 63 6f   * - ( + tab0.co
2c6b0 6c 30 20 29 20 41 53 20 63 6f 6c 32 20 46 52 4f  l0 ) AS col2 FRO
2c6c0 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33  M tab0..----..-3
2c6d0 32 39 38 0d 0a 2d 36 33 37 0d 0a 37 37 34 0d 0a  298..-637..774..
2c6e0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2c6f0 74 0d 0a 53 45 4c 45 43 54 20 2d 20 37 36 20 2b  t..SELECT - 76 +
2c700 20 2b 20 38 36 20 41 53 20 63 6f 6c 32 20 46 52   + 86 AS col2 FR
2c710 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
2c720 0a 2d 2d 2d 2d 0d 0a 31 30 0d 0a 31 30 0d 0a 31  .----..10..10..1
2c730 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  0....query I row
2c740 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
2c750 20 63 6f 6c 32 20 2d 20 74 61 62 32 2e 63 6f 6c   col2 - tab2.col
2c760 32 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d  2 FROM tab2..---
2c770 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a 6f 6e  -..0..0..0....on
2c780 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70  lyif mysql # sup
2c790 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73  port for MySQL s
2c7a0 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20 74  pecific system t
2c7b0 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d  ypes and syntax.
2c7c0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2c7d0 20 6c 61 62 65 6c 2d 31 32 33 35 0d 0a 53 45 4c   label-1235..SEL
2c7e0 45 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c  ECT DISTINCT col
2c7f0 30 20 2a 20 2d 20 43 41 53 54 28 20 4e 55 4c 4c  0 * - CAST( NULL
2c800 20 41 53 20 53 49 47 4e 45 44 20 29 20 2a 20 2d   AS SIGNED ) * -
2c810 20 74 61 62 31 2e 63 6f 6c 32 20 46 52 4f 4d 20   tab1.col2 FROM 
2c820 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c  tab1..----..NULL
2c830 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
2c840 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
2c850 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
2c860 72 74 20 6c 61 62 65 6c 2d 31 32 33 35 0d 0a 53  rt label-1235..S
2c870 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 63  ELECT DISTINCT c
2c880 6f 6c 30 20 2a 20 2d 20 43 41 53 54 20 28 20 4e  ol0 * - CAST ( N
2c890 55 4c 4c 20 41 53 20 49 4e 54 45 47 45 52 20 29  ULL AS INTEGER )
2c8a0 20 2a 20 2d 20 74 61 62 31 2e 63 6f 6c 32 20 46   * - tab1.col2 F
2c8b0 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab1..----..
2c8c0 4e 55 4c 4c 0d 0a 0d 0a 71 75 65 72 79 20 49 20  NULL....query I 
2c8d0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
2c8e0 2d 20 63 6f 6c 32 20 2a 20 2b 20 33 34 20 2b 20  - col2 * + 34 + 
2c8f0 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 0d 0a  col2 FROM tab2..
2c900 2d 2d 2d 2d 0d 0a 2d 31 32 35 34 0d 0a 2d 38 35  ----..-1254..-85
2c910 38 0d 0a 2d 38 39 31 0d 0a 0d 0a 71 75 65 72 79  8..-891....query
2c920 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
2c930 43 54 20 38 37 20 2a 20 63 6f 6c 31 20 2d 20 63  CT 87 * col1 - c
2c940 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  ol0 AS col1 FROM
2c950 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 30 35   tab1..----..105
2c960 31 0d 0a 32 32 35 39 0d 0a 38 30 36 0d 0a 0d 0a  1..2259..806....
2c970 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71  skipif postgresq
2c980 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72  l # PostgreSQL r
2c990 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20  equires AS when 
2c9a0 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20  renaming output 
2c9b0 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49  columns..query I
2c9c0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
2c9d0 20 2b 20 36 34 20 2b 20 63 6f 6c 32 20 63 6f 6c   + 64 + col2 col
2c9e0 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d  0 FROM tab0..---
2c9f0 2d 0d 0a 31 34 36 0d 0a 36 35 0d 0a 39 37 0d 0a  -..146..65..97..
2ca00 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2ca10 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 31 20 2a  t..SELECT col1 *
2ca20 20 2d 20 28 20 63 6f 6c 30 20 29 20 2b 20 37 37   - ( col0 ) + 77
2ca30 20 2a 20 2d 20 63 6f 6c 32 20 46 52 4f 4d 20 74   * - col2 FROM t
2ca40 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 32 33 36  ab1..----..-4236
2ca50 0d 0a 2d 35 30 32 39 0d 0a 2d 38 34 33 32 0d 0a  ..-5029..-8432..
2ca60 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2ca70 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
2ca80 43 54 20 2d 20 37 36 20 41 53 20 63 6f 6c 31 20  CT - 76 AS col1 
2ca90 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a  FROM tab0 cor0..
2caa0 2d 2d 2d 2d 0d 0a 2d 37 36 0d 0a 0d 0a 71 75 65  ----..-76....que
2cab0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
2cac0 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20  LECT DISTINCT - 
2cad0 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c 32 20 2b 20  col0 * + col2 + 
2cae0 2b 20 74 61 62 31 2e 63 6f 6c 30 20 41 53 20 63  + tab1.col0 AS c
2caf0 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d  ol1 FROM tab1..-
2cb00 2d 2d 2d 0d 0a 2d 31 35 39 0d 0a 2d 33 35 38 34  ---..-159..-3584
2cb10 0d 0a 2d 37 36 30 30 0d 0a 0d 0a 71 75 65 72 79  ..-7600....query
2cb20 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
2cb30 43 54 20 74 61 62 32 2e 63 6f 6c 32 20 2b 20 2b  CT tab2.col2 + +
2cb40 20 33 32 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d   32 FROM tab2..-
2cb50 2d 2d 2d 0d 0a 35 38 0d 0a 35 39 0d 0a 37 30 0d  ---..58..59..70.
2cb60 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72  ...skipif postgr
2cb70 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51  esql # PostgreSQ
2cb80 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68  L requires AS wh
2cb90 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70  en renaming outp
2cba0 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72  ut columns..quer
2cbb0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
2cbc0 45 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c  ECT DISTINCT col
2cbd0 31 20 2a 20 2b 20 63 6f 6c 30 20 2b 20 2b 20 63  1 * + col0 + + c
2cbe0 6f 6c 31 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61  ol1 col2 FROM ta
2cbf0 62 30 0d 0a 2d 2d 2d 2d 0d 0a 32 31 35 30 0d 0a  b0..----..2150..
2cc00 33 34 39 32 0d 0a 38 31 39 30 0d 0a 0d 0a 6f 6e  3492..8190....on
2cc10 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
2cc20 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
2cc30 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
2cc40 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
2cc50 6f 72 74 20 6c 61 62 65 6c 2d 31 32 34 34 0d 0a  ort label-1244..
2cc60 53 45 4c 45 43 54 20 63 6f 6c 31 20 2b 20 63 6f  SELECT col1 + co
2cc70 6c 30 20 44 49 56 20 63 6f 6c 30 20 2b 20 2d 20  l0 DIV col0 + - 
2cc80 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46 52 4f  col2 AS col1 FRO
2cc90 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 32  M tab2..----..-2
2cca0 30 0d 0a 33 34 0d 0a 35 0d 0a 0d 0a 73 6b 69 70  0..34..5....skip
2ccb0 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
2ccc0 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
2ccd0 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
2cce0 2d 31 32 34 34 0d 0a 53 45 4c 45 43 54 20 63 6f  -1244..SELECT co
2ccf0 6c 31 20 2b 20 63 6f 6c 30 20 2f 20 63 6f 6c 30  l1 + col0 / col0
2cd00 20 2b 20 2d 20 63 6f 6c 32 20 41 53 20 63 6f 6c   + - col2 AS col
2cd10 31 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d  1 FROM tab2..---
2cd20 2d 0d 0a 2d 32 30 0d 0a 33 34 0d 0a 35 0d 0a 0d  -..-20..34..5...
2cd30 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2cd40 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 39  ..SELECT ALL - 9
2cd50 31 20 2a 20 2b 20 63 6f 6c 32 20 41 53 20 63 6f  1 * + col2 AS co
2cd60 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 63 6f 72  l2 FROM tab2 cor
2cd70 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 33 36 36 0d 0a  0..----..-2366..
2cd80 2d 32 34 35 37 0d 0a 2d 33 34 35 38 0d 0a 0d 0a  -2457..-3458....
2cd90 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
2cda0 0a 53 45 4c 45 43 54 20 39 20 2a 20 63 6f 6c 32  .SELECT 9 * col2
2cdb0 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
2cdc0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 34 38 36 0d 0a 35  r0..----..486..5
2cdd0 31 33 0d 0a 38 36 34 0d 0a 0d 0a 71 75 65 72 79  13..864....query
2cde0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
2cdf0 43 54 20 41 4c 4c 20 63 6f 6c 31 20 2b 20 2b 20  CT ALL col1 + + 
2ce00 63 6f 6c 32 20 2a 20 37 34 20 46 52 4f 4d 20 74  col2 * 74 FROM t
2ce10 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
2ce20 2d 0d 0a 31 39 38 33 0d 0a 32 30 32 39 0d 0a 32  -..1983..2029..2
2ce30 38 32 39 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  829....onlyif my
2ce40 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70  sql # use DIV op
2ce50 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67  erator for integ
2ce60 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65  er division..que
2ce70 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
2ce80 65 6c 2d 31 32 34 38 0d 0a 53 45 4c 45 43 54 20  el-1248..SELECT 
2ce90 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c 31 20  DISTINCT - col1 
2cea0 2b 20 2d 20 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c  + - col2 * - col
2ceb0 32 20 44 49 56 20 2b 20 63 6f 6c 32 20 41 53 20  2 DIV + col2 AS 
2cec0 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41  col0 FROM tab0 A
2ced0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 35  S cor0..----..-5
2cee0 33 0d 0a 2d 39 0d 0a 2d 39 36 0d 0a 0d 0a 73 6b  3..-9..-96....sk
2cef0 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
2cf00 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
2cf10 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
2cf20 65 6c 2d 31 32 34 38 0d 0a 53 45 4c 45 43 54 20  el-1248..SELECT 
2cf30 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c 31 20  DISTINCT - col1 
2cf40 2b 20 2d 20 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c  + - col2 * - col
2cf50 32 20 2f 20 2b 20 63 6f 6c 32 20 41 53 20 63 6f  2 / + col2 AS co
2cf60 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l0 FROM tab0 AS 
2cf70 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 33 0d  cor0..----..-53.
2cf80 0a 2d 39 0d 0a 2d 39 36 0d 0a 0d 0a 71 75 65 72  .-9..-96....quer
2cf90 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
2cfa0 45 43 54 20 2b 20 2b 20 63 6f 6c 30 20 2b 20 63  ECT + + col0 + c
2cfb0 6f 6c 31 20 2a 20 37 20 41 53 20 63 6f 6c 31 20  ol1 * 7 AS col1 
2cfc0 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a  FROM tab1 cor0..
2cfd0 2d 2d 2d 2d 0d 0a 31 33 34 0d 0a 31 37 31 0d 0a  ----..134..171..
2cfe0 31 38 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  185....query I r
2cff0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
2d000 4c 4c 20 63 6f 6c 32 20 2b 20 63 6f 6c 32 20 2a  LL col2 + col2 *
2d010 20 2d 20 63 6f 6c 30 20 2b 20 2b 20 63 6f 72 30   - col0 + + cor0
2d020 2e 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20  .col2 FROM tab0 
2d030 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 33 0d  cor0..----..-33.
2d040 0a 2d 37 31 33 34 0d 0a 2d 37 32 36 0d 0a 0d 0a  .-7134..-726....
2d050 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
2d060 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
2d070 20 2d 20 63 6f 72 30 2e 63 6f 6c 31 20 2d 20 2d   - cor0.col1 - -
2d080 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46 52   col0 AS col0 FR
2d090 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
2d0a0 0a 2d 2d 2d 2d 0d 0a 2d 32 33 0d 0a 35 34 0d 0a  .----..-23..54..
2d0b0 36 37 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73  67....skipif pos
2d0c0 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72  tgresql # Postgr
2d0d0 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53  eSQL requires AS
2d0e0 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f   when renaming o
2d0f0 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71  utput columns..q
2d100 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
2d110 53 45 4c 45 43 54 20 2d 20 2d 20 63 6f 6c 30 20  SELECT - - col0 
2d120 2b 20 63 6f 6c 30 20 63 6f 6c 30 20 46 52 4f 4d  + col0 col0 FROM
2d130 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
2d140 2d 2d 2d 0d 0a 31 34 0d 0a 31 35 36 0d 0a 31 35  ---..14..156..15
2d150 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  8....query I row
2d160 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2d  sort..SELECT + -
2d170 20 34 35 20 2a 20 63 6f 6c 30 20 41 53 20 63 6f   45 * col0 AS co
2d180 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l0 FROM tab2 AS 
2d190 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 31 35  cor0..----..-315
2d1a0 0d 0a 2d 33 35 31 30 0d 0a 2d 33 35 35 35 0d 0a  ..-3510..-3555..
2d1b0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2d1c0 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20  t..SELECT ALL - 
2d1d0 2b 20 35 30 20 41 53 20 63 6f 6c 31 20 46 52 4f  + 50 AS col1 FRO
2d1e0 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
2d1f0 2d 2d 2d 2d 0d 0a 2d 35 30 0d 0a 2d 35 30 0d 0a  ----..-50..-50..
2d200 2d 35 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  -50....query I r
2d210 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
2d220 20 63 6f 6c 31 20 2b 20 63 6f 6c 30 20 2a 20 2b   col1 + col0 * +
2d230 20 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46 52   col2 AS col2 FR
2d240 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d  OM tab1 cor0..--
2d250 2d 2d 0d 0a 31 38 38 0d 0a 33 36 35 38 0d 0a 37  --..188..3658..7
2d260 36 39 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  693....query I r
2d270 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
2d280 49 53 54 49 4e 43 54 20 63 6f 6c 30 20 2b 20 2d  ISTINCT col0 + -
2d290 20 63 6f 72 30 2e 63 6f 6c 30 20 41 53 20 63 6f   cor0.col0 AS co
2d2a0 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l1 FROM tab2 AS 
2d2b0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 0d  cor0..----..0...
2d2c0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2d2d0 0d 0a 53 45 4c 45 43 54 20 2d 20 2d 20 63 6f 72  ..SELECT - - cor
2d2e0 30 2e 63 6f 6c 30 20 2a 20 2d 20 63 6f 72 30 2e  0.col0 * - cor0.
2d2f0 63 6f 6c 31 20 2a 20 34 33 20 41 53 20 63 6f 6c  col1 * 43 AS col
2d300 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  2 FROM tab1 AS c
2d310 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 37 35 32  or0..----..-2752
2d320 30 0d 0a 2d 33 33 35 34 0d 0a 2d 34 34 37 32 30  0..-3354..-44720
2d330 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
2d340 6f 72 74 0d 0a 53 45 4c 45 43 54 20 28 20 2b 20  ort..SELECT ( + 
2d350 63 6f 6c 32 20 2a 20 2d 20 74 61 62 30 2e 63 6f  col2 * - tab0.co
2d360 6c 31 20 29 20 46 52 4f 4d 20 74 61 62 30 0d 0a  l1 ) FROM tab0..
2d370 2d 2d 2d 2d 0d 0a 2d 32 38 33 38 0d 0a 2d 37 34  ----..-2838..-74
2d380 36 32 0d 0a 2d 39 37 0d 0a 0d 0a 6f 6e 6c 79 69  62..-97....onlyi
2d390 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49  f mysql # use DI
2d3a0 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69  V operator for i
2d3b0 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d  nteger division.
2d3c0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2d3d0 20 6c 61 62 65 6c 2d 31 32 35 39 0d 0a 53 45 4c   label-1259..SEL
2d3e0 45 43 54 20 41 4c 4c 20 28 20 2d 20 63 6f 6c 30  ECT ALL ( - col0
2d3f0 20 29 20 44 49 56 20 63 6f 6c 31 20 41 53 20 63   ) DIV col1 AS c
2d400 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d  ol0 FROM tab1..-
2d410 2d 2d 2d 0d 0a 2d 36 0d 0a 2d 36 0d 0a 30 0d 0a  ---..-6..-6..0..
2d420 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
2d430 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
2d440 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2d450 20 6c 61 62 65 6c 2d 31 32 35 39 0d 0a 53 45 4c   label-1259..SEL
2d460 45 43 54 20 41 4c 4c 20 28 20 2d 20 63 6f 6c 30  ECT ALL ( - col0
2d470 20 29 20 2f 20 63 6f 6c 31 20 41 53 20 63 6f 6c   ) / col1 AS col
2d480 30 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d  0 FROM tab1..---
2d490 2d 0d 0a 2d 36 0d 0a 2d 36 0d 0a 30 0d 0a 0d 0a  -..-6..-6..0....
2d4a0 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75  onlyif mysql # u
2d4b0 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20  se DIV operator 
2d4c0 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69  for integer divi
2d4d0 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f  sion..query I ro
2d4e0 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 32 36 30  wsort label-1260
2d4f0 0d 0a 53 45 4c 45 43 54 20 2b 20 2b 20 63 6f 6c  ..SELECT + + col
2d500 30 20 2b 20 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c  0 + col2 * - col
2d510 31 20 44 49 56 20 2d 20 63 6f 6c 31 20 2b 20 2b  1 DIV - col1 + +
2d520 20 63 6f 72 30 2e 63 6f 6c 32 20 2a 20 2d 20 63   cor0.col2 * - c
2d530 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  ol2 AS col0 FROM
2d540 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
2d550 2d 2d 2d 0d 0a 2d 32 38 35 39 0d 0a 2d 33 31 32  ---..-2859..-312
2d560 38 0d 0a 2d 39 30 34 30 0d 0a 0d 0a 73 6b 69 70  8..-9040....skip
2d570 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
2d580 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
2d590 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
2d5a0 2d 31 32 36 30 0d 0a 53 45 4c 45 43 54 20 2b 20  -1260..SELECT + 
2d5b0 2b 20 63 6f 6c 30 20 2b 20 63 6f 6c 32 20 2a 20  + col0 + col2 * 
2d5c0 2d 20 63 6f 6c 31 20 2f 20 2d 20 63 6f 6c 31 20  - col1 / - col1 
2d5d0 2b 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 2a 20  + + cor0.col2 * 
2d5e0 2d 20 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46  - col2 AS col0 F
2d5f0 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
2d600 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 38 35 39 0d 0a 2d  ..----..-2859..-
2d610 33 31 32 38 0d 0a 2d 39 30 34 30 0d 0a 0d 0a 6f  3128..-9040....o
2d620 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73  nlyif mysql # us
2d630 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66  e DIV operator f
2d640 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73  or integer divis
2d650 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ion..query I row
2d660 73 6f 72 74 20 6c 61 62 65 6c 2d 31 32 36 31 0d  sort label-1261.
2d670 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
2d680 20 2b 20 36 38 20 44 49 56 20 2b 20 63 6f 6c 30   + 68 DIV + col0
2d690 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d   FROM tab2..----
2d6a0 0d 0a 30 0d 0a 39 0d 0a 0d 0a 73 6b 69 70 69 66  ..0..9....skipif
2d6b0 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
2d6c0 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
2d6d0 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
2d6e0 32 36 31 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  261..SELECT DIST
2d6f0 49 4e 43 54 20 2b 20 36 38 20 2f 20 2b 20 63 6f  INCT + 68 / + co
2d700 6c 30 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d  l0 FROM tab2..--
2d710 2d 2d 0d 0a 30 0d 0a 39 0d 0a 0d 0a 71 75 65 72  --..0..9....quer
2d720 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
2d730 45 43 54 20 63 6f 72 30 2e 63 6f 6c 30 20 2a 20  ECT cor0.col0 * 
2d740 2d 20 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  - 0 AS col1 FROM
2d750 20 74 61 62 31 2c 20 74 61 62 32 20 63 6f 72 30   tab1, tab2 cor0
2d760 2c 20 74 61 62 31 20 41 53 20 63 6f 72 31 0d 0a  , tab1 AS cor1..
2d770 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75 65 73 20  ----..27 values 
2d780 68 61 73 68 69 6e 67 20 74 6f 20 65 32 35 36 38  hashing to e2568
2d790 62 30 31 64 64 34 31 31 62 35 61 32 30 36 30 36  b01dd411b5a20606
2d7a0 38 36 39 37 64 30 65 64 30 64 32 0d 0a 0d 0a 71  8697d0ed0d2....q
2d7b0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
2d7c0 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
2d7d0 2d 20 2b 20 28 20 63 6f 6c 31 20 29 20 2b 20 2d  - + ( col1 ) + -
2d7e0 20 28 20 2b 20 63 6f 6c 31 20 29 20 2b 20 2b 20   ( + col1 ) + + 
2d7f0 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41  col1 FROM tab0 A
2d800 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 38  S cor0..----..-8
2d810 36 0d 0a 2d 39 31 0d 0a 2d 39 37 0d 0a 0d 0a 71  6..-91..-97....q
2d820 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
2d830 53 45 4c 45 43 54 20 63 6f 6c 30 20 2b 20 2d 20  SELECT col0 + - 
2d840 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c 31 20 41 53  col0 * - col1 AS
2d850 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20   col2 FROM tab2 
2d860 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
2d870 34 32 32 0d 0a 32 32 34 0d 0a 34 36 38 30 0d 0a  422..224..4680..
2d880 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2d890 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 30 20 2a  t..SELECT col0 *
2d8a0 20 28 20 2b 20 63 6f 6c 31 20 2b 20 2b 20 63 6f   ( + col1 + + co
2d8b0 6c 32 20 29 20 41 53 20 63 6f 6c 32 20 46 52 4f  l2 ) AS col2 FRO
2d8c0 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
2d8d0 2d 2d 2d 2d 0d 0a 34 30 36 0d 0a 34 33 34 35 0d  ----..406..4345.
2d8e0 0a 36 36 33 30 0d 0a 0d 0a 71 75 65 72 79 20 49  .6630....query I
2d8f0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
2d900 20 2d 20 63 6f 6c 30 20 2a 20 2b 20 63 6f 72 30   - col0 * + cor0
2d910 2e 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52  .col1 AS col0 FR
2d920 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d  OM tab1 cor0..--
2d930 2d 2d 0d 0a 2d 31 30 34 30 0d 0a 2d 36 34 30 0d  --..-1040..-640.
2d940 0a 2d 37 38 0d 0a 0d 0a 73 6b 69 70 69 66 20 70  .-78....skipif p
2d950 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74  ostgresql # Post
2d960 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20  greSQL requires 
2d970 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67  AS when renaming
2d980 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d   output columns.
2d990 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2d9a0 0d 0a 53 45 4c 45 43 54 20 2b 20 2d 20 63 6f 6c  ..SELECT + - col
2d9b0 31 20 2a 20 63 6f 6c 30 20 63 6f 6c 30 20 46 52  1 * col0 col0 FR
2d9c0 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
2d9d0 0a 2d 2d 2d 2d 0d 0a 2d 31 33 34 33 0d 0a 2d 32  .----..-1343..-2
2d9e0 31 37 0d 0a 2d 34 36 30 32 0d 0a 0d 0a 6f 6e 6c  17..-4602....onl
2d9f0 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20  yif mysql # use 
2da00 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72  DIV operator for
2da10 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f   integer divisio
2da20 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  n..query I rowso
2da30 72 74 20 6c 61 62 65 6c 2d 31 32 36 38 0d 0a 53  rt label-1268..S
2da40 45 4c 45 43 54 20 41 4c 4c 20 2d 20 2d 20 33 37  ELECT ALL - - 37
2da50 20 44 49 56 20 63 6f 6c 30 20 2b 20 63 6f 6c 30   DIV col0 + col0
2da60 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
2da70 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32  b0 cor0..----..2
2da80 35 0d 0a 33 36 0d 0a 38 39 0d 0a 0d 0a 73 6b 69  5..36..89....ski
2da90 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
2daa0 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
2dab0 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
2dac0 6c 2d 31 32 36 38 0d 0a 53 45 4c 45 43 54 20 41  l-1268..SELECT A
2dad0 4c 4c 20 2d 20 2d 20 33 37 20 2f 20 63 6f 6c 30  LL - - 37 / col0
2dae0 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20   + col0 AS col1 
2daf0 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a  FROM tab0 cor0..
2db00 2d 2d 2d 2d 0d 0a 32 35 0d 0a 33 36 0d 0a 38 39  ----..25..36..89
2db10 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
2db20 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
2db30 49 4e 43 54 20 2b 20 2d 20 34 39 20 2b 20 2d 20  INCT + - 49 + - 
2db40 31 35 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  15 FROM tab0 AS 
2db50 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 36 34 0d  cor0..----..-64.
2db60 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
2db70 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
2db80 4e 43 54 20 2d 20 63 6f 6c 30 20 2b 20 34 37 20  NCT - col0 + 47 
2db90 2a 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31  * col1 FROM tab1
2dba0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
2dbb0 31 32 31 39 0d 0a 34 30 36 0d 0a 35 33 31 0d 0a  1219..406..531..
2dbc0 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
2dbd0 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f   use DIV operato
2dbe0 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69  r for integer di
2dbf0 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20  vision..query I 
2dc00 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 32  rowsort label-12
2dc10 37 31 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d  71..SELECT ALL -
2dc20 20 33 33 20 44 49 56 20 33 31 20 46 52 4f 4d 20   33 DIV 31 FROM 
2dc30 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
2dc40 2d 2d 0d 0a 2d 31 0d 0a 2d 31 0d 0a 2d 31 0d 0a  --..-1..-1..-1..
2dc50 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
2dc60 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
2dc70 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2dc80 20 6c 61 62 65 6c 2d 31 32 37 31 0d 0a 53 45 4c   label-1271..SEL
2dc90 45 43 54 20 41 4c 4c 20 2d 20 33 33 20 2f 20 33  ECT ALL - 33 / 3
2dca0 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  1 FROM tab2 AS c
2dcb0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 2d  or0..----..-1..-
2dcc0 31 0d 0a 2d 31 0d 0a 0d 0a 73 6b 69 70 69 66 20  1..-1....skipif 
2dcd0 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73  postgresql # Pos
2dce0 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73  tgreSQL requires
2dcf0 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e   AS when renamin
2dd00 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73  g output columns
2dd10 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2dd20 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 32 20 2a  t..SELECT col2 *
2dd30 20 39 35 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   95 col1 FROM ta
2dd40 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33  b0 cor0..----..3
2dd50 31 33 35 0d 0a 37 37 39 30 0d 0a 39 35 0d 0a 0d  135..7790..95...
2dd60 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2dd70 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
2dd80 54 20 2d 20 2b 20 63 6f 6c 31 20 2a 20 2b 20 28  T - + col1 * + (
2dd90 20 2b 20 63 6f 6c 31 20 29 20 46 52 4f 4d 20 74   + col1 ) FROM t
2dda0 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
2ddb0 2d 0d 0a 2d 37 33 39 36 0d 0a 2d 38 32 38 31 0d  -..-7396..-8281.
2ddc0 0a 2d 39 34 30 39 0d 0a 0d 0a 71 75 65 72 79 20  .-9409....query 
2ddd0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
2dde0 54 20 41 4c 4c 20 35 34 20 2b 20 63 6f 6c 32 20  T ALL 54 + col2 
2ddf0 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
2de00 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33 36 0d 0a 35 35  0..----..136..55
2de10 0d 0a 38 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..87....query I 
2de20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
2de30 44 49 53 54 49 4e 43 54 20 2b 20 2d 20 35 39 20  DISTINCT + - 59 
2de40 2b 20 63 6f 6c 32 20 2a 20 63 6f 6c 32 20 46 52  + col2 * col2 FR
2de50 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
2de60 0a 2d 2d 2d 2d 0d 0a 2d 35 38 0d 0a 31 30 33 30  .----..-58..1030
2de70 0d 0a 36 36 36 35 0d 0a 0d 0a 71 75 65 72 79 20  ..6665....query 
2de80 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
2de90 54 20 2b 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20  T + + cor0.col2 
2dea0 2b 20 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c 30 20  + col2 * + col0 
2deb0 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
2dec0 30 0d 0a 2d 2d 2d 2d 0d 0a 32 30 35 34 0d 0a 32  0..----..2054..2
2ded0 31 36 0d 0a 33 30 34 30 0d 0a 0d 0a 71 75 65 72  16..3040....quer
2dee0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
2def0 45 43 54 20 2d 20 36 35 20 2a 20 2d 20 63 6f 6c  ECT - 65 * - col
2df00 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  2 FROM tab2 AS c
2df10 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 36 39 30 0d  or0..----..1690.
2df20 0a 31 37 35 35 0d 0a 32 34 37 30 0d 0a 0d 0a 6f  .1755..2470....o
2df30 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75  nlyif mysql # su
2df40 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20  pport for MySQL 
2df50 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20  specific system 
2df60 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78  types and syntax
2df70 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2df80 74 20 6c 61 62 65 6c 2d 31 32 37 38 0d 0a 53 45  t label-1278..SE
2df90 4c 45 43 54 20 2d 20 63 6f 72 30 2e 63 6f 6c 31  LECT - cor0.col1
2dfa0 20 2a 20 2d 20 63 6f 6c 31 20 2b 20 2d 20 63 6f   * - col1 + - co
2dfb0 72 30 2e 63 6f 6c 32 20 2a 20 2b 20 43 41 53 54  r0.col2 * + CAST
2dfc0 28 20 2b 20 63 6f 6c 30 20 41 53 20 53 49 47 4e  ( + col0 AS SIGN
2dfd0 45 44 20 29 20 41 53 20 63 6f 6c 32 20 46 52 4f  ED ) AS col2 FRO
2dfe0 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
2dff0 2d 2d 2d 2d 0d 0a 2d 33 35 34 38 0d 0a 2d 37 35  ----..-3548..-75
2e000 31 31 0d 0a 35 31 34 0d 0a 0d 0a 73 6b 69 70 69  11..514....skipi
2e010 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
2e020 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
2e030 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
2e040 31 32 37 38 0d 0a 53 45 4c 45 43 54 20 2d 20 63  1278..SELECT - c
2e050 6f 72 30 2e 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c  or0.col1 * - col
2e060 31 20 2b 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20  1 + - cor0.col2 
2e070 2a 20 2b 20 43 41 53 54 20 28 20 2b 20 63 6f 6c  * + CAST ( + col
2e080 30 20 41 53 20 49 4e 54 45 47 45 52 20 29 20 41  0 AS INTEGER ) A
2e090 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31  S col2 FROM tab1
2e0a0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
2e0b0 2d 33 35 34 38 0d 0a 2d 37 35 31 31 0d 0a 35 31  -3548..-7511..51
2e0c0 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  4....query I row
2e0d0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63  sort..SELECT - c
2e0e0 6f 6c 31 20 2d 20 34 38 20 41 53 20 63 6f 6c 30  ol1 - 48 AS col0
2e0f0 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
2e100 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 34 0d 0a  r0..----..-134..
2e110 2d 31 33 39 0d 0a 2d 31 34 35 0d 0a 0d 0a 6f 6e  -139..-145....on
2e120 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
2e130 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
2e140 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
2e150 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
2e160 6f 72 74 20 6c 61 62 65 6c 2d 31 32 38 30 0d 0a  ort label-1280..
2e170 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
2e180 32 35 20 44 49 56 20 63 6f 72 30 2e 63 6f 6c 32  25 DIV cor0.col2
2e190 20 2d 20 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20   - col2 AS col0 
2e1a0 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a  FROM tab1 cor0..
2e1b0 2d 2d 2d 2d 0d 0a 2d 35 34 0d 0a 2d 35 37 0d 0a  ----..-54..-57..
2e1c0 2d 39 36 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  -96....skipif my
2e1d0 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
2e1e0 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
2e1f0 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 32 38 30  wsort label-1280
2e200 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
2e210 54 20 32 35 20 2f 20 63 6f 72 30 2e 63 6f 6c 32  T 25 / cor0.col2
2e220 20 2d 20 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20   - col2 AS col0 
2e230 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a  FROM tab1 cor0..
2e240 2d 2d 2d 2d 0d 0a 2d 35 34 0d 0a 2d 35 37 0d 0a  ----..-54..-57..
2e250 2d 39 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  -96....query I r
2e260 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
2e270 4c 4c 20 2b 20 2b 20 63 6f 72 30 2e 63 6f 6c 31  LL + + cor0.col1
2e280 20 2a 20 2d 20 63 6f 6c 32 20 46 52 4f 4d 20 74   * - col2 FROM t
2e290 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
2e2a0 2d 0d 0a 2d 31 35 33 34 0d 0a 2d 36 34 36 0d 0a  -..-1534..-646..
2e2b0 2d 38 33 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20  -837....query I 
2e2c0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
2e2d0 2b 20 2d 20 63 6f 6c 30 20 2d 20 63 6f 6c 32 20  + - col0 - col2 
2e2e0 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
2e2f0 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
2e300 0a 2d 31 37 31 0d 0a 2d 33 36 0d 0a 2d 35 37 0d  .-171..-36..-57.
2e310 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
2e320 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
2e330 4e 43 54 20 2d 20 2b 20 63 6f 6c 32 20 2b 20 2d  NCT - + col2 + -
2e340 20 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c 31 20 41   col2 * - col1 A
2e350 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32  S col0 FROM tab2
2e360 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 35 30   cor0..----..150
2e370 38 0d 0a 36 30 38 0d 0a 38 31 30 0d 0a 0d 0a 71  8..608..810....q
2e380 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
2e390 53 45 4c 45 43 54 20 2b 20 37 30 20 2b 20 2b 20  SELECT + 70 + + 
2e3a0 63 6f 72 30 2e 63 6f 6c 31 20 46 52 4f 4d 20 74  cor0.col1 FROM t
2e3b0 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab0 cor0..----..
2e3c0 31 35 36 0d 0a 31 36 31 0d 0a 31 36 37 0d 0a 0d  156..161..167...
2e3d0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2e3e0 0d 0a 53 45 4c 45 43 54 20 36 30 20 2b 20 63 6f  ..SELECT 60 + co
2e3f0 72 30 2e 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  r0.col0 FROM tab
2e400 30 2c 20 74 61 62 30 20 41 53 20 63 6f 72 30 20  0, tab0 AS cor0 
2e410 43 52 4f 53 53 20 4a 4f 49 4e 20 74 61 62 31 2c  CROSS JOIN tab1,
2e420 20 74 61 62 30 20 41 53 20 63 6f 72 31 0d 0a 2d   tab0 AS cor1..-
2e430 2d 2d 2d 0d 0a 38 31 20 76 61 6c 75 65 73 20 68  ---..81 values h
2e440 61 73 68 69 6e 67 20 74 6f 20 37 30 33 66 38 34  ashing to 703f84
2e450 31 39 32 34 61 33 38 37 39 64 38 37 37 64 64 66  1924a3879d877ddf
2e460 65 62 66 32 33 63 38 65 32 66 0d 0a 0d 0a 71 75  ebf23c8e2f....qu
2e470 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
2e480 45 4c 45 43 54 20 36 34 20 2a 20 2d 20 63 6f 6c  ELECT 64 * - col
2e490 31 20 2b 20 2b 20 74 61 62 32 2e 63 6f 6c 30 20  1 + + tab2.col0 
2e4a0 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
2e4b0 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 30 39 0d 0a  2..----..-1009..
2e4c0 2d 31 39 37 37 0d 0a 2d 33 36 39 38 0d 0a 0d 0a  -1977..-3698....
2e4d0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
2e4e0 0a 53 45 4c 45 43 54 20 2b 20 63 6f 72 31 2e 63  .SELECT + cor1.c
2e4f0 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol0 FROM tab1 AS
2e500 20 63 6f 72 30 20 43 52 4f 53 53 20 4a 4f 49 4e   cor0 CROSS JOIN
2e510 20 74 61 62 31 20 63 6f 72 31 0d 0a 2d 2d 2d 2d   tab1 cor1..----
2e520 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68 69  ..9 values hashi
2e530 6e 67 20 74 6f 20 64 64 31 38 62 39 33 32 36 33  ng to dd18b93263
2e540 61 36 63 64 34 32 35 66 63 37 63 63 38 34 64 39  a6cd425fc7cc84d9
2e550 31 33 37 38 37 30 0d 0a 0d 0a 6f 6e 6c 79 69 66  137870....onlyif
2e560 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74   mysql # support
2e570 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69   for MySQL speci
2e580 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73  fic system types
2e590 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65   and syntax..que
2e5a0 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
2e5b0 65 6c 2d 31 32 38 38 0d 0a 53 45 4c 45 43 54 20  el-1288..SELECT 
2e5c0 41 4c 4c 20 43 41 53 54 28 20 4e 55 4c 4c 20 41  ALL CAST( NULL A
2e5d0 53 20 53 49 47 4e 45 44 20 29 20 2a 20 2b 20 63  S SIGNED ) * + c
2e5e0 6f 6c 30 20 2a 20 63 6f 6c 30 20 41 53 20 63 6f  ol0 * col0 AS co
2e5f0 6c 31 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d  l1 FROM tab1..--
2e600 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a  --..NULL..NULL..
2e610 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  NULL....skipif m
2e620 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
2e630 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
2e640 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 32 38  owsort label-128
2e650 38 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 43 41  8..SELECT ALL CA
2e660 53 54 20 28 20 4e 55 4c 4c 20 41 53 20 49 4e 54  ST ( NULL AS INT
2e670 45 47 45 52 20 29 20 2a 20 2b 20 63 6f 6c 30 20  EGER ) * + col0 
2e680 2a 20 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46  * col0 AS col1 F
2e690 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab1..----..
2e6a0 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c  NULL..NULL..NULL
2e6b0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
2e6c0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
2e6d0 63 6f 6c 31 20 2b 20 37 20 46 52 4f 4d 20 74 61  col1 + 7 FROM ta
2e6e0 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 37 0d 0a 32 30  b1..----..17..20
2e6f0 0d 0a 33 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..33....query I 
2e700 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
2e710 2b 20 63 6f 6c 32 20 2a 20 2d 20 34 38 20 41 53  + col2 * - 48 AS
2e720 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d   col0 FROM tab0.
2e730 0a 2d 2d 2d 2d 0d 0a 2d 31 35 38 34 0d 0a 2d 33  .----..-1584..-3
2e740 39 33 36 0d 0a 2d 34 38 0d 0a 0d 0a 71 75 65 72  936..-48....quer
2e750 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
2e760 45 43 54 20 2d 20 63 6f 72 30 2e 63 6f 6c 30 20  ECT - cor0.col0 
2e770 2d 20 63 6f 6c 31 20 2a 20 34 33 20 46 52 4f 4d  - col1 * 43 FROM
2e780 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
2e790 2d 2d 2d 0d 0a 2d 31 33 34 30 0d 0a 2d 32 36 31  ---..-1340..-261
2e7a0 35 0d 0a 2d 38 31 30 0d 0a 0d 0a 71 75 65 72 79  5..-810....query
2e7b0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
2e7c0 43 54 20 63 6f 6c 32 20 2a 20 37 36 20 41 53 20  CT col2 * 76 AS 
2e7d0 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 0d 0a  col2 FROM tab1..
2e7e0 2d 2d 2d 2d 0d 0a 34 31 30 34 0d 0a 34 33 33 32  ----..4104..4332
2e7f0 0d 0a 37 32 39 36 0d 0a 0d 0a 73 6b 69 70 69 66  ..7296....skipif
2e800 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f   postgresql # Po
2e810 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65  stgreSQL require
2e820 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69  s AS when renami
2e830 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e  ng output column
2e840 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  s..query I rowso
2e850 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 32  rt..SELECT ALL 2
2e860 39 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31  9 col1 FROM tab1
2e870 2c 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  , tab1 AS cor0..
2e880 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68  ----..9 values h
2e890 61 73 68 69 6e 67 20 74 6f 20 31 65 37 31 32 30  ashing to 1e7120
2e8a0 62 61 38 65 39 31 39 31 30 38 34 31 37 32 64 64  ba8e9191084172dd
2e8b0 63 65 64 31 37 65 35 65 62 32 0d 0a 0d 0a 71 75  ced17e5eb2....qu
2e8c0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
2e8d0 45 4c 45 43 54 20 2d 20 63 6f 72 30 2e 63 6f 6c  ELECT - cor0.col
2e8e0 32 20 2a 20 28 20 2d 20 63 6f 6c 31 20 29 20 41  2 * ( - col1 ) A
2e8f0 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31  S col2 FROM tab1
2e900 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
2e910 31 32 34 38 0d 0a 31 34 30 34 0d 0a 35 37 30 0d  1248..1404..570.
2e920 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
2e930 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c  rt..SELECT - col
2e940 32 20 2a 20 38 35 20 2d 20 63 6f 72 30 2e 63 6f  2 * 85 - cor0.co
2e950 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l1 FROM tab0 AS 
2e960 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 38 32  cor0..----..-182
2e970 0d 0a 2d 32 38 39 31 0d 0a 2d 37 30 36 31 0d 0a  ..-2891..-7061..
2e980 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2e990 74 0d 0a 53 45 4c 45 43 54 20 32 35 20 46 52 4f  t..SELECT 25 FRO
2e9a0 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab2 cor0..---
2e9b0 2d 0d 0a 32 35 0d 0a 32 35 0d 0a 32 35 0d 0a 0d  -..25..25..25...
2e9c0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2e9d0 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 36 34 20  ..SELECT ALL 64 
2e9e0 2b 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 41 53  + + cor0.col0 AS
2e9f0 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20   col1 FROM tab0 
2ea00 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
2ea10 35 33 0d 0a 38 38 0d 0a 39 39 0d 0a 0d 0a 71 75  53..88..99....qu
2ea20 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
2ea30 45 4c 45 43 54 20 2b 20 28 20 63 6f 6c 32 20 29  ELECT + ( col2 )
2ea40 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 46 52 4f   + cor0.col1 FRO
2ea50 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
2ea60 2d 2d 2d 2d 0d 0a 31 31 39 0d 0a 31 37 33 0d 0a  ----..119..173..
2ea70 39 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  98....query I ro
2ea80 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
2ea90 63 6f 72 30 2e 63 6f 6c 32 20 46 52 4f 4d 20 74  cor0.col2 FROM t
2eaa0 61 62 32 2c 20 74 61 62 31 20 41 53 20 63 6f 72  ab2, tab1 AS cor
2eab0 30 2c 20 74 61 62 30 20 63 6f 72 31 0d 0a 2d 2d  0, tab0 cor1..--
2eac0 2d 2d 0d 0a 32 37 20 76 61 6c 75 65 73 20 68 61  --..27 values ha
2ead0 73 68 69 6e 67 20 74 6f 20 37 66 34 61 39 62 66  shing to 7f4a9bf
2eae0 32 34 64 36 34 38 33 33 37 30 36 64 66 62 64 64  24d64833706dfbdd
2eaf0 30 62 61 66 34 39 64 37 39 0d 0a 0d 0a 71 75 65  0baf49d79....que
2eb00 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
2eb10 4c 45 43 54 20 2d 20 34 36 20 41 53 20 63 6f 6c  LECT - 46 AS col
2eb20 31 20 46 52 4f 4d 20 74 61 62 31 2c 20 74 61 62  1 FROM tab1, tab
2eb30 31 20 41 53 20 63 6f 72 30 2c 20 74 61 62 32 20  1 AS cor0, tab2 
2eb40 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 32  AS cor1..----..2
2eb50 37 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67  7 values hashing
2eb60 20 74 6f 20 35 61 35 64 34 35 39 38 39 64 63 63   to 5a5d45989dcc
2eb70 36 61 30 36 64 39 65 65 35 61 30 38 39 34 35 35  6a06d9ee5a089455
2eb80 31 38 66 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20  18f9....query I 
2eb90 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
2eba0 36 38 20 2a 20 2b 20 63 6f 6c 32 20 2a 20 2b 20  68 * + col2 * + 
2ebb0 37 37 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  77 AS col1 FROM 
2ebc0 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
2ebd0 2d 2d 0d 0a 31 33 36 31 33 36 0d 0a 31 34 31 33  --..136136..1413
2ebe0 37 32 0d 0a 31 39 38 39 36 38 0d 0a 0d 0a 71 75  72..198968....qu
2ebf0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
2ec00 45 4c 45 43 54 20 63 6f 6c 31 20 2a 20 2b 20 63  ELECT col1 * + c
2ec10 6f 72 30 2e 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c  or0.col1 * + col
2ec20 31 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  1 AS col1 FROM t
2ec30 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
2ec40 2d 0d 0a 32 30 35 33 37 39 0d 0a 32 39 37 39 31  -..205379..29791
2ec50 0d 0a 34 39 31 33 0d 0a 0d 0a 71 75 65 72 79 20  ..4913....query 
2ec60 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
2ec70 54 20 2b 20 2b 20 32 20 46 52 4f 4d 20 74 61 62  T + + 2 FROM tab
2ec80 32 2c 20 74 61 62 31 2c 20 74 61 62 30 20 41 53  2, tab1, tab0 AS
2ec90 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20   cor0..----..27 
2eca0 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74  values hashing t
2ecb0 6f 20 35 33 35 33 34 35 63 35 30 61 31 39 66 64  o 535345c50a19fd
2ecc0 61 62 39 37 63 65 30 35 64 31 38 33 37 62 31 66  ab97ce05d1837b1f
2ecd0 30 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  09....query I ro
2ece0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
2ecf0 4c 20 63 6f 72 30 2e 63 6f 6c 31 20 2b 20 63 6f  L cor0.col1 + co
2ed00 6c 30 20 2a 20 63 6f 6c 30 20 2b 20 63 6f 6c 30  l0 * col0 + col0
2ed10 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
2ed20 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
2ed30 0d 0a 36 32 32 31 0d 0a 36 33 33 37 0d 0a 38 37  ..6221..6337..87
2ed40 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67  ....skipif postg
2ed50 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53  resql # PostgreS
2ed60 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77  QL requires AS w
2ed70 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74  hen renaming out
2ed80 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65  put columns..que
2ed90 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
2eda0 4c 45 43 54 20 2d 20 63 6f 6c 30 20 2a 20 63 6f  LECT - col0 * co
2edb0 72 30 2e 63 6f 6c 30 20 63 6f 6c 31 20 46 52 4f  r0.col0 col1 FRO
2edc0 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
2edd0 2d 2d 2d 2d 0d 0a 2d 34 30 39 36 0d 0a 2d 36 34  ----..-4096..-64
2ede0 30 30 0d 0a 2d 39 0d 0a 0d 0a 6f 6e 6c 79 69 66  00..-9....onlyif
2edf0 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74   mysql # support
2ee00 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69   for MySQL speci
2ee10 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73  fic system types
2ee20 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65   and syntax..que
2ee30 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
2ee40 65 6c 2d 31 33 30 36 0d 0a 53 45 4c 45 43 54 20  el-1306..SELECT 
2ee50 41 4c 4c 20 2b 20 63 6f 6c 32 20 2b 20 2b 20 43  ALL + col2 + + C
2ee60 41 53 54 28 20 4e 55 4c 4c 20 41 53 20 53 49 47  AST( NULL AS SIG
2ee70 4e 45 44 20 29 20 2b 20 2b 20 33 36 20 41 53 20  NED ) + + 36 AS 
2ee80 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41  col1 FROM tab2 A
2ee90 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55  S cor0..----..NU
2eea0 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a  LL..NULL..NULL..
2eeb0 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
2eec0 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
2eed0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2eee0 20 6c 61 62 65 6c 2d 31 33 30 36 0d 0a 53 45 4c   label-1306..SEL
2eef0 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 32 20 2b  ECT ALL + col2 +
2ef00 20 2b 20 43 41 53 54 20 28 20 4e 55 4c 4c 20 41   + CAST ( NULL A
2ef10 53 20 49 4e 54 45 47 45 52 20 29 20 2b 20 2b 20  S INTEGER ) + + 
2ef20 33 36 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  36 AS col1 FROM 
2ef30 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
2ef40 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a  --..NULL..NULL..
2ef50 4e 55 4c 4c 0d 0a 0d 0a 71 75 65 72 79 20 49 20  NULL....query I 
2ef60 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
2ef70 2b 20 2d 20 63 6f 6c 30 20 2b 20 38 36 20 46 52  + - col0 + 86 FR
2ef80 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
2ef90 0a 2d 2d 2d 2d 0d 0a 2d 33 0d 0a 35 31 0d 0a 36  .----..-3..51..6
2efa0 32 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74  2....skipif post
2efb0 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65  gresql # Postgre
2efc0 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20  SQL requires AS 
2efd0 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75  when renaming ou
2efe0 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75  tput columns..qu
2eff0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
2f000 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 63  ELECT DISTINCT c
2f010 6f 6c 30 20 2a 20 2b 20 63 6f 6c 30 20 2b 20 2d  ol0 * + col0 + -
2f020 20 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c 32 20 63   col0 * - col2 c
2f030 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol1 FROM tab1 AS
2f040 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 34 30   cor0..----..140
2f050 38 30 0d 0a 31 37 31 0d 0a 37 37 34 34 0d 0a 0d  80..171..7744...
2f060 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2f070 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c  ..SELECT ALL col
2f080 31 20 2b 20 63 6f 6c 32 20 2b 20 63 6f 6c 32 20  1 + col2 + col2 
2f090 2a 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30  * col1 FROM tab0
2f0a0 0d 0a 2d 2d 2d 2d 0d 0a 31 39 35 0d 0a 32 39 35  ..----..195..295
2f0b0 37 0d 0a 37 36 33 35 0d 0a 0d 0a 73 6b 69 70 69  7..7635....skipi
2f0c0 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50  f postgresql # P
2f0d0 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72  ostgreSQL requir
2f0e0 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d  es AS when renam
2f0f0 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d  ing output colum
2f100 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ns..query I rows
2f110 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
2f120 49 4e 43 54 20 31 20 63 6f 6c 30 20 46 52 4f 4d  INCT 1 col0 FROM
2f130 20 74 61 62 31 2c 20 74 61 62 32 20 41 53 20 63   tab1, tab2 AS c
2f140 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 0d 0a 0d 0a  or0..----..1....
2f150 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
2f160 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 2d 20  .SELECT ALL - - 
2f170 63 6f 6c 32 20 2b 20 63 6f 6c 32 20 2a 20 2b 20  col2 + col2 * + 
2f180 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46 52 4f  col2 AS 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 31 34 38 32 0d 0a 37 30 32 0d  ----..1482..702.
2f1b0 0a 37 35 36 0d 0a 0d 0a 73 6b 69 70 69 66 20 70  .756....skipif p
2f1c0 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74  ostgresql # Post
2f1d0 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20  greSQL requires 
2f1e0 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67  AS when renaming
2f1f0 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d   output columns.
2f200 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2f210 0d 0a 53 45 4c 45 43 54 20 35 38 20 2b 20 2d 20  ..SELECT 58 + - 
2f220 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c 30 20 2a 20  col0 * + col0 * 
2f230 2b 20 28 20 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c  + ( col2 * + col
2f240 30 20 29 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61  0 ) col0 FROM ta
2f250 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
2f260 0d 0a 2d 34 32 38 31 37 0d 0a 2d 34 35 36 31 33  ..-42817..-45613
2f270 34 0d 0a 2d 35 37 38 30 37 34 30 30 0d 0a 0d 0a  4..-57807400....
2f280 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75  onlyif mysql # u
2f290 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20  se DIV operator 
2f2a0 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69  for integer divi
2f2b0 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f  sion..query I ro
2f2c0 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 33 31 33  wsort label-1313
2f2d0 0d 0a 53 45 4c 45 43 54 20 2b 20 2b 20 31 33 20  ..SELECT + + 13 
2f2e0 2a 20 2d 20 63 6f 72 30 2e 63 6f 6c 30 20 2b 20  * - cor0.col0 + 
2f2f0 63 6f 6c 32 20 44 49 56 20 2b 20 34 30 20 46 52  col2 DIV + 40 FR
2f300 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
2f310 0a 2d 2d 2d 2d 0d 0a 2d 31 30 33 38 0d 0a 2d 33  .----..-1038..-3
2f320 38 0d 0a 2d 38 33 31 0d 0a 0d 0a 73 6b 69 70 69  8..-831....skipi
2f330 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
2f340 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
2f350 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
2f360 31 33 31 33 0d 0a 53 45 4c 45 43 54 20 2b 20 2b  1313..SELECT + +
2f370 20 31 33 20 2a 20 2d 20 63 6f 72 30 2e 63 6f 6c   13 * - cor0.col
2f380 30 20 2b 20 63 6f 6c 32 20 2f 20 2b 20 34 30 20  0 + col2 / + 40 
2f390 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
2f3a0 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 33 38 0d 0a  0..----..-1038..
2f3b0 2d 33 38 0d 0a 2d 38 33 31 0d 0a 0d 0a 71 75 65  -38..-831....que
2f3c0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
2f3d0 4c 45 43 54 20 2b 20 28 20 2b 20 33 32 20 29 20  LECT + ( + 32 ) 
2f3e0 2b 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 41 53  + + cor0.col1 AS
2f3f0 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20   col2 FROM tab2 
2f400 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 34 39 0d 0a  cor0..----..49..
2f410 36 33 0d 0a 39 31 0d 0a 0d 0a 71 75 65 72 79 20  63..91....query 
2f420 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
2f430 54 20 2b 20 2d 20 63 6f 6c 32 20 2b 20 63 6f 72  T + - col2 + cor
2f440 30 2e 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46  0.col1 AS col2 F
2f450 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
2f460 0d 0a 2d 2d 2d 2d 0d 0a 35 33 0d 0a 39 0d 0a 39  ..----..53..9..9
2f470 36 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  6....skipif mysq
2f480 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
2f490 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
2f4a0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
2f4b0 43 41 53 54 20 28 20 2b 20 63 6f 6c 31 20 41 53  CAST ( + col1 AS
2f4c0 20 52 45 41 4c 20 29 20 2b 20 63 6f 6c 31 20 46   REAL ) + col1 F
2f4d0 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab0..----..
2f4e0 31 37 32 0d 0a 31 38 32 0d 0a 31 39 34 0d 0a 0d  172..182..194...
2f4f0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2f500 0d 0a 53 45 4c 45 43 54 20 2d 20 32 35 20 2d 20  ..SELECT - 25 - 
2f510 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 0d 0a  col2 FROM tab2..
2f520 2d 2d 2d 2d 0d 0a 2d 35 31 0d 0a 2d 35 32 0d 0a  ----..-51..-52..
2f530 2d 36 33 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  -63....onlyif my
2f540 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70  sql # use DIV op
2f550 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67  erator for integ
2f560 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65  er division..que
2f570 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
2f580 65 6c 2d 31 33 31 38 0d 0a 53 45 4c 45 43 54 20  el-1318..SELECT 
2f590 2b 20 74 61 62 30 2e 63 6f 6c 31 20 44 49 56 20  + tab0.col1 DIV 
2f5a0 63 6f 6c 32 20 2b 20 63 6f 6c 31 20 2a 20 2b 20  col2 + col1 * + 
2f5b0 32 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  20 AS col2 FROM 
2f5c0 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 37 32 32  tab0..----..1722
2f5d0 0d 0a 31 38 32 31 0d 0a 32 30 33 37 0d 0a 0d 0a  ..1821..2037....
2f5e0 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
2f5f0 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
2f600 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
2f610 61 62 65 6c 2d 31 33 31 38 0d 0a 53 45 4c 45 43  abel-1318..SELEC
2f620 54 20 2b 20 74 61 62 30 2e 63 6f 6c 31 20 2f 20  T + tab0.col1 / 
2f630 63 6f 6c 32 20 2b 20 63 6f 6c 31 20 2a 20 2b 20  col2 + col1 * + 
2f640 32 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  20 AS col2 FROM 
2f650 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 37 32 32  tab0..----..1722
2f660 0d 0a 31 38 32 31 0d 0a 32 30 33 37 0d 0a 0d 0a  ..1821..2037....
2f670 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
2f680 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 39 37  .SELECT ALL - 97
2f690 20 2b 20 63 6f 6c 31 20 2a 20 2d 20 74 61 62 31   + col1 * - tab1
2f6a0 2e 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46 52  .col2 AS col0 FR
2f6b0 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d  OM tab1..----..-
2f6c0 31 33 34 35 0d 0a 2d 31 35 30 31 0d 0a 2d 36 36  1345..-1501..-66
2f6d0 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  7....query I row
2f6e0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2b  sort..SELECT + +
2f6f0 20 33 33 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20   33 + col1 FROM 
2f700 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab1 cor0..----.
2f710 0a 34 33 0d 0a 34 36 0d 0a 35 39 0d 0a 0d 0a 6f  .43..46..59....o
2f720 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73  nlyif mysql # us
2f730 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66  e DIV operator f
2f740 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73  or integer divis
2f750 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ion..query I row
2f760 73 6f 72 74 20 6c 61 62 65 6c 2d 31 33 32 31 0d  sort label-1321.
2f770 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 30 20 44  .SELECT - col0 D
2f780 49 56 20 63 6f 6c 31 20 2b 20 2b 20 39 39 20 2a  IV col1 + + 99 *
2f790 20 63 6f 6c 32 20 2a 20 63 6f 6c 30 20 46 52 4f   col2 * col0 FRO
2f7a0 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
2f7b0 2d 2d 2d 2d 0d 0a 31 36 30 33 38 0d 0a 33 36 31  ----..16038..361
2f7c0 31 34 36 0d 0a 37 36 30 33 31 34 0d 0a 0d 0a 73  146..760314....s
2f7d0 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
2f7e0 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
2f7f0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
2f800 62 65 6c 2d 31 33 32 31 0d 0a 53 45 4c 45 43 54  bel-1321..SELECT
2f810 20 2d 20 63 6f 6c 30 20 2f 20 63 6f 6c 31 20 2b   - col0 / col1 +
2f820 20 2b 20 39 39 20 2a 20 63 6f 6c 32 20 2a 20 63   + 99 * col2 * c
2f830 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol0 FROM tab1 AS
2f840 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 36 30   cor0..----..160
2f850 33 38 0d 0a 33 36 31 31 34 36 0d 0a 37 36 30 33  38..361146..7603
2f860 31 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  14....query I ro
2f870 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
2f880 63 6f 72 30 2e 63 6f 6c 31 20 2b 20 63 6f 6c 32  cor0.col1 + col2
2f890 20 2b 20 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20   + col2 AS col0 
2f8a0 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
2f8b0 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 37 0d 0a 32 33 0d  0..----..-7..23.
2f8c0 0a 35 39 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  .59....onlyif my
2f8d0 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70  sql # use DIV op
2f8e0 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67  erator for integ
2f8f0 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65  er division..que
2f900 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
2f910 65 6c 2d 31 33 32 33 0d 0a 53 45 4c 45 43 54 20  el-1323..SELECT 
2f920 35 20 44 49 56 20 63 6f 72 30 2e 63 6f 6c 32 20  5 DIV cor0.col2 
2f930 2b 20 2d 20 28 20 63 6f 6c 30 20 2b 20 63 6f 6c  + - ( col0 + col
2f940 30 20 29 20 46 52 4f 4d 20 74 61 62 31 20 41 53  0 ) FROM tab1 AS
2f950 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32   cor0..----..-12
2f960 38 0d 0a 2d 31 36 30 0d 0a 2d 36 0d 0a 0d 0a 73  8..-160..-6....s
2f970 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
2f980 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
2f990 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
2f9a0 62 65 6c 2d 31 33 32 33 0d 0a 53 45 4c 45 43 54  bel-1323..SELECT
2f9b0 20 35 20 2f 20 63 6f 72 30 2e 63 6f 6c 32 20 2b   5 / cor0.col2 +
2f9c0 20 2d 20 28 20 63 6f 6c 30 20 2b 20 63 6f 6c 30   - ( col0 + col0
2f9d0 20 29 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20   ) FROM tab1 AS 
2f9e0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32 38  cor0..----..-128
2f9f0 0d 0a 2d 31 36 30 0d 0a 2d 36 0d 0a 0d 0a 6f 6e  ..-160..-6....on
2fa00 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70  lyif mysql # sup
2fa10 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73  port for MySQL s
2fa20 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20 74  pecific system t
2fa30 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d  ypes and syntax.
2fa40 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2fa50 20 6c 61 62 65 6c 2d 31 33 32 34 0d 0a 53 45 4c   label-1324..SEL
2fa60 45 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c  ECT DISTINCT col
2fa70 31 20 2b 20 2b 20 63 6f 6c 30 20 2a 20 43 41 53  1 + + col0 * CAS
2fa80 54 28 20 4e 55 4c 4c 20 41 53 20 53 49 47 4e 45  T( NULL AS SIGNE
2fa90 44 20 29 20 46 52 4f 4d 20 74 61 62 30 20 41 53  D ) FROM tab0 AS
2faa0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c   cor0..----..NUL
2fab0 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  L....skipif mysq
2fac0 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
2fad0 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
2fae0 6f 72 74 20 6c 61 62 65 6c 2d 31 33 32 34 0d 0a  ort label-1324..
2faf0 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
2fb00 63 6f 6c 31 20 2b 20 2b 20 63 6f 6c 30 20 2a 20  col1 + + col0 * 
2fb10 43 41 53 54 20 28 20 4e 55 4c 4c 20 41 53 20 49  CAST ( NULL AS I
2fb20 4e 54 45 47 45 52 20 29 20 46 52 4f 4d 20 74 61  NTEGER ) FROM ta
2fb30 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
2fb40 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 6f 6e 6c 79 69 66  ..NULL....onlyif
2fb50 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56   mysql # use DIV
2fb60 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e   operator for in
2fb70 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a  teger division..
2fb80 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
2fb90 6c 61 62 65 6c 2d 31 33 32 35 0d 0a 53 45 4c 45  label-1325..SELE
2fba0 43 54 20 2b 20 2b 20 63 6f 6c 32 20 2b 20 2d 20  CT + + col2 + - 
2fbb0 63 6f 6c 31 20 44 49 56 20 32 38 20 41 53 20 63  col1 DIV 28 AS c
2fbc0 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol2 FROM tab0 AS
2fbd0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 0d   cor0..----..-2.
2fbe0 0a 33 30 0d 0a 37 39 0d 0a 0d 0a 73 6b 69 70 69  .30..79....skipi
2fbf0 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
2fc00 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
2fc10 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
2fc20 31 33 32 35 0d 0a 53 45 4c 45 43 54 20 2b 20 2b  1325..SELECT + +
2fc30 20 63 6f 6c 32 20 2b 20 2d 20 63 6f 6c 31 20 2f   col2 + - col1 /
2fc40 20 32 38 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d   28 AS col2 FROM
2fc50 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
2fc60 2d 2d 2d 0d 0a 2d 32 0d 0a 33 30 0d 0a 37 39 0d  ---..-2..30..79.
2fc70 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
2fc80 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
2fc90 4e 43 54 20 2d 20 63 6f 6c 31 20 2b 20 2d 20 63  NCT - col1 + - c
2fca0 6f 72 30 2e 63 6f 6c 32 20 41 53 20 63 6f 6c 31  or0.col2 AS col1
2fcb0 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
2fcc0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 35 0d 0a 2d  r0..----..-55..-
2fcd0 35 38 0d 0a 2d 38 35 0d 0a 0d 0a 71 75 65 72 79  58..-85....query
2fce0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
2fcf0 43 54 20 63 6f 6c 32 20 2b 20 2b 20 63 6f 6c 31  CT col2 + + col1
2fd00 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62   + col0 FROM tab
2fd10 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
2fd20 0a 31 33 31 0d 0a 31 38 39 0d 0a 38 33 0d 0a 0d  .131..189..83...
2fd30 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2fd40 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 2b  ..SELECT ALL + +
2fd50 20 28 20 63 6f 72 30 2e 63 6f 6c 30 20 29 20 41   ( cor0.col0 ) A
2fd60 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30  S col2 FROM tab0
2fd70 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
2fd80 32 34 0d 0a 33 35 0d 0a 38 39 0d 0a 0d 0a 6f 6e  24..35..89....on
2fd90 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70  lyif mysql # sup
2fda0 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73  port for MySQL s
2fdb0 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20 74  pecific system t
2fdc0 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d  ypes and syntax.
2fdd0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2fde0 20 6c 61 62 65 6c 2d 31 33 32 39 0d 0a 53 45 4c   label-1329..SEL
2fdf0 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 37  ECT DISTINCT - 7
2fe00 39 20 2a 20 2d 20 63 6f 72 30 2e 63 6f 6c 30 20  9 * - cor0.col0 
2fe10 2b 20 43 41 53 54 28 20 4e 55 4c 4c 20 41 53 20  + CAST( NULL AS 
2fe20 44 45 43 49 4d 41 4c 20 29 20 41 53 20 63 6f 6c  DECIMAL ) AS col
2fe30 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  2 FROM tab0 AS c
2fe40 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d  or0..----..NULL.
2fe50 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
2fe60 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
2fe70 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2fe80 74 20 6c 61 62 65 6c 2d 31 33 32 39 0d 0a 53 45  t label-1329..SE
2fe90 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20  LECT DISTINCT - 
2fea0 37 39 20 2a 20 2d 20 63 6f 72 30 2e 63 6f 6c 30  79 * - cor0.col0
2feb0 20 2b 20 43 41 53 54 20 28 20 4e 55 4c 4c 20 41   + CAST ( NULL A
2fec0 53 20 52 45 41 4c 20 29 20 41 53 20 63 6f 6c 32  S REAL ) AS col2
2fed0 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
2fee0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a  r0..----..NULL..
2fef0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2ff00 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2b 20 37 38  t..SELECT - + 78
2ff10 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20   + col1 AS col2 
2ff20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
2ff30 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 39 0d 0a 2d 34  0..----..-19..-4
2ff40 37 0d 0a 2d 36 31 0d 0a 0d 0a 71 75 65 72 79 20  7..-61....query 
2ff50 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
2ff60 54 20 44 49 53 54 49 4e 43 54 20 2b 20 32 38 20  T DISTINCT + 28 
2ff70 2b 20 39 33 20 2a 20 2b 20 63 6f 6c 32 20 2a 20  + 93 * + col2 * 
2ff80 34 36 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  46 AS col0 FROM 
2ff90 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
2ffa0 2d 2d 0d 0a 32 33 31 30 34 30 0d 0a 32 34 33 38  --..231040..2438
2ffb0 37 34 0d 0a 34 31 30 37 31 36 0d 0a 0d 0a 71 75  74..410716....qu
2ffc0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
2ffd0 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 30  ELECT ALL - col0
2ffe0 20 2a 20 63 6f 6c 32 20 2b 20 2d 20 63 6f 6c 32   * col2 + - col2
2fff0 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
30000 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
30010 0d 0a 2d 32 31 36 0d 0a 2d 33 37 30 35 0d 0a 2d  ..-216..-3705..-
30020 37 37 37 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20  7776....query I 
30030 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
30040 41 4c 4c 20 2d 20 33 32 20 2a 20 63 6f 6c 30 20  ALL - 32 * col0 
30050 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
30060 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32  2 cor0..----..-2
30070 32 34 0d 0a 2d 32 34 39 36 0d 0a 2d 32 35 32 38  24..-2496..-2528
30080 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67  ....skipif postg
30090 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53  resql # PostgreS
300a0 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77  QL requires AS w
300b0 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74  hen renaming out
300c0 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65  put columns..que
300d0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
300e0 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20  LECT DISTINCT - 
300f0 35 30 20 2a 20 2d 20 63 6f 72 30 2e 63 6f 6c 32  50 * - cor0.col2
30100 20 2b 20 63 6f 6c 30 20 63 6f 6c 32 20 46 52 4f   + col0 col2 FRO
30110 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
30120 2d 2d 2d 2d 0d 0a 31 33 35 37 0d 0a 31 33 37 38  ----..1357..1378
30130 0d 0a 31 39 37 39 0d 0a 0d 0a 71 75 65 72 79 20  ..1979....query 
30140 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
30150 54 20 2b 20 2b 20 39 36 20 46 52 4f 4d 20 74 61  T + + 96 FROM ta
30160 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39  b2 cor0..----..9
30170 36 0d 0a 39 36 0d 0a 39 36 0d 0a 0d 0a 6f 6e 6c  6..96..96....onl
30180 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70  yif mysql # supp
30190 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70  ort for MySQL sp
301a0 65 63 69 66 69 63 20 73 79 73 74 65 6d 20 74 79  ecific system ty
301b0 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a  pes and syntax..
301c0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
301d0 6c 61 62 65 6c 2d 31 33 33 36 0d 0a 53 45 4c 45  label-1336..SELE
301e0 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 43 41  CT DISTINCT + CA
301f0 53 54 28 20 4e 55 4c 4c 20 41 53 20 53 49 47 4e  ST( NULL AS SIGN
30200 45 44 20 29 20 2a 20 2b 20 28 20 63 6f 6c 31 20  ED ) * + ( col1 
30210 29 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  ) FROM tab1 AS c
30220 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d  or0..----..NULL.
30230 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
30240 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
30250 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
30260 74 20 6c 61 62 65 6c 2d 31 33 33 36 0d 0a 53 45  t label-1336..SE
30270 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20  LECT DISTINCT + 
30280 43 41 53 54 20 28 20 4e 55 4c 4c 20 41 53 20 49  CAST ( NULL AS I
30290 4e 54 45 47 45 52 20 29 20 2a 20 2b 20 28 20 63  NTEGER ) * + ( c
302a0 6f 6c 31 20 29 20 46 52 4f 4d 20 74 61 62 31 20  ol1 ) FROM tab1 
302b0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e  AS cor0..----..N
302c0 55 4c 4c 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  ULL....query I r
302d0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
302e0 49 53 54 49 4e 43 54 20 32 33 20 2a 20 63 6f 6c  ISTINCT 23 * col
302f0 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  0 AS col1 FROM t
30300 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
30310 2d 0d 0a 32 30 34 37 0d 0a 35 35 32 0d 0a 38 30  -..2047..552..80
30320 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  5....query I row
30330 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 36 39 20  sort..SELECT 69 
30340 46 52 4f 4d 20 74 61 62 30 2c 20 74 61 62 30 20  FROM tab0, tab0 
30350 41 53 20 63 6f 72 30 2c 20 74 61 62 31 20 41 53  AS cor0, tab1 AS
30360 20 63 6f 72 31 2c 20 74 61 62 32 20 63 6f 72 32   cor1, tab2 cor2
30370 0d 0a 2d 2d 2d 2d 0d 0a 38 31 20 76 61 6c 75 65  ..----..81 value
30380 73 20 68 61 73 68 69 6e 67 20 74 6f 20 64 66 61  s hashing to dfa
30390 64 61 31 65 65 37 61 34 65 33 65 35 63 37 34 61  da1ee7a4e3e5c74a
303a0 30 36 33 61 31 32 38 32 37 36 39 66 39 0d 0a 0d  063a1282769f9...
303b0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
303c0 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63  ..SELECT ALL - c
303d0 6f 6c 32 20 2b 20 2d 20 63 6f 6c 31 20 2b 20 63  ol2 + - col1 + c
303e0 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol1 FROM tab2 AS
303f0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 36   cor0..----..-26
30400 0d 0a 2d 32 37 0d 0a 2d 33 38 0d 0a 0d 0a 73 6b  ..-27..-38....sk
30410 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20  ipif postgresql 
30420 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71  # PostgreSQL req
30430 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65  uires AS when re
30440 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f  naming output co
30450 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72  lumns..query I r
30460 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
30470 20 35 35 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   55 col1 FROM ta
30480 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
30490 0d 0a 35 35 0d 0a 35 35 0d 0a 35 35 0d 0a 0d 0a  ..55..55..55....
304a0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
304b0 0a 53 45 4c 45 43 54 20 2d 20 28 20 2b 20 63 6f  .SELECT - ( + co
304c0 72 30 2e 63 6f 6c 30 20 29 20 2b 20 2d 20 33 35  r0.col0 ) + - 35
304d0 20 2a 20 2d 20 37 39 20 41 53 20 63 6f 6c 30 20   * - 79 AS col0 
304e0 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
304f0 30 0d 0a 2d 2d 2d 2d 0d 0a 32 36 38 35 0d 0a 32  0..----..2685..2
30500 37 30 31 0d 0a 32 37 36 32 0d 0a 0d 0a 71 75 65  701..2762....que
30510 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
30520 4c 45 43 54 20 41 4c 4c 20 2d 20 28 20 2d 20 32  LECT ALL - ( - 2
30530 38 20 2a 20 74 61 62 30 2e 63 6f 6c 32 20 29 20  8 * tab0.col2 ) 
30540 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d  FROM tab0..----.
30550 0a 32 32 39 36 0d 0a 32 38 0d 0a 39 32 34 0d 0a  .2296..28..924..
30560 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65  ..skipif postgre
30570 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c  sql # PostgreSQL
30580 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65   requires AS whe
30590 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75  n renaming outpu
305a0 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79  t columns..query
305b0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
305c0 43 54 20 2d 20 31 37 20 2a 20 2d 20 63 6f 6c 32  CT - 17 * - col2
305d0 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20   col2 FROM tab0 
305e0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
305f0 33 39 34 0d 0a 31 37 0d 0a 35 36 31 0d 0a 0d 0a  394..17..561....
30600 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
30610 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 31  .SELECT ALL col1
30620 20 2a 20 2b 20 63 6f 6c 31 20 2b 20 2b 20 37 39   * + col1 + + 79
30630 20 2a 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62   * col1 FROM tab
30640 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
30650 0a 31 31 39 36 0d 0a 32 37 33 30 0d 0a 38 39 30  .1196..2730..890
30660 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
30670 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d   # support for M
30680 79 53 51 4c 20 73 70 65 63 69 66 69 63 20 73 79  ySQL specific sy
30690 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73  stem types and s
306a0 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72  yntax..query I r
306b0 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 33 34  owsort label-134
306c0 35 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  5..SELECT DISTIN
306d0 43 54 20 2b 20 63 6f 6c 30 20 2b 20 2d 20 43 41  CT + col0 + - CA
306e0 53 54 28 20 63 6f 72 30 2e 63 6f 6c 30 20 41 53  ST( cor0.col0 AS
306f0 20 53 49 47 4e 45 44 20 29 20 2d 20 63 6f 6c 32   SIGNED ) - col2
30700 20 46 52 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d   FROM tab2 cor0.
30710 0a 2d 2d 2d 2d 0d 0a 2d 32 36 0d 0a 2d 32 37 0d  .----..-26..-27.
30720 0a 2d 33 38 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  .-38....skipif m
30730 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
30740 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
30750 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 33 34  owsort label-134
30760 35 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  5..SELECT DISTIN
30770 43 54 20 2b 20 63 6f 6c 30 20 2b 20 2d 20 43 41  CT + col0 + - CA
30780 53 54 20 28 20 63 6f 72 30 2e 63 6f 6c 30 20 41  ST ( cor0.col0 A
30790 53 20 49 4e 54 45 47 45 52 20 29 20 2d 20 63 6f  S INTEGER ) - co
307a0 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 63 6f 72  l2 FROM tab2 cor
307b0 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 36 0d 0a 2d 32  0..----..-26..-2
307c0 37 0d 0a 2d 33 38 0d 0a 0d 0a 71 75 65 72 79 20  7..-38....query 
307d0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
307e0 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c  T DISTINCT - col
307f0 32 20 2a 20 28 20 63 6f 6c 32 20 29 20 2b 20 63  2 * ( col2 ) + c
30800 6f 6c 31 20 2a 20 63 6f 6c 31 20 2a 20 63 6f 6c  ol1 * col1 * col
30810 32 20 2d 20 2d 20 63 6f 6c 30 20 46 52 4f 4d 20  2 - - col0 FROM 
30820 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab1 cor0..----.
30830 0a 32 35 31 35 0d 0a 33 33 35 39 31 0d 0a 37 30  .2515..33591..70
30840 38 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  88....query I ro
30850 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
30860 4c 20 2d 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20  L - + cor0.col2 
30870 2a 20 2d 20 32 32 20 2b 20 2d 20 63 6f 72 30 2e  * - 22 + - cor0.
30880 63 6f 6c 31 20 2a 20 63 6f 6c 32 20 41 53 20 63  col1 * col2 AS c
30890 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol1 FROM tab2 AS
308a0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 34   cor0..----..-24
308b0 33 0d 0a 2d 39 36 32 0d 0a 31 39 30 0d 0a 0d 0a  3..-962..190....
308c0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
308d0 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 30 20 2a  .SELECT + col0 *
308e0 20 63 6f 6c 31 20 2a 20 33 33 20 2b 20 63 6f 72   col1 * 33 + cor
308f0 30 2e 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31  0.col0 FROM tab1
30900 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
30910 32 31 31 38 34 0d 0a 32 35 37 37 0d 0a 33 34 34  21184..2577..344
30920 30 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  00....query I ro
30930 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
30940 53 54 49 4e 43 54 20 63 6f 72 30 2e 63 6f 6c 32  STINCT cor0.col2
30950 20 2d 20 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20   - col2 AS col0 
30960 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
30970 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 0d 0a 73 6b  0..----..0....sk
30980 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20  ipif postgresql 
30990 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71  # PostgreSQL req
309a0 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65  uires AS when re
309b0 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f  naming output co
309c0 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72  lumns..query I r
309d0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63  owsort..SELECT c
309e0 6f 6c 31 20 2b 20 28 20 35 35 20 29 20 2a 20 2d  ol1 + ( 55 ) * -
309f0 20 63 6f 6c 31 20 63 6f 6c 32 20 46 52 4f 4d 20   col1 col2 FROM 
30a00 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
30a10 2d 2d 0d 0a 2d 34 36 34 34 0d 0a 2d 34 39 31 34  --..-4644..-4914
30a20 0d 0a 2d 35 32 33 38 0d 0a 0d 0a 6f 6e 6c 79 69  ..-5238....onlyi
30a30 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49  f mysql # use DI
30a40 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69  V operator for i
30a50 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d  nteger division.
30a60 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
30a70 20 6c 61 62 65 6c 2d 31 33 35 31 0d 0a 53 45 4c   label-1351..SEL
30a80 45 43 54 20 2d 20 63 6f 6c 31 20 2b 20 2b 20 63  ECT - col1 + + c
30a90 6f 6c 30 20 2b 20 37 33 20 44 49 56 20 2b 20 63  ol0 + 73 DIV + c
30aa0 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d  ol1 FROM tab0..-
30ab0 2d 2d 2d 0d 0a 2d 32 0d 0a 2d 36 32 0d 0a 2d 36  ---..-2..-62..-6
30ac0 32 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  2....skipif mysq
30ad0 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
30ae0 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
30af0 6f 72 74 20 6c 61 62 65 6c 2d 31 33 35 31 0d 0a  ort label-1351..
30b00 53 45 4c 45 43 54 20 2d 20 63 6f 6c 31 20 2b 20  SELECT - col1 + 
30b10 2b 20 63 6f 6c 30 20 2b 20 37 33 20 2f 20 2b 20  + col0 + 73 / + 
30b20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a  col1 FROM tab0..
30b30 2d 2d 2d 2d 0d 0a 2d 32 0d 0a 2d 36 32 0d 0a 2d  ----..-2..-62..-
30b40 36 32 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  62....onlyif mys
30b50 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65  ql # use DIV ope
30b60 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65  rator for intege
30b70 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72  r division..quer
30b80 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
30b90 6c 2d 31 33 35 32 0d 0a 53 45 4c 45 43 54 20 41  l-1352..SELECT A
30ba0 4c 4c 20 2d 20 35 32 20 44 49 56 20 2d 20 63 6f  LL - 52 DIV - co
30bb0 6c 31 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74  l1 + col0 FROM t
30bc0 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 37 38 0d 0a 38  ab2..----..78..8
30bd0 0d 0a 38 32 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  ..82....skipif m
30be0 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
30bf0 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
30c00 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 33 35  owsort label-135
30c10 32 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20  2..SELECT ALL - 
30c20 35 32 20 2f 20 2d 20 63 6f 6c 31 20 2b 20 63 6f  52 / - col1 + co
30c30 6c 30 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d  l0 FROM tab2..--
30c40 2d 2d 0d 0a 37 38 0d 0a 38 0d 0a 38 32 0d 0a 0d  --..78..8..82...
30c50 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
30c60 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63  ..SELECT ALL - c
30c70 6f 6c 30 20 2b 20 2b 20 63 6f 6c 31 20 2d 20 2b  ol0 + + col1 - +
30c80 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 0d   col1 FROM tab1.
30c90 0a 2d 2d 2d 2d 0d 0a 2d 33 0d 0a 2d 36 34 0d 0a  .----..-3..-64..
30ca0 2d 38 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  -80....query I r
30cb0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
30cc0 20 63 6f 72 30 2e 63 6f 6c 30 20 2a 20 63 6f 72   cor0.col0 * cor
30cd0 30 2e 63 6f 6c 30 20 2b 20 63 6f 6c 30 20 2a 20  0.col0 + col0 * 
30ce0 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46 52 4f  col2 AS col0 FRO
30cf0 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
30d00 2d 2d 2d 2d 0d 0a 32 33 38 0d 0a 38 31 31 32 0d  ----..238..8112.
30d10 0a 39 32 34 33 0d 0a 0d 0a 71 75 65 72 79 20 49  .9243....query I
30d20 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
30d30 20 44 49 53 54 49 4e 43 54 20 2b 20 2b 20 63 6f   DISTINCT + + co
30d40 6c 31 20 2b 20 2d 20 63 6f 6c 32 20 2a 20 63 6f  l1 + - col2 * co
30d50 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l2 FROM tab2 AS 
30d60 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 34 32  cor0..----..-142
30d70 37 0d 0a 2d 36 31 37 0d 0a 2d 36 39 38 0d 0a 0d  7..-617..-698...
30d80 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
30d90 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63  ..SELECT ALL - c
30da0 6f 6c 32 20 2a 20 63 6f 6c 30 20 2b 20 63 6f 6c  ol2 * col0 + col
30db0 31 20 2a 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61  1 * col0 FROM ta
30dc0 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
30dd0 0d 0a 31 32 37 32 0d 0a 33 33 36 30 0d 0a 38 30  ..1272..3360..80
30de0 31 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74  1....skipif post
30df0 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65  gresql # Postgre
30e00 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20  SQL requires AS 
30e10 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75  when renaming ou
30e20 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75  tput columns..qu
30e30 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
30e40 45 4c 45 43 54 20 63 6f 6c 31 20 2a 20 63 6f 6c  ELECT col1 * col
30e50 31 20 2a 20 63 6f 6c 32 20 2b 20 74 61 62 32 2e  1 * col2 + tab2.
30e60 63 6f 6c 32 20 63 6f 6c 31 20 46 52 4f 4d 20 74  col2 col1 FROM t
30e70 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 31 30 32 30  ab2..----..11020
30e80 0d 0a 32 35 39 37 34 0d 0a 39 30 35 33 32 0d 0a  ..25974..90532..
30e90 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
30ea0 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53   support for MyS
30eb0 51 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74  QL specific syst
30ec0 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e  em types and syn
30ed0 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  tax..query I row
30ee0 73 6f 72 74 20 6c 61 62 65 6c 2d 31 33 35 38 0d  sort label-1358.
30ef0 0a 53 45 4c 45 43 54 20 43 41 53 54 28 20 4e 55  .SELECT CAST( NU
30f00 4c 4c 20 41 53 20 44 45 43 49 4d 41 4c 20 29 20  LL AS DECIMAL ) 
30f10 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
30f20 32 2c 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  2, tab2 AS cor0.
30f30 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20  .----..9 values 
30f40 68 61 73 68 69 6e 67 20 74 6f 20 63 64 37 61 37  hashing to cd7a7
30f50 39 30 31 65 34 37 63 31 35 31 35 35 34 30 34 61  901e47c15155404a
30f60 66 66 30 64 32 31 36 66 65 30 62 0d 0a 0d 0a 73  ff0d216fe0b....s
30f70 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
30f80 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
30f90 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
30fa0 62 65 6c 2d 31 33 35 38 0d 0a 53 45 4c 45 43 54  bel-1358..SELECT
30fb0 20 43 41 53 54 20 28 20 4e 55 4c 4c 20 41 53 20   CAST ( NULL AS 
30fc0 52 45 41 4c 20 29 20 41 53 20 63 6f 6c 30 20 46  REAL ) AS col0 F
30fd0 52 4f 4d 20 74 61 62 32 2c 20 74 61 62 32 20 41  ROM tab2, tab2 A
30fe0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20  S cor0..----..9 
30ff0 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74  values hashing t
31000 6f 20 63 64 37 61 37 39 30 31 65 34 37 63 31 35  o cd7a7901e47c15
31010 31 35 35 34 30 34 61 66 66 30 64 32 31 36 66 65  155404aff0d216fe
31020 30 62 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  0b....query I ro
31030 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
31040 53 54 49 4e 43 54 20 2d 20 74 61 62 31 2e 63 6f  STINCT - tab1.co
31050 6c 32 20 2b 20 2d 20 63 6f 6c 30 20 41 53 20 63  l2 + - col0 AS c
31060 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d  ol2 FROM tab1..-
31070 2d 2d 2d 0d 0a 2d 31 32 31 0d 0a 2d 31 37 36 0d  ---..-121..-176.
31080 0a 2d 35 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .-57....query I 
31090 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
310a0 2b 20 63 6f 6c 31 20 2a 20 2b 20 32 32 20 2b 20  + col1 * + 22 + 
310b0 31 37 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  17 AS col1 FROM 
310c0 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 39 30 39  tab0..----..1909
310d0 0d 0a 32 30 31 39 0d 0a 32 31 35 31 0d 0a 0d 0a  ..2019..2151....
310e0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
310f0 0a 53 45 4c 45 43 54 20 63 6f 6c 30 20 2a 20 2d  .SELECT col0 * -
31100 20 28 20 63 6f 6c 32 20 2a 20 2d 20 74 61 62 32   ( col2 * - tab2
31110 2e 63 6f 6c 30 20 29 20 2b 20 2b 20 63 6f 6c 31  .col0 ) + + col1
31120 20 2b 20 2d 20 39 34 20 46 52 4f 4d 20 74 61 62   + - 94 FROM tab
31130 32 0d 0a 2d 2d 2d 2d 0d 0a 31 32 36 30 0d 0a 31  2..----..1260..1
31140 35 38 31 34 39 0d 0a 32 33 37 30 38 31 0d 0a 0d  58149..237081...
31150 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
31160 0d 0a 53 45 4c 45 43 54 20 2d 20 74 61 62 31 2e  ..SELECT - tab1.
31170 63 6f 6c 30 20 2a 20 2d 20 34 31 20 46 52 4f 4d  col0 * - 41 FROM
31180 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 32 33   tab1..----..123
31190 0d 0a 32 36 32 34 0d 0a 33 32 38 30 0d 0a 0d 0a  ..2624..3280....
311a0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
311b0 0a 53 45 4c 45 43 54 20 2d 20 2d 20 36 37 20 2a  .SELECT - - 67 *
311c0 20 2d 20 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c 32   - col1 * - col2
311d0 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
311e0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 39 30 31 34 36  r0..----..190146
311f0 0d 0a 34 39 39 39 35 34 0d 0a 36 34 39 39 0d 0a  ..499954..6499..
31200 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
31210 74 0d 0a 53 45 4c 45 43 54 20 2b 20 38 35 20 2b  t..SELECT + 85 +
31220 20 2d 20 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c 30   - col2 * + col0
31230 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
31240 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 35 36 33 0d  r0..----..-3563.
31250 0a 2d 37 35 39 35 0d 0a 2d 37 37 0d 0a 0d 0a 71  .-7595..-77....q
31260 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
31270 53 45 4c 45 43 54 20 2b 20 63 6f 6c 31 20 2a 20  SELECT + col1 * 
31280 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c 30 20 41 53  col2 * - col0 AS
31290 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20   col0 FROM tab0 
312a0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
312b0 33 33 39 35 0d 0a 2d 36 36 34 31 31 38 0d 0a 2d  3395..-664118..-
312c0 36 38 31 31 32 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  68112....onlyif 
312d0 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20  mysql # support 
312e0 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66  for MySQL specif
312f0 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20  ic system types 
31300 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72  and syntax..quer
31310 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
31320 6c 2d 31 33 36 36 0d 0a 53 45 4c 45 43 54 20 2d  l-1366..SELECT -
31330 20 43 41 53 54 28 20 4e 55 4c 4c 20 41 53 20 53   CAST( NULL AS S
31340 49 47 4e 45 44 20 29 20 2b 20 2b 20 74 61 62 30  IGNED ) + + tab0
31350 2e 63 6f 6c 32 20 63 6f 6c 30 20 46 52 4f 4d 20  .col2 col0 FROM 
31360 74 61 62 30 2c 20 74 61 62 32 20 41 53 20 63 6f  tab0, tab2 AS co
31370 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75  r0..----..9 valu
31380 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 63 64  es hashing to cd
31390 37 61 37 39 30 31 65 34 37 63 31 35 31 35 35 34  7a7901e47c151554
313a0 30 34 61 66 66 30 64 32 31 36 66 65 30 62 0d 0a  04aff0d216fe0b..
313b0 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65  ..skipif postgre
313c0 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c  sql # PostgreSQL
313d0 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65   requires AS whe
313e0 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75  n renaming outpu
313f0 74 20 63 6f 6c 75 6d 6e 73 0d 0a 73 6b 69 70 69  t columns..skipi
31400 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
31410 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
31420 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
31430 31 33 36 36 0d 0a 53 45 4c 45 43 54 20 2d 20 43  1366..SELECT - C
31440 41 53 54 20 28 20 4e 55 4c 4c 20 41 53 20 49 4e  AST ( NULL AS IN
31450 54 45 47 45 52 20 29 20 2b 20 2b 20 74 61 62 30  TEGER ) + + tab0
31460 2e 63 6f 6c 32 20 63 6f 6c 30 20 46 52 4f 4d 20  .col2 col0 FROM 
31470 74 61 62 30 2c 20 74 61 62 32 20 41 53 20 63 6f  tab0, tab2 AS co
31480 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75  r0..----..9 valu
31490 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 63 64  es hashing to cd
314a0 37 61 37 39 30 31 65 34 37 63 31 35 31 35 35 34  7a7901e47c151554
314b0 30 34 61 66 66 30 64 32 31 36 66 65 30 62 0d 0a  04aff0d216fe0b..
314c0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
314d0 74 0d 0a 53 45 4c 45 43 54 20 74 61 62 32 2e 63  t..SELECT tab2.c
314e0 6f 6c 31 20 2a 20 2d 20 63 6f 72 30 2e 63 6f 6c  ol1 * - cor0.col
314f0 31 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  1 AS col0 FROM t
31500 61 62 32 2c 20 74 61 62 31 20 41 53 20 63 6f 72  ab2, tab1 AS cor
31510 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65  0..----..9 value
31520 73 20 68 61 73 68 69 6e 67 20 74 6f 20 63 36 66  s hashing to c6f
31530 34 62 30 62 31 64 31 66 37 37 39 36 62 30 35 34  4b0b1d1f7796b054
31540 39 33 65 32 33 64 34 30 62 30 62 37 35 0d 0a 0d  93e23d40b0b75...
31550 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
31560 0d 0a 53 45 4c 45 43 54 20 63 6f 72 30 2e 63 6f  ..SELECT cor0.co
31570 6c 32 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  l2 AS col0 FROM 
31580 74 61 62 30 20 63 6f 72 30 20 43 52 4f 53 53 20  tab0 cor0 CROSS 
31590 4a 4f 49 4e 20 74 61 62 30 20 41 53 20 63 6f 72  JOIN tab0 AS cor
315a0 31 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65  1..----..9 value
315b0 73 20 68 61 73 68 69 6e 67 20 74 6f 20 63 38 66  s hashing to c8f
315c0 39 66 61 39 65 66 30 66 38 37 30 32 62 64 33 38  9fa9ef0f8702bd38
315d0 32 65 38 32 31 33 37 38 61 39 36 64 38 0d 0a 0d  2e821378a96d8...
315e0 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73  .skipif postgres
315f0 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20  ql # PostgreSQL 
31600 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e  requires AS when
31610 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74   renaming output
31620 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20   columns..query 
31630 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
31640 54 20 44 49 53 54 49 4e 43 54 20 28 20 2b 20 63  T DISTINCT ( + c
31650 6f 6c 31 20 2b 20 2d 20 63 6f 6c 32 20 29 20 63  ol1 + - col2 ) c
31660 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d  ol0 FROM tab2..-
31670 2d 2d 2d 0d 0a 2d 32 31 0d 0a 33 33 0d 0a 34 0d  ---..-21..33..4.
31680 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
31690 72 74 0d 0a 53 45 4c 45 43 54 20 28 20 2b 20 35  rt..SELECT ( + 5
316a0 31 20 29 20 2a 20 2d 20 63 6f 6c 31 20 46 52 4f  1 ) * - col1 FRO
316b0 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
316c0 2d 2d 2d 2d 0d 0a 2d 34 33 38 36 0d 0a 2d 34 36  ----..-4386..-46
316d0 34 31 0d 0a 2d 34 39 34 37 0d 0a 0d 0a 71 75 65  41..-4947....que
316e0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
316f0 4c 45 43 54 20 32 31 20 2a 20 2b 20 63 6f 72 30  LECT 21 * + cor0
31700 2e 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c 30 20 2a  .col0 + - col0 *
31710 20 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46 52   col2 AS col0 FR
31720 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
31730 0a 2d 2d 2d 2d 0d 0a 2d 32 33 30 34 0d 0a 2d 36  .----..-2304..-6
31740 30 30 30 0d 0a 2d 39 39 0d 0a 0d 0a 6f 6e 6c 79  000..-99....only
31750 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f  if mysql # suppo
31760 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65  rt for MySQL spe
31770 63 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70  cific system typ
31780 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71  es and syntax..q
31790 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
317a0 61 62 65 6c 2d 31 33 37 32 0d 0a 53 45 4c 45 43  abel-1372..SELEC
317b0 54 20 2d 20 43 41 53 54 28 20 4e 55 4c 4c 20 41  T - CAST( NULL A
317c0 53 20 53 49 47 4e 45 44 20 29 20 2a 20 63 6f 72  S SIGNED ) * cor
317d0 30 2e 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46  0.col0 AS col2 F
317e0 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
317f0 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55  ..----..NULL..NU
31800 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70  LL..NULL....skip
31810 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
31820 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
31830 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
31840 2d 31 33 37 32 0d 0a 53 45 4c 45 43 54 20 2d 20  -1372..SELECT - 
31850 43 41 53 54 20 28 20 4e 55 4c 4c 20 41 53 20 49  CAST ( NULL AS I
31860 4e 54 45 47 45 52 20 29 20 2a 20 63 6f 72 30 2e  NTEGER ) * cor0.
31870 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46 52 4f  col0 AS col2 FRO
31880 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
31890 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c  ----..NULL..NULL
318a0 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66  ..NULL....skipif
318b0 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f   postgresql # Po
318c0 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65  stgreSQL require
318d0 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69  s AS when renami
318e0 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e  ng output column
318f0 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  s..query I rowso
31900 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 36 35 20  rt..SELECT + 65 
31910 2b 20 63 6f 6c 32 20 63 6f 6c 32 20 46 52 4f 4d  + col2 col2 FROM
31920 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
31930 2d 2d 2d 0d 0a 31 31 39 0d 0a 31 32 32 0d 0a 31  ---..119..122..1
31940 36 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  61....query I ro
31950 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
31960 53 54 49 4e 43 54 20 2d 20 37 31 20 2b 20 2d 20  STINCT - 71 + - 
31970 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 0d 0a  col1 FROM tab2..
31980 2d 2d 2d 2d 0d 0a 2d 31 30 32 0d 0a 2d 31 33 30  ----..-102..-130
31990 0d 0a 2d 38 38 0d 0a 0d 0a 71 75 65 72 79 20 49  ..-88....query I
319a0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
319b0 20 41 4c 4c 20 63 6f 6c 32 20 2b 20 2d 20 63 6f   ALL col2 + - co
319c0 6c 32 20 2a 20 2b 20 36 32 20 46 52 4f 4d 20 74  l2 * + 62 FROM t
319d0 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 35 38 36  ab2..----..-1586
319e0 0d 0a 2d 31 36 34 37 0d 0a 2d 32 33 31 38 0d 0a  ..-1647..-2318..
319f0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
31a00 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20  t..SELECT ALL + 
31a10 63 6f 6c 32 20 2a 20 63 6f 6c 31 20 2b 20 2b 20  col2 * col1 + + 
31a20 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c 32 20 2b 20  col0 * + col2 + 
31a30 63 6f 6c 31 20 2a 20 2b 20 63 6f 72 30 2e 63 6f  col1 * + cor0.co
31a40 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l2 FROM tab0 AS 
31a50 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 32 32 32  cor0..----..2222
31a60 32 0d 0a 32 32 39 0d 0a 36 34 36 38 0d 0a 0d 0a  2..229..6468....
31a70 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
31a80 0a 53 45 4c 45 43 54 20 2b 20 38 37 20 2a 20 2b  .SELECT + 87 * +
31a90 20 63 6f 72 30 2e 63 6f 6c 32 20 41 53 20 63 6f   cor0.col2 AS co
31aa0 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l1 FROM tab0 AS 
31ab0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 38 37 31  cor0..----..2871
31ac0 0d 0a 37 31 33 34 0d 0a 38 37 0d 0a 0d 0a 71 75  ..7134..87....qu
31ad0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
31ae0 45 4c 45 43 54 20 41 4c 4c 20 2d 20 32 38 20 2b  ELECT ALL - 28 +
31af0 20 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46 52   col2 AS col1 FR
31b00 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
31b10 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 2d 32 0d 0a 31  .----..-1..-2..1
31b20 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  0....query I row
31b30 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
31b40 54 49 4e 43 54 20 2b 20 33 31 20 2a 20 63 6f 6c  TINCT + 31 * col
31b50 31 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  1 AS col1 FROM t
31b60 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
31b70 2d 0d 0a 32 36 36 36 0d 0a 32 38 32 31 0d 0a 33  -..2666..2821..3
31b80 30 30 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  007....query I r
31b90 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
31ba0 4c 4c 20 2d 20 28 20 2d 20 63 6f 6c 30 20 29 20  LL - ( - col0 ) 
31bb0 2a 20 2d 20 34 34 20 2b 20 63 6f 6c 30 20 2a 20  * - 44 + col0 * 
31bc0 63 6f 6c 31 20 2a 20 63 6f 6c 32 20 46 52 4f 4d  col1 * col2 FROM
31bd0 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
31be0 2d 2d 2d 0d 0a 31 31 36 32 32 30 0d 0a 34 37 35  ---..116220..475
31bf0 35 38 0d 0a 35 35 35 31 0d 0a 0d 0a 71 75 65 72  58..5551....quer
31c00 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
31c10 45 43 54 20 2b 20 2d 20 63 6f 6c 32 20 2b 20 63  ECT + - col2 + c
31c20 6f 6c 30 20 2a 20 2b 20 63 6f 6c 31 20 41 53 20  ol0 * + col1 AS 
31c30 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41  col0 FROM tab1 A
31c40 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 34  S cor0..----..24
31c50 0d 0a 35 38 33 0d 0a 39 34 34 0d 0a 0d 0a 71 75  ..583..944....qu
31c60 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
31c70 45 4c 45 43 54 20 2d 20 2b 20 63 6f 6c 31 20 2a  ELECT - + col1 *
31c80 20 2b 20 33 20 41 53 20 63 6f 6c 31 20 46 52 4f   + 3 AS col1 FRO
31c90 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
31ca0 2d 2d 2d 2d 0d 0a 2d 31 37 37 0d 0a 2d 35 31 0d  ----..-177..-51.
31cb0 0a 2d 39 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .-93....query I 
31cc0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
31cd0 2d 20 28 20 39 33 20 29 20 41 53 20 63 6f 6c 30  - ( 93 ) AS col0
31ce0 20 46 52 4f 4d 20 74 61 62 30 2c 20 74 61 62 31   FROM tab0, tab1
31cf0 20 41 53 20 63 6f 72 30 2c 20 74 61 62 30 20 41   AS cor0, tab0 A
31d00 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 32 37  S cor1..----..27
31d10 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20   values hashing 
31d20 74 6f 20 65 61 37 39 63 36 31 66 37 61 30 32 64  to ea79c61f7a02d
31d30 32 35 38 30 35 31 37 31 66 35 65 38 35 32 32 39  25805171f5e85229
31d40 66 62 61 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  fba....query I r
31d50 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
31d60 20 63 6f 6c 31 20 2b 20 63 6f 6c 31 20 2b 20 2b   col1 + col1 + +
31d70 20 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c 32 20 46   col2 * - col2 F
31d80 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
31d90 0d 0a 2d 2d 2d 2d 0d 0a 2d 36 35 34 32 0d 0a 2d  ..----..-6542..-
31da0 39 31 37 0d 0a 31 39 33 0d 0a 0d 0a 71 75 65 72  917..193....quer
31db0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
31dc0 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63  ECT DISTINCT + c
31dd0 6f 6c 30 20 2a 20 2d 20 63 6f 6c 30 20 2a 20 63  ol0 * - col0 * c
31de0 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d  ol0 FROM tab0..-
31df0 2d 2d 2d 0d 0a 2d 31 33 38 32 34 0d 0a 2d 34 32  ---..-13824..-42
31e00 38 37 35 0d 0a 2d 37 30 34 39 36 39 0d 0a 0d 0a  875..-704969....
31e10 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
31e20 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
31e30 20 2d 20 74 61 62 30 2e 63 6f 6c 31 20 46 52 4f   - tab0.col1 FRO
31e40 4d 20 74 61 62 30 2c 20 74 61 62 31 20 63 6f 72  M tab0, tab1 cor
31e50 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 38 36 0d 0a 2d 39  0..----..-86..-9
31e60 31 0d 0a 2d 39 37 0d 0a 0d 0a 71 75 65 72 79 20  1..-97....query 
31e70 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
31e80 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c  T DISTINCT + col
31e90 30 20 2a 20 2b 20 31 34 20 46 52 4f 4d 20 74 61  0 * + 14 FROM ta
31ea0 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 31 32 30 0d 0a  b1..----..1120..
31eb0 34 32 0d 0a 38 39 36 0d 0a 0d 0a 71 75 65 72 79  42..896....query
31ec0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
31ed0 43 54 20 2d 20 39 38 20 41 53 20 63 6f 6c 32 20  CT - 98 AS col2 
31ee0 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d  FROM tab2..----.
31ef0 0a 2d 39 38 0d 0a 2d 39 38 0d 0a 2d 39 38 0d 0a  .-98..-98..-98..
31f00 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
31f10 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
31f20 43 54 20 2d 20 2d 20 33 20 2d 20 63 6f 6c 32 20  CT - - 3 - col2 
31f30 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
31f40 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
31f50 0a 2d 33 30 0d 0a 2d 37 39 0d 0a 32 0d 0a 0d 0a  .-30..-79..2....
31f60 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
31f70 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 32 34  .SELECT ALL - 24
31f80 20 2a 20 2b 20 63 6f 6c 31 20 2b 20 33 32 20 2a   * + col1 + 32 *
31f90 20 36 30 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d   60 AS col0 FROM
31fa0 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
31fb0 2d 2d 2d 0d 0a 31 31 37 36 0d 0a 31 35 31 32 0d  ---..1176..1512.
31fc0 0a 35 30 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .504....query I 
31fd0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
31fe0 44 49 53 54 49 4e 43 54 20 63 6f 6c 30 20 2a 20  DISTINCT col0 * 
31ff0 2d 20 63 6f 6c 32 20 2b 20 2b 20 34 20 2a 20 2d  - col2 + + 4 * -
32000 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20   col1 FROM tab1 
32010 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
32020 32 36 36 0d 0a 2d 33 36 38 38 0d 0a 2d 37 37 33  266..-3688..-773
32030 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  2....query I row
32040 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
32050 54 49 4e 43 54 20 2d 20 37 31 20 2a 20 36 31 20  TINCT - 71 * 61 
32060 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
32070 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 33 33 31 0d 0a  0..----..-4331..
32080 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
32090 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2d 20 28 20  t..SELECT + - ( 
320a0 63 6f 6c 30 20 29 20 2a 20 63 6f 6c 30 20 2a 20  col0 ) * col0 * 
320b0 2d 20 31 37 20 46 52 4f 4d 20 74 61 62 31 20 41  - 17 FROM tab1 A
320c0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30  S cor0..----..10
320d0 38 38 30 30 0d 0a 31 35 33 0d 0a 36 39 36 33 32  8800..153..69632
320e0 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
320f0 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d   # support for M
32100 79 53 51 4c 20 73 70 65 63 69 66 69 63 20 73 79  ySQL specific sy
32110 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73  stem types and s
32120 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72  yntax..query I r
32130 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 33 39  owsort label-139
32140 34 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  4..SELECT DISTIN
32150 43 54 20 43 41 53 54 28 20 63 6f 6c 31 20 2b 20  CT CAST( col1 + 
32160 63 6f 6c 32 20 41 53 20 53 49 47 4e 45 44 20 29  col2 AS SIGNED )
32170 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
32180 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 30 39 0d 0a 36  b1..----..109..6
32190 37 0d 0a 38 30 0d 0a 0d 0a 73 6b 69 70 69 66 20  7..80....skipif 
321a0 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
321b0 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
321c0 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 33  rowsort label-13
321d0 39 34 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  94..SELECT DISTI
321e0 4e 43 54 20 43 41 53 54 20 28 20 63 6f 6c 31 20  NCT CAST ( col1 
321f0 2b 20 63 6f 6c 32 20 41 53 20 49 4e 54 45 47 45  + col2 AS INTEGE
32200 52 20 29 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  R ) AS col0 FROM
32210 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 30 39   tab1..----..109
32220 0d 0a 36 37 0d 0a 38 30 0d 0a 0d 0a 6f 6e 6c 79  ..67..80....only
32230 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f  if mysql # suppo
32240 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65  rt for MySQL spe
32250 63 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70  cific system typ
32260 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71  es and syntax..q
32270 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
32280 61 62 65 6c 2d 31 33 39 35 0d 0a 53 45 4c 45 43  abel-1395..SELEC
32290 54 20 43 41 53 54 28 20 4e 55 4c 4c 20 41 53 20  T CAST( NULL AS 
322a0 53 49 47 4e 45 44 20 29 20 2a 20 63 6f 6c 31 20  SIGNED ) * col1 
322b0 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46  + col0 AS col2 F
322c0 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab1..----..
322d0 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c  NULL..NULL..NULL
322e0 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
322f0 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
32300 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
32310 72 74 20 6c 61 62 65 6c 2d 31 33 39 35 0d 0a 53  rt label-1395..S
32320 45 4c 45 43 54 20 43 41 53 54 20 28 20 4e 55 4c  ELECT CAST ( NUL
32330 4c 20 41 53 20 49 4e 54 45 47 45 52 20 29 20 2a  L AS INTEGER ) *
32340 20 63 6f 6c 31 20 2b 20 63 6f 6c 30 20 41 53 20   col1 + col0 AS 
32350 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 0d 0a  col2 FROM tab1..
32360 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c  ----..NULL..NULL
32370 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75 65 72 79 20  ..NULL....query 
32380 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
32390 54 20 2b 20 2d 20 63 6f 72 30 2e 63 6f 6c 30 20  T + - cor0.col0 
323a0 2b 20 2d 20 63 6f 6c 30 20 2a 20 63 6f 6c 30 20  + - col0 * col0 
323b0 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
323c0 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
323d0 0a 2d 35 36 0d 0a 2d 36 31 36 32 0d 0a 2d 36 33  .-56..-6162..-63
323e0 32 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  20....query I ro
323f0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 39 37  wsort..SELECT 97
32400 20 2b 20 2d 20 63 6f 6c 30 20 41 53 20 63 6f 6c   + - col0 AS col
32410 32 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d  2 FROM tab0..---
32420 2d 0d 0a 36 32 0d 0a 37 33 0d 0a 38 0d 0a 0d 0a  -..62..73..8....
32430 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
32440 0a 53 45 4c 45 43 54 20 39 35 20 2b 20 63 6f 6c  .SELECT 95 + col
32450 32 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  2 AS col1 FROM t
32460 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
32470 2d 0d 0a 31 34 39 0d 0a 31 35 32 0d 0a 31 39 31  -..149..152..191
32480 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
32490 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
324a0 2b 20 63 6f 6c 32 20 2a 20 63 6f 72 30 2e 63 6f  + col2 * cor0.co
324b0 6c 31 20 2a 20 2d 20 28 20 2b 20 63 6f 72 30 2e  l1 * - ( + cor0.
324c0 63 6f 6c 32 20 29 20 46 52 4f 4d 20 74 61 62 32  col2 ) FROM tab2
324d0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
324e0 2d 32 32 35 39 39 0d 0a 2d 32 34 35 34 38 0d 0a  -22599..-24548..
324f0 2d 33 39 38 38 34 0d 0a 0d 0a 71 75 65 72 79 20  -39884....query 
32500 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
32510 54 20 31 35 20 2b 20 63 6f 6c 32 20 46 52 4f 4d  T 15 + col2 FROM
32520 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
32530 2d 2d 2d 0d 0a 34 31 0d 0a 34 32 0d 0a 35 33 0d  ---..41..42..53.
32540 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
32550 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 32 31 20  rt..SELECT + 21 
32560 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
32570 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 31  2 cor0..----..21
32580 0d 0a 32 31 0d 0a 32 31 0d 0a 0d 0a 71 75 65 72  ..21..21....quer
32590 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
325a0 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 39  ECT DISTINCT + 9
325b0 31 20 2a 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f  1 * + col0 AS co
325c0 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l0 FROM tab2 AS 
325d0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 36 33 37 0d  cor0..----..637.
325e0 0a 37 30 39 38 0d 0a 37 31 38 39 0d 0a 0d 0a 71  .7098..7189....q
325f0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
32600 53 45 4c 45 43 54 20 63 6f 6c 31 20 2a 20 2d 20  SELECT col1 * - 
32610 37 32 20 2a 20 63 6f 6c 31 20 46 52 4f 4d 20 74  72 * col1 FROM t
32620 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 30 38 30  ab2..----..-2080
32630 38 0d 0a 2d 32 35 30 36 33 32 0d 0a 2d 36 39 31  8..-250632..-691
32640 39 32 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73  92....skipif pos
32650 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72  tgresql # Postgr
32660 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53  eSQL requires AS
32670 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f   when renaming o
32680 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71  utput columns..q
32690 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
326a0 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
326b0 63 6f 6c 31 20 2a 20 28 20 63 6f 6c 31 20 2a 20  col1 * ( col1 * 
326c0 2d 20 63 6f 6c 30 20 2b 20 63 6f 6c 30 20 29 20  - col0 + col0 ) 
326d0 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a  col0 FROM tab0..
326e0 2d 2d 2d 2d 0d 0a 2d 31 37 35 34 34 30 0d 0a 2d  ----..-175440..-
326f0 33 32 35 39 32 30 0d 0a 2d 37 32 38 39 31 30 0d  325920..-728910.
32700 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
32710 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79  # support for My
32720 53 51 4c 20 73 70 65 63 69 66 69 63 20 73 79 73  SQL specific sys
32730 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79  tem types and sy
32740 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f  ntax..query I ro
32750 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 34 30 35  wsort label-1405
32760 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 43 41 53  ..SELECT ALL CAS
32770 54 28 20 2d 20 33 37 20 41 53 20 53 49 47 4e 45  T( - 37 AS SIGNE
32780 44 20 29 20 46 52 4f 4d 20 74 61 62 31 20 41 53  D ) FROM tab1 AS
32790 20 63 6f 72 30 20 43 52 4f 53 53 20 4a 4f 49 4e   cor0 CROSS JOIN
327a0 20 74 61 62 32 2c 20 74 61 62 31 20 41 53 20 63   tab2, tab1 AS c
327b0 6f 72 31 2c 20 74 61 62 32 20 41 53 20 63 6f 72  or1, tab2 AS cor
327c0 32 0d 0a 2d 2d 2d 2d 0d 0a 38 31 20 76 61 6c 75  2..----..81 valu
327d0 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 61 32  es hashing to a2
327e0 38 33 61 39 38 64 31 34 63 33 34 36 33 36 64 37  83a98d14c34636d7
327f0 34 62 30 65 30 62 35 37 36 33 33 35 38 35 0d 0a  4b0e0b57633585..
32800 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
32810 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
32820 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
32830 20 6c 61 62 65 6c 2d 31 34 30 35 0d 0a 53 45 4c   label-1405..SEL
32840 45 43 54 20 41 4c 4c 20 43 41 53 54 20 28 20 2d  ECT ALL CAST ( -
32850 20 33 37 20 41 53 20 49 4e 54 45 47 45 52 20 29   37 AS INTEGER )
32860 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
32870 72 30 20 43 52 4f 53 53 20 4a 4f 49 4e 20 74 61  r0 CROSS JOIN ta
32880 62 32 2c 20 74 61 62 31 20 41 53 20 63 6f 72 31  b2, tab1 AS cor1
32890 2c 20 74 61 62 32 20 41 53 20 63 6f 72 32 0d 0a  , tab2 AS cor2..
328a0 2d 2d 2d 2d 0d 0a 38 31 20 76 61 6c 75 65 73 20  ----..81 values 
328b0 68 61 73 68 69 6e 67 20 74 6f 20 61 32 38 33 61  hashing to a283a
328c0 39 38 64 31 34 63 33 34 36 33 36 64 37 34 62 30  98d14c34636d74b0
328d0 65 30 62 35 37 36 33 33 35 38 35 0d 0a 0d 0a 71  e0b57633585....q
328e0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
328f0 53 45 4c 45 43 54 20 63 6f 6c 32 20 2a 20 2d 20  SELECT col2 * - 
32900 28 20 2d 20 32 34 20 2a 20 2d 20 63 6f 6c 31 20  ( - 24 * - col1 
32910 29 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  ) AS col0 FROM t
32920 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 36 38  ab1..----..-1368
32930 30 0d 0a 2d 32 39 39 35 32 0d 0a 2d 33 33 36 39  0..-29952..-3369
32940 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  6....query I row
32950 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63  sort..SELECT + c
32960 6f 6c 30 20 2b 20 2d 20 63 6f 72 30 2e 63 6f 6c  ol0 + - cor0.col
32970 30 20 2a 20 2b 20 39 34 20 41 53 20 63 6f 6c 30  0 * + 94 AS col0
32980 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
32990 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 37 39 0d 0a  r0..----..-279..
329a0 2d 35 39 35 32 0d 0a 2d 37 34 34 30 0d 0a 0d 0a  -5952..-7440....
329b0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
329c0 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 32 20 2a  .SELECT - col2 *
329d0 20 28 20 2d 20 36 30 20 29 20 2a 20 2b 20 63 6f   ( - 60 ) * + co
329e0 6c 32 20 2b 20 2b 20 35 39 20 2b 20 63 6f 6c 31  l2 + + 59 + col1
329f0 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
32a00 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
32a10 0d 0a 32 31 36 0d 0a 34 30 33 35 39 30 0d 0a 36  ..216..403590..6
32a20 35 34 38 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20  5485....query I 
32a30 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
32a40 2b 20 63 6f 6c 31 20 2b 20 2b 20 63 6f 6c 30 20  + col1 + + col0 
32a50 2a 20 2d 20 33 37 20 46 52 4f 4d 20 74 61 62 30  * - 37 FROM tab0
32a60 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
32a70 2d 31 31 39 38 0d 0a 2d 33 32 30 32 0d 0a 2d 38  -1198..-3202..-8
32a80 30 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  02....query I ro
32a90 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
32aa0 2d 20 39 35 20 2b 20 2b 20 63 6f 6c 31 20 41 53  - 95 + + col1 AS
32ab0 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20   col0 FROM tab0 
32ac0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
32ad0 38 31 0d 0a 31 38 36 0d 0a 31 39 32 0d 0a 0d 0a  81..186..192....
32ae0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
32af0 0a 53 45 4c 45 43 54 20 2d 20 28 20 2d 20 63 6f  .SELECT - ( - co
32b00 6c 32 20 29 20 2b 20 2d 20 63 6f 6c 30 20 41 53  l2 ) + - col0 AS
32b10 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20   col1 FROM tab1 
32b20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
32b30 37 0d 0a 31 36 0d 0a 35 31 0d 0a 0d 0a 73 6b 69  7..16..51....ski
32b40 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23  pif postgresql #
32b50 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75   PostgreSQL requ
32b60 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e  ires AS when ren
32b70 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c  aming output col
32b80 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f  umns..query I ro
32b90 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
32ba0 63 6f 72 30 2e 63 6f 6c 32 20 63 6f 6c 30 20 46  cor0.col2 col0 F
32bb0 52 4f 4d 20 74 61 62 30 2c 20 74 61 62 32 20 41  ROM tab0, tab2 A
32bc0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20  S cor0..----..9 
32bd0 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74  values hashing t
32be0 6f 20 35 39 31 31 62 61 63 35 31 34 34 31 66 34  o 5911bac51441f4
32bf0 66 66 36 34 30 62 32 61 32 62 37 32 31 65 61 38  ff640b2a2b721ea8
32c00 65 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  e3....query I ro
32c10 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
32c20 63 6f 72 30 2e 63 6f 6c 30 20 2a 20 2b 20 38 34  cor0.col0 * + 84
32c30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
32c40 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
32c50 0d 0a 35 38 38 0d 0a 36 35 35 32 0d 0a 36 36 33  ..588..6552..663
32c60 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  6....query I row
32c70 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
32c80 20 2d 20 63 6f 6c 32 20 2b 20 2d 20 63 6f 6c 32   - col2 + - col2
32c90 20 2b 20 2d 20 63 6f 6c 31 20 46 52 4f 4d 20 74   + - col1 FROM t
32ca0 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab2 cor0..----..
32cb0 2d 31 31 31 0d 0a 2d 38 35 0d 0a 2d 39 33 0d 0a  -111..-85..-93..
32cc0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
32cd0 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20  t..SELECT ALL - 
32ce0 2d 20 63 6f 6c 31 20 2b 20 2b 20 39 35 20 2b 20  - col1 + + 95 + 
32cf0 2b 20 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c 31 20  + col2 * - col1 
32d00 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
32d10 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
32d20 0a 2d 32 36 35 37 0d 0a 2d 37 32 37 36 0d 0a 39  .-2657..-7276..9
32d30 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  5....query I row
32d40 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 33  sort..SELECT - 3
32d50 35 20 2a 20 2d 20 63 6f 6c 32 20 2a 20 74 61 62  5 * - col2 * tab
32d60 30 2e 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30  0.col2 FROM tab0
32d70 0d 0a 2d 2d 2d 2d 0d 0a 32 33 35 33 34 30 0d 0a  ..----..235340..
32d80 33 35 0d 0a 33 38 31 31 35 0d 0a 0d 0a 73 6b 69  35..38115....ski
32d90 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23  pif postgresql #
32da0 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75   PostgreSQL requ
32db0 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e  ires AS when ren
32dc0 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c  aming output col
32dd0 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f  umns..query I ro
32de0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
32df0 2b 20 38 34 20 2b 20 2d 20 63 6f 6c 31 20 63 6f  + 84 + - col1 co
32e00 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l1 FROM tab1 AS 
32e10 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 30  cor0..----..-110
32e20 0d 0a 2d 39 34 0d 0a 2d 39 37 0d 0a 0d 0a 71 75  ..-94..-97....qu
32e30 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
32e40 45 4c 45 43 54 20 63 6f 6c 32 20 2b 20 2d 20 63  ELECT col2 + - c
32e50 6f 6c 31 20 2a 20 2b 20 63 6f 6c 31 20 2a 20 63  ol1 * + col1 * c
32e60 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  ol1 AS col2 FROM
32e70 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
32e80 2d 2d 2d 0d 0a 2d 36 33 36 30 32 33 0d 0a 2d 37  ---..-636023..-7
32e90 35 33 34 38 39 0d 0a 2d 39 31 32 36 37 32 0d 0a  53489..-912672..
32ea0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
32eb0 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
32ec0 43 54 20 32 32 20 2a 20 63 6f 6c 31 20 2b 20 63  CT 22 * col1 + c
32ed0 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  ol1 AS col2 FROM
32ee0 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
32ef0 2d 2d 2d 0d 0a 32 33 30 0d 0a 32 39 39 0d 0a 35  ---..230..299..5
32f00 39 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  98....query I ro
32f10 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
32f20 4c 20 63 6f 72 30 2e 63 6f 6c 32 20 2b 20 2d 20  L cor0.col2 + - 
32f30 63 6f 72 30 2e 63 6f 6c 32 20 46 52 4f 4d 20 74  cor0.col2 FROM t
32f40 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
32f50 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a 71 75  -..0..0..0....qu
32f60 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
32f70 45 4c 45 43 54 20 41 4c 4c 20 32 32 20 2a 20 2d  ELECT ALL 22 * -
32f80 20 33 34 20 2b 20 2d 20 63 6f 6c 30 20 2a 20 33   34 + - col0 * 3
32f90 36 20 2a 20 63 6f 6c 30 20 2d 20 63 6f 72 30 2e  6 * col0 - cor0.
32fa0 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46 52 4f  col2 AS col2 FRO
32fb0 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
32fc0 2d 2d 2d 2d 0d 0a 2d 32 31 39 37 39 38 0d 0a 2d  ----..-219798..-
32fd0 32 32 35 34 36 32 0d 0a 2d 32 35 33 39 0d 0a 0d  225462..-2539...
32fe0 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
32ff0 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72  use DIV operator
33000 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76   for integer div
33010 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72  ision..query I r
33020 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 34 32  owsort label-142
33030 32 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  2..SELECT DISTIN
33040 43 54 20 2b 20 28 20 63 6f 6c 31 20 29 20 2a 20  CT + ( col1 ) * 
33050 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c 30 20 2a 20  col0 + - col0 * 
33060 2b 20 63 6f 6c 32 20 44 49 56 20 2b 20 63 6f 6c  + col2 DIV + col
33070 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  2 FROM tab1 AS c
33080 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 35 37 36 0d 0a  or0..----..576..
33090 37 35 0d 0a 39 36 30 0d 0a 0d 0a 73 6b 69 70 69  75..960....skipi
330a0 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
330b0 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
330c0 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
330d0 31 34 32 32 0d 0a 53 45 4c 45 43 54 20 44 49 53  1422..SELECT DIS
330e0 54 49 4e 43 54 20 2b 20 28 20 63 6f 6c 31 20 29  TINCT + ( col1 )
330f0 20 2a 20 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c 30   * col0 + - col0
33100 20 2a 20 2b 20 63 6f 6c 32 20 2f 20 2b 20 63 6f   * + col2 / + co
33110 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l2 FROM tab1 AS 
33120 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 35 37 36 0d  cor0..----..576.
33130 0a 37 35 0d 0a 39 36 30 0d 0a 0d 0a 71 75 65 72  .75..960....quer
33140 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
33150 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 28  ECT DISTINCT - (
33160 20 31 32 20 29 20 2b 20 2b 20 63 6f 6c 32 20 46   12 ) + + col2 F
33170 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
33180 0d 0a 2d 2d 2d 2d 0d 0a 31 34 0d 0a 31 35 0d 0a  ..----..14..15..
33190 32 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  26....query I ro
331a0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
331b0 4c 20 38 34 20 2b 20 37 30 20 41 53 20 63 6f 6c  L 84 + 70 AS col
331c0 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  0 FROM tab0 AS c
331d0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 35 34 0d 0a  or0..----..154..
331e0 31 35 34 0d 0a 31 35 34 0d 0a 0d 0a 71 75 65 72  154..154....quer
331f0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
33200 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63  ECT DISTINCT + c
33210 6f 6c 30 20 2a 20 63 6f 6c 31 20 2b 20 2b 20 63  ol0 * col1 + + c
33220 6f 72 30 2e 63 6f 6c 30 20 2b 20 63 6f 6c 31 20  or0.col0 + col1 
33230 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
33240 30 0d 0a 2d 2d 2d 2d 0d 0a 32 31 37 34 0d 0a 33  0..----..2174..3
33250 35 32 37 0d 0a 38 32 37 39 0d 0a 0d 0a 71 75 65  527..8279....que
33260 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
33270 4c 45 43 54 20 2d 20 63 6f 6c 31 20 2b 20 2d 20  LECT - col1 + - 
33280 38 34 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  84 FROM tab1 AS 
33290 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 30  cor0..----..-110
332a0 0d 0a 2d 39 34 0d 0a 2d 39 37 0d 0a 0d 0a 71 75  ..-94..-97....qu
332b0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
332c0 45 4c 45 43 54 20 2b 20 2b 20 63 6f 6c 32 20 2b  ELECT + + col2 +
332d0 20 63 6f 6c 30 20 2a 20 2b 20 63 6f 72 30 2e 63   col0 * + cor0.c
332e0 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol0 FROM tab0 AS
332f0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 32   cor0..----..122
33300 36 0d 0a 36 30 39 0d 0a 38 30 30 33 0d 0a 0d 0a  6..609..8003....
33310 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
33320 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
33330 20 2d 20 2d 20 63 6f 6c 31 20 2a 20 28 20 63 6f   - - col1 * ( co
33340 6c 30 20 29 20 2b 20 39 34 20 2a 20 63 6f 6c 30  l0 ) + 94 * col0
33350 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62   + col1 FROM tab
33360 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
33370 0a 31 31 39 39 33 0d 0a 38 37 38 36 0d 0a 39 30  .11993..8786..90
33380 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  6....query I row
33390 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 32  sort..SELECT - 2
333a0 35 20 2a 20 63 6f 6c 32 20 2a 20 2b 20 33 36 20  5 * col2 * + 36 
333b0 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
333c0 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 39 37 30 30 0d  0..----..-29700.
333d0 0a 2d 37 33 38 30 30 0d 0a 2d 39 30 30 0d 0a 0d  .-73800..-900...
333e0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
333f0 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
33400 54 20 2d 20 74 61 62 32 2e 63 6f 6c 30 20 2b 20  T - tab2.col0 + 
33410 63 6f 6c 30 20 2b 20 63 6f 6c 30 20 41 53 20 63  col0 + col0 AS c
33420 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d  ol1 FROM tab2..-
33430 2d 2d 2d 0d 0a 37 0d 0a 37 38 0d 0a 37 39 0d 0a  ---..7..78..79..
33440 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
33450 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f   use DIV operato
33460 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69  r for integer di
33470 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20  vision..query I 
33480 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 34  rowsort label-14
33490 33 31 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63  31..SELECT ALL c
334a0 6f 6c 31 20 44 49 56 20 63 6f 6c 31 20 2b 20 34  ol1 DIV col1 + 4
334b0 37 20 46 52 4f 4d 20 74 61 62 32 20 63 6f 72 30  7 FROM tab2 cor0
334c0 0d 0a 2d 2d 2d 2d 0d 0a 34 38 0d 0a 34 38 0d 0a  ..----..48..48..
334d0 34 38 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  48....skipif mys
334e0 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
334f0 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
33500 73 6f 72 74 20 6c 61 62 65 6c 2d 31 34 33 31 0d  sort label-1431.
33510 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 31  .SELECT ALL col1
33520 20 2f 20 63 6f 6c 31 20 2b 20 34 37 20 46 52 4f   / col1 + 47 FRO
33530 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab2 cor0..---
33540 2d 0d 0a 34 38 0d 0a 34 38 0d 0a 34 38 0d 0a 0d  -..48..48..48...
33550 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
33560 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
33570 54 20 2b 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20  T + - cor0.col2 
33580 2d 20 2d 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30  - - col0 AS col0
33590 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
335a0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 30 0d 0a 34  r0..----..-20..4
335b0 31 0d 0a 35 32 0d 0a 0d 0a 73 6b 69 70 69 66 20  1..52....skipif 
335c0 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73  postgresql # Pos
335d0 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73  tgreSQL requires
335e0 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e   AS when renamin
335f0 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73  g output columns
33600 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
33610 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 30  t..SELECT - col0
33620 20 2d 20 28 20 2b 20 63 6f 6c 30 20 29 20 63 6f   - ( + col0 ) co
33630 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l0 FROM tab2 AS 
33640 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 34 0d  cor0..----..-14.
33650 0a 2d 31 35 36 0d 0a 2d 31 35 38 0d 0a 0d 0a 71  .-156..-158....q
33660 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
33670 53 45 4c 45 43 54 20 2b 20 63 6f 6c 31 20 2a 20  SELECT + col1 * 
33680 63 6f 72 30 2e 63 6f 6c 31 20 2d 20 36 20 41 53  cor0.col1 - 6 AS
33690 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20   col0 FROM tab1 
336a0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 36 33 0d  cor0..----..163.
336b0 0a 36 37 30 0d 0a 39 34 0d 0a 0d 0a 6f 6e 6c 79  .670..94....only
336c0 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44  if mysql # use D
336d0 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20  IV operator for 
336e0 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e  integer division
336f0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
33700 74 20 6c 61 62 65 6c 2d 31 34 33 35 0d 0a 53 45  t label-1435..SE
33710 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20  LECT DISTINCT + 
33720 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c 31 20 2a 20  col2 * - col1 * 
33730 38 35 20 2b 20 2b 20 63 6f 6c 30 20 44 49 56 20  85 + + col0 DIV 
33740 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 63  col0 FROM tab2 c
33750 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 30 33  or0..----..-1303
33760 38 39 0d 0a 2d 35 34 39 30 39 0d 0a 2d 37 31 31  89..-54909..-711
33770 34 34 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  44....skipif mys
33780 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
33790 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
337a0 73 6f 72 74 20 6c 61 62 65 6c 2d 31 34 33 35 0d  sort label-1435.
337b0 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
337c0 20 2b 20 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c 31   + col2 * - col1
337d0 20 2a 20 38 35 20 2b 20 2b 20 63 6f 6c 30 20 2f   * 85 + + col0 /
337e0 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20   col0 FROM tab2 
337f0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 30  cor0..----..-130
33800 33 38 39 0d 0a 2d 35 34 39 30 39 0d 0a 2d 37 31  389..-54909..-71
33810 31 34 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  144....query I r
33820 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
33830 20 63 6f 6c 31 20 2a 20 2b 20 38 20 2b 20 63 6f   col1 * + 8 + co
33840 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l0 FROM tab0 AS 
33850 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 36 33 39  cor0..----..-639
33860 0d 0a 2d 36 36 34 0d 0a 2d 37 34 31 0d 0a 0d 0a  ..-664..-741....
33870 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
33880 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
33890 20 63 6f 72 30 2e 63 6f 6c 31 20 2b 20 2b 20 37   cor0.col1 + + 7
338a0 34 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  4 FROM tab0 AS c
338b0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 36 30 0d 0a  or0..----..160..
338c0 31 36 35 0d 0a 31 37 31 0d 0a 0d 0a 71 75 65 72  165..171....quer
338d0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
338e0 45 43 54 20 2d 20 63 6f 6c 30 20 2a 20 28 20 2b  ECT - col0 * ( +
338f0 20 63 6f 72 30 2e 63 6f 6c 31 20 29 20 2a 20 63   cor0.col1 ) * c
33900 6f 6c 30 20 2b 20 63 6f 6c 32 20 2a 20 2d 20 63  ol0 + col2 * - c
33910 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  ol2 AS col2 FROM
33920 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
33930 2d 2d 2d 0d 0a 2d 31 30 37 35 34 31 0d 0a 2d 32  ---..-107541..-2
33940 32 34 38 0d 0a 2d 33 35 39 36 33 32 0d 0a 0d 0a  248..-359632....
33950 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
33960 0a 53 45 4c 45 43 54 20 63 6f 6c 32 20 2a 20 74  .SELECT col2 * t
33970 61 62 30 2e 63 6f 6c 31 20 2b 20 63 6f 6c 31 20  ab0.col1 + col1 
33980 2a 20 2d 20 74 61 62 30 2e 63 6f 6c 31 20 41 53  * - tab0.col1 AS
33990 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d   col0 FROM tab0.
339a0 0a 2d 2d 2d 2d 0d 0a 2d 34 35 35 38 0d 0a 2d 38  .----..-4558..-8
339b0 31 39 0d 0a 2d 39 33 31 32 0d 0a 0d 0a 71 75 65  19..-9312....que
339c0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
339d0 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f 72 30 2e  LECT ALL - cor0.
339e0 63 6f 6c 31 20 2d 20 2d 20 28 20 2d 20 63 6f 6c  col1 - - ( - col
339f0 32 20 29 20 46 52 4f 4d 20 74 61 62 30 20 41 53  2 ) FROM tab0 AS
33a00 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31   cor0..----..-11
33a10 39 0d 0a 2d 31 37 33 0d 0a 2d 39 38 0d 0a 0d 0a  9..-173..-98....
33a20 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73  onlyif mysql # s
33a30 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c  upport for MySQL
33a40 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d   specific system
33a50 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61   types and synta
33a60 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  x..query I rowso
33a70 72 74 20 6c 61 62 65 6c 2d 31 34 34 31 0d 0a 53  rt label-1441..S
33a80 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 43  ELECT DISTINCT C
33a90 41 53 54 28 20 4e 55 4c 4c 20 41 53 20 53 49 47  AST( NULL AS SIG
33aa0 4e 45 44 20 29 20 2a 20 32 37 20 46 52 4f 4d 20  NED ) * 27 FROM 
33ab0 74 61 62 30 20 41 53 20 63 6f 72 30 20 43 52 4f  tab0 AS cor0 CRO
33ac0 53 53 20 4a 4f 49 4e 20 74 61 62 32 20 41 53 20  SS JOIN tab2 AS 
33ad0 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c  cor1..----..NULL
33ae0 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
33af0 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
33b00 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
33b10 72 74 20 6c 61 62 65 6c 2d 31 34 34 31 0d 0a 53  rt label-1441..S
33b20 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 43  ELECT DISTINCT C
33b30 41 53 54 20 28 20 4e 55 4c 4c 20 41 53 20 49 4e  AST ( NULL AS IN
33b40 54 45 47 45 52 20 29 20 2a 20 32 37 20 46 52 4f  TEGER ) * 27 FRO
33b50 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 20 43  M tab0 AS cor0 C
33b60 52 4f 53 53 20 4a 4f 49 4e 20 74 61 62 32 20 41  ROSS JOIN tab2 A
33b70 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 4e 55  S cor1..----..NU
33b80 4c 4c 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  LL....onlyif mys
33b90 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65  ql # use DIV ope
33ba0 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65  rator for intege
33bb0 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72  r division..quer
33bc0 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
33bd0 6c 2d 31 34 34 32 0d 0a 53 45 4c 45 43 54 20 2b  l-1442..SELECT +
33be0 20 38 39 20 44 49 56 20 63 6f 6c 32 20 41 53 20   89 DIV col2 AS 
33bf0 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 0d 0a  col1 FROM tab1..
33c00 2d 2d 2d 2d 0d 0a 30 0d 0a 31 0d 0a 31 0d 0a 0d  ----..0..1..1...
33c10 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
33c20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
33c30 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
33c40 6c 61 62 65 6c 2d 31 34 34 32 0d 0a 53 45 4c 45  label-1442..SELE
33c50 43 54 20 2b 20 38 39 20 2f 20 63 6f 6c 32 20 41  CT + 89 / col2 A
33c60 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31  S col1 FROM tab1
33c70 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 31 0d 0a 31 0d  ..----..0..1..1.
33c80 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
33c90 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
33ca0 4e 43 54 20 63 6f 6c 32 20 2b 20 34 34 20 2a 20  NCT col2 + 44 * 
33cb0 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a  col1 FROM tab0..
33cc0 2d 2d 2d 2d 0d 0a 33 38 31 37 0d 0a 34 30 38 36  ----..3817..4086
33cd0 0d 0a 34 32 36 39 0d 0a 0d 0a 71 75 65 72 79 20  ..4269....query 
33ce0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
33cf0 54 20 41 4c 4c 20 63 6f 6c 30 20 2a 20 2d 20 63  T ALL col0 * - c
33d00 6f 6c 31 20 2d 20 2b 20 31 31 20 41 53 20 63 6f  ol1 - + 11 AS co
33d10 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d  l0 FROM tab0..--
33d20 2d 2d 0d 0a 2d 32 30 37 35 0d 0a 2d 33 34 30 36  --..-2075..-3406
33d30 0d 0a 2d 38 31 31 30 0d 0a 0d 0a 71 75 65 72 79  ..-8110....query
33d40 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
33d50 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 32  CT DISTINCT col2
33d60 20 2d 20 63 6f 6c 31 20 2a 20 74 61 62 31 2e 63   - col1 * tab1.c
33d70 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  ol1 AS col1 FROM
33d80 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 33   tab1..----..-43
33d90 0d 0a 2d 36 32 32 0d 0a 2d 37 33 0d 0a 0d 0a 6f  ..-622..-73....o
33da0 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73  nlyif mysql # us
33db0 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66  e DIV operator f
33dc0 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73  or integer divis
33dd0 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ion..query I row
33de0 73 6f 72 74 20 6c 61 62 65 6c 2d 31 34 34 36 0d  sort label-1446.
33df0 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 31  .SELECT ALL col1
33e00 20 2d 20 2b 20 37 20 44 49 56 20 2b 20 63 6f 6c   - + 7 DIV + col
33e10 31 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  1 AS col0 FROM t
33e20 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 30 0d 0a 31  ab1..----..10..1
33e30 33 0d 0a 32 36 0d 0a 0d 0a 73 6b 69 70 69 66 20  3..26....skipif 
33e40 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
33e50 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
33e60 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 34  rowsort label-14
33e70 34 36 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63  46..SELECT ALL c
33e80 6f 6c 31 20 2d 20 2b 20 37 20 2f 20 2b 20 63 6f  ol1 - + 7 / + co
33e90 6c 31 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  l1 AS col0 FROM 
33ea0 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 30 0d 0a  tab1..----..10..
33eb0 31 33 0d 0a 32 36 0d 0a 0d 0a 71 75 65 72 79 20  13..26....query 
33ec0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
33ed0 54 20 2d 20 2b 20 63 6f 6c 31 20 2b 20 2d 20 63  T - + col1 + - c
33ee0 6f 6c 30 20 2a 20 2b 20 63 6f 6c 32 20 46 52 4f  ol0 * + col2 FRO
33ef0 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
33f00 2d 2d 2d 2d 0d 0a 2d 31 38 38 0d 0a 2d 33 36 35  ----..-188..-365
33f10 38 0d 0a 2d 37 36 39 33 0d 0a 0d 0a 71 75 65 72  8..-7693....quer
33f20 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
33f30 45 43 54 20 2d 20 2b 20 63 6f 6c 31 20 2b 20 2d  ECT - + col1 + -
33f40 20 63 6f 72 30 2e 63 6f 6c 32 20 2b 20 34 39 20   cor0.col2 + 49 
33f50 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
33f60 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 38 0d 0a 2d 33  0..----..-18..-3
33f70 31 0d 0a 2d 36 30 0d 0a 0d 0a 71 75 65 72 79 20  1..-60....query 
33f80 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
33f90 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c  T DISTINCT - col
33fa0 30 20 2b 20 28 20 2b 20 36 20 2b 20 2d 20 63 6f  0 + ( + 6 + - co
33fb0 6c 30 20 29 20 46 52 4f 4d 20 74 61 62 31 0d 0a  l0 ) FROM tab1..
33fc0 2d 2d 2d 2d 0d 0a 2d 31 32 32 0d 0a 2d 31 35 34  ----..-122..-154
33fd0 0d 0a 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  ..0....onlyif my
33fe0 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70  sql # use DIV op
33ff0 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67  erator for integ
34000 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65  er division..que
34010 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
34020 65 6c 2d 31 34 35 30 0d 0a 53 45 4c 45 43 54 20  el-1450..SELECT 
34030 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c 30 20 2b 20  col0 * - col0 + 
34040 63 6f 6c 30 20 2a 20 63 6f 6c 32 20 44 49 56 20  col0 * col2 DIV 
34050 28 20 2d 20 74 61 62 30 2e 63 6f 6c 32 20 29 20  ( - tab0.col2 ) 
34060 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30  + col0 FROM tab0
34070 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32 32 35 0d 0a 2d  ..----..-1225..-
34080 35 37 36 0d 0a 2d 37 39 32 31 0d 0a 0d 0a 73 6b  576..-7921....sk
34090 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
340a0 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
340b0 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
340c0 65 6c 2d 31 34 35 30 0d 0a 53 45 4c 45 43 54 20  el-1450..SELECT 
340d0 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c 30 20 2b 20  col0 * - col0 + 
340e0 63 6f 6c 30 20 2a 20 63 6f 6c 32 20 2f 20 28 20  col0 * col2 / ( 
340f0 2d 20 74 61 62 30 2e 63 6f 6c 32 20 29 20 2b 20  - tab0.col2 ) + 
34100 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a  col0 FROM tab0..
34110 2d 2d 2d 2d 0d 0a 2d 31 32 32 35 0d 0a 2d 35 37  ----..-1225..-57
34120 36 0d 0a 2d 37 39 32 31 0d 0a 0d 0a 71 75 65 72  6..-7921....quer
34130 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
34140 45 43 54 20 2d 20 63 6f 6c 30 20 2b 20 2b 20 63  ECT - col0 + + c
34150 6f 6c 30 20 2b 20 2d 20 74 61 62 32 2e 63 6f 6c  ol0 + - tab2.col
34160 31 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  1 AS col0 FROM t
34170 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 37 0d 0a  ab2..----..-17..
34180 2d 33 31 0d 0a 2d 35 39 0d 0a 0d 0a 71 75 65 72  -31..-59....quer
34190 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
341a0 45 43 54 20 41 4c 4c 20 74 61 62 31 2e 63 6f 6c  ECT ALL tab1.col
341b0 30 20 2b 20 37 37 20 41 53 20 63 6f 6c 32 20 46  0 + 77 AS col2 F
341c0 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab1..----..
341d0 31 34 31 0d 0a 31 35 37 0d 0a 38 30 0d 0a 0d 0a  141..157..80....
341e0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
341f0 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 31  .SELECT ALL col1
34200 20 2b 20 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c 30   + col0 * + col0
34210 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
34220 62 31 0d 0a 2d 2d 2d 2d 0d 0a 33 35 0d 0a 34 31  b1..----..35..41
34230 30 36 0d 0a 36 34 31 33 0d 0a 0d 0a 73 6b 69 70  06..6413....skip
34240 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20  if postgresql # 
34250 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69  PostgreSQL requi
34260 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61  res AS when rena
34270 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75  ming output colu
34280 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  mns..query I row
34290 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
342a0 20 2d 20 36 37 20 2b 20 2b 20 63 6f 6c 31 20 63   - 67 + + col1 c
342b0 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol1 FROM tab2 AS
342c0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 36   cor0..----..-36
342d0 0d 0a 2d 35 30 0d 0a 2d 38 0d 0a 0d 0a 71 75 65  ..-50..-8....que
342e0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
342f0 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20  LECT DISTINCT + 
34300 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 2a 20 63 6f  + cor0.col2 * co
34310 6c 31 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  l1 AS col1 FROM 
34320 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
34330 2d 2d 0d 0a 31 32 34 38 0d 0a 31 34 30 34 0d 0a  --..1248..1404..
34340 35 37 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  570....query I r
34350 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
34360 4c 4c 20 2d 20 2b 20 33 30 20 2a 20 63 6f 6c 30  LL - + 30 * col0
34370 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
34380 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  b1 cor0..----..-
34390 31 39 32 30 0d 0a 2d 32 34 30 30 0d 0a 2d 39 30  1920..-2400..-90
343a0 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67  ....skipif postg
343b0 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53  resql # PostgreS
343c0 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77  QL requires AS w
343d0 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74  hen renaming out
343e0 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65  put columns..que
343f0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
34400 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20  LECT DISTINCT + 
34410 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c 30 20 63 6f  col1 * - col0 co
34420 6c 32 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d  l2 FROM tab2..--
34430 2d 2d 0d 0a 2d 31 33 34 33 0d 0a 2d 32 31 37 0d  --..-1343..-217.
34440 0a 2d 34 36 30 32 0d 0a 0d 0a 73 6b 69 70 69 66  .-4602....skipif
34450 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f   postgresql # Po
34460 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65  stgreSQL require
34470 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69  s AS when renami
34480 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e  ng output column
34490 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  s..query I rowso
344a0 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
344b0 4e 43 54 20 2b 20 63 6f 6c 31 20 2a 20 36 35 20  NCT + col1 * 65 
344c0 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41  col1 FROM tab1 A
344d0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 36  S cor0..----..16
344e0 39 30 0d 0a 36 35 30 0d 0a 38 34 35 0d 0a 0d 0a  90..650..845....
344f0 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73  onlyif mysql # s
34500 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c  upport for MySQL
34510 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d   specific system
34520 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61   types and synta
34530 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  x..query I rowso
34540 72 74 20 6c 61 62 65 6c 2d 31 34 35 39 0d 0a 53  rt label-1459..S
34550 45 4c 45 43 54 20 2d 20 63 6f 6c 30 20 2a 20 2d  ELECT - col0 * -
34560 20 43 41 53 54 28 20 4e 55 4c 4c 20 41 53 20 53   CAST( NULL AS S
34570 49 47 4e 45 44 20 29 20 2b 20 63 6f 6c 32 20 46  IGNED ) + col2 F
34580 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
34590 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55  ..----..NULL..NU
345a0 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70  LL..NULL....skip
345b0 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
345c0 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
345d0 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
345e0 2d 31 34 35 39 0d 0a 53 45 4c 45 43 54 20 2d 20  -1459..SELECT - 
345f0 63 6f 6c 30 20 2a 20 2d 20 43 41 53 54 20 28 20  col0 * - CAST ( 
34600 4e 55 4c 4c 20 41 53 20 49 4e 54 45 47 45 52 20  NULL AS INTEGER 
34610 29 20 2b 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61  ) + col2 FROM ta
34620 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
34630 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55  ..NULL..NULL..NU
34640 4c 4c 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  LL....onlyif mys
34650 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65  ql # use DIV ope
34660 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65  rator for intege
34670 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72  r division..quer
34680 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
34690 6c 2d 31 34 36 30 0d 0a 53 45 4c 45 43 54 20 44  l-1460..SELECT D
346a0 49 53 54 49 4e 43 54 20 35 34 20 2a 20 2d 20 34  ISTINCT 54 * - 4
346b0 35 20 2b 20 74 61 62 32 2e 63 6f 6c 32 20 2b 20  5 + tab2.col2 + 
346c0 2b 20 63 6f 6c 31 20 2a 20 32 36 20 44 49 56 20  + col1 * 26 DIV 
346d0 2d 20 74 61 62 32 2e 63 6f 6c 31 20 41 53 20 63  - tab2.col1 AS c
346e0 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d  ol1 FROM tab2..-
346f0 2d 2d 2d 0d 0a 2d 32 34 31 38 0d 0a 2d 32 34 32  ---..-2418..-242
34700 39 0d 0a 2d 32 34 33 30 0d 0a 0d 0a 73 6b 69 70  9..-2430....skip
34710 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
34720 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
34730 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
34740 2d 31 34 36 30 0d 0a 53 45 4c 45 43 54 20 44 49  -1460..SELECT DI
34750 53 54 49 4e 43 54 20 35 34 20 2a 20 2d 20 34 35  STINCT 54 * - 45
34760 20 2b 20 74 61 62 32 2e 63 6f 6c 32 20 2b 20 2b   + tab2.col2 + +
34770 20 63 6f 6c 31 20 2a 20 32 36 20 2f 20 2d 20 74   col1 * 26 / - t
34780 61 62 32 2e 63 6f 6c 31 20 41 53 20 63 6f 6c 31  ab2.col1 AS col1
34790 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d   FROM tab2..----
347a0 0d 0a 2d 32 34 31 38 0d 0a 2d 32 34 32 39 0d 0a  ..-2418..-2429..
347b0 2d 32 34 33 30 0d 0a 0d 0a 71 75 65 72 79 20 49  -2430....query I
347c0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
347d0 20 44 49 53 54 49 4e 43 54 20 2b 20 74 61 62 32   DISTINCT + tab2
347e0 2e 63 6f 6c 32 20 2b 20 35 37 20 2a 20 2d 20 63  .col2 + 57 * - c
347f0 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d  ol0 FROM tab2..-
34800 2d 2d 2d 0d 0a 2d 33 37 32 0d 0a 2d 34 34 32 30  ---..-372..-4420
34810 0d 0a 2d 34 34 36 35 0d 0a 0d 0a 71 75 65 72 79  ..-4465....query
34820 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
34830 43 54 20 41 4c 4c 20 2d 20 2b 20 63 6f 72 30 2e  CT ALL - + cor0.
34840 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c 32 20 41 53  col2 * - col2 AS
34850 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20   col2 FROM tab1 
34860 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 39 31 36  cor0..----..2916
34870 0d 0a 33 32 34 39 0d 0a 39 32 31 36 0d 0a 0d 0a  ..3249..9216....
34880 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71  skipif postgresq
34890 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72  l # PostgreSQL r
348a0 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20  equires AS when 
348b0 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20  renaming output 
348c0 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49  columns..query I
348d0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
348e0 20 63 6f 72 30 2e 63 6f 6c 31 20 2b 20 38 30 20   cor0.col1 + 80 
348f0 2a 20 2d 20 63 6f 6c 31 20 63 6f 6c 31 20 46 52  * - col1 col1 FR
34900 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d  OM tab2 cor0..--
34910 2d 2d 0d 0a 2d 31 33 34 33 0d 0a 2d 32 34 34 39  --..-1343..-2449
34920 0d 0a 2d 34 36 36 31 0d 0a 0d 0a 73 6b 69 70 69  ..-4661....skipi
34930 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50  f postgresql # P
34940 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72  ostgreSQL requir
34950 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d  es AS when renam
34960 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d  ing output colum
34970 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ns..query I rows
34980 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
34990 49 4e 43 54 20 39 30 20 2b 20 2b 20 38 20 2b 20  INCT 90 + + 8 + 
349a0 63 6f 6c 30 20 63 6f 6c 32 20 46 52 4f 4d 20 74  col0 col2 FROM t
349b0 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 32 0d 0a  ab0..----..122..
349c0 31 33 33 0d 0a 31 38 37 0d 0a 0d 0a 6f 6e 6c 79  133..187....only
349d0 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f  if mysql # suppo
349e0 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65  rt for MySQL spe
349f0 63 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70  cific system typ
34a00 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71  es and syntax..q
34a10 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
34a20 61 62 65 6c 2d 31 34 36 35 0d 0a 53 45 4c 45 43  abel-1465..SELEC
34a30 54 20 2d 20 43 41 53 54 28 20 4e 55 4c 4c 20 41  T - CAST( NULL A
34a40 53 20 53 49 47 4e 45 44 20 29 20 2b 20 2b 20 63  S SIGNED ) + + c
34a50 6f 6c 31 20 2a 20 63 6f 6c 31 20 41 53 20 63 6f  ol1 * col1 AS co
34a60 6c 31 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d  l1 FROM tab1..--
34a70 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a  --..NULL..NULL..
34a80 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  NULL....skipif m
34a90 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
34aa0 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
34ab0 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 34 36  owsort label-146
34ac0 35 0d 0a 53 45 4c 45 43 54 20 2d 20 43 41 53 54  5..SELECT - CAST
34ad0 20 28 20 4e 55 4c 4c 20 41 53 20 49 4e 54 45 47   ( NULL AS INTEG
34ae0 45 52 20 29 20 2b 20 2b 20 63 6f 6c 31 20 2a 20  ER ) + + col1 * 
34af0 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46 52 4f  col1 AS col1 FRO
34b00 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 4e 55  M tab1..----..NU
34b10 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a  LL..NULL..NULL..
34b20 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
34b30 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20  t..SELECT ALL - 
34b40 63 6f 6c 30 20 2b 20 35 36 20 41 53 20 63 6f 6c  col0 + 56 AS col
34b50 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  0 FROM tab2 AS c
34b60 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 32 0d 0a  or0..----..-22..
34b70 2d 32 33 0d 0a 34 39 0d 0a 0d 0a 71 75 65 72 79  -23..49....query
34b80 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
34b90 43 54 20 41 4c 4c 20 2b 20 2d 20 63 6f 6c 30 20  CT ALL + - col0 
34ba0 2b 20 63 6f 6c 30 20 2b 20 63 6f 6c 31 20 2a 20  + col0 + col1 * 
34bb0 38 33 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  83 FROM tab1 AS 
34bc0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 37 39  cor0..----..1079
34bd0 0d 0a 32 31 35 38 0d 0a 38 33 30 0d 0a 0d 0a 71  ..2158..830....q
34be0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
34bf0 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 31 20  SELECT ALL col1 
34c00 2a 20 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c 31 20  * col0 + + col1 
34c10 2b 20 2b 20 28 20 2b 20 34 20 29 20 2a 20 2d 20  + + ( + 4 ) * - 
34c20 63 6f 72 30 2e 63 6f 6c 30 20 2a 20 2b 20 63 6f  cor0.col0 * + co
34c30 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l2 FROM tab2 AS 
34c40 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 36  cor0..----..-106
34c50 34 38 0d 0a 2d 33 34 35 31 0d 0a 2d 35 30 38 0d  48..-3451..-508.
34c60 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
34c70 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d  rt..SELECT ALL -
34c80 20 33 39 20 2b 20 34 38 20 46 52 4f 4d 20 74 61   39 + 48 FROM ta
34c90 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
34ca0 0d 0a 39 0d 0a 39 0d 0a 39 0d 0a 0d 0a 71 75 65  ..9..9..9....que
34cb0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
34cc0 4c 45 43 54 20 41 4c 4c 20 36 32 20 41 53 20 63  LECT ALL 62 AS c
34cd0 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 2c 20 74  ol2 FROM tab0, t
34ce0 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
34cf0 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68  -..9 values hash
34d00 69 6e 67 20 74 6f 20 35 31 64 64 32 37 37 31 64  ing to 51dd2771d
34d10 35 31 36 63 65 62 39 33 35 34 38 33 65 64 65 64  516ceb935483eded
34d20 37 38 61 35 66 61 30 0d 0a 0d 0a 71 75 65 72 79  78a5fa0....query
34d30 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
34d40 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f  CT DISTINCT - co
34d50 6c 30 20 2b 20 32 39 20 41 53 20 63 6f 6c 30 20  l0 + 29 AS col0 
34d60 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
34d70 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 36 0d 0a 2d 36 30  0..----..-6..-60
34d80 0d 0a 35 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  ..5....onlyif my
34d90 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f  sql # support fo
34da0 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63  r MySQL specific
34db0 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e   system types an
34dc0 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20  d syntax..query 
34dd0 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
34de0 31 34 37 32 0d 0a 53 45 4c 45 43 54 20 43 41 53  1472..SELECT CAS
34df0 54 28 20 28 20 2d 20 63 6f 6c 30 20 29 20 41 53  T( ( - col0 ) AS
34e00 20 53 49 47 4e 45 44 20 29 20 41 53 20 63 6f 6c   SIGNED ) AS col
34e10 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  0 FROM tab1 AS c
34e20 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 0d 0a 2d  or0..----..-3..-
34e30 36 34 0d 0a 2d 38 30 0d 0a 0d 0a 73 6b 69 70 69  64..-80....skipi
34e40 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
34e50 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
34e60 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
34e70 31 34 37 32 0d 0a 53 45 4c 45 43 54 20 43 41 53  1472..SELECT CAS
34e80 54 20 28 20 28 20 2d 20 63 6f 6c 30 20 29 20 41  T ( ( - col0 ) A
34e90 53 20 49 4e 54 45 47 45 52 20 29 20 41 53 20 63  S INTEGER ) AS c
34ea0 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol0 FROM tab1 AS
34eb0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 0d   cor0..----..-3.
34ec0 0a 2d 36 34 0d 0a 2d 38 30 0d 0a 0d 0a 71 75 65  .-64..-80....que
34ed0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
34ee0 4c 45 43 54 20 41 4c 4c 20 2b 20 38 35 20 46 52  LECT ALL + 85 FR
34ef0 4f 4d 20 74 61 62 30 2c 20 74 61 62 31 20 41 53  OM tab0, tab1 AS
34f00 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76   cor0..----..9 v
34f10 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f  alues hashing to
34f20 20 61 61 66 61 38 65 35 63 66 62 39 65 30 32 63   aafa8e5cfb9e02c
34f30 65 61 38 37 31 37 38 33 33 65 37 35 38 31 66 37  ea8717833e7581f7
34f40 62 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  b....query I row
34f50 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 37  sort..SELECT + 7
34f60 31 20 2d 20 2d 20 63 6f 6c 32 20 2a 20 2d 20 63  1 - - col2 * - c
34f70 6f 6c 30 20 2a 20 2b 20 63 6f 6c 30 20 41 53 20  ol0 * + col0 AS 
34f80 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 63  col1 FROM tab0 c
34f90 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 35 34  or0..----..-1154
34fa0 0d 0a 2d 31 38 39 33 37 0d 0a 2d 36 34 39 34 35  ..-18937..-64945
34fb0 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  1....query I row
34fc0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2b  sort..SELECT + +
34fd0 20 32 33 20 2b 20 2d 20 63 6f 6c 31 20 2a 20 2d   23 + - col1 * -
34fe0 20 35 31 20 2d 20 63 6f 6c 30 20 46 52 4f 4d 20   51 - col0 FROM 
34ff0 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
35000 2d 2d 0d 0a 31 33 34 36 0d 0a 34 36 39 0d 0a 36  --..1346..469..6
35010 30 36 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  06....onlyif mys
35020 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65  ql # use DIV ope
35030 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65  rator for intege
35040 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72  r division..quer
35050 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
35060 6c 2d 31 34 37 36 0d 0a 53 45 4c 45 43 54 20 63  l-1476..SELECT c
35070 6f 6c 32 20 2b 20 63 6f 6c 30 20 44 49 56 20 2d  ol2 + col0 DIV -
35080 20 31 33 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d   13 AS col2 FROM
35090 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
350a0 2d 2d 2d 0d 0a 35 33 0d 0a 35 34 0d 0a 39 30 0d  ---..53..54..90.
350b0 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
350c0 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
350d0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
350e0 74 20 6c 61 62 65 6c 2d 31 34 37 36 0d 0a 53 45  t label-1476..SE
350f0 4c 45 43 54 20 63 6f 6c 32 20 2b 20 63 6f 6c 30  LECT col2 + col0
35100 20 2f 20 2d 20 31 33 20 41 53 20 63 6f 6c 32 20   / - 13 AS col2 
35110 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
35120 30 0d 0a 2d 2d 2d 2d 0d 0a 35 33 0d 0a 35 34 0d  0..----..53..54.
35130 0a 39 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .90....query I r
35140 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
35150 20 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c 32 20 2b   col1 * + col2 +
35160 20 2b 20 28 20 63 6f 6c 32 20 2a 20 63 6f 6c 30   + ( col2 * col0
35170 20 2b 20 63 6f 6c 32 20 29 20 46 52 4f 4d 20 74   + col2 ) FROM t
35180 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
35190 2d 0d 0a 31 36 32 30 0d 0a 34 32 37 35 0d 0a 39  -..1620..4275..9
351a0 30 32 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  024....query I r
351b0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
351c0 49 53 54 49 4e 43 54 20 2b 20 28 20 63 6f 6c 31  ISTINCT + ( col1
351d0 20 29 20 2a 20 63 6f 6c 32 20 46 52 4f 4d 20 74   ) * col2 FROM t
351e0 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab2 cor0..----..
351f0 31 35 33 34 0d 0a 36 34 36 0d 0a 38 33 37 0d 0a  1534..646..837..
35200 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
35210 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2d 20 28 20  t..SELECT + - ( 
35220 2b 20 63 6f 6c 32 20 29 20 2a 20 2b 20 63 6f 6c  + col2 ) * + col
35230 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  2 FROM tab1 AS c
35240 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 39 31 36  or0..----..-2916
35250 0d 0a 2d 33 32 34 39 0d 0a 2d 39 32 31 36 0d 0a  ..-3249..-9216..
35260 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
35270 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
35280 43 54 20 2d 20 38 37 20 2a 20 63 6f 6c 31 20 2a  CT - 87 * col1 *
35290 20 63 6f 6c 30 20 2b 20 63 6f 6c 32 20 2a 20 2b   col0 + col2 * +
352a0 20 74 61 62 31 2e 63 6f 6c 32 20 46 52 4f 4d 20   tab1.col2 FROM 
352b0 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 38 37  tab1..----..-387
352c0 30 0d 0a 2d 35 32 34 33 31 0d 0a 2d 38 31 32 36  0..-52431..-8126
352d0 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  4....query I row
352e0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
352f0 20 63 6f 6c 32 20 2b 20 2b 20 63 6f 6c 32 20 2b   col2 + + col2 +
35300 20 2b 20 74 61 62 30 2e 63 6f 6c 31 20 46 52 4f   + tab0.col1 FRO
35310 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 35  M tab0..----..15
35320 32 0d 0a 32 35 35 0d 0a 39 39 0d 0a 0d 0a 71 75  2..255..99....qu
35330 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
35340 45 4c 45 43 54 20 2d 20 63 6f 6c 30 20 2b 20 63  ELECT - col0 + c
35350 6f 6c 30 20 2b 20 2b 20 63 6f 6c 32 20 41 53 20  ol0 + + col2 AS 
35360 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 0d 0a  col0 FROM tab1..
35370 2d 2d 2d 2d 0d 0a 35 34 0d 0a 35 37 0d 0a 39 36  ----..54..57..96
35380 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
35390 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61   # use DIV opera
353a0 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20  tor for integer 
353b0 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20  division..query 
353c0 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
353d0 31 34 38 33 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  1483..SELECT ALL
353e0 20 33 20 44 49 56 20 2b 20 33 32 20 2d 20 2b 20   3 DIV + 32 - + 
353f0 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 0d 0a  col2 FROM tab0..
35400 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 2d 33 33 0d 0a 2d  ----..-1..-33..-
35410 38 32 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  82....skipif mys
35420 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
35430 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
35440 73 6f 72 74 20 6c 61 62 65 6c 2d 31 34 38 33 0d  sort label-1483.
35450 0a 53 45 4c 45 43 54 20 41 4c 4c 20 33 20 2f 20  .SELECT ALL 3 / 
35460 2b 20 33 32 20 2d 20 2b 20 63 6f 6c 32 20 46 52  + 32 - + col2 FR
35470 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  OM tab0..----..-
35480 31 0d 0a 2d 33 33 0d 0a 2d 38 32 0d 0a 0d 0a 71  1..-33..-82....q
35490 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
354a0 53 45 4c 45 43 54 20 2d 20 63 6f 72 30 2e 63 6f  SELECT - cor0.co
354b0 6c 31 20 46 52 4f 4d 20 74 61 62 32 2c 20 74 61  l1 FROM tab2, ta
354c0 62 30 20 63 6f 72 30 2c 20 74 61 62 32 20 41 53  b0 cor0, tab2 AS
354d0 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20   cor1..----..27 
354e0 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74  values hashing t
354f0 6f 20 64 34 63 36 37 33 62 37 34 34 34 65 62 39  o d4c673b7444eb9
35500 39 32 37 65 63 36 33 31 37 35 62 34 33 63 36 62  927ec63175b43c6b
35510 38 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  84....query I ro
35520 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
35530 31 35 20 2b 20 2b 20 63 6f 6c 31 20 41 53 20 63  15 + + col1 AS c
35540 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d  ol0 FROM tab0..-
35550 2d 2d 2d 0d 0a 31 30 31 0d 0a 31 30 36 0d 0a 31  ---..101..106..1
35560 31 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  12....query I ro
35570 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
35580 4c 20 74 61 62 30 2e 63 6f 6c 32 20 2b 20 2d 20  L tab0.col2 + - 
35590 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46 52 4f  col0 AS col2 FRO
355a0 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33  M tab0..----..-3
355b0 34 0d 0a 2d 37 0d 0a 39 0d 0a 0d 0a 6f 6e 6c 79  4..-7..9....only
355c0 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44  if mysql # use D
355d0 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20  IV operator for 
355e0 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e  integer division
355f0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
35600 74 20 6c 61 62 65 6c 2d 31 34 38 37 0d 0a 53 45  t label-1487..SE
35610 4c 45 43 54 20 2b 20 28 20 63 6f 6c 31 20 29 20  LECT + ( col1 ) 
35620 44 49 56 20 74 61 62 30 2e 63 6f 6c 30 20 2b 20  DIV tab0.col0 + 
35630 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46  + col1 AS col1 F
35640 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab0..----..
35650 38 39 0d 0a 39 32 0d 0a 39 39 0d 0a 0d 0a 73 6b  89..92..99....sk
35660 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
35670 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
35680 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
35690 65 6c 2d 31 34 38 37 0d 0a 53 45 4c 45 43 54 20  el-1487..SELECT 
356a0 2b 20 28 20 63 6f 6c 31 20 29 20 2f 20 74 61 62  + ( col1 ) / tab
356b0 30 2e 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c 31 20  0.col0 + + col1 
356c0 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
356d0 30 0d 0a 2d 2d 2d 2d 0d 0a 38 39 0d 0a 39 32 0d  0..----..89..92.
356e0 0a 39 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .99....query I r
356f0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
35700 20 2b 20 63 6f 72 31 2e 63 6f 6c 30 20 2a 20 36   + cor1.col0 * 6
35710 35 20 2a 20 2b 20 37 30 20 41 53 20 63 6f 6c 31  5 * + 70 AS col1
35720 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
35730 72 30 20 43 52 4f 53 53 20 4a 4f 49 4e 20 74 61  r0 CROSS JOIN ta
35740 62 31 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d  b1 AS cor1..----
35750 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68 69  ..9 values hashi
35760 6e 67 20 74 6f 20 38 37 30 38 33 32 36 35 34 30  ng to 8708326540
35770 64 30 37 38 32 37 65 64 66 35 64 65 34 32 64 32  d07827edf5de42d2
35780 66 34 39 36 32 39 0d 0a 0d 0a 71 75 65 72 79 20  f49629....query 
35790 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
357a0 54 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 2d 20  T + cor0.col0 - 
357b0 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46 52 4f  col1 AS col1 FRO
357c0 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab0 cor0..---
357d0 2d 0d 0a 2d 32 0d 0a 2d 36 32 0d 0a 2d 36 32 0d  -..-2..-62..-62.
357e0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
357f0 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2d 20 63  rt..SELECT + - c
35800 6f 6c 30 20 2a 20 2d 20 28 20 63 6f 6c 32 20 2a  ol0 * - ( col2 *
35810 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 29 20 41   - cor0.col2 ) A
35820 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31  S col2 FROM tab1
35830 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
35840 2d 32 30 37 39 33 36 0d 0a 2d 37 33 37 32 38 30  -207936..-737280
35850 0d 0a 2d 38 37 34 38 0d 0a 0d 0a 71 75 65 72 79  ..-8748....query
35860 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
35870 43 54 20 41 4c 4c 20 2b 20 2d 20 63 6f 6c 31 20  CT ALL + - col1 
35880 2a 20 37 31 20 2b 20 2b 20 63 6f 6c 32 20 46 52  * 71 + + col2 FR
35890 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
358a0 0a 2d 2d 2d 2d 0d 0a 2d 36 30 37 33 0d 0a 2d 36  .----..-6073..-6
358b0 33 37 39 0d 0a 2d 36 38 38 36 0d 0a 0d 0a 71 75  379..-6886....qu
358c0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
358d0 45 4c 45 43 54 20 2d 20 2d 20 63 6f 6c 31 20 2b  ELECT - - col1 +
358e0 20 34 34 20 2b 20 2d 20 63 6f 6c 30 20 46 52 4f   44 + - col0 FRO
358f0 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
35900 2d 2d 2d 2d 0d 0a 2d 31 38 0d 0a 32 35 0d 0a 36  ----..-18..25..6
35910 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  8....query I row
35920 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c  sort..SELECT col
35930 31 20 2a 20 36 35 20 2b 20 36 35 20 2b 20 63 6f  1 * 65 + 65 + co
35940 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l1 FROM tab0 AS 
35950 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 35 37 34 31  cor0..----..5741
35960 0d 0a 36 30 37 31 0d 0a 36 34 36 37 0d 0a 0d 0a  ..6071..6467....
35970 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
35980 0a 53 45 4c 45 43 54 20 2b 20 63 6f 72 30 2e 63  .SELECT + cor0.c
35990 6f 6c 31 20 2b 20 31 37 20 46 52 4f 4d 20 74 61  ol1 + 17 FROM ta
359a0 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
359b0 0d 0a 33 34 0d 0a 34 38 0d 0a 37 36 0d 0a 0d 0a  ..34..48..76....
359c0 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75  onlyif mysql # u
359d0 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20  se DIV operator 
359e0 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69  for integer divi
359f0 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f  sion..query I ro
35a00 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 34 39 35  wsort label-1495
35a10 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 31 20  ..SELECT + col1 
35a20 44 49 56 20 2d 20 28 20 2d 20 63 6f 6c 30 20 2b  DIV - ( - col0 +
35a30 20 63 6f 6c 31 20 2a 20 63 6f 6c 30 20 29 20 46   col1 * col0 ) F
35a40 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d  ROM tab0 cor0..-
35a50 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a  ---..0..0..0....
35a60 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
35a70 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
35a80 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
35a90 61 62 65 6c 2d 31 34 39 35 0d 0a 53 45 4c 45 43  abel-1495..SELEC
35aa0 54 20 2b 20 63 6f 6c 31 20 2f 20 2d 20 28 20 2d  T + col1 / - ( -
35ab0 20 63 6f 6c 30 20 2b 20 63 6f 6c 31 20 2a 20 63   col0 + col1 * c
35ac0 6f 6c 30 20 29 20 46 52 4f 4d 20 74 61 62 30 20  ol0 ) FROM tab0 
35ad0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30  cor0..----..0..0
35ae0 0d 0a 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  ..0....query I r
35af0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
35b00 20 2d 20 63 6f 6c 30 20 2b 20 2d 20 28 20 32 33   - col0 + - ( 23
35b10 20 2a 20 2d 20 63 6f 6c 30 20 2b 20 63 6f 6c 30   * - col0 + col0
35b20 20 29 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20   ) AS col2 FROM 
35b30 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
35b40 2d 2d 0d 0a 31 36 31 0d 0a 31 37 39 34 0d 0a 31  --..161..1794..1
35b50 38 31 37 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  817....onlyif my
35b60 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70  sql # use DIV op
35b70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67  erator for integ
35b80 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65  er division..que
35b90 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
35ba0 65 6c 2d 31 34 39 37 0d 0a 53 45 4c 45 43 54 20  el-1497..SELECT 
35bb0 44 49 53 54 49 4e 43 54 20 2d 20 2b 20 63 6f 6c  DISTINCT - + col
35bc0 32 20 44 49 56 20 35 36 20 46 52 4f 4d 20 74 61  2 DIV 56 FROM ta
35bd0 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
35be0 0d 0a 2d 31 0d 0a 30 0d 0a 0d 0a 73 6b 69 70 69  ..-1..0....skipi
35bf0 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
35c00 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
35c10 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
35c20 31 34 39 37 0d 0a 53 45 4c 45 43 54 20 44 49 53  1497..SELECT DIS
35c30 54 49 4e 43 54 20 2d 20 2b 20 63 6f 6c 32 20 2f  TINCT - + col2 /
35c40 20 35 36 20 46 52 4f 4d 20 74 61 62 30 20 41 53   56 FROM tab0 AS
35c50 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d   cor0..----..-1.
35c60 0a 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  .0....query I ro
35c70 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
35c80 53 54 49 4e 43 54 20 74 61 62 32 2e 63 6f 6c 30  STINCT tab2.col0
35c90 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
35ca0 62 32 2c 20 74 61 62 30 2c 20 74 61 62 30 20 41  b2, tab0, tab0 A
35cb0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 37 0d  S cor0..----..7.
35cc0 0a 37 38 0d 0a 37 39 0d 0a 0d 0a 71 75 65 72 79  .78..79....query
35cd0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
35ce0 43 54 20 2b 20 38 35 20 2b 20 63 6f 6c 31 20 41  CT + 85 + col1 A
35cf0 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32  S col0 FROM tab2
35d00 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
35d10 31 30 32 0d 0a 31 31 36 0d 0a 31 34 34 0d 0a 0d  102..116..144...
35d20 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
35d30 0d 0a 53 45 4c 45 43 54 20 2b 20 28 20 63 6f 6c  ..SELECT + ( col
35d40 31 20 29 20 2a 20 63 6f 72 30 2e 63 6f 6c 32 20  1 ) * cor0.col2 
35d50 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
35d60 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
35d70 0a 32 38 33 38 0d 0a 37 34 36 32 0d 0a 39 37 0d  .2838..7462..97.
35d80 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
35d90 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63  rt..SELECT ALL c
35da0 6f 6c 32 20 2a 20 35 35 20 2d 20 63 6f 72 30 2e  ol2 * 55 - cor0.
35db0 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46 52 4f  col0 AS col2 FRO
35dc0 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
35dd0 2d 2d 2d 2d 0d 0a 32 39 36 37 0d 0a 33 30 37 31  ----..2967..3071
35de0 0d 0a 35 32 30 30 0d 0a 0d 0a 6f 6e 6c 79 69 66  ..5200....onlyif
35df0 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56   mysql # use DIV
35e00 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e   operator for in
35e10 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a  teger division..
35e20 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
35e30 6c 61 62 65 6c 2d 31 35 30 32 0d 0a 53 45 4c 45  label-1502..SELE
35e40 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 30  CT DISTINCT col0
35e50 20 44 49 56 20 2d 20 74 61 62 30 2e 63 6f 6c 30   DIV - tab0.col0
35e60 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62   + col1 FROM tab
35e70 30 0d 0a 2d 2d 2d 2d 0d 0a 38 35 0d 0a 39 30 0d  0..----..85..90.
35e80 0a 39 36 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  .96....skipif my
35e90 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
35ea0 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
35eb0 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 35 30 32  wsort label-1502
35ec0 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
35ed0 54 20 63 6f 6c 30 20 2f 20 2d 20 74 61 62 30 2e  T col0 / - tab0.
35ee0 63 6f 6c 30 20 2b 20 63 6f 6c 31 20 46 52 4f 4d  col0 + col1 FROM
35ef0 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 38 35 0d   tab0..----..85.
35f00 0a 39 30 0d 0a 39 36 0d 0a 0d 0a 71 75 65 72 79  .90..96....query
35f10 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
35f20 43 54 20 63 6f 6c 32 20 2a 20 2d 20 74 61 62 32  CT col2 * - tab2
35f30 2e 63 6f 6c 32 20 2b 20 2d 20 63 6f 6c 31 20 46  .col2 + - col1 F
35f40 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab2..----..
35f50 2d 31 34 36 31 0d 0a 2d 37 33 35 0d 0a 2d 37 36  -1461..-735..-76
35f60 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  0....onlyif mysq
35f70 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72  l # use DIV oper
35f80 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72  ator for integer
35f90 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79   division..query
35fa0 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
35fb0 2d 31 35 30 34 0d 0a 53 45 4c 45 43 54 20 41 4c  -1504..SELECT AL
35fc0 4c 20 74 61 62 30 2e 63 6f 6c 31 20 44 49 56 20  L tab0.col1 DIV 
35fd0 63 6f 6c 31 20 2b 20 2b 20 63 6f 6c 30 20 46 52  col1 + + col0 FR
35fe0 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 32  OM tab0..----..2
35ff0 35 0d 0a 33 36 0d 0a 39 30 0d 0a 0d 0a 73 6b 69  5..36..90....ski
36000 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
36010 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
36020 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
36030 6c 2d 31 35 30 34 0d 0a 53 45 4c 45 43 54 20 41  l-1504..SELECT A
36040 4c 4c 20 74 61 62 30 2e 63 6f 6c 31 20 2f 20 63  LL tab0.col1 / c
36050 6f 6c 31 20 2b 20 2b 20 63 6f 6c 30 20 46 52 4f  ol1 + + col0 FRO
36060 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 32 35  M tab0..----..25
36070 0d 0a 33 36 0d 0a 39 30 0d 0a 0d 0a 71 75 65 72  ..36..90....quer
36080 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
36090 45 43 54 20 2d 20 63 6f 6c 30 20 2a 20 2b 20 63  ECT - col0 * + c
360a0 6f 6c 32 20 2b 20 2d 20 63 6f 6c 32 20 41 53 20  ol2 + - col2 AS 
360b0 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 0d 0a  col2 FROM tab0..
360c0 2d 2d 2d 2d 0d 0a 2d 33 36 0d 0a 2d 37 33 38 30  ----..-36..-7380
360d0 0d 0a 2d 38 32 35 0d 0a 0d 0a 71 75 65 72 79 20  ..-825....query 
360e0 49 49 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  III rowsort..SEL
360f0 45 43 54 20 44 49 53 54 49 4e 43 54 20 2a 20 46  ECT DISTINCT * F
36100 52 4f 4d 20 74 61 62 31 20 57 48 45 52 45 20 4e  ROM tab1 WHERE N
36110 4f 54 20 4e 55 4c 4c 20 3e 3d 20 2d 20 63 6f 6c  OT NULL >= - col
36120 32 20 2b 20 2d 20 63 6f 6c 32 20 2d 20 2b 20 63  2 + - col2 - + c
36130 6f 6c 30 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a 71 75 65  ol0..----....que
36140 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
36150 4c 45 43 54 20 2d 20 63 6f 6c 30 20 2a 20 63 6f  LECT - col0 * co
36160 6c 32 20 2b 20 63 6f 6c 32 20 41 53 20 63 6f 6c  l2 + col2 AS col
36170 32 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d  2 FROM tab2..---
36180 2d 0d 0a 2d 31 36 32 0d 0a 2d 32 30 30 32 0d 0a  -..-162..-2002..
36190 2d 32 39 36 34 0d 0a 0d 0a 71 75 65 72 79 20 49  -2964....query I
361a0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
361b0 20 44 49 53 54 49 4e 43 54 20 2d 20 74 61 62 30   DISTINCT - tab0
361c0 2e 63 6f 6c 32 20 2d 20 2b 20 63 6f 6c 32 20 41  .col2 - + col2 A
361d0 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30  S col1 FROM tab0
361e0 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 36 34 0d 0a 2d 32  ..----..-164..-2
361f0 0d 0a 2d 36 36 0d 0a 0d 0a 71 75 65 72 79 20 49  ..-66....query I
36200 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
36210 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 31 20 2b   DISTINCT col1 +
36220 20 63 6f 6c 30 20 2b 20 63 6f 6c 30 20 2a 20 2b   col0 + col0 * +
36230 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20   col2 FROM tab0 
36240 57 48 45 52 45 20 4e 55 4c 4c 20 3c 3e 20 63 6f  WHERE NULL <> co
36250 6c 32 20 2d 20 2d 20 63 6f 6c 30 0d 0a 2d 2d 2d  l2 - - col0..---
36260 2d 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  -....query I row
36270 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c  sort..SELECT col
36280 32 20 2a 20 2d 20 63 6f 6c 30 20 2d 20 63 6f 6c  2 * - col0 - col
36290 30 20 2a 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f  0 * + col1 AS co
362a0 6c 32 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d  l2 FROM tab1..--
362b0 2d 2d 0d 0a 2d 32 34 30 0d 0a 2d 34 32 38 38 0d  --..-240..-4288.
362c0 0a 2d 38 37 32 30 0d 0a 0d 0a 71 75 65 72 79 20  .-8720....query 
362d0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
362e0 54 20 2b 20 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c  T + col0 * + col
362f0 30 20 2b 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f  0 + + col1 AS co
36300 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d  l0 FROM tab0..--
36310 2d 2d 0d 0a 31 33 32 32 0d 0a 36 36 32 0d 0a 38  --..1322..662..8
36320 30 31 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  012....query I r
36330 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63  owsort..SELECT c
36340 6f 6c 31 20 2a 20 2b 20 63 6f 6c 30 20 2b 20 63  ol1 * + col0 + c
36350 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  ol1 AS col0 FROM
36360 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 32 31 35   tab0..----..215
36370 30 0d 0a 33 34 39 32 0d 0a 38 31 39 30 0d 0a 0d  0..3492..8190...
36380 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
36390 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
363a0 54 20 2d 20 74 61 62 31 2e 63 6f 6c 30 20 2a 20  T - tab1.col0 * 
363b0 2d 20 63 6f 6c 31 20 2b 20 2d 20 63 6f 6c 30 20  - col1 + - col0 
363c0 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
363d0 31 0d 0a 2d 2d 2d 2d 0d 0a 35 37 36 0d 0a 37 35  1..----..576..75
363e0 0d 0a 39 36 30 0d 0a 0d 0a 71 75 65 72 79 20 49  ..960....query I
363f0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
36400 20 2b 20 74 61 62 31 2e 63 6f 6c 32 20 2b 20 2d   + tab1.col2 + -
36410 20 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c 32 20 2a   col0 * + col2 *
36420 20 2d 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20   - col0 AS col0 
36430 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d  FROM tab1..----.
36440 0a 32 33 33 35 32 39 0d 0a 35 34 30 0d 0a 36 31  .233529..540..61
36450 34 34 39 36 0d 0a 0d 0a 71 75 65 72 79 20 49 49  4496....query II
36460 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
36470 54 20 2a 20 46 52 4f 4d 20 74 61 62 30 20 57 48  T * FROM tab0 WH
36480 45 52 45 20 2d 20 63 6f 6c 30 20 42 45 54 57 45  ERE - col0 BETWE
36490 45 4e 20 4e 55 4c 4c 20 41 4e 44 20 4e 55 4c 4c  EN NULL AND NULL
364a0 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a 71 75 65 72 79 20  ..----....query 
364b0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
364c0 54 20 41 4c 4c 20 74 61 62 32 2e 63 6f 6c 31 20  T ALL tab2.col1 
364d0 2b 20 74 61 62 32 2e 63 6f 6c 32 20 2a 20 74 61  + tab2.col2 * ta
364e0 62 32 2e 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20  b2.col2 AS col0 
364f0 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d  FROM tab2..----.
36500 0a 31 34 36 31 0d 0a 37 33 35 0d 0a 37 36 30 0d  .1461..735..760.
36510 0a 0d 0a 71 75 65 72 79 20 49 49 49 20 72 6f 77  ...query III row
36520 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
36530 20 2a 20 46 52 4f 4d 20 74 61 62 31 20 57 48 45   * FROM tab1 WHE
36540 52 45 20 4e 4f 54 20 63 6f 6c 30 20 42 45 54 57  RE NOT col0 BETW
36550 45 45 4e 20 4e 55 4c 4c 20 41 4e 44 20 4e 55 4c  EEN NULL AND NUL
36560 4c 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a 71 75 65 72 79  L..----....query
36570 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
36580 43 54 20 63 6f 6c 32 20 2a 20 2d 20 74 61 62 31  CT col2 * - tab1
36590 2e 63 6f 6c 31 20 2d 20 63 6f 6c 30 20 41 53 20  .col1 - col0 AS 
365a0 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 0d 0a  col2 FROM tab1..
365b0 2d 2d 2d 2d 0d 0a 2d 31 33 32 38 0d 0a 2d 31 34  ----..-1328..-14
365c0 30 37 0d 0a 2d 36 33 34 0d 0a 0d 0a 71 75 65 72  07..-634....quer
365d0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
365e0 45 43 54 20 41 4c 4c 20 63 6f 6c 31 20 2a 20 63  ECT ALL col1 * c
365f0 6f 6c 31 20 2a 20 63 6f 6c 32 20 2b 20 2b 20 63  ol1 * col2 + + c
36600 6f 6c 32 20 2a 20 2b 20 63 6f 6c 32 20 41 53 20  ol2 * + col2 AS 
36610 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a  col0 FROM tab0..
36620 2d 2d 2d 2d 0d 0a 32 34 35 31 35 37 0d 0a 36 38  ----..245157..68
36630 35 37 36 36 0d 0a 39 34 31 30 0d 0a 0d 0a 71 75  5766..9410....qu
36640 65 72 79 20 49 49 49 20 72 6f 77 73 6f 72 74 0d  ery III rowsort.
36650 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2a 20 46 52  .SELECT ALL * FR
36660 4f 4d 20 74 61 62 30 20 57 48 45 52 45 20 4e 4f  OM tab0 WHERE NO
36670 54 20 28 20 4e 55 4c 4c 20 29 20 49 4e 20 28 20  T ( NULL ) IN ( 
36680 63 6f 6c 31 20 2b 20 2b 20 63 6f 6c 32 20 29 0d  col1 + + col2 ).
36690 0a 2d 2d 2d 2d 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  .----....onlyif 
366a0 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20  mysql # use DIV 
366b0 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74  operator for int
366c0 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71  eger division..q
366d0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
366e0 61 62 65 6c 2d 31 35 32 31 0d 0a 53 45 4c 45 43  abel-1521..SELEC
366f0 54 20 41 4c 4c 20 63 6f 6c 31 20 44 49 56 20 2b  T ALL col1 DIV +
36700 20 63 6f 6c 30 20 2b 20 63 6f 6c 32 20 2a 20 2b   col0 + col2 * +
36710 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 0d   col2 FROM tab2.
36720 0a 2d 2d 2d 2d 0d 0a 31 34 34 34 0d 0a 36 37 36  .----..1444..676
36730 0d 0a 37 33 33 0d 0a 0d 0a 73 6b 69 70 69 66 20  ..733....skipif 
36740 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
36750 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
36760 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 35  rowsort label-15
36770 32 31 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63  21..SELECT ALL c
36780 6f 6c 31 20 2f 20 2b 20 63 6f 6c 30 20 2b 20 63  ol1 / + col0 + c
36790 6f 6c 32 20 2a 20 2b 20 63 6f 6c 32 20 46 52 4f  ol2 * + col2 FRO
367a0 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 34  M tab2..----..14
367b0 34 34 0d 0a 36 37 36 0d 0a 37 33 33 0d 0a 0d 0a  44..676..733....
367c0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
367d0 0a 53 45 4c 45 43 54 20 74 61 62 31 2e 63 6f 6c  .SELECT tab1.col
367e0 30 20 2a 20 2d 20 63 6f 6c 31 20 2a 20 63 6f 6c  0 * - col1 * col
367f0 31 20 2b 20 2d 20 63 6f 6c 30 20 2b 20 2b 20 63  1 + - col0 + + c
36800 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d  ol0 FROM tab1..-
36810 2d 2d 2d 0d 0a 2d 31 33 35 32 30 0d 0a 2d 32 30  ---..-13520..-20
36820 32 38 0d 0a 2d 36 34 30 30 0d 0a 0d 0a 71 75 65  28..-6400....que
36830 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
36840 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f  LECT DISTINCT co
36850 6c 32 20 2f 20 63 6f 6c 32 20 2b 20 63 6f 6c 30  l2 / col2 + col0
36860 20 46 52 4f 4d 20 74 61 62 32 20 57 48 45 52 45   FROM tab2 WHERE
36870 20 4e 4f 54 20 4e 55 4c 4c 20 4e 4f 54 20 49 4e   NOT NULL NOT IN
36880 20 28 20 63 6f 6c 31 20 2f 20 63 6f 6c 32 20 2b   ( col1 / col2 +
36890 20 2d 20 63 6f 6c 31 20 29 0d 0a 2d 2d 2d 2d 0d   - col1 )..----.
368a0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
368b0 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
368c0 4e 43 54 20 63 6f 6c 32 20 2b 20 2b 20 74 61 62  NCT col2 + + tab
368d0 32 2e 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c 32 20  2.col0 * - col2 
368e0 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
368f0 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 36 32 0d 0a 2d  2..----..-162..-
36900 32 30 30 32 0d 0a 2d 32 39 36 34 0d 0a 0d 0a 71  2002..-2964....q
36910 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
36920 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
36930 2b 20 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46  + col2 AS col1 F
36940 52 4f 4d 20 74 61 62 31 20 57 48 45 52 45 20 28  ROM tab1 WHERE (
36950 20 4e 55 4c 4c 20 29 20 4e 4f 54 20 49 4e 20 28   NULL ) NOT IN (
36960 20 2d 20 63 6f 6c 32 20 2f 20 2b 20 63 6f 6c 31   - col2 / + col1
36970 20 2b 20 2b 20 63 6f 6c 31 20 29 0d 0a 2d 2d 2d   + + col1 )..---
36980 2d 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  -....onlyif mysq
36990 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72  l # use DIV oper
369a0 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72  ator for integer
369b0 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79   division..query
369c0 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
369d0 2d 31 35 32 36 0d 0a 53 45 4c 45 43 54 20 2d 20  -1526..SELECT - 
369e0 63 6f 6c 30 20 2a 20 63 6f 6c 30 20 44 49 56 20  col0 * col0 DIV 
369f0 2b 20 63 6f 6c 30 20 2d 20 63 6f 6c 30 20 2a 20  + col0 - col0 * 
36a00 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46 52 4f  col1 AS col2 FRO
36a10 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
36a20 2d 2d 2d 2d 0d 0a 2d 31 31 32 30 0d 0a 2d 37 30  ----..-1120..-70
36a30 34 0d 0a 2d 38 31 0d 0a 0d 0a 73 6b 69 70 69 66  4..-81....skipif
36a40 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
36a50 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
36a60 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
36a70 35 32 36 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f  526..SELECT - co
36a80 6c 30 20 2a 20 63 6f 6c 30 20 2f 20 2b 20 63 6f  l0 * col0 / + co
36a90 6c 30 20 2d 20 63 6f 6c 30 20 2a 20 63 6f 6c 31  l0 - col0 * col1
36aa0 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
36ab0 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
36ac0 0d 0a 2d 31 31 32 30 0d 0a 2d 37 30 34 0d 0a 2d  ..-1120..-704..-
36ad0 38 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  81....query I ro
36ae0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f  wsort..SELECT co
36af0 72 30 2e 63 6f 6c 30 20 2a 20 63 6f 6c 30 20 2b  r0.col0 * col0 +
36b00 20 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46 52   col0 AS col1 FR
36b10 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d  OM tab1 cor0..--
36b20 2d 2d 0d 0a 31 32 0d 0a 34 31 36 30 0d 0a 36 34  --..12..4160..64
36b30 38 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  80....query I ro
36b40 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
36b50 53 54 49 4e 43 54 20 63 6f 6c 30 20 41 53 20 63  STINCT col0 AS c
36b60 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 57 48  ol1 FROM tab0 WH
36b70 45 52 45 20 4e 4f 54 20 63 6f 6c 32 20 2a 20 63  ERE NOT col2 * c
36b80 6f 6c 31 20 2b 20 63 6f 6c 30 20 3c 20 2b 20 63  ol1 + col0 < + c
36b90 6f 6c 30 0d 0a 2d 2d 2d 2d 0d 0a 32 34 0d 0a 33  ol0..----..24..3
36ba0 35 0d 0a 38 39 0d 0a 0d 0a 71 75 65 72 79 20 49  5..89....query I
36bb0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
36bc0 20 2b 20 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20   + col2 AS col1 
36bd0 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
36be0 30 20 57 48 45 52 45 20 28 20 4e 55 4c 4c 20 29  0 WHERE ( NULL )
36bf0 20 3d 20 4e 55 4c 4c 0d 0a 2d 2d 2d 2d 0d 0a 0d   = NULL..----...
36c00 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
36c10 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 31 20 2a 20  ..SELECT col1 * 
36c20 2d 20 63 6f 72 30 2e 63 6f 6c 30 20 2b 20 2d 20  - cor0.col0 + - 
36c30 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46 52 4f  col2 AS col2 FRO
36c40 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
36c50 2d 2d 2d 2d 0d 0a 2d 31 31 33 36 0d 0a 2d 31 33  ----..-1136..-13
36c60 32 0d 0a 2d 36 39 37 0d 0a 0d 0a 6f 6e 6c 79 69  2..-697....onlyi
36c70 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49  f mysql # use DI
36c80 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69  V operator for i
36c90 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d  nteger division.
36ca0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
36cb0 20 6c 61 62 65 6c 2d 31 35 33 31 0d 0a 53 45 4c   label-1531..SEL
36cc0 45 43 54 20 63 6f 6c 31 20 2b 20 63 6f 6c 30 20  ECT col1 + col0 
36cd0 44 49 56 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20  DIV + col0 FROM 
36ce0 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
36cf0 2d 2d 0d 0a 31 38 0d 0a 33 32 0d 0a 36 30 0d 0a  --..18..32..60..
36d00 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
36d10 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
36d20 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
36d30 20 6c 61 62 65 6c 2d 31 35 33 31 0d 0a 53 45 4c   label-1531..SEL
36d40 45 43 54 20 63 6f 6c 31 20 2b 20 63 6f 6c 30 20  ECT col1 + col0 
36d50 2f 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61  / + col0 FROM ta
36d60 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
36d70 0d 0a 31 38 0d 0a 33 32 0d 0a 36 30 0d 0a 0d 0a  ..18..32..60....
36d80 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
36d90 0a 53 45 4c 45 43 54 20 2b 20 74 61 62 31 2e 63  .SELECT + tab1.c
36da0 6f 6c 31 20 2a 20 2b 20 63 6f 6c 31 20 2b 20 63  ol1 * + col1 + c
36db0 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  ol2 AS col1 FROM
36dc0 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 35 37   tab1..----..157
36dd0 0d 0a 32 36 35 0d 0a 37 33 30 0d 0a 0d 0a 73 6b  ..265..730....sk
36de0 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20  ipif postgresql 
36df0 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71  # PostgreSQL req
36e00 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65  uires AS when re
36e10 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f  naming output co
36e20 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72  lumns..query I r
36e30 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
36e40 20 74 61 62 30 2e 63 6f 6c 32 20 2a 20 2b 20 63   tab0.col2 * + c
36e50 6f 6c 32 20 2b 20 63 6f 6c 30 20 2b 20 63 6f 6c  ol2 + col0 + col
36e60 30 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30  0 col0 FROM tab0
36e70 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 34 31 0d 0a 2d  ..----..-1041..-
36e80 36 35 34 36 0d 0a 36 39 0d 0a 0d 0a 71 75 65 72  6546..69....quer
36e90 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
36ea0 45 43 54 20 41 4c 4c 20 63 6f 6c 32 20 2b 20 63  ECT ALL col2 + c
36eb0 6f 6c 31 20 2b 20 2d 20 63 6f 6c 31 20 41 53 20  ol1 + - col1 AS 
36ec0 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 0d 0a  col2 FROM tab0..
36ed0 2d 2d 2d 2d 0d 0a 31 0d 0a 33 33 0d 0a 38 32 0d  ----..1..33..82.
36ee0 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72  ...skipif postgr
36ef0 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51  esql # PostgreSQ
36f00 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68  L requires AS wh
36f10 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70  en renaming outp
36f20 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72  ut columns..quer
36f30 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
36f40 45 43 54 20 41 4c 4c 20 63 6f 6c 31 20 2a 20 2d  ECT ALL col1 * -
36f50 20 74 61 62 32 2e 63 6f 6c 31 20 63 6f 6c 30 20   tab2.col1 col0 
36f60 46 52 4f 4d 20 74 61 62 32 20 57 48 45 52 45 20  FROM tab2 WHERE 
36f70 4e 4f 54 20 63 6f 6c 31 20 2a 20 63 6f 6c 30 20  NOT col1 * col0 
36f80 2b 20 2d 20 63 6f 6c 30 20 2a 20 63 6f 6c 32 20  + - col0 * col2 
36f90 4e 4f 54 20 49 4e 20 28 20 2b 20 63 6f 6c 31 20  NOT IN ( + col1 
36fa0 29 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a 71 75 65 72 79  )..----....query
36fb0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
36fc0 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 31  CT DISTINCT col1
36fd0 20 2a 20 2b 20 63 6f 6c 30 20 2a 20 2b 20 63 6f   * + col0 * + co
36fe0 6c 30 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d  l0 FROM tab1..--
36ff0 2d 2d 0d 0a 32 33 34 0d 0a 34 30 39 36 30 0d 0a  --..234..40960..
37000 38 33 32 30 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  83200....onlyif 
37010 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20  mysql # use DIV 
37020 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74  operator for int
37030 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71  eger division..q
37040 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
37050 61 62 65 6c 2d 31 35 33 37 0d 0a 53 45 4c 45 43  abel-1537..SELEC
37060 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 30 20  T DISTINCT col0 
37070 2a 20 74 61 62 32 2e 63 6f 6c 32 20 2b 20 63 6f  * tab2.col2 + co
37080 6c 32 20 2b 20 2b 20 63 6f 6c 32 20 44 49 56 20  l2 + + col2 DIV 
37090 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 0d 0a  col1 FROM tab2..
370a0 2d 2d 2d 2d 0d 0a 32 30 35 34 0d 0a 32 31 36 0d  ----..2054..216.
370b0 0a 33 30 34 32 0d 0a 0d 0a 73 6b 69 70 69 66 20  .3042....skipif 
370c0 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
370d0 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
370e0 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 35  rowsort label-15
370f0 33 37 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  37..SELECT DISTI
37100 4e 43 54 20 63 6f 6c 30 20 2a 20 74 61 62 32 2e  NCT col0 * tab2.
37110 63 6f 6c 32 20 2b 20 63 6f 6c 32 20 2b 20 2b 20  col2 + col2 + + 
37120 63 6f 6c 32 20 2f 20 63 6f 6c 31 20 46 52 4f 4d  col2 / col1 FROM
37130 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 32 30 35   tab2..----..205
37140 34 0d 0a 32 31 36 0d 0a 33 30 34 32 0d 0a 0d 0a  4..216..3042....
37150 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
37160 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 31  .SELECT ALL col1
37170 20 46 52 4f 4d 20 74 61 62 30 20 57 48 45 52 45   FROM tab0 WHERE
37180 20 28 20 63 6f 6c 32 20 2b 20 2b 20 63 6f 6c 31   ( col2 + + col1
37190 20 29 20 49 4e 20 28 20 63 6f 6c 32 20 29 0d 0a   ) IN ( col2 )..
371a0 2d 2d 2d 2d 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ----....query I 
371b0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
371c0 2d 20 63 6f 6c 30 20 2b 20 63 6f 72 30 2e 63 6f  - col0 + cor0.co
371d0 6c 31 20 2b 20 2d 20 63 6f 6c 32 20 2a 20 2b 20  l1 + - col2 * + 
371e0 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46 52 4f  col0 AS col1 FRO
371f0 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab2 cor0..---
37200 2d 0d 0a 2d 31 36 35 0d 0a 2d 32 30 34 37 0d 0a  -..-165..-2047..
37210 2d 33 30 36 34 0d 0a 0d 0a 71 75 65 72 79 20 49  -3064....query I
37220 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
37230 20 41 4c 4c 20 63 6f 6c 30 20 46 52 4f 4d 20 74   ALL col0 FROM t
37240 61 62 32 20 41 53 20 63 6f 72 30 20 57 48 45 52  ab2 AS cor0 WHER
37250 45 20 4e 4f 54 20 28 20 63 6f 6c 31 20 2a 20 63  E NOT ( col1 * c
37260 6f 6c 32 20 2a 20 2b 20 63 6f 6c 32 20 2b 20 2b  ol2 * + col2 + +
37270 20 63 6f 6c 30 20 2b 20 63 6f 6c 32 20 29 20 3c   col0 + col2 ) <
37280 20 63 6f 6c 30 0d 0a 2d 2d 2d 2d 0d 0a 37 0d 0a   col0..----..7..
37290 37 38 0d 0a 37 39 0d 0a 0d 0a 71 75 65 72 79 20  78..79....query 
372a0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
372b0 54 20 41 4c 4c 20 63 6f 6c 30 20 2b 20 63 6f 6c  T ALL col0 + col
372c0 32 20 2a 20 2d 20 63 6f 6c 31 20 2d 20 2b 20 63  2 * - col1 - + c
372d0 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol1 FROM tab1 AS
372e0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31   cor0..----..-11
372f0 38 31 0d 0a 2d 31 34 32 37 0d 0a 2d 35 31 36 0d  81..-1427..-516.
37300 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
37310 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
37320 4e 43 54 20 2b 20 63 6f 6c 32 20 46 52 4f 4d 20  NCT + col2 FROM 
37330 74 61 62 30 20 41 53 20 63 6f 72 30 20 57 48 45  tab0 AS cor0 WHE
37340 52 45 20 4e 4f 54 20 28 20 2d 20 63 6f 6c 30 20  RE NOT ( - col0 
37350 29 20 4e 4f 54 20 49 4e 20 28 20 2d 20 63 6f 72  ) NOT IN ( - cor
37360 30 2e 63 6f 6c 31 20 29 0d 0a 2d 2d 2d 2d 0d 0a  0.col1 )..----..
37370 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
37380 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
37390 43 54 20 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c 31  CT col1 * - col1
373a0 20 2b 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c   + + col1 AS col
373b0 32 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d  2 FROM tab0..---
373c0 2d 0d 0a 2d 37 33 31 30 0d 0a 2d 38 31 39 30 0d  -..-7310..-8190.
373d0 0a 2d 39 33 31 32 0d 0a 0d 0a 71 75 65 72 79 20  .-9312....query 
373e0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
373f0 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c  T DISTINCT + col
37400 32 20 2a 20 63 6f 6c 32 20 2a 20 2d 20 63 6f 72  2 * col2 * - cor
37410 30 2e 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46  0.col1 AS col1 F
37420 52 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d  ROM tab2 cor0..-
37430 2d 2d 2d 0d 0a 2d 32 32 35 39 39 0d 0a 2d 32 34  ---..-22599..-24
37440 35 34 38 0d 0a 2d 33 39 38 38 34 0d 0a 0d 0a 71  548..-39884....q
37450 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
37460 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c  SELECT ALL + col
37470 31 20 2b 20 28 20 2d 20 63 6f 72 30 2e 63 6f 6c  1 + ( - cor0.col
37480 30 20 2a 20 63 6f 6c 30 20 29 20 46 52 4f 4d 20  0 * col0 ) FROM 
37490 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
374a0 2d 2d 0d 0a 2d 34 30 38 36 0d 0a 2d 36 33 38 37  --..-4086..-6387
374b0 0d 0a 31 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..17....query I 
374c0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
374d0 63 6f 6c 30 20 2b 20 33 32 20 46 52 4f 4d 20 74  col0 + 32 FROM t
374e0 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
374f0 2d 0d 0a 31 32 31 0d 0a 35 36 0d 0a 36 37 0d 0a  -..121..56..67..
37500 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
37510 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f   use DIV operato
37520 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69  r for integer di
37530 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20  vision..query I 
37540 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 35  rowsort label-15
37550 34 37 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  47..SELECT DISTI
37560 4e 43 54 20 2d 20 2b 20 63 6f 6c 32 20 44 49 56  NCT - + col2 DIV
37570 20 2d 20 31 32 20 63 6f 6c 32 20 46 52 4f 4d 20   - 12 col2 FROM 
37580 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
37590 2d 2d 0d 0a 30 0d 0a 32 0d 0a 36 0d 0a 0d 0a 73  --..0..2..6....s
375a0 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c  kipif postgresql
375b0 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65   # PostgreSQL re
375c0 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72  quires AS when r
375d0 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63  enaming output c
375e0 6f 6c 75 6d 6e 73 0d 0a 73 6b 69 70 69 66 20 6d  olumns..skipif m
375f0 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
37600 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
37610 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 35 34  owsort label-154
37620 37 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  7..SELECT DISTIN
37630 43 54 20 2d 20 2b 20 63 6f 6c 32 20 2f 20 2d 20  CT - + col2 / - 
37640 31 32 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  12 col2 FROM tab
37650 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
37660 0a 30 0d 0a 32 0d 0a 36 0d 0a 0d 0a 71 75 65 72  .0..2..6....quer
37670 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
37680 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 2d  ECT DISTINCT + -
37690 20 63 6f 6c 32 20 2b 20 2b 20 63 6f 72 30 2e 63   col2 + + cor0.c
376a0 6f 6c 30 20 2a 20 2b 20 63 6f 6c 31 20 41 53 20  ol0 * + col1 AS 
376b0 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41  col1 FROM tab0 A
376c0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 30  S cor0..----..20
376d0 33 31 0d 0a 33 33 39 34 0d 0a 38 30 31 37 0d 0a  31..3394..8017..
376e0 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
376f0 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53   support for MyS
37700 51 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74  QL specific syst
37710 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e  em types and syn
37720 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  tax..query I row
37730 73 6f 72 74 20 6c 61 62 65 6c 2d 31 35 34 39 0d  sort label-1549.
37740 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 30  .SELECT ALL col0
37750 20 2b 20 43 41 53 54 28 20 4e 55 4c 4c 20 41 53   + CAST( NULL AS
37760 20 53 49 47 4e 45 44 20 29 20 46 52 4f 4d 20 74   SIGNED ) FROM t
37770 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d  ab1..----..NULL.
37780 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73  .NULL..NULL....s
37790 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
377a0 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
377b0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
377c0 62 65 6c 2d 31 35 34 39 0d 0a 53 45 4c 45 43 54  bel-1549..SELECT
377d0 20 41 4c 4c 20 63 6f 6c 30 20 2b 20 43 41 53 54   ALL col0 + CAST
377e0 20 28 20 4e 55 4c 4c 20 41 53 20 49 4e 54 45 47   ( NULL AS INTEG
377f0 45 52 20 29 20 46 52 4f 4d 20 74 61 62 31 0d 0a  ER ) FROM tab1..
37800 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c  ----..NULL..NULL
37810 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75 65 72 79 20  ..NULL....query 
37820 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
37830 54 20 2b 20 2b 20 63 6f 6c 32 20 2a 20 2d 20 63  T + + col2 * - c
37840 6f 6c 31 20 2b 20 28 20 2d 20 63 6f 6c 32 20 2b  ol1 + ( - col2 +
37850 20 2b 20 63 6f 6c 32 20 29 20 46 52 4f 4d 20 74   + col2 ) FROM t
37860 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
37870 2d 0d 0a 2d 31 35 33 34 0d 0a 2d 36 34 36 0d 0a  -..-1534..-646..
37880 2d 38 33 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20  -837....query I 
37890 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
378a0 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c 31 20  DISTINCT - col1 
378b0 2a 20 2b 20 35 35 20 46 52 4f 4d 20 74 61 62 30  * + 55 FROM tab0
378c0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
378d0 2d 34 37 33 30 0d 0a 2d 35 30 30 35 0d 0a 2d 35  -4730..-5005..-5
378e0 33 33 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  335....query I r
378f0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
37900 20 2d 20 28 20 2d 20 35 20 29 20 2b 20 63 6f 6c   - ( - 5 ) + col
37910 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  0 FROM tab1 AS c
37920 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 0d 0a 35  or0..----..-2..5
37930 39 0d 0a 37 35 0d 0a 0d 0a 71 75 65 72 79 20 49  9..75....query I
37940 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
37950 20 44 49 53 54 49 4e 43 54 20 2d 20 36 34 20 2b   DISTINCT - 64 +
37960 20 34 36 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d   46 AS col0 FROM
37970 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
37980 2d 2d 2d 0d 0a 2d 31 38 0d 0a 0d 0a 71 75 65 72  ---..-18....quer
37990 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
379a0 45 43 54 20 44 49 53 54 49 4e 43 54 20 34 37 20  ECT DISTINCT 47 
379b0 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
379c0 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
379d0 0a 34 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .47....query I r
379e0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
379f0 4c 4c 20 2d 20 34 39 20 2b 20 2b 20 63 6f 6c 31  LL - 49 + + col1
37a00 20 2a 20 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20   * col0 AS col1 
37a10 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a  FROM tab0 cor0..
37a20 2d 2d 2d 2d 0d 0a 32 30 31 35 0d 0a 33 33 34 36  ----..2015..3346
37a30 0d 0a 38 30 35 30 0d 0a 0d 0a 73 6b 69 70 69 66  ..8050....skipif
37a40 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f   postgresql # Po
37a50 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65  stgreSQL require
37a60 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69  s AS when renami
37a70 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e  ng output column
37a80 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  s..query I rowso
37a90 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b  rt..SELECT ALL +
37aa0 20 2b 20 28 20 63 6f 6c 32 20 29 20 2a 20 63 6f   + ( col2 ) * co
37ab0 6c 32 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  l2 col2 FROM tab
37ac0 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
37ad0 0a 32 39 31 36 0d 0a 33 32 34 39 0d 0a 39 32 31  .2916..3249..921
37ae0 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  6....query I row
37af0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
37b00 54 49 4e 43 54 20 63 6f 6c 32 20 2d 20 2d 20 37  TINCT col2 - - 7
37b10 36 20 2a 20 2d 20 63 6f 6c 31 20 46 52 4f 4d 20  6 * - col1 FROM 
37b20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 39 32  tab1..----..-192
37b30 32 0d 0a 2d 37 30 33 0d 0a 2d 38 39 32 0d 0a 0d  2..-703..-892...
37b40 0a 71 75 65 72 79 20 49 49 49 49 49 49 49 49 49  .query IIIIIIIII
37b50 49 49 49 49 49 49 20 72 6f 77 73 6f 72 74 0d 0a  IIIIII rowsort..
37b60 53 45 4c 45 43 54 20 2a 20 46 52 4f 4d 20 74 61  SELECT * FROM ta
37b70 62 31 20 63 6f 72 30 20 43 52 4f 53 53 20 4a 4f  b1 cor0 CROSS JO
37b80 49 4e 20 74 61 62 30 2c 20 74 61 62 31 20 41 53  IN tab0, tab1 AS
37b90 20 63 6f 72 31 2c 20 74 61 62 30 20 41 53 20 63   cor1, tab0 AS c
37ba0 6f 72 32 2c 20 74 61 62 30 20 63 6f 72 33 0d 0a  or2, tab0 cor3..
37bb0 2d 2d 2d 2d 0d 0a 33 36 34 35 20 76 61 6c 75 65  ----..3645 value
37bc0 73 20 68 61 73 68 69 6e 67 20 74 6f 20 64 32 34  s hashing to d24
37bd0 62 33 34 62 30 36 37 33 63 39 30 37 31 35 61 37  b34b0673c90715a7
37be0 31 30 31 65 37 65 36 33 30 66 61 39 34 0d 0a 0d  101e7e630fa94...
37bf0 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
37c00 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51  support for MySQ
37c10 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65  L specific syste
37c20 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74  m types and synt
37c30 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ax..query I rows
37c40 6f 72 74 20 6c 61 62 65 6c 2d 31 35 35 39 0d 0a  ort label-1559..
37c50 53 45 4c 45 43 54 20 63 6f 6c 31 20 2a 20 2d 20  SELECT col1 * - 
37c60 43 41 53 54 28 20 2d 20 74 61 62 31 2e 63 6f 6c  CAST( - tab1.col
37c70 30 20 41 53 20 53 49 47 4e 45 44 20 29 20 46 52  0 AS SIGNED ) FR
37c80 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31  OM tab1..----..1
37c90 30 34 30 0d 0a 36 34 30 0d 0a 37 38 0d 0a 0d 0a  040..640..78....
37ca0 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
37cb0 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
37cc0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
37cd0 61 62 65 6c 2d 31 35 35 39 0d 0a 53 45 4c 45 43  abel-1559..SELEC
37ce0 54 20 63 6f 6c 31 20 2a 20 2d 20 43 41 53 54 20  T col1 * - CAST 
37cf0 28 20 2d 20 74 61 62 31 2e 63 6f 6c 30 20 41 53  ( - tab1.col0 AS
37d00 20 49 4e 54 45 47 45 52 20 29 20 46 52 4f 4d 20   INTEGER ) FROM 
37d10 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 30 34 30  tab1..----..1040
37d20 0d 0a 36 34 30 0d 0a 37 38 0d 0a 0d 0a 6f 6e 6c  ..640..78....onl
37d30 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20  yif mysql # use 
37d40 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72  DIV operator for
37d50 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f   integer divisio
37d60 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  n..query I rowso
37d70 72 74 20 6c 61 62 65 6c 2d 31 35 36 30 0d 0a 53  rt label-1560..S
37d80 45 4c 45 43 54 20 2b 20 2b 20 63 6f 6c 32 20 44  ELECT + + col2 D
37d90 49 56 20 63 6f 6c 30 20 2b 20 63 6f 6c 30 20 41  IV col0 + col0 A
37da0 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31  S col1 FROM tab1
37db0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
37dc0 32 31 0d 0a 36 34 0d 0a 38 31 0d 0a 0d 0a 73 6b  21..64..81....sk
37dd0 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
37de0 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
37df0 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
37e00 65 6c 2d 31 35 36 30 0d 0a 53 45 4c 45 43 54 20  el-1560..SELECT 
37e10 2b 20 2b 20 63 6f 6c 32 20 2f 20 63 6f 6c 30 20  + + col2 / col0 
37e20 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46  + col0 AS col1 F
37e30 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
37e40 0d 0a 2d 2d 2d 2d 0d 0a 32 31 0d 0a 36 34 0d 0a  ..----..21..64..
37e50 38 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  81....query I ro
37e60 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
37e70 4c 20 35 37 20 2a 20 2b 20 63 6f 6c 32 20 46 52  L 57 * + col2 FR
37e80 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
37e90 0a 2d 2d 2d 2d 0d 0a 31 38 38 31 0d 0a 34 36 37  .----..1881..467
37ea0 34 0d 0a 35 37 0d 0a 0d 0a 71 75 65 72 79 20 49  4..57....query I
37eb0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
37ec0 20 41 4c 4c 20 2d 20 37 31 20 2a 20 63 6f 6c 30   ALL - 71 * col0
37ed0 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
37ee0 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
37ef0 0d 0a 2d 32 31 33 0d 0a 2d 34 35 34 34 0d 0a 2d  ..-213..-4544..-
37f00 35 36 38 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20  5680....query I 
37f10 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
37f20 2d 20 2b 20 28 20 63 6f 6c 31 20 29 20 2a 20 2d  - + ( col1 ) * -
37f30 20 28 20 63 6f 72 30 2e 63 6f 6c 30 20 29 20 46   ( cor0.col0 ) F
37f40 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
37f50 0d 0a 2d 2d 2d 2d 0d 0a 31 33 34 33 0d 0a 32 31  ..----..1343..21
37f60 37 0d 0a 34 36 30 32 0d 0a 0d 0a 71 75 65 72 79  7..4602....query
37f70 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
37f80 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 2d 20  CT DISTINCT + - 
37f90 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c 31 20 2b 20  col0 + + col1 + 
37fa0 2b 20 28 20 2d 20 63 6f 6c 30 20 29 20 46 52 4f  + ( - col0 ) FRO
37fb0 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
37fc0 2d 2d 2d 2d 0d 0a 2d 31 31 38 0d 0a 2d 31 34 37  ----..-118..-147
37fd0 0d 0a 32 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  ..20....onlyif m
37fe0 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f  ysql # use DIV o
37ff0 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65  perator for inte
38000 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75  ger division..qu
38010 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
38020 62 65 6c 2d 31 35 36 35 0d 0a 53 45 4c 45 43 54  bel-1565..SELECT
38030 20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c 31   DISTINCT - col1
38040 20 44 49 56 20 2b 20 63 6f 6c 32 20 2b 20 2b 20   DIV + col2 + + 
38050 63 6f 6c 30 20 2a 20 63 6f 6c 32 20 63 6f 6c 30  col0 * col2 col0
38060 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
38070 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 36 32 0d 0a 33  r0..----..162..3
38080 36 34 38 0d 0a 37 36 38 30 0d 0a 0d 0a 73 6b 69  648..7680....ski
38090 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23  pif postgresql #
380a0 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75   PostgreSQL requ
380b0 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e  ires AS when ren
380c0 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c  aming output col
380d0 75 6d 6e 73 0d 0a 73 6b 69 70 69 66 20 6d 79 73  umns..skipif mys
380e0 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
380f0 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
38100 73 6f 72 74 20 6c 61 62 65 6c 2d 31 35 36 35 0d  sort label-1565.
38110 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
38120 20 2d 20 63 6f 6c 31 20 2f 20 2b 20 63 6f 6c 32   - col1 / + col2
38130 20 2b 20 2b 20 63 6f 6c 30 20 2a 20 63 6f 6c 32   + + col0 * col2
38140 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20   col0 FROM tab1 
38150 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
38160 36 32 0d 0a 33 36 34 38 0d 0a 37 36 38 30 0d 0a  62..3648..7680..
38170 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
38180 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20  t..SELECT ALL + 
38190 2d 20 63 6f 72 30 2e 63 6f 6c 31 20 2a 20 63 6f  - cor0.col1 * co
381a0 6c 31 20 2b 20 2d 20 63 6f 6c 32 20 46 52 4f 4d  l1 + - col2 FROM
381b0 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
381c0 2d 2d 2d 0d 0a 2d 37 34 32 39 0d 0a 2d 38 33 36  ---..-7429..-836
381d0 33 0d 0a 2d 39 34 31 30 0d 0a 0d 0a 71 75 65 72  3..-9410....quer
381e0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
381f0 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63  ECT DISTINCT - c
38200 6f 6c 30 20 2a 20 2d 20 63 6f 6c 32 20 2b 20 2d  ol0 * - col2 + -
38210 20 63 6f 72 30 2e 63 6f 6c 31 20 46 52 4f 4d 20   cor0.col1 FROM 
38220 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
38230 2d 2d 0d 0a 31 33 36 0d 0a 33 36 33 38 0d 0a 37  --..136..3638..7
38240 36 36 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  667....query I r
38250 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
38260 49 53 54 49 4e 43 54 20 2d 20 33 30 20 2a 20 2b  ISTINCT - 30 * +
38270 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46 52   col0 AS col0 FR
38280 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
38290 0a 2d 2d 2d 2d 0d 0a 2d 32 31 30 0d 0a 2d 32 33  .----..-210..-23
382a0 34 30 0d 0a 2d 32 33 37 30 0d 0a 0d 0a 71 75 65  40..-2370....que
382b0 72 79 20 49 49 49 49 49 49 49 49 49 49 49 49 49  ry IIIIIIIIIIIII
382c0 49 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45  II rowsort..SELE
382d0 43 54 20 41 4c 4c 20 2a 20 46 52 4f 4d 20 74 61  CT ALL * FROM ta
382e0 62 30 2c 20 74 61 62 30 20 41 53 20 63 6f 72 30  b0, tab0 AS cor0
382f0 2c 20 74 61 62 31 20 63 6f 72 31 2c 20 74 61 62  , tab1 cor1, tab
38300 32 2c 20 74 61 62 30 20 41 53 20 63 6f 72 32 0d  2, tab0 AS cor2.
38310 0a 2d 2d 2d 2d 0d 0a 33 36 34 35 20 76 61 6c 75  .----..3645 valu
38320 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 63 61  es hashing to ca
38330 34 63 37 39 61 31 36 32 66 39 32 34 35 34 65 30  4c79a162f92454e0
38340 35 34 34 37 30 37 62 38 39 37 35 32 31 61 0d 0a  544707b897521a..
38350 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
38360 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f   use DIV operato
38370 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69  r for integer di
38380 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20  vision..query I 
38390 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 35  rowsort label-15
383a0 37 30 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  70..SELECT DISTI
383b0 4e 43 54 20 2d 20 2d 20 63 6f 6c 31 20 2b 20 2d  NCT - - col1 + -
383c0 20 63 6f 6c 31 20 44 49 56 20 63 6f 72 30 2e 63   col1 DIV cor0.c
383d0 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol1 FROM tab0 AS
383e0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 38 35 0d   cor0..----..85.
383f0 0a 39 30 0d 0a 39 36 0d 0a 0d 0a 73 6b 69 70 69  .90..96....skipi
38400 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
38410 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
38420 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
38430 31 35 37 30 0d 0a 53 45 4c 45 43 54 20 44 49 53  1570..SELECT DIS
38440 54 49 4e 43 54 20 2d 20 2d 20 63 6f 6c 31 20 2b  TINCT - - col1 +
38450 20 2d 20 63 6f 6c 31 20 2f 20 63 6f 72 30 2e 63   - col1 / cor0.c
38460 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol1 FROM tab0 AS
38470 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 38 35 0d   cor0..----..85.
38480 0a 39 30 0d 0a 39 36 0d 0a 0d 0a 71 75 65 72 79  .90..96....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 41 4c 4c 20 2b 20 63 6f 6c 31 20 2a 20  CT ALL + col1 * 
384b0 32 39 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  29 FROM tab0 AS 
384c0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 34 39 34  cor0..----..2494
384d0 0d 0a 32 36 33 39 0d 0a 32 38 31 33 0d 0a 0d 0a  ..2639..2813....
384e0 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71  skipif postgresq
384f0 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72  l # PostgreSQL r
38500 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20  equires AS when 
38510 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20  renaming output 
38520 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49  columns..query I
38530 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
38540 20 44 49 53 54 49 4e 43 54 20 2d 20 2d 20 63 6f   DISTINCT - - co
38550 6c 31 20 2a 20 2b 20 38 36 20 63 6f 6c 30 20 46  l1 * + 86 col0 F
38560 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
38570 0d 0a 2d 2d 2d 2d 0d 0a 37 33 39 36 0d 0a 37 38  ..----..7396..78
38580 32 36 0d 0a 38 33 34 32 0d 0a 0d 0a 71 75 65 72  26..8342....quer
38590 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
385a0 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 2b  ECT DISTINCT + +
385b0 20 63 6f 6c 32 20 2b 20 34 20 41 53 20 63 6f 6c   col2 + 4 AS col
385c0 30 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30  0 FROM tab0 cor0
385d0 0d 0a 2d 2d 2d 2d 0d 0a 33 37 0d 0a 35 0d 0a 38  ..----..37..5..8
385e0 36 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  6....onlyif mysq
385f0 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72  l # use DIV oper
38600 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72  ator for integer
38610 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79   division..query
38620 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
38630 2d 31 35 37 34 0d 0a 53 45 4c 45 43 54 20 2b 20  -1574..SELECT + 
38640 2d 20 63 6f 6c 31 20 44 49 56 20 2b 20 63 6f 72  - col1 DIV + cor
38650 30 2e 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32  0.col0 FROM tab2
38660 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
38670 2d 34 0d 0a 30 0d 0a 30 0d 0a 0d 0a 73 6b 69 70  -4..0..0....skip
38680 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
38690 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
386a0 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
386b0 2d 31 35 37 34 0d 0a 53 45 4c 45 43 54 20 2b 20  -1574..SELECT + 
386c0 2d 20 63 6f 6c 31 20 2f 20 2b 20 63 6f 72 30 2e  - col1 / + cor0.
386d0 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41  col0 FROM tab2 A
386e0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 34  S cor0..----..-4
386f0 0d 0a 30 0d 0a 30 0d 0a 0d 0a 71 75 65 72 79 20  ..0..0....query 
38700 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
38710 54 20 2b 20 2b 20 63 6f 6c 30 20 2a 20 32 31 20  T + + col0 * 21 
38720 2b 20 2d 20 38 34 20 2a 20 63 6f 72 30 2e 63 6f  + - 84 * cor0.co
38730 6c 31 20 2a 20 2d 20 63 6f 6c 31 20 2d 20 2b 20  l1 * - col1 - + 
38740 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41  col0 FROM tab0 A
38750 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 36 32  S cor0..----..62
38760 31 37 34 34 0d 0a 36 39 37 33 38 34 0d 0a 37 39  1744..697384..79
38770 31 30 35 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20  1056....query I 
38780 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
38790 41 4c 4c 20 63 6f 6c 32 20 2a 20 28 20 63 6f 6c  ALL col2 * ( col
387a0 32 20 2a 20 2d 20 63 6f 6c 31 20 2b 20 2d 20 63  2 * - col1 + - c
387b0 6f 6c 31 20 29 20 41 53 20 63 6f 6c 30 20 46 52  ol1 ) AS col0 FR
387c0 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d  OM tab2 cor0..--
387d0 2d 2d 0d 0a 2d 32 33 34 33 36 0d 0a 2d 32 35 31  --..-23436..-251
387e0 39 34 0d 0a 2d 34 31 34 31 38 0d 0a 0d 0a 71 75  94..-41418....qu
387f0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
38800 45 4c 45 43 54 20 41 4c 4c 20 63 6f 72 30 2e 63  ELECT ALL cor0.c
38810 6f 6c 30 20 2a 20 2b 20 35 34 20 2b 20 63 6f 6c  ol0 * + 54 + col
38820 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  0 AS col2 FROM t
38830 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
38840 2d 0d 0a 31 36 35 0d 0a 33 35 32 30 0d 0a 34 34  -..165..3520..44
38850 30 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  00....query I ro
38860 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
38870 4c 20 28 20 39 39 20 29 20 41 53 20 63 6f 6c 30  L ( 99 ) AS col0
38880 20 46 52 4f 4d 20 74 61 62 32 2c 20 74 61 62 32   FROM tab2, tab2
38890 20 41 53 20 63 6f 72 30 2c 20 74 61 62 31 20 41   AS cor0, tab1 A
388a0 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 32 37  S cor1..----..27
388b0 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20   values hashing 
388c0 74 6f 20 30 35 65 61 31 38 32 66 64 36 30 33 36  to 05ea182fd6036
388d0 63 37 66 35 65 30 65 61 30 38 66 63 30 36 31 63  c7f5e0ea08fc061c
388e0 63 36 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  c67....query I r
388f0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
38900 20 2d 20 74 61 62 31 2e 63 6f 6c 32 20 46 52 4f   - tab1.col2 FRO
38910 4d 20 74 61 62 31 2c 20 74 61 62 30 2c 20 74 61  M tab1, tab0, ta
38920 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32  b1 cor0..----..2
38930 37 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67  7 values hashing
38940 20 74 6f 20 37 66 34 61 39 62 66 32 34 64 36 34   to 7f4a9bf24d64
38950 38 33 33 37 30 36 64 66 62 64 64 30 62 61 66 34  833706dfbdd0baf4
38960 39 64 37 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20  9d79....query I 
38970 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
38980 63 6f 72 30 2e 63 6f 6c 30 20 2b 20 2d 20 74 61  cor0.col0 + - ta
38990 62 30 2e 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20  b0.col1 AS col2 
389a0 46 52 4f 4d 20 74 61 62 30 2c 20 74 61 62 32 20  FROM tab0, tab2 
389b0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61  cor0..----..9 va
389c0 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20  lues hashing to 
389d0 34 38 38 31 66 39 66 38 37 37 66 30 31 37 65 66  4881f9f877f017ef
389e0 30 65 32 32 62 31 34 32 35 34 34 34 37 33 36 63  0e22b1425444736c
389f0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
38a00 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2b 20  ort..SELECT + + 
38a10 63 6f 72 30 2e 63 6f 6c 32 20 2a 20 2d 20 63 6f  cor0.col2 * - co
38a20 6c 32 20 2b 20 63 6f 6c 31 20 2a 20 2d 20 63 6f  l2 + col1 * - co
38a30 6c 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  l0 AS col2 FROM 
38a40 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
38a50 2d 2d 0d 0a 2d 32 37 38 37 0d 0a 2d 35 32 37 38  --..-2787..-5278
38a60 0d 0a 2d 39 34 36 0d 0a 0d 0a 71 75 65 72 79 20  ..-946....query 
38a70 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
38a80 54 20 2b 20 63 6f 6c 32 20 2a 20 2d 20 33 39 20  T + col2 * - 39 
38a90 2d 20 2d 20 63 6f 6c 30 20 41 53 20 63 6f 6c 32  - - col0 AS col2
38aa0 20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d   FROM tab1 cor0.
38ab0 0a 2d 2d 2d 2d 0d 0a 2d 32 31 30 33 0d 0a 2d 32  .----..-2103..-2
38ac0 31 35 39 0d 0a 2d 33 36 36 34 0d 0a 0d 0a 71 75  159..-3664....qu
38ad0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
38ae0 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 32 20 2b  ELECT ALL col2 +
38af0 20 2d 20 33 36 20 41 53 20 63 6f 6c 31 20 46 52   - 36 AS col1 FR
38b00 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  OM tab0..----..-
38b10 33 0d 0a 2d 33 35 0d 0a 34 36 0d 0a 0d 0a 71 75  3..-35..46....qu
38b20 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
38b30 45 4c 45 43 54 20 2b 20 63 6f 6c 32 20 2b 20 2d  ELECT + col2 + -
38b40 20 28 20 39 35 20 29 20 46 52 4f 4d 20 74 61 62   ( 95 ) FROM tab
38b50 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 37 0d 0a 2d 36  2..----..-57..-6
38b60 38 0d 0a 2d 36 39 0d 0a 0d 0a 71 75 65 72 79 20  8..-69....query 
38b70 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
38b80 54 20 38 20 2a 20 2b 20 63 6f 6c 32 20 2a 20 2d  T 8 * + col2 * -
38b90 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 0d   col2 FROM tab0.
38ba0 0a 2d 2d 2d 2d 0d 0a 2d 35 33 37 39 32 0d 0a 2d  .----..-53792..-
38bb0 38 0d 0a 2d 38 37 31 32 0d 0a 0d 0a 6f 6e 6c 79  8..-8712....only
38bc0 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f  if mysql # suppo
38bd0 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65  rt for MySQL spe
38be0 63 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70  cific system typ
38bf0 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71  es and syntax..q
38c00 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
38c10 61 62 65 6c 2d 31 35 38 36 0d 0a 53 45 4c 45 43  abel-1586..SELEC
38c20 54 20 43 41 53 54 28 20 4e 55 4c 4c 20 41 53 20  T CAST( NULL AS 
38c30 53 49 47 4e 45 44 20 29 20 2b 20 2d 20 63 6f 6c  SIGNED ) + - col
38c40 32 20 2a 20 2d 20 63 6f 6c 30 20 2b 20 74 61 62  2 * - col0 + tab
38c50 32 2e 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32  2.col2 FROM tab2
38c60 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55  ..----..NULL..NU
38c70 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a