sqllogictest
Hex Artifact Content
Not logged in

Artifact aabefe3dd2431109c680d284e185815973a7fd9e:


0000: 68 61 73 68 2d 74 68 72 65 73 68 6f 6c 64 20 38  hash-threshold 8
0010: 0d 0a 0d 0a 73 74 61 74 65 6d 65 6e 74 20 6f 6b  ....statement ok
0020: 0d 0a 43 52 45 41 54 45 20 54 41 42 4c 45 20 74  ..CREATE TABLE t
0030: 61 62 30 28 63 6f 6c 30 20 49 4e 54 45 47 45 52  ab0(col0 INTEGER
0040: 2c 20 63 6f 6c 31 20 49 4e 54 45 47 45 52 2c 20  , col1 INTEGER, 
0050: 63 6f 6c 32 20 49 4e 54 45 47 45 52 29 0d 0a 0d  col2 INTEGER)...
0060: 0a 73 74 61 74 65 6d 65 6e 74 20 6f 6b 0d 0a 43  .statement ok..C
0070: 52 45 41 54 45 20 54 41 42 4c 45 20 74 61 62 31  REATE TABLE tab1
0080: 28 63 6f 6c 30 20 49 4e 54 45 47 45 52 2c 20 63  (col0 INTEGER, c
0090: 6f 6c 31 20 49 4e 54 45 47 45 52 2c 20 63 6f 6c  ol1 INTEGER, col
00a0: 32 20 49 4e 54 45 47 45 52 29 0d 0a 0d 0a 73 74  2 INTEGER)....st
00b0: 61 74 65 6d 65 6e 74 20 6f 6b 0d 0a 43 52 45 41  atement ok..CREA
00c0: 54 45 20 54 41 42 4c 45 20 74 61 62 32 28 63 6f  TE TABLE tab2(co
00d0: 6c 30 20 49 4e 54 45 47 45 52 2c 20 63 6f 6c 31  l0 INTEGER, col1
00e0: 20 49 4e 54 45 47 45 52 2c 20 63 6f 6c 32 20 49   INTEGER, col2 I
00f0: 4e 54 45 47 45 52 29 0d 0a 0d 0a 73 74 61 74 65  NTEGER)....state
0100: 6d 65 6e 74 20 6f 6b 0d 0a 49 4e 53 45 52 54 20  ment ok..INSERT 
0110: 49 4e 54 4f 20 74 61 62 30 20 56 41 4c 55 45 53  INTO tab0 VALUES
0120: 28 38 39 2c 39 31 2c 38 32 29 0d 0a 0d 0a 73 74  (89,91,82)....st
0130: 61 74 65 6d 65 6e 74 20 6f 6b 0d 0a 49 4e 53 45  atement ok..INSE
0140: 52 54 20 49 4e 54 4f 20 74 61 62 30 20 56 41 4c  RT INTO tab0 VAL
0150: 55 45 53 28 33 35 2c 39 37 2c 31 29 0d 0a 0d 0a  UES(35,97,1)....
0160: 73 74 61 74 65 6d 65 6e 74 20 6f 6b 0d 0a 49 4e  statement ok..IN
0170: 53 45 52 54 20 49 4e 54 4f 20 74 61 62 30 20 56  SERT INTO tab0 V
0180: 41 4c 55 45 53 28 32 34 2c 38 36 2c 33 33 29 0d  ALUES(24,86,33).
0190: 0a 0d 0a 73 74 61 74 65 6d 65 6e 74 20 6f 6b 0d  ...statement ok.
01a0: 0a 49 4e 53 45 52 54 20 49 4e 54 4f 20 74 61 62  .INSERT INTO tab
01b0: 31 20 56 41 4c 55 45 53 28 36 34 2c 31 30 2c 35  1 VALUES(64,10,5
01c0: 37 29 0d 0a 0d 0a 73 74 61 74 65 6d 65 6e 74 20  7)....statement 
01d0: 6f 6b 0d 0a 49 4e 53 45 52 54 20 49 4e 54 4f 20  ok..INSERT INTO 
01e0: 74 61 62 31 20 56 41 4c 55 45 53 28 33 2c 32 36  tab1 VALUES(3,26
01f0: 2c 35 34 29 0d 0a 0d 0a 73 74 61 74 65 6d 65 6e  ,54)....statemen
0200: 74 20 6f 6b 0d 0a 49 4e 53 45 52 54 20 49 4e 54  t ok..INSERT INT
0210: 4f 20 74 61 62 31 20 56 41 4c 55 45 53 28 38 30  O tab1 VALUES(80
0220: 2c 31 33 2c 39 36 29 0d 0a 0d 0a 73 74 61 74 65  ,13,96)....state
0230: 6d 65 6e 74 20 6f 6b 0d 0a 49 4e 53 45 52 54 20  ment ok..INSERT 
0240: 49 4e 54 4f 20 74 61 62 32 20 56 41 4c 55 45 53  INTO tab2 VALUES
0250: 28 37 2c 33 31 2c 32 37 29 0d 0a 0d 0a 73 74 61  (7,31,27)....sta
0260: 74 65 6d 65 6e 74 20 6f 6b 0d 0a 49 4e 53 45 52  tement ok..INSER
0270: 54 20 49 4e 54 4f 20 74 61 62 32 20 56 41 4c 55  T INTO tab2 VALU
0280: 45 53 28 37 39 2c 31 37 2c 33 38 29 0d 0a 0d 0a  ES(79,17,38)....
0290: 73 74 61 74 65 6d 65 6e 74 20 6f 6b 0d 0a 49 4e  statement ok..IN
02a0: 53 45 52 54 20 49 4e 54 4f 20 74 61 62 32 20 56  SERT INTO tab2 V
02b0: 41 4c 55 45 53 28 37 38 2c 35 39 2c 32 36 29 0d  ALUES(78,59,26).
02c0: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
02d0: 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c  rt..SELECT - col
02e0: 32 20 2a 20 2b 20 33 33 20 41 53 20 63 6f 6c 31  2 * + 33 AS col1
02f0: 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d   FROM tab0..----
0300: 0d 0a 2d 31 30 38 39 0d 0a 2d 32 37 30 36 0d 0a  ..-1089..-2706..
0310: 2d 33 33 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  -33....onlyif my
0320: 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70  sql # use DIV op
0330: 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67  erator for integ
0340: 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65  er division..que
0350: 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
0360: 65 6c 2d 31 0d 0a 53 45 4c 45 43 54 20 2d 20 63  el-1..SELECT - c
0370: 6f 6c 32 20 2d 20 2b 20 43 41 53 54 28 20 2d 20  ol2 - + CAST( - 
0380: 63 6f 6c 31 20 41 53 20 53 49 47 4e 45 44 20 29  col1 AS SIGNED )
0390: 20 44 49 56 20 2b 20 63 6f 6c 32 20 41 53 20 63   DIV + col2 AS c
03a0: 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol0 FROM tab0 AS
03b0: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 31   cor0..----..-31
03c0: 0d 0a 2d 38 31 0d 0a 39 36 0d 0a 0d 0a 73 6b 69  ..-81..96....ski
03d0: 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
03e0: 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
03f0: 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
0400: 6c 2d 31 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f  l-1..SELECT - co
0410: 6c 32 20 2d 20 2b 20 43 41 53 54 20 28 20 2d 20  l2 - + CAST ( - 
0420: 63 6f 6c 31 20 41 53 20 49 4e 54 45 47 45 52 20  col1 AS INTEGER 
0430: 29 20 2f 20 2b 20 63 6f 6c 32 20 41 53 20 63 6f  ) / + col2 AS co
0440: 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l0 FROM tab0 AS 
0450: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 31 0d  cor0..----..-31.
0460: 0a 2d 38 31 0d 0a 39 36 0d 0a 0d 0a 71 75 65 72  .-81..96....quer
0470: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
0480: 45 43 54 20 63 6f 72 30 2e 63 6f 6c 32 20 2a 20  ECT cor0.col2 * 
0490: 2d 20 28 20 63 6f 6c 32 20 2a 20 63 6f 6c 30 20  - ( col2 * col0 
04a0: 29 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c 32  ) + col0 AS col2
04b0: 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
04c0: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 36 31 31 32  r0..----..-26112
04d0: 0d 0a 2d 35 39 38 33 34 37 0d 0a 30 0d 0a 0d 0a  ..-598347..0....
04e0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
04f0: 0a 53 45 4c 45 43 54 20 2d 20 63 6f 72 30 2e 63  .SELECT - cor0.c
0500: 6f 6c 32 20 2b 20 32 31 20 41 53 20 63 6f 6c 32  ol2 + 21 AS col2
0510: 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
0520: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 37 0d 0a 2d  r0..----..-17..-
0530: 35 0d 0a 2d 36 0d 0a 0d 0a 71 75 65 72 79 20 49  5..-6....query I
0540: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
0550: 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 30 20 2a   DISTINCT col0 *
0560: 20 28 20 2d 20 63 6f 6c 30 20 29 20 46 52 4f 4d   ( - col0 ) FROM
0570: 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
0580: 2d 2d 2d 0d 0a 2d 34 30 39 36 0d 0a 2d 36 34 30  ---..-4096..-640
0590: 30 0d 0a 2d 39 0d 0a 0d 0a 73 6b 69 70 69 66 20  0..-9....skipif 
05a0: 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73  postgresql # Pos
05b0: 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73  tgreSQL requires
05c0: 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e   AS when renamin
05d0: 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73  g output columns
05e0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
05f0: 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 31  t..SELECT - col1
0600: 20 2a 20 2d 20 63 6f 6c 30 20 2d 20 37 39 20 63   * - col0 - 79 c
0610: 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol2 FROM tab1 AS
0620: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d   cor0..----..-1.
0630: 0a 35 36 31 0d 0a 39 36 31 0d 0a 0d 0a 71 75 65  .561..961....que
0640: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
0650: 4c 45 43 54 20 63 6f 6c 31 20 2d 20 2b 20 36 34  LECT col1 - + 64
0660: 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
0670: 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
0680: 0d 0a 32 32 0d 0a 32 37 0d 0a 33 33 0d 0a 0d 0a  ..22..27..33....
0690: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
06a0: 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 32  .SELECT ALL col2
06b0: 20 2a 20 2b 20 36 30 20 46 52 4f 4d 20 74 61 62   * + 60 FROM tab
06c0: 30 0d 0a 2d 2d 2d 2d 0d 0a 31 39 38 30 0d 0a 34  0..----..1980..4
06d0: 39 32 30 0d 0a 36 30 0d 0a 0d 0a 6f 6e 6c 79 69  920..60....onlyi
06e0: 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72  f mysql # suppor
06f0: 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63  t for MySQL spec
0700: 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65  ific system type
0710: 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75  s and syntax..qu
0720: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
0730: 62 65 6c 2d 38 0d 0a 53 45 4c 45 43 54 20 44 49  bel-8..SELECT DI
0740: 53 54 49 4e 43 54 20 2d 20 2b 20 43 41 53 54 28  STINCT - + CAST(
0750: 20 4e 55 4c 4c 20 41 53 20 44 45 43 49 4d 41 4c   NULL AS DECIMAL
0760: 20 29 20 2a 20 2d 20 63 6f 6c 32 20 41 53 20 63   ) * - col2 AS c
0770: 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 63 6f  ol0 FROM tab0 co
0780: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a  r0..----..NULL..
0790: 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
07a0: 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
07b0: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
07c0: 20 6c 61 62 65 6c 2d 38 0d 0a 53 45 4c 45 43 54   label-8..SELECT
07d0: 20 44 49 53 54 49 4e 43 54 20 2d 20 2b 20 43 41   DISTINCT - + CA
07e0: 53 54 20 28 20 4e 55 4c 4c 20 41 53 20 52 45 41  ST ( NULL AS REA
07f0: 4c 20 29 20 2a 20 2d 20 63 6f 6c 32 20 41 53 20  L ) * - col2 AS 
0800: 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 63  col0 FROM tab0 c
0810: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d  or0..----..NULL.
0820: 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
0830: 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74  # use DIV operat
0840: 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64  or for integer d
0850: 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49  ivision..query I
0860: 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 39   rowsort label-9
0870: 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 2d  ..SELECT ALL + -
0880: 20 63 6f 6c 30 20 44 49 56 20 2d 20 36 36 20 46   col0 DIV - 66 F
0890: 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
08a0: 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 31 0d  ..----..0..0..1.
08b0: 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
08c0: 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
08d0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
08e0: 74 20 6c 61 62 65 6c 2d 39 0d 0a 53 45 4c 45 43  t label-9..SELEC
08f0: 54 20 41 4c 4c 20 2b 20 2d 20 63 6f 6c 30 20 2f  T ALL + - col0 /
0900: 20 2d 20 36 36 20 46 52 4f 4d 20 74 61 62 30 20   - 66 FROM tab0 
0910: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30  AS cor0..----..0
0920: 0d 0a 30 0d 0a 31 0d 0a 0d 0a 71 75 65 72 79 20  ..0..1....query 
0930: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
0940: 54 20 28 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20  T ( + cor0.col0 
0950: 29 20 2a 20 2b 20 63 6f 6c 32 20 2d 20 2b 20 37  ) * + col2 - + 7
0960: 38 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  8 FROM tab2 AS c
0970: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 31 0d 0a  or0..----..111..
0980: 31 39 35 30 0d 0a 32 39 32 34 0d 0a 0d 0a 6f 6e  1950..2924....on
0990: 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70  lyif mysql # sup
09a0: 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73  port for MySQL s
09b0: 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20 74  pecific system t
09c0: 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d  ypes and syntax.
09d0: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
09e0: 20 6c 61 62 65 6c 2d 31 31 0d 0a 53 45 4c 45 43   label-11..SELEC
09f0: 54 20 2b 20 63 6f 6c 30 20 2a 20 2d 20 43 41 53  T + col0 * - CAS
0a00: 54 28 20 2b 20 63 6f 6c 32 20 41 53 20 53 49 47  T( + col2 AS SIG
0a10: 4e 45 44 20 29 20 46 52 4f 4d 20 74 61 62 32 20  NED ) FROM tab2 
0a20: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 38 39  cor0..----..-189
0a30: 0d 0a 2d 32 30 32 38 0d 0a 2d 33 30 30 32 0d 0a  ..-2028..-3002..
0a40: 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
0a50: 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
0a60: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
0a70: 20 6c 61 62 65 6c 2d 31 31 0d 0a 53 45 4c 45 43   label-11..SELEC
0a80: 54 20 2b 20 63 6f 6c 30 20 2a 20 2d 20 43 41 53  T + col0 * - CAS
0a90: 54 20 28 20 2b 20 63 6f 6c 32 20 41 53 20 49 4e  T ( + col2 AS IN
0aa0: 54 45 47 45 52 20 29 20 46 52 4f 4d 20 74 61 62  TEGER ) FROM tab
0ab0: 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  2 cor0..----..-1
0ac0: 38 39 0d 0a 2d 32 30 32 38 0d 0a 2d 33 30 30 32  89..-2028..-3002
0ad0: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
0ae0: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
0af0: 63 6f 6c 30 20 2d 20 63 6f 6c 31 20 2a 20 2b 20  col0 - col1 * + 
0b00: 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c 32 20 41 53  col0 * - col2 AS
0b10: 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 0d   col0 FROM tab2.
0b20: 0a 2d 2d 2d 2d 0d 0a 31 31 39 37 33 30 0d 0a 35  .----..119730..5
0b30: 31 31 31 33 0d 0a 35 38 36 36 0d 0a 0d 0a 71 75  1113..5866....qu
0b40: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
0b50: 45 4c 45 43 54 20 41 4c 4c 20 2d 20 34 31 20 41  ELECT ALL - 41 A
0b60: 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31  S col0 FROM tab1
0b70: 2c 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  , tab1 AS cor0..
0b80: 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68  ----..9 values h
0b90: 61 73 68 69 6e 67 20 74 6f 20 34 62 61 30 63 31  ashing to 4ba0c1
0ba0: 30 32 30 39 31 66 39 63 62 63 39 66 65 39 34 33  02091f9cbc9fe943
0bb0: 39 62 30 34 35 38 34 65 37 30 0d 0a 0d 0a 71 75  9b04584e70....qu
0bc0: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
0bd0: 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 30 20 2d  ELECT ALL col0 -
0be0: 20 2d 20 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c 32   - col1 * + col2
0bf0: 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
0c00: 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 33 32 38 0d 0a  b1..----..1328..
0c10: 31 34 30 37 0d 0a 36 33 34 0d 0a 0d 0a 6f 6e 6c  1407..634....onl
0c20: 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20  yif mysql # use 
0c30: 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72  DIV operator for
0c40: 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f   integer divisio
0c50: 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  n..query I rowso
0c60: 72 74 20 6c 61 62 65 6c 2d 31 35 0d 0a 53 45 4c  rt label-15..SEL
0c70: 45 43 54 20 28 20 34 31 20 29 20 2a 20 63 6f 6c  ECT ( 41 ) * col
0c80: 30 20 44 49 56 20 2b 20 63 6f 6c 31 20 46 52 4f  0 DIV + col1 FRO
0c90: 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
0ca0: 2d 2d 2d 2d 0d 0a 31 31 0d 0a 31 34 0d 0a 34 30  ----..11..14..40
0cb0: 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
0cc0: 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
0cd0: 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
0ce0: 72 74 20 6c 61 62 65 6c 2d 31 35 0d 0a 53 45 4c  rt label-15..SEL
0cf0: 45 43 54 20 28 20 34 31 20 29 20 2a 20 63 6f 6c  ECT ( 41 ) * col
0d00: 30 20 2f 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20  0 / + col1 FROM 
0d10: 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
0d20: 2d 2d 0d 0a 31 31 0d 0a 31 34 0d 0a 34 30 0d 0a  --..11..14..40..
0d30: 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65  ..skipif postgre
0d40: 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c  sql # PostgreSQL
0d50: 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65   requires AS whe
0d60: 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75  n renaming outpu
0d70: 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79  t columns..query
0d80: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
0d90: 43 54 20 2b 20 2b 20 63 6f 6c 32 20 2a 20 2b 20  CT + + col2 * + 
0da0: 28 20 63 6f 6c 30 20 29 20 2a 20 2b 20 32 37 20  ( col0 ) * + 27 
0db0: 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41  col2 FROM tab0 A
0dc0: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 39  S cor0..----..19
0dd0: 37 30 34 36 0d 0a 32 31 33 38 34 0d 0a 39 34 35  7046..21384..945
0de0: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
0df0: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 30  ort..SELECT col0
0e00: 20 2d 20 63 6f 6c 32 20 2a 20 63 6f 6c 31 20 41   - col2 * col1 A
0e10: 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32  S col1 FROM tab2
0e20: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 34   cor0..----..-14
0e30: 35 36 0d 0a 2d 35 36 37 0d 0a 2d 38 33 30 0d 0a  56..-567..-830..
0e40: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
0e50: 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
0e60: 43 54 20 2d 20 63 6f 6c 31 20 2a 20 2d 20 31 31  CT - col1 * - 11
0e70: 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
0e80: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 30 0d 0a 31  r0..----..110..1
0e90: 34 33 0d 0a 32 38 36 0d 0a 0d 0a 71 75 65 72 79  43..286....query
0ea0: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
0eb0: 43 54 20 2d 20 28 20 2d 20 63 6f 6c 32 20 29 20  CT - ( - col2 ) 
0ec0: 2b 20 2d 20 63 6f 6c 30 20 2a 20 63 6f 6c 30 20  + - col0 * col0 
0ed0: 2a 20 2d 20 63 6f 72 30 2e 63 6f 6c 30 20 41 53  * - cor0.col0 AS
0ee0: 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20   col0 FROM tab0 
0ef0: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
0f00: 33 38 35 37 0d 0a 34 32 38 37 36 0d 0a 37 30 35  3857..42876..705
0f10: 30 35 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  051....query I r
0f20: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
0f30: 4c 4c 20 2d 20 33 31 20 2a 20 63 6f 6c 32 20 2b  LL - 31 * col2 +
0f40: 20 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46 52   col2 AS col0 FR
0f50: 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
0f60: 0a 2d 2d 2d 2d 0d 0a 2d 31 31 34 30 0d 0a 2d 37  .----..-1140..-7
0f70: 38 30 0d 0a 2d 38 31 30 0d 0a 0d 0a 6f 6e 6c 79  80..-810....only
0f80: 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44  if mysql # use D
0f90: 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20  IV operator for 
0fa0: 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e  integer division
0fb0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
0fc0: 74 20 6c 61 62 65 6c 2d 32 31 0d 0a 53 45 4c 45  t label-21..SELE
0fd0: 43 54 20 2b 20 33 32 20 2b 20 63 6f 6c 32 20 2a  CT + 32 + col2 *
0fe0: 20 2d 20 63 6f 6c 30 20 2d 20 2b 20 63 6f 6c 31   - col0 - + col1
0ff0: 20 44 49 56 20 63 6f 6c 32 20 63 6f 6c 31 20 46   DIV col2 col1 F
1000: 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
1010: 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 30 0d 0a 2d 33  ..----..-130..-3
1020: 36 31 36 0d 0a 2d 37 36 34 38 0d 0a 0d 0a 73 6b  616..-7648....sk
1030: 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20  ipif postgresql 
1040: 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71  # PostgreSQL req
1050: 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65  uires AS when re
1060: 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f  naming output co
1070: 6c 75 6d 6e 73 0d 0a 73 6b 69 70 69 66 20 6d 79  lumns..skipif my
1080: 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
1090: 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
10a0: 77 73 6f 72 74 20 6c 61 62 65 6c 2d 32 31 0d 0a  wsort label-21..
10b0: 53 45 4c 45 43 54 20 2b 20 33 32 20 2b 20 63 6f  SELECT + 32 + co
10c0: 6c 32 20 2a 20 2d 20 63 6f 6c 30 20 2d 20 2b 20  l2 * - col0 - + 
10d0: 63 6f 6c 31 20 2f 20 63 6f 6c 32 20 63 6f 6c 31  col1 / col2 col1
10e0: 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
10f0: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 30 0d 0a  r0..----..-130..
1100: 2d 33 36 31 36 0d 0a 2d 37 36 34 38 0d 0a 0d 0a  -3616..-7648....
1110: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
1120: 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
1130: 20 2b 20 2d 20 28 20 63 6f 6c 30 20 29 20 2a 20   + - ( col0 ) * 
1140: 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41  col2 FROM tab1 A
1150: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
1160: 36 32 0d 0a 2d 33 36 34 38 0d 0a 2d 37 36 38 30  62..-3648..-7680
1170: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
1180: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
1190: 49 4e 43 54 20 2d 20 36 39 20 2a 20 2d 20 63 6f  INCT - 69 * - co
11a0: 6c 32 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  l2 AS col1 FROM 
11b0: 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab0 cor0..----.
11c0: 0a 32 32 37 37 0d 0a 35 36 35 38 0d 0a 36 39 0d  .2277..5658..69.
11d0: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
11e0: 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
11f0: 4e 43 54 20 63 6f 6c 31 20 2b 20 2d 20 34 34 20  NCT col1 + - 44 
1200: 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
1210: 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
1220: 0a 34 32 0d 0a 34 37 0d 0a 35 33 0d 0a 0d 0a 71  .42..47..53....q
1230: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
1240: 53 45 4c 45 43 54 20 2d 20 28 20 63 6f 6c 32 20  SELECT - ( col2 
1250: 29 20 2a 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20  ) * + col0 FROM 
1260: 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab2 cor0..----.
1270: 0a 2d 31 38 39 0d 0a 2d 32 30 32 38 0d 0a 2d 33  .-189..-2028..-3
1280: 30 30 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  002....query I r
1290: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
12a0: 4c 4c 20 2d 20 2b 20 63 6f 72 30 2e 63 6f 6c 32  LL - + cor0.col2
12b0: 20 2a 20 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c 32   * col2 * + col2
12c0: 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
12d0: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 35 37 34 36  r0..----..-15746
12e0: 34 0d 0a 2d 31 38 35 31 39 33 0d 0a 2d 38 38 34  4..-185193..-884
12f0: 37 33 36 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  736....onlyif my
1300: 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f  sql # support fo
1310: 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63  r MySQL specific
1320: 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e   system types an
1330: 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20  d syntax..query 
1340: 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
1350: 32 37 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b  27..SELECT ALL +
1360: 20 63 6f 6c 32 20 2d 20 28 20 63 6f 6c 31 20 2b   col2 - ( col1 +
1370: 20 43 41 53 54 28 20 2b 20 63 6f 6c 30 20 41 53   CAST( + col0 AS
1380: 20 53 49 47 4e 45 44 20 29 20 29 20 46 52 4f 4d   SIGNED ) ) FROM
1390: 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
13a0: 2d 2d 2d 0d 0a 2d 31 33 31 0d 0a 2d 37 37 0d 0a  ---..-131..-77..
13b0: 2d 39 38 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  -98....skipif my
13c0: 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
13d0: 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
13e0: 77 73 6f 72 74 20 6c 61 62 65 6c 2d 32 37 0d 0a  wsort label-27..
13f0: 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c  SELECT ALL + col
1400: 32 20 2d 20 28 20 63 6f 6c 31 20 2b 20 43 41 53  2 - ( col1 + CAS
1410: 54 20 28 20 2b 20 63 6f 6c 30 20 41 53 20 49 4e  T ( + col0 AS IN
1420: 54 45 47 45 52 20 29 20 29 20 46 52 4f 4d 20 74  TEGER ) ) FROM t
1430: 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
1440: 2d 0d 0a 2d 31 33 31 0d 0a 2d 37 37 0d 0a 2d 39  -..-131..-77..-9
1450: 38 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74  8....skipif post
1460: 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65  gresql # Postgre
1470: 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20  SQL requires AS 
1480: 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75  when renaming ou
1490: 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75  tput columns..qu
14a0: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
14b0: 45 4c 45 43 54 20 63 6f 6c 31 20 2a 20 63 6f 6c  ELECT col1 * col
14c0: 30 20 2b 20 28 20 63 6f 6c 30 20 29 20 2a 20 74  0 + ( col0 ) * t
14d0: 61 62 31 2e 63 6f 6c 32 20 63 6f 6c 31 20 46 52  ab1.col2 col1 FR
14e0: 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 32  OM tab1..----..2
14f0: 34 30 0d 0a 34 32 38 38 0d 0a 38 37 32 30 0d 0a  40..4288..8720..
1500: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1510: 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 31 20 2b  t..SELECT col1 +
1520: 20 63 6f 6c 30 20 2a 20 33 37 20 2a 20 63 6f 6c   col0 * 37 * col
1530: 31 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  1 AS col2 FROM t
1540: 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 35 37 31  ab0..----..12571
1550: 32 0d 0a 32 39 39 37 35 34 0d 0a 37 36 34 35 34  2..299754..76454
1560: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
1570: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 33 31 20 2a  ort..SELECT 31 *
1580: 20 63 6f 72 30 2e 63 6f 6c 32 20 46 52 4f 4d 20   cor0.col2 FROM 
1590: 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
15a0: 2d 2d 0d 0a 31 36 37 34 0d 0a 31 37 36 37 0d 0a  --..1674..1767..
15b0: 32 39 37 36 0d 0a 0d 0a 73 6b 69 70 69 66 20 70  2976....skipif p
15c0: 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74  ostgresql # Post
15d0: 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20  greSQL requires 
15e0: 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67  AS when renaming
15f0: 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d   output columns.
1600: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1610: 0d 0a 53 45 4c 45 43 54 20 2b 20 34 32 20 63 6f  ..SELECT + 42 co
1620: 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l1 FROM tab0 AS 
1630: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 34 32 0d 0a  cor0..----..42..
1640: 34 32 0d 0a 34 32 0d 0a 0d 0a 71 75 65 72 79 20  42..42....query 
1650: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
1660: 54 20 44 49 53 54 49 4e 43 54 20 39 30 20 2a 20  T DISTINCT 90 * 
1670: 63 6f 72 30 2e 63 6f 6c 30 20 41 53 20 63 6f 6c  cor0.col0 AS col
1680: 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  1 FROM tab2 AS c
1690: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 36 33 30 0d 0a  or0..----..630..
16a0: 37 30 32 30 0d 0a 37 31 31 30 0d 0a 0d 0a 71 75  7020..7110....qu
16b0: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
16c0: 45 4c 45 43 54 20 2b 20 36 34 20 2a 20 2d 20 63  ELECT + 64 * - c
16d0: 6f 72 30 2e 63 6f 6c 31 20 46 52 4f 4d 20 74 61  or0.col1 FROM ta
16e0: 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
16f0: 0d 0a 2d 31 36 36 34 0d 0a 2d 36 34 30 0d 0a 2d  ..-1664..-640..-
1700: 38 33 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  832....query I r
1710: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
1720: 4c 4c 20 2d 20 2d 20 63 6f 6c 30 20 2b 20 2d 20  LL - - col0 + - 
1730: 34 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  40 AS col2 FROM 
1740: 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
1750: 2d 2d 0d 0a 2d 33 37 0d 0a 32 34 0d 0a 34 30 0d  --..-37..24..40.
1760: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
1770: 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
1780: 4e 43 54 20 2b 20 63 6f 6c 30 20 2a 20 2d 20 63  NCT + col0 * - c
1790: 6f 6c 32 20 2b 20 63 6f 6c 31 20 2b 20 63 6f 6c  ol2 + col1 + col
17a0: 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  0 AS col1 FROM t
17b0: 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
17c0: 2d 0d 0a 2d 36 38 32 0d 0a 2d 37 31 31 38 0d 0a  -..-682..-7118..
17d0: 39 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  97....query I ro
17e0: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
17f0: 53 54 49 4e 43 54 20 2b 20 33 39 20 46 52 4f 4d  STINCT + 39 FROM
1800: 20 74 61 62 31 2c 20 74 61 62 30 20 41 53 20 63   tab1, tab0 AS c
1810: 6f 72 30 2c 20 74 61 62 31 20 63 6f 72 31 0d 0a  or0, tab1 cor1..
1820: 2d 2d 2d 2d 0d 0a 33 39 0d 0a 0d 0a 71 75 65 72  ----..39....quer
1830: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
1840: 45 43 54 20 63 6f 6c 30 20 2a 20 63 6f 6c 30 20  ECT col0 * col0 
1850: 2a 20 2d 20 33 32 20 46 52 4f 4d 20 74 61 62 30  * - 32 FROM tab0
1860: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
1870: 2d 31 38 34 33 32 0d 0a 2d 32 35 33 34 37 32 0d  -18432..-253472.
1880: 0a 2d 33 39 32 30 30 0d 0a 0d 0a 71 75 65 72 79  .-39200....query
1890: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
18a0: 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 2d 20  CT DISTINCT + - 
18b0: 38 30 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  80 AS col0 FROM 
18c0: 74 61 62 32 20 41 53 20 63 6f 72 30 20 43 52 4f  tab2 AS cor0 CRO
18d0: 53 53 20 4a 4f 49 4e 20 74 61 62 30 20 41 53 20  SS JOIN tab0 AS 
18e0: 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 38 30 0d  cor1..----..-80.
18f0: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
1900: 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b  rt..SELECT ALL +
1910: 20 28 20 63 6f 72 30 2e 63 6f 6c 30 20 29 20 46   ( cor0.col0 ) F
1920: 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
1930: 20 43 52 4f 53 53 20 4a 4f 49 4e 20 74 61 62 30   CROSS JOIN tab0
1940: 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a   AS cor1..----..
1950: 39 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67  9 values hashing
1960: 20 74 6f 20 39 35 62 39 36 63 61 31 64 62 65 32   to 95b96ca1dbe2
1970: 65 33 39 61 30 66 61 37 38 66 35 30 64 33 37 34  e39a0fa78f50d374
1980: 66 35 31 61 0d 0a 0d 0a 71 75 65 72 79 20 49 20  f51a....query I 
1990: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
19a0: 41 4c 4c 20 2d 20 2d 20 63 6f 6c 32 20 2b 20 63  ALL - - col2 + c
19b0: 6f 6c 30 20 2b 20 63 6f 6c 32 20 46 52 4f 4d 20  ol0 + col2 FROM 
19c0: 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab2 cor0..----.
19d0: 0a 31 33 30 0d 0a 31 35 35 0d 0a 36 31 0d 0a 0d  .130..155..61...
19e0: 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
19f0: 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72  use DIV operator
1a00: 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76   for integer div
1a10: 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72  ision..query I r
1a20: 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 34 31 0d  owsort label-41.
1a30: 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
1a40: 20 2b 20 32 34 20 44 49 56 20 2b 20 63 6f 6c 31   + 24 DIV + col1
1a50: 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
1a60: 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
1a70: 0d 0a 30 0d 0a 31 0d 0a 32 0d 0a 0d 0a 73 6b 69  ..0..1..2....ski
1a80: 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
1a90: 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
1aa0: 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
1ab0: 6c 2d 34 31 0d 0a 53 45 4c 45 43 54 20 44 49 53  l-41..SELECT DIS
1ac0: 54 49 4e 43 54 20 2b 20 32 34 20 2f 20 2b 20 63  TINCT + 24 / + c
1ad0: 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  ol1 AS col2 FROM
1ae0: 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
1af0: 2d 2d 2d 0d 0a 30 0d 0a 31 0d 0a 32 0d 0a 0d 0a  ---..0..1..2....
1b00: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
1b10: 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
1b20: 20 2d 20 2d 20 63 6f 6c 30 20 2a 20 2d 20 63 6f   - - col0 * - co
1b30: 6c 30 20 2d 20 31 30 20 2a 20 2b 20 63 6f 6c 30  l0 - 10 * + col0
1b40: 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
1b50: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 39 0d 0a 2d  r0..----..-39..-
1b60: 34 37 33 36 0d 0a 2d 37 32 30 30 0d 0a 0d 0a 71  4736..-7200....q
1b70: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
1b80: 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 2d 20 63  SELECT ALL - - c
1b90: 6f 6c 30 20 2b 20 2d 20 63 6f 6c 30 20 2a 20 63  ol0 + - col0 * c
1ba0: 6f 6c 32 20 2b 20 37 31 20 46 52 4f 4d 20 74 61  ol2 + 71 FROM ta
1bb0: 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
1bc0: 0d 0a 2d 33 35 31 33 0d 0a 2d 37 35 32 39 0d 0a  ..-3513..-7529..
1bd0: 2d 38 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  -88....query I r
1be0: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
1bf0: 4c 4c 20 2b 20 28 20 63 6f 72 30 2e 63 6f 6c 31  LL + ( cor0.col1
1c00: 20 29 20 2d 20 2d 20 37 37 20 46 52 4f 4d 20 74   ) - - 77 FROM t
1c10: 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
1c20: 2d 0d 0a 31 30 33 0d 0a 38 37 0d 0a 39 30 0d 0a  -..103..87..90..
1c30: 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65  ..skipif postgre
1c40: 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c  sql # PostgreSQL
1c50: 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65   requires AS whe
1c60: 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75  n renaming outpu
1c70: 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79  t columns..query
1c80: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
1c90: 43 54 20 41 4c 4c 20 63 6f 6c 31 20 2b 20 63 6f  CT ALL col1 + co
1ca0: 6c 32 20 2b 20 2b 20 63 6f 6c 30 20 2a 20 2b 20  l2 + + col0 * + 
1cb0: 63 6f 6c 32 20 63 6f 6c 31 20 46 52 4f 4d 20 74  col2 col1 FROM t
1cc0: 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
1cd0: 2d 0d 0a 32 31 31 33 0d 0a 32 34 37 0d 0a 33 30  -..2113..247..30
1ce0: 35 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  57....query I ro
1cf0: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
1d00: 53 54 49 4e 43 54 20 2b 20 28 20 2d 20 63 6f 6c  STINCT + ( - col
1d10: 31 20 29 20 2d 20 28 20 2d 20 63 6f 6c 31 20 29  1 ) - ( - col1 )
1d20: 20 2a 20 2b 20 63 6f 6c 32 20 46 52 4f 4d 20 74   * + col2 FROM t
1d30: 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab2 cor0..----..
1d40: 31 34 37 35 0d 0a 36 32 39 0d 0a 38 30 36 0d 0a  1475..629..806..
1d50: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1d60: 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
1d70: 43 54 20 31 38 20 2a 20 63 6f 6c 31 20 41 53 20  CT 18 * col1 AS 
1d80: 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41  col1 FROM tab2 A
1d90: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30  S cor0..----..10
1da0: 36 32 0d 0a 33 30 36 0d 0a 35 35 38 0d 0a 0d 0a  62..306..558....
1db0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
1dc0: 0a 53 45 4c 45 43 54 20 28 20 2b 20 63 6f 6c 32  .SELECT ( + col2
1dd0: 20 29 20 2a 20 2b 20 63 6f 6c 31 20 2d 20 63 6f   ) * + col1 - co
1de0: 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72  l2 FROM tab1 cor
1df0: 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 35 32 0d 0a 31  0..----..1152..1
1e00: 33 35 30 0d 0a 35 31 33 0d 0a 0d 0a 71 75 65 72  350..513....quer
1e10: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
1e20: 45 43 54 20 41 4c 4c 20 2b 20 2d 20 35 34 20 2a  ECT ALL + - 54 *
1e30: 20 2b 20 63 6f 6c 30 20 2b 20 63 6f 6c 30 20 46   + col0 + col0 F
1e40: 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
1e50: 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 35 39 0d 0a 2d 33  ..----..-159..-3
1e60: 33 39 32 0d 0a 2d 34 32 34 30 0d 0a 0d 0a 71 75  392..-4240....qu
1e70: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
1e80: 45 4c 45 43 54 20 2b 20 2b 20 36 38 20 2a 20 2b  ELECT + + 68 * +
1e90: 20 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46 52   col0 AS col1 FR
1ea0: 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
1eb0: 0a 2d 2d 2d 2d 0d 0a 34 37 36 0d 0a 35 33 30 34  .----..476..5304
1ec0: 0d 0a 35 33 37 32 0d 0a 0d 0a 71 75 65 72 79 20  ..5372....query 
1ed0: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
1ee0: 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 32 20  T DISTINCT col2 
1ef0: 2a 20 2d 20 63 6f 6c 32 20 2d 20 63 6f 6c 30 20  * - col2 - col0 
1f00: 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
1f10: 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 39 31 39 0d 0a  0..----..-2919..
1f20: 2d 33 33 31 33 0d 0a 2d 39 32 39 36 0d 0a 0d 0a  -3313..-9296....
1f30: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
1f40: 0a 53 45 4c 45 43 54 20 2d 20 28 20 2b 20 63 6f  .SELECT - ( + co
1f50: 6c 31 20 29 20 2b 20 31 36 20 2a 20 2b 20 63 6f  l1 ) + 16 * + co
1f60: 6c 31 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  l1 AS col0 FROM 
1f70: 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
1f80: 2d 2d 0d 0a 32 35 35 0d 0a 34 36 35 0d 0a 38 38  --..255..465..88
1f90: 35 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74  5....skipif post
1fa0: 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65  gresql # Postgre
1fb0: 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20  SQL requires AS 
1fc0: 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75  when renaming ou
1fd0: 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75  tput columns..qu
1fe0: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
1ff0: 45 4c 45 43 54 20 2b 20 35 30 20 2a 20 2d 20 74  ELECT + 50 * - t
2000: 61 62 31 2e 63 6f 6c 30 20 2d 20 2d 20 63 6f 6c  ab1.col0 - - col
2010: 30 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31  0 col1 FROM tab1
2020: 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 34 37 0d 0a 2d 33  ..----..-147..-3
2030: 31 33 36 0d 0a 2d 33 39 32 30 0d 0a 0d 0a 71 75  136..-3920....qu
2040: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
2050: 45 4c 45 43 54 20 2d 20 36 30 20 41 53 20 63 6f  ELECT - 60 AS co
2060: 6c 31 20 46 52 4f 4d 20 74 61 62 31 2c 20 74 61  l1 FROM tab1, ta
2070: 62 32 20 41 53 20 63 6f 72 30 2c 20 74 61 62 32  b2 AS cor0, tab2
2080: 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a   AS cor1..----..
2090: 32 37 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e  27 values hashin
20a0: 67 20 74 6f 20 31 61 30 62 32 39 66 38 65 36 66  g to 1a0b29f8e6f
20b0: 38 32 63 35 34 36 32 33 61 36 36 35 62 61 34 61  82c54623a665ba4a
20c0: 66 38 66 64 31 0d 0a 0d 0a 71 75 65 72 79 20 49  f8fd1....query I
20d0: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
20e0: 20 2b 20 63 6f 6c 32 20 2b 20 63 6f 6c 31 20 2b   + col2 + col1 +
20f0: 20 2b 20 63 6f 6c 30 20 2a 20 63 6f 6c 30 20 41   + col0 * col0 A
2100: 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30  S col2 FROM tab0
2110: 0d 0a 2d 2d 2d 2d 0d 0a 31 33 32 33 0d 0a 36 39  ..----..1323..69
2120: 35 0d 0a 38 30 39 34 0d 0a 0d 0a 71 75 65 72 79  5..8094....query
2130: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
2140: 43 54 20 44 49 53 54 49 4e 43 54 20 36 37 20 2b  CT DISTINCT 67 +
2150: 20 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46 52   col2 AS col2 FR
2160: 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31  OM tab1..----..1
2170: 32 31 0d 0a 31 32 34 0d 0a 31 36 33 0d 0a 0d 0a  21..124..163....
2180: 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71  skipif postgresq
2190: 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72  l # PostgreSQL r
21a0: 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20  equires AS when 
21b0: 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20  renaming output 
21c0: 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49  columns..query I
21d0: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
21e0: 20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c 30   DISTINCT - col0
21f0: 20 2b 20 63 6f 6c 31 20 2a 20 34 33 20 2b 20 63   + col1 * 43 + c
2200: 6f 6c 31 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61  ol1 col0 FROM ta
2210: 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
2220: 0d 0a 31 31 34 31 0d 0a 33 37 36 0d 0a 34 39 32  ..1141..376..492
2230: 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67  ....skipif postg
2240: 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53  resql # PostgreS
2250: 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77  QL requires AS w
2260: 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74  hen renaming out
2270: 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65  put columns..que
2280: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
2290: 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f 72 30 2e  LECT ALL - cor0.
22a0: 63 6f 6c 32 20 2a 20 63 6f 6c 32 20 2b 20 2d 20  col2 * col2 + - 
22b0: 63 6f 6c 30 20 63 6f 6c 32 20 46 52 4f 4d 20 74  col0 col2 FROM t
22c0: 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
22d0: 2d 0d 0a 2d 31 31 31 33 0d 0a 2d 33 36 0d 0a 2d  -..-1113..-36..-
22e0: 36 38 31 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20  6813....query I 
22f0: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
2300: 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c 30 20 2b 20  col1 * + col0 + 
2310: 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41  col2 FROM tab1 A
2320: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31  S cor0..----..11
2330: 33 36 0d 0a 31 33 32 0d 0a 36 39 37 0d 0a 0d 0a  36..132..697....
2340: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
2350: 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
2360: 20 2d 20 63 6f 6c 31 20 2b 20 2b 20 33 20 2a 20   - col1 + + 3 * 
2370: 2d 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31  - col1 FROM tab1
2380: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
2390: 2d 31 30 34 0d 0a 2d 34 30 0d 0a 2d 35 32 0d 0a  -104..-40..-52..
23a0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
23b0: 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 32  t..SELECT - col2
23c0: 20 2b 20 2d 20 34 35 20 2a 20 2d 20 63 6f 6c 31   + - 45 * - col1
23d0: 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
23e0: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 38 33 37 0d 0a  r0..----..3837..
23f0: 34 30 31 33 0d 0a 34 33 36 34 0d 0a 0d 0a 71 75  4013..4364....qu
2400: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
2410: 45 4c 45 43 54 20 41 4c 4c 20 63 6f 72 31 2e 63  ELECT ALL cor1.c
2420: 6f 6c 31 20 2d 20 2d 20 63 6f 72 30 2e 63 6f 6c  ol1 - - cor0.col
2430: 32 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  2 AS col1 FROM t
2440: 61 62 32 20 41 53 20 63 6f 72 30 20 43 52 4f 53  ab2 AS cor0 CROS
2450: 53 20 4a 4f 49 4e 20 74 61 62 31 20 41 53 20 63  S JOIN tab1 AS c
2460: 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c  or1..----..9 val
2470: 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 62  ues hashing to b
2480: 38 62 36 32 37 36 32 30 30 35 64 63 30 64 37 32  8b62762005dc0d72
2490: 33 37 31 34 35 64 30 35 33 38 65 64 62 33 34 0d  37145d0538edb34.
24a0: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
24b0: 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
24c0: 4e 43 54 20 2b 20 63 6f 72 31 2e 63 6f 6c 30 20  NCT + cor1.col0 
24d0: 2a 20 2b 20 36 38 20 41 53 20 63 6f 6c 31 20 46  * + 68 AS col1 F
24e0: 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
24f0: 20 43 52 4f 53 53 20 4a 4f 49 4e 20 74 61 62 31   CROSS JOIN tab1
2500: 2c 20 74 61 62 31 20 41 53 20 63 6f 72 31 0d 0a  , tab1 AS cor1..
2510: 2d 2d 2d 2d 0d 0a 32 30 34 0d 0a 34 33 35 32 0d  ----..204..4352.
2520: 0a 35 34 34 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  .5440....onlyif 
2530: 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20  mysql # use DIV 
2540: 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74  operator for int
2550: 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71  eger division..q
2560: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
2570: 61 62 65 6c 2d 36 34 0d 0a 53 45 4c 45 43 54 20  abel-64..SELECT 
2580: 63 6f 6c 31 20 44 49 56 20 63 6f 6c 32 20 2b 20  col1 DIV col2 + 
2590: 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46 52 4f  col0 AS col2 FRO
25a0: 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 33 0d  M tab1..----..3.
25b0: 0a 36 34 0d 0a 38 30 0d 0a 0d 0a 73 6b 69 70 69  .64..80....skipi
25c0: 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
25d0: 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
25e0: 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
25f0: 36 34 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 31 20  64..SELECT col1 
2600: 2f 20 63 6f 6c 32 20 2b 20 63 6f 6c 30 20 41 53  / col2 + col0 AS
2610: 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 0d   col2 FROM tab1.
2620: 0a 2d 2d 2d 2d 0d 0a 33 0d 0a 36 34 0d 0a 38 30  .----..3..64..80
2630: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
2640: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 31  ort..SELECT col1
2650: 20 2d 20 2b 20 28 20 2b 20 63 6f 6c 30 20 29 20   - + ( + col0 ) 
2660: 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
2670: 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 39 0d 0a 2d 36  2..----..-19..-6
2680: 32 0d 0a 32 34 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  2..24....onlyif 
2690: 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20  mysql # support 
26a0: 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66  for MySQL specif
26b0: 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20  ic system types 
26c0: 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72  and syntax..quer
26d0: 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
26e0: 6c 2d 36 36 0d 0a 53 45 4c 45 43 54 20 2b 20 35  l-66..SELECT + 5
26f0: 30 20 2a 20 2b 20 74 61 62 30 2e 63 6f 6c 32 20  0 * + tab0.col2 
2700: 2b 20 63 6f 6c 32 20 2a 20 43 41 53 54 28 20 4e  + col2 * CAST( N
2710: 55 4c 4c 20 41 53 20 53 49 47 4e 45 44 20 29 20  ULL AS SIGNED ) 
2720: 2f 20 31 39 20 41 53 20 63 6f 6c 32 20 46 52 4f  / 19 AS col2 FRO
2730: 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55  M tab0..----..NU
2740: 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a  LL..NULL..NULL..
2750: 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
2760: 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
2770: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2780: 20 6c 61 62 65 6c 2d 36 36 0d 0a 53 45 4c 45 43   label-66..SELEC
2790: 54 20 2b 20 35 30 20 2a 20 2b 20 74 61 62 30 2e  T + 50 * + tab0.
27a0: 63 6f 6c 32 20 2b 20 63 6f 6c 32 20 2a 20 43 41  col2 + col2 * CA
27b0: 53 54 20 28 20 4e 55 4c 4c 20 41 53 20 49 4e 54  ST ( NULL AS INT
27c0: 45 47 45 52 20 29 20 2f 20 31 39 20 41 53 20 63  EGER ) / 19 AS c
27d0: 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d  ol2 FROM tab0..-
27e0: 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d  ---..NULL..NULL.
27f0: 0a 4e 55 4c 4c 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  .NULL....onlyif 
2800: 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20  mysql # use DIV 
2810: 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74  operator for int
2820: 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71  eger division..q
2830: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
2840: 61 62 65 6c 2d 36 37 0d 0a 53 45 4c 45 43 54 20  abel-67..SELECT 
2850: 2d 20 33 38 20 2a 20 2b 20 63 6f 6c 30 20 2b 20  - 38 * + col0 + 
2860: 2d 20 63 6f 6c 32 20 44 49 56 20 63 6f 6c 32 20  - col2 DIV col2 
2870: 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d  FROM tab1..----.
2880: 0a 2d 31 31 35 0d 0a 2d 32 34 33 33 0d 0a 2d 33  .-115..-2433..-3
2890: 30 34 31 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  041....skipif my
28a0: 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
28b0: 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
28c0: 77 73 6f 72 74 20 6c 61 62 65 6c 2d 36 37 0d 0a  wsort label-67..
28d0: 53 45 4c 45 43 54 20 2d 20 33 38 20 2a 20 2b 20  SELECT - 38 * + 
28e0: 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c 32 20 2f 20  col0 + - col2 / 
28f0: 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 0d 0a  col2 FROM tab1..
2900: 2d 2d 2d 2d 0d 0a 2d 31 31 35 0d 0a 2d 32 34 33  ----..-115..-243
2910: 33 0d 0a 2d 33 30 34 31 0d 0a 0d 0a 73 6b 69 70  3..-3041....skip
2920: 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20  if postgresql # 
2930: 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69  PostgreSQL requi
2940: 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61  res AS when rena
2950: 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75  ming output colu
2960: 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  mns..query I row
2970: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 39  sort..SELECT - 9
2980: 32 20 2b 20 2d 20 63 6f 6c 32 20 63 6f 6c 32 20  2 + - col2 col2 
2990: 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d  FROM tab0..----.
29a0: 0a 2d 31 32 35 0d 0a 2d 31 37 34 0d 0a 2d 39 33  .-125..-174..-93
29b0: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
29c0: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 39 37 20 2a  ort..SELECT 97 *
29d0: 20 2d 20 34 31 20 2b 20 63 6f 6c 32 20 46 52 4f   - 41 + col2 FRO
29e0: 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 33  M tab1..----..-3
29f0: 38 38 31 0d 0a 2d 33 39 32 30 0d 0a 2d 33 39 32  881..-3920..-392
2a00: 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  3....query I row
2a10: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
2a20: 20 2d 20 37 34 20 2d 20 37 38 20 41 53 20 63 6f   - 74 - 78 AS co
2a30: 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l1 FROM tab1 AS 
2a40: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 35 32  cor0..----..-152
2a50: 0d 0a 2d 31 35 32 0d 0a 2d 31 35 32 0d 0a 0d 0a  ..-152..-152....
2a60: 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75  onlyif mysql # u
2a70: 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20  se DIV operator 
2a80: 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69  for integer divi
2a90: 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f  sion..query I ro
2aa0: 77 73 6f 72 74 20 6c 61 62 65 6c 2d 37 31 0d 0a  wsort label-71..
2ab0: 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
2ac0: 2d 20 2b 20 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c  - + col2 * - col
2ad0: 32 20 2b 20 2d 20 63 6f 72 30 2e 63 6f 6c 31 20  2 + - cor0.col1 
2ae0: 44 49 56 20 2b 20 34 35 20 46 52 4f 4d 20 74 61  DIV + 45 FROM ta
2af0: 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  b0 cor0..----..-
2b00: 31 0d 0a 31 30 38 38 0d 0a 36 37 32 32 0d 0a 0d  1..1088..6722...
2b10: 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
2b20: 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
2b30: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
2b40: 6c 61 62 65 6c 2d 37 31 0d 0a 53 45 4c 45 43 54  label-71..SELECT
2b50: 20 44 49 53 54 49 4e 43 54 20 2d 20 2b 20 63 6f   DISTINCT - + co
2b60: 6c 32 20 2a 20 2d 20 63 6f 6c 32 20 2b 20 2d 20  l2 * - col2 + - 
2b70: 63 6f 72 30 2e 63 6f 6c 31 20 2f 20 2b 20 34 35  cor0.col1 / + 45
2b80: 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d   FROM tab0 cor0.
2b90: 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 31 30 38 38 0d  .----..-1..1088.
2ba0: 0a 36 37 32 32 0d 0a 0d 0a 71 75 65 72 79 20 49  .6722....query I
2bb0: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
2bc0: 20 41 4c 4c 20 28 20 31 36 20 29 20 2b 20 63 6f   ALL ( 16 ) + co
2bd0: 6c 31 20 2a 20 63 6f 6c 31 20 46 52 4f 4d 20 74  l1 * col1 FROM t
2be0: 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
2bf0: 2d 0d 0a 31 31 36 0d 0a 31 38 35 0d 0a 36 39 32  -..116..185..692
2c00: 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
2c10: 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d   # support for M
2c20: 79 53 51 4c 20 73 70 65 63 69 66 69 63 20 73 79  ySQL specific sy
2c30: 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73  stem types and s
2c40: 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72  yntax..query I r
2c50: 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 37 33 0d  owsort label-73.
2c60: 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
2c70: 20 63 6f 72 30 2e 63 6f 6c 30 20 2a 20 2b 20 63   cor0.col0 * + c
2c80: 6f 72 30 2e 63 6f 6c 30 20 2d 20 2d 20 43 41 53  or0.col0 - - CAS
2c90: 54 28 20 4e 55 4c 4c 20 41 53 20 53 49 47 4e 45  T( NULL AS SIGNE
2ca0: 44 20 29 20 2a 20 2b 20 38 38 20 46 52 4f 4d 20  D ) * + 88 FROM 
2cb0: 74 61 62 30 2c 20 74 61 62 30 20 41 53 20 63 6f  tab0, tab0 AS co
2cc0: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a  r0..----..NULL..
2cd0: 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
2ce0: 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
2cf0: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2d00: 20 6c 61 62 65 6c 2d 37 33 0d 0a 53 45 4c 45 43   label-73..SELEC
2d10: 54 20 44 49 53 54 49 4e 43 54 20 63 6f 72 30 2e  T DISTINCT cor0.
2d20: 63 6f 6c 30 20 2a 20 2b 20 63 6f 72 30 2e 63 6f  col0 * + cor0.co
2d30: 6c 30 20 2d 20 2d 20 43 41 53 54 20 28 20 4e 55  l0 - - CAST ( NU
2d40: 4c 4c 20 41 53 20 49 4e 54 45 47 45 52 20 29 20  LL AS INTEGER ) 
2d50: 2a 20 2b 20 38 38 20 46 52 4f 4d 20 74 61 62 30  * + 88 FROM tab0
2d60: 2c 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  , tab0 AS cor0..
2d70: 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 6f 6e  ----..NULL....on
2d80: 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
2d90: 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
2da0: 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
2db0: 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
2dc0: 6f 72 74 20 6c 61 62 65 6c 2d 37 34 0d 0a 53 45  ort label-74..SE
2dd0: 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20  LECT DISTINCT + 
2de0: 2b 20 63 6f 6c 32 20 44 49 56 20 33 37 20 41 53  + col2 DIV 37 AS
2df0: 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20   col1 FROM tab0 
2e00: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30  AS cor0..----..0
2e10: 0d 0a 32 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  ..2....skipif my
2e20: 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
2e30: 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
2e40: 77 73 6f 72 74 20 6c 61 62 65 6c 2d 37 34 0d 0a  wsort label-74..
2e50: 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
2e60: 2b 20 2b 20 63 6f 6c 32 20 2f 20 33 37 20 41 53  + + col2 / 37 AS
2e70: 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20   col1 FROM tab0 
2e80: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30  AS cor0..----..0
2e90: 0d 0a 32 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  ..2....skipif my
2ea0: 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
2eb0: 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
2ec0: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
2ed0: 53 54 49 4e 43 54 20 28 20 63 6f 6c 30 20 29 20  STINCT ( col0 ) 
2ee0: 2b 20 63 6f 6c 30 20 2a 20 2d 20 43 41 53 54 20  + col0 * - CAST 
2ef0: 28 20 2b 20 35 37 20 2b 20 63 6f 6c 32 20 41 53  ( + 57 + col2 AS
2f00: 20 52 45 41 4c 20 29 20 46 52 4f 4d 20 74 61 62   REAL ) FROM tab
2f10: 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  0 cor0..----..-1
2f20: 32 32 38 32 0d 0a 2d 31 39 39 35 0d 0a 2d 32 31  2282..-1995..-21
2f30: 33 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  36....query I ro
2f40: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
2f50: 53 54 49 4e 43 54 20 2b 20 63 6f 6c 30 20 2b 20  STINCT + col0 + 
2f60: 2b 20 33 32 20 2a 20 2d 20 63 6f 6c 32 20 41 53  + 32 * - col2 AS
2f70: 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20   col1 FROM tab1 
2f80: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
2f90: 31 37 32 35 0d 0a 2d 31 37 36 30 0d 0a 2d 32 39  1725..-1760..-29
2fa0: 39 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  92....query I ro
2fb0: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
2fc0: 53 54 49 4e 43 54 20 2b 20 2d 20 28 20 2b 20 63  STINCT + - ( + c
2fd0: 6f 72 30 2e 63 6f 6c 30 20 29 20 46 52 4f 4d 20  or0.col0 ) FROM 
2fe0: 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
2ff0: 2d 2d 0d 0a 2d 37 0d 0a 2d 37 38 0d 0a 2d 37 39  --..-7..-78..-79
3000: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
3010: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
3020: 33 32 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74  32 + col1 FROM t
3030: 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
3040: 2d 0d 0a 34 32 0d 0a 34 35 0d 0a 35 38 0d 0a 0d  -..42..45..58...
3050: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
3060: 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63  ..SELECT ALL - c
3070: 6f 72 30 2e 63 6f 6c 31 20 2a 20 2d 20 35 34 20  or0.col1 * - 54 
3080: 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
3090: 30 0d 0a 2d 2d 2d 2d 0d 0a 34 36 34 34 0d 0a 34  0..----..4644..4
30a0: 39 31 34 0d 0a 35 32 33 38 0d 0a 0d 0a 6f 6e 6c  914..5238....onl
30b0: 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20  yif mysql # use 
30c0: 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72  DIV operator for
30d0: 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f   integer divisio
30e0: 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  n..query I rowso
30f0: 72 74 20 6c 61 62 65 6c 2d 38 30 0d 0a 53 45 4c  rt label-80..SEL
3100: 45 43 54 20 41 4c 4c 20 2d 20 2b 20 63 6f 6c 31  ECT ALL - + col1
3110: 20 44 49 56 20 63 6f 72 30 2e 63 6f 6c 31 20 41   DIV cor0.col1 A
3120: 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32  S col0 FROM tab2
3130: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
3140: 2d 31 0d 0a 2d 31 0d 0a 2d 31 0d 0a 0d 0a 73 6b  -1..-1..-1....sk
3150: 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
3160: 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
3170: 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
3180: 65 6c 2d 38 30 0d 0a 53 45 4c 45 43 54 20 41 4c  el-80..SELECT AL
3190: 4c 20 2d 20 2b 20 63 6f 6c 31 20 2f 20 63 6f 72  L - + col1 / cor
31a0: 30 2e 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46  0.col1 AS col0 F
31b0: 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
31c0: 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 2d 31 0d 0a  ..----..-1..-1..
31d0: 2d 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  -1....query I ro
31e0: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
31f0: 53 54 49 4e 43 54 20 36 35 20 2b 20 39 39 20 2a  STINCT 65 + 99 *
3200: 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20   + col1 AS col1 
3210: 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a  FROM tab0 cor0..
3220: 2d 2d 2d 2d 0d 0a 38 35 37 39 0d 0a 39 30 37 34  ----..8579..9074
3230: 0d 0a 39 36 36 38 0d 0a 0d 0a 71 75 65 72 79 20  ..9668....query 
3240: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
3250: 54 20 41 4c 4c 20 2d 20 2d 20 28 20 2d 20 63 6f  T ALL - - ( - co
3260: 6c 30 20 29 20 2a 20 35 32 20 46 52 4f 4d 20 74  l0 ) * 52 FROM t
3270: 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
3280: 2d 0d 0a 2d 31 35 36 0d 0a 2d 33 33 32 38 0d 0a  -..-156..-3328..
3290: 2d 34 31 36 30 0d 0a 0d 0a 71 75 65 72 79 20 49  -4160....query I
32a0: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
32b0: 20 2d 20 2b 20 63 6f 6c 31 20 2a 20 63 6f 72 30   - + col1 * cor0
32c0: 2e 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46 52  .col1 AS col1 FR
32d0: 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d  OM tab0 cor0..--
32e0: 2d 2d 0d 0a 2d 37 33 39 36 0d 0a 2d 38 32 38 31  --..-7396..-8281
32f0: 0d 0a 2d 39 34 30 39 0d 0a 0d 0a 71 75 65 72 79  ..-9409....query
3300: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
3310: 43 54 20 2d 20 35 34 20 46 52 4f 4d 20 74 61 62  CT - 54 FROM tab
3320: 31 2c 20 74 61 62 30 20 41 53 20 63 6f 72 30 2c  1, tab0 AS cor0,
3330: 20 74 61 62 31 20 41 53 20 63 6f 72 31 0d 0a 2d   tab1 AS cor1..-
3340: 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75 65 73 20 68  ---..27 values h
3350: 61 73 68 69 6e 67 20 74 6f 20 37 31 65 32 37 61  ashing to 71e27a
3360: 31 32 37 36 37 64 33 61 39 38 37 63 65 30 35 65  12767d3a987ce05e
3370: 34 64 36 65 64 61 64 32 31 31 0d 0a 0d 0a 71 75  4d6edad211....qu
3380: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
3390: 45 4c 45 43 54 20 41 4c 4c 20 2d 20 28 20 2d 20  ELECT ALL - ( - 
33a0: 34 30 20 29 20 46 52 4f 4d 20 74 61 62 32 2c 20  40 ) FROM tab2, 
33b0: 74 61 62 32 20 41 53 20 63 6f 72 30 2c 20 74 61  tab2 AS cor0, ta
33c0: 62 30 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d  b0 AS cor1..----
33d0: 0d 0a 32 37 20 76 61 6c 75 65 73 20 68 61 73 68  ..27 values hash
33e0: 69 6e 67 20 74 6f 20 65 34 64 31 30 66 37 64 36  ing to e4d10f7d6
33f0: 63 33 34 61 32 38 31 66 35 32 34 65 34 35 65 38  c34a281f524e45e8
3400: 32 65 62 64 32 61 30 0d 0a 0d 0a 71 75 65 72 79  2ebd2a0....query
3410: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
3420: 43 54 20 41 4c 4c 20 2b 20 38 39 20 2a 20 2d 20  CT ALL + 89 * - 
3430: 63 6f 72 30 2e 63 6f 6c 31 20 46 52 4f 4d 20 74  cor0.col1 FROM t
3440: 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
3450: 2d 0d 0a 2d 37 36 35 34 0d 0a 2d 38 30 39 39 0d  -..-7654..-8099.
3460: 0a 2d 38 36 33 33 0d 0a 0d 0a 71 75 65 72 79 20  .-8633....query 
3470: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
3480: 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c  T DISTINCT + col
3490: 30 20 2d 20 2d 20 63 6f 6c 30 20 2a 20 63 6f 6c  0 - - col0 * col
34a0: 32 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  2 AS col0 FROM t
34b0: 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab2 cor0..----..
34c0: 31 39 36 0d 0a 32 31 30 36 0d 0a 33 30 38 31 0d  196..2106..3081.
34d0: 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72  ...skipif postgr
34e0: 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51  esql # PostgreSQ
34f0: 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68  L requires AS wh
3500: 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70  en renaming outp
3510: 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72  ut columns..quer
3520: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
3530: 45 43 54 20 2b 20 32 34 20 63 6f 6c 32 20 46 52  ECT + 24 col2 FR
3540: 4f 4d 20 74 61 62 32 2c 20 74 61 62 31 20 63 6f  OM tab2, tab1 co
3550: 72 30 2c 20 74 61 62 32 20 63 6f 72 31 0d 0a 2d  r0, tab2 cor1..-
3560: 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75 65 73 20 68  ---..27 values h
3570: 61 73 68 69 6e 67 20 74 6f 20 61 65 65 61 63 34  ashing to aeeac4
3580: 33 31 64 32 32 35 32 38 31 38 38 65 38 61 35 61  31d22528188e8a5a
3590: 32 61 36 30 64 32 64 30 38 30 0d 0a 0d 0a 71 75  2a60d2d080....qu
35a0: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
35b0: 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b  ELECT DISTINCT +
35c0: 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 2b 20 28   + cor0.col2 + (
35d0: 20 2d 20 63 6f 6c 32 20 29 20 46 52 4f 4d 20 74   - col2 ) FROM t
35e0: 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
35f0: 2d 0d 0a 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  -..0....onlyif m
3600: 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66  ysql # support f
3610: 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69  or MySQL specifi
3620: 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61  c system types a
3630: 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79  nd syntax..query
3640: 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
3650: 2d 39 30 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  -90..SELECT ALL 
3660: 63 6f 6c 32 20 2b 20 2d 20 43 41 53 54 28 20 4e  col2 + - CAST( N
3670: 55 4c 4c 20 41 53 20 44 45 43 49 4d 41 4c 20 29  ULL AS DECIMAL )
3680: 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
3690: 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
36a0: 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55  ..NULL..NULL..NU
36b0: 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  LL....skipif mys
36c0: 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
36d0: 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
36e0: 73 6f 72 74 20 6c 61 62 65 6c 2d 39 30 0d 0a 53  sort label-90..S
36f0: 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 32 20 2b  ELECT ALL col2 +
3700: 20 2d 20 43 41 53 54 20 28 20 4e 55 4c 4c 20 41   - CAST ( NULL A
3710: 53 20 52 45 41 4c 20 29 20 41 53 20 63 6f 6c 32  S REAL ) AS col2
3720: 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
3730: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a  r0..----..NULL..
3740: 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75  NULL..NULL....qu
3750: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
3760: 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 32 20 2d  ELECT ALL col2 -
3770: 20 28 20 2d 20 63 6f 6c 30 20 29 20 41 53 20 63   ( - col0 ) AS c
3780: 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol2 FROM tab0 AS
3790: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 37 31   cor0..----..171
37a0: 0d 0a 33 36 0d 0a 35 37 0d 0a 0d 0a 6f 6e 6c 79  ..36..57....only
37b0: 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f  if mysql # suppo
37c0: 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65  rt for MySQL spe
37d0: 63 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70  cific system typ
37e0: 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71  es and syntax..q
37f0: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
3800: 61 62 65 6c 2d 39 32 0d 0a 53 45 4c 45 43 54 20  abel-92..SELECT 
3810: 44 49 53 54 49 4e 43 54 20 63 6f 6c 32 20 2a 20  DISTINCT col2 * 
3820: 43 41 53 54 28 20 2b 20 63 6f 6c 31 20 41 53 20  CAST( + col1 AS 
3830: 53 49 47 4e 45 44 20 29 20 2b 20 63 6f 72 30 2e  SIGNED ) + cor0.
3840: 63 6f 6c 30 20 2b 20 37 39 20 46 52 4f 4d 20 74  col0 + 79 FROM t
3850: 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
3860: 2d 0d 0a 31 36 39 31 0d 0a 38 30 34 0d 0a 39 32  -..1691..804..92
3870: 33 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  3....skipif mysq
3880: 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
3890: 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
38a0: 6f 72 74 20 6c 61 62 65 6c 2d 39 32 0d 0a 53 45  ort label-92..SE
38b0: 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f  LECT DISTINCT co
38c0: 6c 32 20 2a 20 43 41 53 54 20 28 20 2b 20 63 6f  l2 * CAST ( + co
38d0: 6c 31 20 41 53 20 49 4e 54 45 47 45 52 20 29 20  l1 AS INTEGER ) 
38e0: 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 2b 20 37 39  + cor0.col0 + 79
38f0: 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
3900: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 36 39 31 0d 0a  r0..----..1691..
3910: 38 30 34 0d 0a 39 32 33 0d 0a 0d 0a 71 75 65 72  804..923....quer
3920: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
3930: 45 43 54 20 2d 20 2d 20 31 34 20 2b 20 2d 20 63  ECT - - 14 + - c
3940: 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  ol0 AS col1 FROM
3950: 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
3960: 2d 2d 2d 0d 0a 2d 36 34 0d 0a 2d 36 35 0d 0a 37  ---..-64..-65..7
3970: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
3980: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 30  ort..SELECT col0
3990: 20 2a 20 28 20 63 6f 6c 30 20 29 20 2a 20 37 30   * ( col0 ) * 70
39a0: 20 2b 20 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20   + col2 AS col1 
39b0: 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
39c0: 30 0d 0a 2d 2d 2d 2d 0d 0a 32 38 36 37 37 37 0d  0..----..286777.
39d0: 0a 34 34 38 30 39 36 0d 0a 36 38 34 0d 0a 0d 0a  .448096..684....
39e0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
39f0: 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 28 20  .SELECT ALL + ( 
3a00: 63 6f 6c 30 20 29 20 2a 20 2b 20 63 6f 6c 32 20  col0 ) * + col2 
3a10: 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
3a20: 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
3a30: 0a 31 36 32 0d 0a 33 36 34 38 0d 0a 37 36 38 30  .162..3648..7680
3a40: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
3a50: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 30  ort..SELECT col0
3a60: 20 2a 20 2d 20 63 6f 6c 32 20 2b 20 2d 20 63 6f   * - col2 + - co
3a70: 6c 32 20 2b 20 2b 20 63 6f 6c 32 20 46 52 4f 4d  l2 + + col2 FROM
3a80: 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
3a90: 2d 2d 2d 0d 0a 2d 31 38 39 0d 0a 2d 32 30 32 38  ---..-189..-2028
3aa0: 0d 0a 2d 33 30 30 32 0d 0a 0d 0a 71 75 65 72 79  ..-3002....query
3ab0: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
3ac0: 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 30  CT DISTINCT col0
3ad0: 20 2a 20 2b 20 28 20 2d 20 38 36 20 29 20 46 52   * + ( - 86 ) FR
3ae0: 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d  OM tab1..----..-
3af0: 32 35 38 0d 0a 2d 35 35 30 34 0d 0a 2d 36 38 38  258..-5504..-688
3b00: 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  0....query I row
3b10: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
3b20: 54 49 4e 43 54 20 2b 20 37 31 20 46 52 4f 4d 20  TINCT + 71 FROM 
3b30: 74 61 62 31 2c 20 74 61 62 32 20 63 6f 72 30 0d  tab1, tab2 cor0.
3b40: 0a 2d 2d 2d 2d 0d 0a 37 31 0d 0a 0d 0a 71 75 65  .----..71....que
3b50: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
3b60: 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f  LECT DISTINCT co
3b70: 6c 31 20 2a 20 63 6f 6c 31 20 2b 20 31 39 20 46  l1 * col1 + 19 F
3b80: 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab1..----..
3b90: 31 31 39 0d 0a 31 38 38 0d 0a 36 39 35 0d 0a 0d  119..188..695...
3ba0: 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73  .skipif postgres
3bb0: 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20  ql # PostgreSQL 
3bc0: 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e  requires AS when
3bd0: 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74   renaming output
3be0: 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20   columns..query 
3bf0: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
3c00: 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 32 20  T DISTINCT col2 
3c10: 2b 20 28 20 2b 20 63 6f 6c 31 20 29 20 2a 20 63  + ( + col1 ) * c
3c20: 6f 6c 30 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61  ol0 col1 FROM ta
3c30: 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 31 33 36 0d 0a  b1..----..1136..
3c40: 31 33 32 0d 0a 36 39 37 0d 0a 0d 0a 71 75 65 72  132..697....quer
3c50: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
3c60: 45 43 54 20 41 4c 4c 20 2b 20 74 61 62 32 2e 63  ECT ALL + tab2.c
3c70: 6f 6c 32 20 2a 20 63 6f 6c 31 20 2b 20 63 6f 6c  ol2 * col1 + col
3c80: 31 20 2b 20 63 6f 6c 32 20 2a 20 39 37 20 46 52  1 + col2 * 97 FR
3c90: 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 33  OM tab2..----..3
3ca0: 34 38 37 0d 0a 34 31 31 35 0d 0a 34 33 34 39 0d  487..4115..4349.
3cb0: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
3cc0: 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
3cd0: 4e 43 54 20 2b 20 63 6f 6c 31 20 2a 20 2b 20 39  NCT + col1 * + 9
3ce0: 37 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d  7 FROM tab2..---
3cf0: 2d 0d 0a 31 36 34 39 0d 0a 33 30 30 37 0d 0a 35  -..1649..3007..5
3d00: 37 32 33 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f  723....skipif po
3d10: 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67  stgresql # Postg
3d20: 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41  reSQL requires A
3d30: 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20  S when renaming 
3d40: 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a  output columns..
3d50: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
3d60: 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 30 20 2a  .SELECT + col0 *
3d70: 20 2b 20 33 35 20 63 6f 6c 32 20 46 52 4f 4d 20   + 35 col2 FROM 
3d80: 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 32 34 35 0d  tab2..----..245.
3d90: 0a 32 37 33 30 0d 0a 32 37 36 35 0d 0a 0d 0a 71  .2730..2765....q
3da0: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
3db0: 53 45 4c 45 43 54 20 63 6f 6c 31 20 2a 20 2b 20  SELECT col1 * + 
3dc0: 28 20 74 61 62 31 2e 63 6f 6c 32 20 29 20 41 53  ( tab1.col2 ) AS
3dd0: 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 0d   col1 FROM tab1.
3de0: 0a 2d 2d 2d 2d 0d 0a 31 32 34 38 0d 0a 31 34 30  .----..1248..140
3df0: 34 0d 0a 35 37 30 0d 0a 0d 0a 6f 6e 6c 79 69 66  4..570....onlyif
3e00: 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74   mysql # support
3e10: 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69   for MySQL speci
3e20: 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73  fic system types
3e30: 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65   and syntax..que
3e40: 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
3e50: 65 6c 2d 31 30 35 0d 0a 53 45 4c 45 43 54 20 2b  el-105..SELECT +
3e60: 20 63 6f 72 30 2e 63 6f 6c 31 20 2d 20 2b 20 43   cor0.col1 - + C
3e70: 41 53 54 28 20 4e 55 4c 4c 20 41 53 20 53 49 47  AST( NULL AS SIG
3e80: 4e 45 44 20 29 20 41 53 20 63 6f 6c 32 20 46 52  NED ) AS col2 FR
3e90: 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d  OM tab0 cor0..--
3ea0: 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a  --..NULL..NULL..
3eb0: 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  NULL....skipif m
3ec0: 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
3ed0: 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
3ee0: 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 30 35  owsort label-105
3ef0: 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 72 30 2e  ..SELECT + cor0.
3f00: 63 6f 6c 31 20 2d 20 2b 20 43 41 53 54 20 28 20  col1 - + CAST ( 
3f10: 4e 55 4c 4c 20 41 53 20 49 4e 54 45 47 45 52 20  NULL AS INTEGER 
3f20: 29 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  ) AS col2 FROM t
3f30: 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab0 cor0..----..
3f40: 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c  NULL..NULL..NULL
3f50: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
3f60: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2b 20  ort..SELECT - + 
3f70: 63 6f 6c 31 20 2a 20 36 33 20 41 53 20 63 6f 6c  col1 * 63 AS col
3f80: 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  0 FROM tab2 AS c
3f90: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 37 31  or0..----..-1071
3fa0: 0d 0a 2d 31 39 35 33 0d 0a 2d 33 37 31 37 0d 0a  ..-1953..-3717..
3fb0: 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
3fc0: 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53   support for MyS
3fd0: 51 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74  QL specific syst
3fe0: 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e  em types and syn
3ff0: 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  tax..query I row
4000: 73 6f 72 74 20 6c 61 62 65 6c 2d 31 30 37 0d 0a  sort label-107..
4010: 53 45 4c 45 43 54 20 2d 20 2b 20 63 6f 72 30 2e  SELECT - + cor0.
4020: 63 6f 6c 31 20 2a 20 43 41 53 54 28 20 34 39 20  col1 * CAST( 49 
4030: 41 53 20 53 49 47 4e 45 44 20 29 20 41 53 20 63  AS SIGNED ) AS c
4040: 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 63 6f  ol2 FROM tab0 co
4050: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 32 31 34 0d  r0..----..-4214.
4060: 0a 2d 34 34 35 39 0d 0a 2d 34 37 35 33 0d 0a 0d  .-4459..-4753...
4070: 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
4080: 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
4090: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
40a0: 6c 61 62 65 6c 2d 31 30 37 0d 0a 53 45 4c 45 43  label-107..SELEC
40b0: 54 20 2d 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20  T - + cor0.col1 
40c0: 2a 20 43 41 53 54 20 28 20 34 39 20 41 53 20 49  * CAST ( 49 AS I
40d0: 4e 54 45 47 45 52 20 29 20 41 53 20 63 6f 6c 32  NTEGER ) AS col2
40e0: 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d   FROM tab0 cor0.
40f0: 0a 2d 2d 2d 2d 0d 0a 2d 34 32 31 34 0d 0a 2d 34  .----..-4214..-4
4100: 34 35 39 0d 0a 2d 34 37 35 33 0d 0a 0d 0a 71 75  459..-4753....qu
4110: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
4120: 45 4c 45 43 54 20 63 6f 6c 30 20 2d 20 33 30 20  ELECT col0 - 30 
4130: 2a 20 2b 20 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c  * + col1 * - col
4140: 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  1 FROM tab1 AS c
4150: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 30 32 38 33  or0..----..20283
4160: 0d 0a 33 30 36 34 0d 0a 35 31 35 30 0d 0a 0d 0a  ..3064..5150....
4170: 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73  onlyif mysql # s
4180: 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c  upport for MySQL
4190: 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d   specific system
41a0: 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61   types and synta
41b0: 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  x..query I rowso
41c0: 72 74 20 6c 61 62 65 6c 2d 31 30 39 0d 0a 53 45  rt label-109..SE
41d0: 4c 45 43 54 20 2b 20 63 6f 6c 30 20 2a 20 2d 20  LECT + col0 * - 
41e0: 43 41 53 54 28 20 4e 55 4c 4c 20 41 53 20 53 49  CAST( NULL AS SI
41f0: 47 4e 45 44 20 29 20 2d 20 63 6f 6c 32 20 46 52  GNED ) - col2 FR
4200: 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
4210: 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c  .----..NULL..NUL
4220: 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69  L..NULL....skipi
4230: 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
4240: 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
4250: 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
4260: 31 30 39 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f  109..SELECT + co
4270: 6c 30 20 2a 20 2d 20 43 41 53 54 20 28 20 4e 55  l0 * - CAST ( NU
4280: 4c 4c 20 41 53 20 49 4e 54 45 47 45 52 20 29 20  LL AS INTEGER ) 
4290: 2d 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32  - col2 FROM tab2
42a0: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
42b0: 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c  NULL..NULL..NULL
42c0: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
42d0: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2d 20  ort..SELECT + - 
42e0: 35 20 2a 20 2d 20 63 6f 6c 30 20 2a 20 2d 20 63  5 * - col0 * - c
42f0: 6f 72 30 2e 63 6f 6c 30 20 46 52 4f 4d 20 74 61  or0.col0 FROM ta
4300: 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  b0 cor0..----..-
4310: 32 38 38 30 0d 0a 2d 33 39 36 30 35 0d 0a 2d 36  2880..-39605..-6
4320: 31 32 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  125....query I r
4330: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
4340: 49 53 54 49 4e 43 54 20 33 20 41 53 20 63 6f 6c  ISTINCT 3 AS col
4350: 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  0 FROM tab1 AS c
4360: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 0d 0a 0d 0a  or0..----..3....
4370: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
4380: 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 2b 20  .SELECT ALL - + 
4390: 28 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 29 20  ( + cor0.col2 ) 
43a0: 2b 20 63 6f 6c 32 20 2a 20 2d 20 28 20 32 32 20  + col2 * - ( 22 
43b0: 29 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  ) FROM tab2 AS c
43c0: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 39 38 0d  or0..----..-598.
43d0: 0a 2d 36 32 31 0d 0a 2d 38 37 34 0d 0a 0d 0a 71  .-621..-874....q
43e0: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
43f0: 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 28 20 2b  SELECT ALL + ( +
4400: 20 38 34 20 29 20 46 52 4f 4d 20 74 61 62 31 20   84 ) FROM tab1 
4410: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 38  AS cor0..----..8
4420: 34 0d 0a 38 34 0d 0a 38 34 0d 0a 0d 0a 71 75 65  4..84..84....que
4430: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
4440: 4c 45 43 54 20 36 31 20 41 53 20 63 6f 6c 30 20  LECT 61 AS col0 
4450: 46 52 4f 4d 20 74 61 62 30 2c 20 74 61 62 32 20  FROM tab0, tab2 
4460: 41 53 20 63 6f 72 30 2c 20 74 61 62 31 20 63 6f  AS cor0, tab1 co
4470: 72 31 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c  r1..----..27 val
4480: 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 38  ues hashing to 8
4490: 64 34 64 66 65 36 34 39 34 33 33 61 35 39 39 66  d4dfe649433a599f
44a0: 63 34 62 31 30 38 33 30 63 63 37 63 65 35 35 0d  c4b10830cc7ce55.
44b0: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
44c0: 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 34 33 20  rt..SELECT - 43 
44d0: 2b 20 2b 20 63 6f 6c 32 20 2a 20 2d 20 28 20 2d  + + col2 * - ( -
44e0: 20 31 38 20 2b 20 2b 20 63 6f 72 30 2e 63 6f 6c   18 + + cor0.col
44f0: 30 20 29 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  0 ) AS col2 FROM
4500: 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
4510: 2d 2d 2d 0d 0a 2d 31 36 30 33 0d 0a 2d 32 33 36  ---..-1603..-236
4520: 31 0d 0a 32 35 34 0d 0a 0d 0a 71 75 65 72 79 20  1..254....query 
4530: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
4540: 54 20 2b 20 63 6f 6c 31 20 2b 20 63 6f 6c 32 20  T + col1 + col2 
4550: 2a 20 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46  * col2 AS col0 F
4560: 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
4570: 0d 0a 2d 2d 2d 2d 0d 0a 31 31 37 35 0d 0a 36 38  ..----..1175..68
4580: 31 35 0d 0a 39 38 0d 0a 0d 0a 71 75 65 72 79 20  15..98....query 
4590: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
45a0: 54 20 44 49 53 54 49 4e 43 54 20 2d 20 2d 20 63  T DISTINCT - - c
45b0: 6f 6c 31 20 2a 20 2d 20 63 6f 6c 30 20 2a 20 28  ol1 * - col0 * (
45c0: 20 63 6f 6c 30 20 29 20 41 53 20 63 6f 6c 30 20   col0 ) AS col0 
45d0: 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
45e0: 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 33 34 0d 0a 2d  0..----..-234..-
45f0: 34 30 39 36 30 0d 0a 2d 38 33 32 30 30 0d 0a 0d  40960..-83200...
4600: 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
4610: 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72  use DIV operator
4620: 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76   for integer div
4630: 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72  ision..query I r
4640: 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 31 38  owsort label-118
4650: 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c  ..SELECT ALL col
4660: 30 20 44 49 56 20 2d 20 63 6f 6c 32 20 2b 20 63  0 DIV - col2 + c
4670: 6f 6c 31 20 2b 20 2d 20 63 6f 6c 32 20 46 52 4f  ol1 + - col2 FRO
4680: 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
4690: 2d 2d 2d 2d 0d 0a 2d 32 38 0d 0a 2d 34 38 0d 0a  ----..-28..-48..
46a0: 2d 38 33 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  -83....skipif my
46b0: 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
46c0: 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
46d0: 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 31 38 0d  wsort label-118.
46e0: 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 30  .SELECT ALL col0
46f0: 20 2f 20 2d 20 63 6f 6c 32 20 2b 20 63 6f 6c 31   / - col2 + col1
4700: 20 2b 20 2d 20 63 6f 6c 32 20 46 52 4f 4d 20 74   + - col2 FROM t
4710: 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
4720: 2d 0d 0a 2d 32 38 0d 0a 2d 34 38 0d 0a 2d 38 33  -..-28..-48..-83
4730: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
4740: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f  ort..SELECT + co
4750: 72 30 2e 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c 30  r0.col1 * - col0
4760: 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
4770: 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
4780: 0d 0a 2d 31 33 34 33 0d 0a 2d 32 31 37 0d 0a 2d  ..-1343..-217..-
4790: 34 36 30 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20  4602....query I 
47a0: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
47b0: 41 4c 4c 20 2b 20 63 6f 6c 32 20 2b 20 2b 20 31  ALL + col2 + + 1
47c0: 35 20 2a 20 63 6f 6c 31 20 41 53 20 63 6f 6c 30  5 * col1 AS col0
47d0: 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
47e0: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33 32 33 0d 0a  r0..----..1323..
47f0: 31 34 34 37 0d 0a 31 34 35 36 0d 0a 0d 0a 71 75  1447..1456....qu
4800: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
4810: 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 33  ELECT DISTINCT 3
4820: 32 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  2 AS col0 FROM t
4830: 61 62 31 2c 20 74 61 62 30 20 41 53 20 63 6f 72  ab1, tab0 AS cor
4840: 30 2c 20 74 61 62 31 20 41 53 20 63 6f 72 31 0d  0, tab1 AS cor1.
4850: 0a 2d 2d 2d 2d 0d 0a 33 32 0d 0a 0d 0a 71 75 65  .----..32....que
4860: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
4870: 4c 45 43 54 20 2d 20 63 6f 72 30 2e 63 6f 6c 31  LECT - cor0.col1
4880: 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
4890: 62 32 2c 20 74 61 62 31 2c 20 74 61 62 30 20 41  b2, tab1, tab0 A
48a0: 53 20 63 6f 72 30 2c 20 74 61 62 30 0d 0a 2d 2d  S cor0, tab0..--
48b0: 2d 2d 0d 0a 38 31 20 76 61 6c 75 65 73 20 68 61  --..81 values ha
48c0: 73 68 69 6e 67 20 74 6f 20 37 38 36 61 32 34 30  shing to 786a240
48d0: 66 38 30 62 65 66 36 66 39 63 36 61 31 39 30 65  f80bef6f9c6a190e
48e0: 39 32 63 64 34 66 39 65 38 0d 0a 0d 0a 71 75 65  92cd4f9e8....que
48f0: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
4900: 4c 45 43 54 20 41 4c 4c 20 35 37 20 2a 20 2b 20  LECT ALL 57 * + 
4910: 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46 52 4f  col2 AS col1 FRO
4920: 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 33 30  M tab1..----..30
4930: 37 38 0d 0a 33 32 34 39 0d 0a 35 34 37 32 0d 0a  78..3249..5472..
4940: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
4950: 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
4960: 43 54 20 63 6f 6c 32 20 2b 20 34 37 20 41 53 20  CT col2 + 47 AS 
4970: 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41  col1 FROM tab0 A
4980: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32  S cor0..----..12
4990: 39 0d 0a 34 38 0d 0a 38 30 0d 0a 0d 0a 71 75 65  9..48..80....que
49a0: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
49b0: 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 31 20  LECT ALL - col1 
49c0: 2d 20 2d 20 31 30 20 2a 20 2b 20 36 33 20 2a 20  - - 10 * + 63 * 
49d0: 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41  col0 FROM tab2 A
49e0: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 34 33  S cor0..----..43
49f0: 37 39 0d 0a 34 39 30 38 31 0d 0a 34 39 37 35 33  79..49081..49753
4a00: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
4a10: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
4a20: 2b 20 2d 20 63 6f 6c 31 20 2a 20 2b 20 37 37 20  + - col1 * + 77 
4a30: 2b 20 28 20 63 6f 6c 32 20 2b 20 63 6f 6c 32 20  + ( col2 + col2 
4a40: 29 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  ) FROM tab2 AS c
4a50: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32 33 33  or0..----..-1233
4a60: 0d 0a 2d 32 33 33 33 0d 0a 2d 34 34 39 31 0d 0a  ..-2333..-4491..
4a70: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
4a80: 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
4a90: 43 54 20 2b 20 63 6f 6c 32 20 2a 20 2d 20 32 39  CT + col2 * - 29
4aa0: 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
4ab0: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 33 37 38 0d  r0..----..-2378.
4ac0: 0a 2d 32 39 0d 0a 2d 39 35 37 0d 0a 0d 0a 71 75  .-29..-957....qu
4ad0: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
4ae0: 45 4c 45 43 54 20 2b 20 63 6f 6c 30 20 2b 20 2b  ELECT + col0 + +
4af0: 20 28 20 63 6f 6c 30 20 29 20 2a 20 2b 20 63 6f   ( col0 ) * + co
4b00: 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l0 FROM tab2 AS 
4b10: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 35 36 0d 0a  cor0..----..56..
4b20: 36 31 36 32 0d 0a 36 33 32 30 0d 0a 0d 0a 71 75  6162..6320....qu
4b30: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
4b40: 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 32  ELECT ALL - col2
4b50: 20 2b 20 2b 20 63 6f 6c 31 20 2d 20 63 6f 6c 31   + + col1 - col1
4b60: 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
4b70: 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
4b80: 0d 0a 2d 32 36 0d 0a 2d 32 37 0d 0a 2d 33 38 0d  ..-26..-27..-38.
4b90: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
4ba0: 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
4bb0: 4e 43 54 20 63 6f 6c 30 20 2a 20 2d 20 37 35 20  NCT col0 * - 75 
4bc0: 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a  FROM tab1 cor0..
4bd0: 2d 2d 2d 2d 0d 0a 2d 32 32 35 0d 0a 2d 34 38 30  ----..-225..-480
4be0: 30 0d 0a 2d 36 30 30 30 0d 0a 0d 0a 71 75 65 72  0..-6000....quer
4bf0: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
4c00: 45 43 54 20 31 33 20 46 52 4f 4d 20 74 61 62 30  ECT 13 FROM tab0
4c10: 2c 20 74 61 62 31 20 41 53 20 63 6f 72 30 2c 20  , tab1 AS cor0, 
4c20: 74 61 62 32 20 41 53 20 63 6f 72 31 0d 0a 2d 2d  tab2 AS cor1..--
4c30: 2d 2d 0d 0a 32 37 20 76 61 6c 75 65 73 20 68 61  --..27 values ha
4c40: 73 68 69 6e 67 20 74 6f 20 61 39 30 64 30 66 33  shing to a90d0f3
4c50: 37 63 65 63 36 30 33 61 65 31 62 63 30 61 36 30  7cec603ae1bc0a60
4c60: 64 63 37 66 62 61 65 65 64 0d 0a 0d 0a 71 75 65  dc7fbaeed....que
4c70: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
4c80: 4c 45 43 54 20 74 61 62 30 2e 63 6f 6c 32 20 2d  LECT tab0.col2 -
4c90: 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 0d   col2 FROM tab0.
4ca0: 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a  .----..0..0..0..
4cb0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
4cc0: 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 30  t..SELECT + col0
4cd0: 20 2b 20 2b 20 34 36 20 2a 20 2b 20 74 61 62 31   + + 46 * + tab1
4ce0: 2e 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46 52  .col2 AS col2 FR
4cf0: 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 32  OM tab1..----..2
4d00: 34 38 37 0d 0a 32 36 38 36 0d 0a 34 34 39 36 0d  487..2686..4496.
4d10: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
4d20: 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b  rt..SELECT ALL +
4d30: 20 33 31 20 46 52 4f 4d 20 74 61 62 32 2c 20 74   31 FROM tab2, t
4d40: 61 62 30 20 41 53 20 63 6f 72 30 2c 20 74 61 62  ab0 AS cor0, tab
4d50: 30 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d  0 AS cor1..----.
4d60: 0a 32 37 20 76 61 6c 75 65 73 20 68 61 73 68 69  .27 values hashi
4d70: 6e 67 20 74 6f 20 63 33 63 36 66 39 32 66 30 63  ng to c3c6f92f0c
4d80: 61 37 32 64 37 31 37 39 33 33 33 39 66 38 38 61  a72d71793339f88a
4d90: 35 37 65 33 33 36 0d 0a 0d 0a 71 75 65 72 79 20  57e336....query 
4da0: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
4db0: 54 20 28 20 2d 20 63 6f 72 30 2e 63 6f 6c 30 20  T ( - cor0.col0 
4dc0: 29 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  ) AS col2 FROM t
4dd0: 61 62 32 2c 20 74 61 62 31 20 41 53 20 63 6f 72  ab2, tab1 AS cor
4de0: 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65  0..----..9 value
4df0: 73 20 68 61 73 68 69 6e 67 20 74 6f 20 34 65 63  s hashing to 4ec
4e00: 33 30 34 62 38 63 65 39 33 35 66 32 32 32 36 65  304b8ce935f2226e
4e10: 37 35 34 38 64 37 32 63 32 62 32 66 30 0d 0a 0d  7548d72c2b2f0...
4e20: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
4e30: 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63  ..SELECT ALL + c
4e40: 6f 6c 31 20 2a 20 2b 20 63 6f 6c 31 20 2b 20 32  ol1 * + col1 + 2
4e50: 36 20 2a 20 2b 20 28 20 2b 20 63 6f 6c 31 20 29  6 * + ( + col1 )
4e60: 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
4e70: 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
4e80: 0d 0a 31 33 35 32 0d 0a 33 36 30 0d 0a 35 30 37  ..1352..360..507
4e90: 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
4ea0: 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61   # use DIV opera
4eb0: 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20  tor for integer 
4ec0: 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20  division..query 
4ed0: 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
4ee0: 31 33 37 0d 0a 53 45 4c 45 43 54 20 32 33 20 44  137..SELECT 23 D
4ef0: 49 56 20 63 6f 6c 30 20 2b 20 63 6f 6c 32 20 41  IV col0 + col2 A
4f00: 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32  S col0 FROM tab2
4f10: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
4f20: 32 36 0d 0a 33 30 0d 0a 33 38 0d 0a 0d 0a 73 6b  26..30..38....sk
4f30: 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
4f40: 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
4f50: 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
4f60: 65 6c 2d 31 33 37 0d 0a 53 45 4c 45 43 54 20 32  el-137..SELECT 2
4f70: 33 20 2f 20 63 6f 6c 30 20 2b 20 63 6f 6c 32 20  3 / col0 + col2 
4f80: 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
4f90: 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
4fa0: 0a 32 36 0d 0a 33 30 0d 0a 33 38 0d 0a 0d 0a 73  .26..30..38....s
4fb0: 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c  kipif postgresql
4fc0: 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65   # PostgreSQL re
4fd0: 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72  quires AS when r
4fe0: 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63  enaming output c
4ff0: 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20  olumns..query I 
5000: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
5010: 41 4c 4c 20 2d 20 63 6f 6c 30 20 2d 20 63 6f 6c  ALL - col0 - col
5020: 31 20 2a 20 38 35 20 2a 20 2b 20 63 6f 6c 30 20  1 * 85 * + col0 
5030: 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 63  col0 FROM tab2 c
5040: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 34 32  or0..----..-1142
5050: 33 34 0d 0a 2d 31 38 34 35 32 0d 0a 2d 33 39 31  34..-18452..-391
5060: 32 34 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  248....query I r
5070: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
5080: 49 53 54 49 4e 43 54 20 28 20 2d 20 63 6f 6c 30  ISTINCT ( - col0
5090: 20 29 20 2b 20 63 6f 6c 32 20 41 53 20 63 6f 6c   ) + col2 AS col
50a0: 32 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d  2 FROM tab2..---
50b0: 2d 0d 0a 2d 34 31 0d 0a 2d 35 32 0d 0a 32 30 0d  -..-41..-52..20.
50c0: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
50d0: 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 30 20  rt..SELECT col0 
50e0: 2b 20 38 32 20 2d 20 63 6f 6c 31 20 2a 20 2b 20  + 82 - col1 * + 
50f0: 31 31 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  11 AS col0 FROM 
5100: 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 35 32  tab2..----..-252
5110: 0d 0a 2d 32 36 0d 0a 2d 34 38 39 0d 0a 0d 0a 73  ..-26..-489....s
5120: 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c  kipif postgresql
5130: 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65   # PostgreSQL re
5140: 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72  quires AS when r
5150: 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63  enaming output c
5160: 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20  olumns..query I 
5170: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
5180: 63 6f 6c 31 20 2a 20 63 6f 6c 30 20 2d 20 2d 20  col1 * col0 - - 
5190: 63 6f 6c 30 20 63 6f 6c 30 20 46 52 4f 4d 20 74  col0 col0 FROM t
51a0: 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 31 32 30 0d  ab1..----..1120.
51b0: 0a 37 30 34 0d 0a 38 31 0d 0a 0d 0a 6f 6e 6c 79  .704..81....only
51c0: 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44  if mysql # use D
51d0: 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20  IV operator for 
51e0: 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e  integer division
51f0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
5200: 74 20 6c 61 62 65 6c 2d 31 34 32 0d 0a 53 45 4c  t label-142..SEL
5210: 45 43 54 20 2d 20 28 20 34 32 20 29 20 44 49 56  ECT - ( 42 ) DIV
5220: 20 2d 20 63 6f 6c 30 20 2b 20 2b 20 38 32 20 2b   - col0 + + 82 +
5230: 20 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46 52   col1 AS col1 FR
5240: 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31  OM tab0..----..1
5250: 36 39 0d 0a 31 37 33 0d 0a 31 38 30 0d 0a 0d 0a  69..173..180....
5260: 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
5270: 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
5280: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
5290: 61 62 65 6c 2d 31 34 32 0d 0a 53 45 4c 45 43 54  abel-142..SELECT
52a0: 20 2d 20 28 20 34 32 20 29 20 2f 20 2d 20 63 6f   - ( 42 ) / - co
52b0: 6c 30 20 2b 20 2b 20 38 32 20 2b 20 63 6f 6c 31  l0 + + 82 + col1
52c0: 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
52d0: 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 36 39 0d 0a 31  b0..----..169..1
52e0: 37 33 0d 0a 31 38 30 0d 0a 0d 0a 6f 6e 6c 79 69  73..180....onlyi
52f0: 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72  f mysql # suppor
5300: 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63  t for MySQL spec
5310: 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65  ific system type
5320: 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75  s and syntax..qu
5330: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
5340: 62 65 6c 2d 31 34 33 0d 0a 53 45 4c 45 43 54 20  bel-143..SELECT 
5350: 2d 20 43 41 53 54 28 20 4e 55 4c 4c 20 41 53 20  - CAST( NULL AS 
5360: 53 49 47 4e 45 44 20 29 20 2f 20 63 6f 6c 32 20  SIGNED ) / col2 
5370: 2b 20 2d 20 63 6f 6c 31 20 2a 20 63 6f 6c 30 20  + - col1 * col0 
5380: 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d  FROM tab2..----.
5390: 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c  .NULL..NULL..NUL
53a0: 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  L....skipif mysq
53b0: 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
53c0: 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
53d0: 6f 72 74 20 6c 61 62 65 6c 2d 31 34 33 0d 0a 53  ort label-143..S
53e0: 45 4c 45 43 54 20 2d 20 43 41 53 54 20 28 20 4e  ELECT - CAST ( N
53f0: 55 4c 4c 20 41 53 20 49 4e 54 45 47 45 52 20 29  ULL AS INTEGER )
5400: 20 2f 20 63 6f 6c 32 20 2b 20 2d 20 63 6f 6c 31   / col2 + - col1
5410: 20 2a 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62   * col0 FROM tab
5420: 32 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e  2..----..NULL..N
5430: 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75 65  ULL..NULL....que
5440: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
5450: 4c 45 43 54 20 33 32 20 2b 20 63 6f 6c 30 20 46  LECT 32 + col0 F
5460: 52 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d  ROM tab2 cor0..-
5470: 2d 2d 2d 0d 0a 31 31 30 0d 0a 31 31 31 0d 0a 33  ---..110..111..3
5480: 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  9....query I row
5490: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 33 38 20  sort..SELECT 38 
54a0: 2b 20 74 61 62 31 2e 63 6f 6c 31 20 41 53 20 63  + tab1.col1 AS c
54b0: 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d  ol1 FROM tab1..-
54c0: 2d 2d 2d 0d 0a 34 38 0d 0a 35 31 0d 0a 36 34 0d  ---..48..51..64.
54d0: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
54e0: 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b  rt..SELECT ALL +
54f0: 20 37 30 20 2a 20 63 6f 6c 30 20 2b 20 38 39 20   70 * col0 + 89 
5500: 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
5510: 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
5520: 0a 35 35 34 39 0d 0a 35 36 31 39 0d 0a 35 37 39  .5549..5619..579
5530: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
5540: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
5550: 2b 20 63 6f 6c 31 20 2a 20 63 6f 6c 30 20 2b 20  + col1 * col0 + 
5560: 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32  + col0 FROM tab2
5570: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 34 32   cor0..----..142
5580: 32 0d 0a 32 32 34 0d 0a 34 36 38 30 0d 0a 0d 0a  2..224..4680....
5590: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
55a0: 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 39 32  .SELECT ALL + 92
55b0: 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 2b 20 28   + cor0.col1 + (
55c0: 20 2b 20 35 31 20 29 20 46 52 4f 4d 20 74 61 62   + 51 ) FROM tab
55d0: 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
55e0: 0a 31 35 33 0d 0a 31 35 36 0d 0a 31 36 39 0d 0a  .153..156..169..
55f0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
5600: 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
5610: 43 54 20 2b 20 63 6f 6c 30 20 2d 20 63 6f 72 30  CT + col0 - cor0
5620: 2e 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20  .col2 FROM tab1 
5630: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
5640: 31 36 0d 0a 2d 35 31 0d 0a 37 0d 0a 0d 0a 71 75  16..-51..7....qu
5650: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
5660: 45 4c 45 43 54 20 41 4c 4c 20 2b 20 2d 20 34 37  ELECT ALL + - 47
5670: 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
5680: 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  b2 cor0..----..-
5690: 34 37 0d 0a 2d 34 37 0d 0a 2d 34 37 0d 0a 0d 0a  47..-47..-47....
56a0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
56b0: 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
56c0: 20 2b 20 2b 20 63 6f 6c 31 20 2a 20 2d 20 63 6f   + + col1 * - co
56d0: 6c 32 20 2b 20 2d 20 28 20 63 6f 6c 32 20 29 20  l2 + - ( col2 ) 
56e0: 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
56f0: 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 35 36 30 0d 0a  0..----..-1560..
5700: 2d 36 38 34 0d 0a 2d 38 36 34 0d 0a 0d 0a 71 75  -684..-864....qu
5710: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
5720: 45 4c 45 43 54 20 2d 20 38 35 20 2a 20 2d 20 63  ELECT - 85 * - c
5730: 6f 72 30 2e 63 6f 6c 30 20 2b 20 2d 20 38 38 20  or0.col0 + - 88 
5740: 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
5750: 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
5760: 0a 31 36 37 0d 0a 35 33 35 32 0d 0a 36 37 31 32  .167..5352..6712
5770: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
5780: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2d 20  ort..SELECT - - 
5790: 28 20 63 6f 6c 30 20 29 20 2a 20 2b 20 30 20 2a  ( col0 ) * + 0 *
57a0: 20 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c 30 20 2b   col0 + - col0 +
57b0: 20 2b 20 35 32 20 46 52 4f 4d 20 74 61 62 31 20   + 52 FROM tab1 
57c0: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
57d0: 31 32 0d 0a 2d 32 38 0d 0a 34 39 0d 0a 0d 0a 71  12..-28..49....q
57e0: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
57f0: 53 45 4c 45 43 54 20 63 6f 72 30 2e 63 6f 6c 30  SELECT cor0.col0
5800: 20 2b 20 63 6f 6c 31 20 2b 20 63 6f 6c 32 20 2a   + col1 + col2 *
5810: 20 63 6f 72 30 2e 63 6f 6c 32 20 46 52 4f 4d 20   cor0.col2 FROM 
5820: 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
5830: 2d 2d 0d 0a 32 39 34 35 0d 0a 33 33 32 33 0d 0a  --..2945..3323..
5840: 39 33 30 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20  9309....query I 
5850: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
5860: 41 4c 4c 20 2b 20 2d 20 34 35 20 46 52 4f 4d 20  ALL + - 45 FROM 
5870: 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab1 cor0..----.
5880: 0a 2d 34 35 0d 0a 2d 34 35 0d 0a 2d 34 35 0d 0a  .-45..-45..-45..
5890: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
58a0: 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
58b0: 43 54 20 2d 20 63 6f 6c 30 20 2a 20 74 61 62 32  CT - col0 * tab2
58c0: 2e 63 6f 6c 31 20 2a 20 63 6f 6c 30 20 46 52 4f  .col1 * col0 FRO
58d0: 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  M tab2..----..-1
58e0: 30 36 30 39 37 0d 0a 2d 31 35 31 39 0d 0a 2d 33  06097..-1519..-3
58f0: 35 38 39 35 36 0d 0a 0d 0a 71 75 65 72 79 20 49  58956....query I
5900: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
5910: 20 63 6f 6c 31 20 2a 20 63 6f 6c 30 20 2b 20 63   col1 * col0 + c
5920: 6f 6c 32 20 2a 20 2b 20 35 37 20 2a 20 2b 20 33  ol2 * + 57 * + 3
5930: 38 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  8 AS col2 FROM t
5940: 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 31 37 30 34  ab1..----..11704
5950: 32 0d 0a 31 32 34 31 30 32 0d 0a 32 30 38 39 37  2..124102..20897
5960: 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  6....query I row
5970: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
5980: 54 49 4e 43 54 20 2b 20 2b 20 63 6f 6c 31 20 2a  TINCT + + col1 *
5990: 20 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46 52   col1 AS col2 FR
59a0: 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
59b0: 0a 2d 2d 2d 2d 0d 0a 37 33 39 36 0d 0a 38 32 38  .----..7396..828
59c0: 31 0d 0a 39 34 30 39 0d 0a 0d 0a 71 75 65 72 79  1..9409....query
59d0: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
59e0: 43 54 20 41 4c 4c 20 2b 20 36 35 20 2a 20 2b 20  CT ALL + 65 * + 
59f0: 63 6f 6c 32 20 2b 20 63 6f 6c 31 20 2a 20 2b 20  col2 + col1 * + 
5a00: 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46 52 4f  col0 AS col0 FRO
5a10: 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
5a20: 2d 2d 2d 2d 0d 0a 31 33 34 32 39 0d 0a 33 34 36  ----..13429..346
5a30: 30 0d 0a 34 32 30 39 0d 0a 0d 0a 71 75 65 72 79  0..4209....query
5a40: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
5a50: 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 2b 20  CT DISTINCT + + 
5a60: 39 34 20 2b 20 2b 20 28 20 63 6f 6c 32 20 29 20  94 + + ( col2 ) 
5a70: 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
5a80: 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 37 0d 0a 31 37  0..----..127..17
5a90: 36 0d 0a 39 35 0d 0a 0d 0a 71 75 65 72 79 20 49  6..95....query I
5aa0: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
5ab0: 20 2d 20 63 6f 6c 31 20 2b 20 2b 20 63 6f 72 30   - col1 + + cor0
5ac0: 2e 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52  .col1 AS col0 FR
5ad0: 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
5ae0: 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a  .----..0..0..0..
5af0: 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
5b00: 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f   use DIV operato
5b10: 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69  r for integer di
5b20: 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20  vision..query I 
5b30: 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 36  rowsort label-16
5b40: 32 0d 0a 53 45 4c 45 43 54 20 2d 20 2d 20 31 31  2..SELECT - - 11
5b50: 20 44 49 56 20 2d 20 63 6f 6c 30 20 46 52 4f 4d   DIV - col0 FROM
5b60: 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab2 cor0..----
5b70: 0d 0a 2d 31 0d 0a 30 0d 0a 30 0d 0a 0d 0a 73 6b  ..-1..0..0....sk
5b80: 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
5b90: 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
5ba0: 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
5bb0: 65 6c 2d 31 36 32 0d 0a 53 45 4c 45 43 54 20 2d  el-162..SELECT -
5bc0: 20 2d 20 31 31 20 2f 20 2d 20 63 6f 6c 30 20 46   - 11 / - col0 F
5bd0: 52 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d  ROM tab2 cor0..-
5be0: 2d 2d 2d 0d 0a 2d 31 0d 0a 30 0d 0a 30 0d 0a 0d  ---..-1..0..0...
5bf0: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
5c00: 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 33 35 20  ..SELECT ALL 35 
5c10: 2a 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30  * col2 FROM tab0
5c20: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
5c30: 31 31 35 35 0d 0a 32 38 37 30 0d 0a 33 35 0d 0a  1155..2870..35..
5c40: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
5c50: 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
5c60: 43 54 20 2d 20 2d 20 36 34 20 2a 20 63 6f 6c 32  CT - - 64 * col2
5c70: 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
5c80: 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
5c90: 0d 0a 33 34 35 36 0d 0a 33 36 34 38 0d 0a 36 31  ..3456..3648..61
5ca0: 34 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  44....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 2b 20 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c  L + col0 * + col
5cd0: 31 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61  1 + col1 FROM ta
5ce0: 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  b1 cor0..----..1
5cf0: 30 34 0d 0a 31 30 35 33 0d 0a 36 35 30 0d 0a 0d  04..1053..650...
5d00: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
5d10: 0d 0a 53 45 4c 45 43 54 20 2d 20 2d 20 63 6f 6c  ..SELECT - - col
5d20: 31 20 2a 20 2d 20 63 6f 6c 30 20 2a 20 63 6f 6c  1 * - col0 * col
5d30: 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  0 FROM tab1 AS c
5d40: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 33 34 0d  or0..----..-234.
5d50: 0a 2d 34 30 39 36 30 0d 0a 2d 38 33 32 30 30 0d  .-40960..-83200.
5d60: 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
5d70: 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74  # use DIV operat
5d80: 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64  or for integer d
5d90: 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49  ivision..query I
5da0: 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
5db0: 36 37 0d 0a 53 45 4c 45 43 54 20 2b 20 2b 20 63  67..SELECT + + c
5dc0: 6f 6c 31 20 2b 20 2b 20 63 6f 6c 32 20 44 49 56  ol1 + + col2 DIV
5dd0: 20 2d 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62   - col1 FROM tab
5de0: 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
5df0: 0a 32 34 0d 0a 35 0d 0a 36 0d 0a 0d 0a 73 6b 69  .24..5..6....ski
5e00: 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
5e10: 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
5e20: 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
5e30: 6c 2d 31 36 37 0d 0a 53 45 4c 45 43 54 20 2b 20  l-167..SELECT + 
5e40: 2b 20 63 6f 6c 31 20 2b 20 2b 20 63 6f 6c 32 20  + col1 + + col2 
5e50: 2f 20 2d 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61  / - col1 FROM ta
5e60: 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
5e70: 0d 0a 32 34 0d 0a 35 0d 0a 36 0d 0a 0d 0a 71 75  ..24..5..6....qu
5e80: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
5e90: 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 63  ELECT DISTINCT c
5ea0: 6f 6c 32 20 2a 20 2d 20 63 6f 6c 30 20 2b 20 63  ol2 * - col0 + c
5eb0: 6f 6c 30 20 2a 20 2b 20 63 6f 6c 30 20 46 52 4f  ol0 * + col0 FRO
5ec0: 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
5ed0: 2d 2d 2d 2d 0d 0a 2d 32 31 36 0d 0a 31 31 39 30  ----..-216..1190
5ee0: 0d 0a 36 32 33 0d 0a 0d 0a 71 75 65 72 79 20 49  ..623....query I
5ef0: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
5f00: 20 41 4c 4c 20 63 6f 72 30 2e 63 6f 6c 32 20 2a   ALL cor0.col2 *
5f10: 20 2b 20 28 20 2b 20 63 6f 6c 31 20 29 20 2b 20   + ( + col1 ) + 
5f20: 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41  col0 FROM tab0 A
5f30: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33  S cor0..----..13
5f40: 32 0d 0a 32 38 36 32 0d 0a 37 35 35 31 0d 0a 0d  2..2862..7551...
5f50: 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
5f60: 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51  support for MySQ
5f70: 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65  L specific syste
5f80: 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74  m types and synt
5f90: 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ax..query I rows
5fa0: 6f 72 74 20 6c 61 62 65 6c 2d 31 37 30 0d 0a 53  ort label-170..S
5fb0: 45 4c 45 43 54 20 2d 20 63 6f 6c 32 20 2a 20 2d  ELECT - col2 * -
5fc0: 20 28 20 2d 20 63 6f 6c 31 20 2a 20 2d 20 63 6f   ( - col1 * - co
5fd0: 6c 32 20 29 20 2b 20 2d 20 43 41 53 54 28 20 2d  l2 ) + - CAST( -
5fe0: 20 36 36 20 41 53 20 53 49 47 4e 45 44 20 29 20   66 AS SIGNED ) 
5ff0: 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a  FROM tab0 cor0..
6000: 2d 2d 2d 2d 0d 0a 31 36 33 0d 0a 36 31 31 39 35  ----..163..61195
6010: 30 0d 0a 39 33 37 32 30 0d 0a 0d 0a 73 6b 69 70  0..93720....skip
6020: 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
6030: 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
6040: 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
6050: 2d 31 37 30 0d 0a 53 45 4c 45 43 54 20 2d 20 63  -170..SELECT - c
6060: 6f 6c 32 20 2a 20 2d 20 28 20 2d 20 63 6f 6c 31  ol2 * - ( - col1
6070: 20 2a 20 2d 20 63 6f 6c 32 20 29 20 2b 20 2d 20   * - col2 ) + - 
6080: 43 41 53 54 20 28 20 2d 20 36 36 20 41 53 20 49  CAST ( - 66 AS I
6090: 4e 54 45 47 45 52 20 29 20 46 52 4f 4d 20 74 61  NTEGER ) FROM ta
60a0: 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  b0 cor0..----..1
60b0: 36 33 0d 0a 36 31 31 39 35 30 0d 0a 39 33 37 32  63..611950..9372
60c0: 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  0....query I row
60d0: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
60e0: 20 2b 20 63 6f 6c 30 20 2b 20 63 6f 6c 30 20 2a   + col0 + col0 *
60f0: 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20   + col1 AS col2 
6100: 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
6110: 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 32 30 0d 0a 37  0..----..1120..7
6120: 30 34 0d 0a 38 31 0d 0a 0d 0a 6f 6e 6c 79 69 66  04..81....onlyif
6130: 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56   mysql # use DIV
6140: 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e   operator for in
6150: 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a  teger division..
6160: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
6170: 6c 61 62 65 6c 2d 31 37 32 0d 0a 53 45 4c 45 43  label-172..SELEC
6180: 54 20 2b 20 2b 20 63 6f 6c 32 20 2a 20 63 6f 6c  T + + col2 * col
6190: 30 20 44 49 56 20 2d 20 63 6f 6c 31 20 2b 20 2d  0 DIV - col1 + -
61a0: 20 63 6f 6c 32 20 63 6f 6c 30 20 46 52 4f 4d 20   col2 col0 FROM 
61b0: 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
61c0: 2d 2d 0d 0a 2d 31 0d 0a 2d 31 36 32 0d 0a 2d 34  --..-1..-162..-4
61d0: 32 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74  2....skipif post
61e0: 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65  gresql # Postgre
61f0: 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20  SQL requires AS 
6200: 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75  when renaming ou
6210: 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 73 6b  tput columns..sk
6220: 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
6230: 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
6240: 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
6250: 65 6c 2d 31 37 32 0d 0a 53 45 4c 45 43 54 20 2b  el-172..SELECT +
6260: 20 2b 20 63 6f 6c 32 20 2a 20 63 6f 6c 30 20 2f   + col2 * col0 /
6270: 20 2d 20 63 6f 6c 31 20 2b 20 2d 20 63 6f 6c 32   - col1 + - col2
6280: 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20   col0 FROM tab0 
6290: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
62a0: 31 0d 0a 2d 31 36 32 0d 0a 2d 34 32 0d 0a 0d 0a  1..-162..-42....
62b0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
62c0: 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 2b 20  .SELECT ALL - + 
62d0: 63 6f 72 30 2e 63 6f 6c 32 20 2b 20 2b 20 36 32  cor0.col2 + + 62
62e0: 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
62f0: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 34 0d 0a 33 35  r0..----..24..35
6300: 0d 0a 33 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..36....query I 
6310: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
6320: 41 4c 4c 20 63 6f 6c 30 20 2a 20 39 39 20 2a 20  ALL col0 * 99 * 
6330: 2d 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30  - col0 FROM tab0
6340: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32   cor0..----..-12
6350: 31 32 37 35 0d 0a 2d 35 37 30 32 34 0d 0a 2d 37  1275..-57024..-7
6360: 38 34 31 37 39 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  84179....onlyif 
6370: 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20  mysql # use DIV 
6380: 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74  operator for int
6390: 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71  eger division..q
63a0: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
63b0: 61 62 65 6c 2d 31 37 35 0d 0a 53 45 4c 45 43 54  abel-175..SELECT
63c0: 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 30 20 2b   DISTINCT col0 +
63d0: 20 2b 20 28 20 63 6f 6c 31 20 29 20 44 49 56 20   + ( col1 ) DIV 
63e0: 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30  + col1 FROM tab0
63f0: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
6400: 32 35 0d 0a 33 36 0d 0a 39 30 0d 0a 0d 0a 73 6b  25..36..90....sk
6410: 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
6420: 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
6430: 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
6440: 65 6c 2d 31 37 35 0d 0a 53 45 4c 45 43 54 20 44  el-175..SELECT D
6450: 49 53 54 49 4e 43 54 20 63 6f 6c 30 20 2b 20 2b  ISTINCT col0 + +
6460: 20 28 20 63 6f 6c 31 20 29 20 2f 20 2b 20 63 6f   ( col1 ) / + co
6470: 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l1 FROM tab0 AS 
6480: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 35 0d 0a  cor0..----..25..
6490: 33 36 0d 0a 39 30 0d 0a 0d 0a 71 75 65 72 79 20  36..90....query 
64a0: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
64b0: 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c  T DISTINCT - col
64c0: 30 20 2a 20 33 37 20 41 53 20 63 6f 6c 32 20 46  0 * 37 AS col2 F
64d0: 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
64e0: 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 35 39 0d 0a 2d 32  ..----..-259..-2
64f0: 38 38 36 0d 0a 2d 32 39 32 33 0d 0a 0d 0a 6f 6e  886..-2923....on
6500: 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
6510: 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
6520: 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
6530: 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
6540: 6f 72 74 20 6c 61 62 65 6c 2d 31 37 37 0d 0a 53  ort label-177..S
6550: 45 4c 45 43 54 20 2d 20 63 6f 6c 32 20 2b 20 63  ELECT - col2 + c
6560: 6f 6c 32 20 44 49 56 20 2b 20 35 30 20 46 52 4f  ol2 DIV + 50 FRO
6570: 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
6580: 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 2d 33 33 0d 0a 2d  ----..-1..-33..-
6590: 38 31 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  81....skipif mys
65a0: 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
65b0: 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
65c0: 73 6f 72 74 20 6c 61 62 65 6c 2d 31 37 37 0d 0a  sort label-177..
65d0: 53 45 4c 45 43 54 20 2d 20 63 6f 6c 32 20 2b 20  SELECT - col2 + 
65e0: 63 6f 6c 32 20 2f 20 2b 20 35 30 20 46 52 4f 4d  col2 / + 50 FROM
65f0: 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
6600: 2d 2d 2d 0d 0a 2d 31 0d 0a 2d 33 33 0d 0a 2d 38  ---..-1..-33..-8
6610: 31 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  1....onlyif mysq
6620: 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72  l # use DIV oper
6630: 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72  ator for integer
6640: 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79   division..query
6650: 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
6660: 2d 31 37 38 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  -178..SELECT ALL
6670: 20 63 6f 6c 30 20 2b 20 2b 20 39 32 20 44 49 56   col0 + + 92 DIV
6680: 20 2d 20 63 6f 72 30 2e 63 6f 6c 31 20 46 52 4f   - cor0.col1 FRO
6690: 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
66a0: 2d 2d 2d 2d 0d 0a 30 0d 0a 35 35 0d 0a 37 33 0d  ----..0..55..73.
66b0: 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
66c0: 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
66d0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
66e0: 74 20 6c 61 62 65 6c 2d 31 37 38 0d 0a 53 45 4c  t label-178..SEL
66f0: 45 43 54 20 41 4c 4c 20 63 6f 6c 30 20 2b 20 2b  ECT ALL col0 + +
6700: 20 39 32 20 2f 20 2d 20 63 6f 72 30 2e 63 6f 6c   92 / - cor0.col
6710: 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  1 FROM tab1 AS c
6720: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 35 35  or0..----..0..55
6730: 0d 0a 37 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..73....query I 
6740: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
6750: 41 4c 4c 20 2d 20 63 6f 6c 31 20 2a 20 63 6f 72  ALL - col1 * cor
6760: 30 2e 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c 30 20  0.col0 + + col0 
6770: 2a 20 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46  * col1 AS col0 F
6780: 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
6790: 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d  ..----..0..0..0.
67a0: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
67b0: 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b  rt..SELECT ALL +
67c0: 20 63 6f 6c 31 20 2b 20 63 6f 72 30 2e 63 6f 6c   col1 + cor0.col
67d0: 31 20 2a 20 63 6f 6c 31 20 41 53 20 63 6f 6c 31  1 * col1 AS col1
67e0: 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
67f0: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 37 34 38 32 0d 0a  r0..----..7482..
6800: 38 33 37 32 0d 0a 39 35 30 36 0d 0a 0d 0a 71 75  8372..9506....qu
6810: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
6820: 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 32 20 2b  ELECT ALL col2 +
6830: 20 63 6f 6c 32 20 2a 20 63 6f 6c 31 20 41 53 20   col2 * col1 AS 
6840: 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41  col1 FROM tab1 A
6850: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33  S cor0..----..13
6860: 34 34 0d 0a 31 34 35 38 0d 0a 36 32 37 0d 0a 0d  44..1458..627...
6870: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
6880: 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
6890: 54 20 2d 20 63 6f 6c 31 20 2a 20 39 34 20 2a 20  T - col1 * 94 * 
68a0: 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32  + col0 FROM tab2
68b0: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32   cor0..----..-12
68c0: 36 32 34 32 0d 0a 2d 32 30 33 39 38 0d 0a 2d 34  6242..-20398..-4
68d0: 33 32 35 38 38 0d 0a 0d 0a 71 75 65 72 79 20 49  32588....query I
68e0: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
68f0: 20 74 61 62 32 2e 63 6f 6c 32 20 2b 20 2d 20 63   tab2.col2 + - c
6900: 6f 6c 31 20 2d 20 38 35 20 41 53 20 63 6f 6c 32  ol1 - 85 AS col2
6910: 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d   FROM tab2..----
6920: 0d 0a 2d 31 31 38 0d 0a 2d 36 34 0d 0a 2d 38 39  ..-118..-64..-89
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 38 37  ort..SELECT - 87
6950: 20 2b 20 2b 20 74 61 62 31 2e 63 6f 6c 31 20 46   + + tab1.col1 F
6960: 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab1..----..
6970: 2d 36 31 0d 0a 2d 37 34 0d 0a 2d 37 37 0d 0a 0d  -61..-74..-77...
6980: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
6990: 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
69a0: 54 20 2b 20 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c  T + col2 * - col
69b0: 31 20 2d 20 63 6f 6c 31 20 41 53 20 63 6f 6c 32  1 - col1 AS col2
69c0: 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
69d0: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 35 39 33 0d  r0..----..-1593.
69e0: 0a 2d 36 36 33 0d 0a 2d 38 36 38 0d 0a 0d 0a 71  .-663..-868....q
69f0: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
6a00: 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
6a10: 2d 20 63 6f 6c 31 20 2b 20 2b 20 63 6f 72 30 2e  - col1 + + cor0.
6a20: 63 6f 6c 31 20 2a 20 63 6f 6c 31 20 41 53 20 63  col1 * col1 AS c
6a30: 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol0 FROM tab0 AS
6a40: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 37 33 31   cor0..----..731
6a50: 30 0d 0a 38 31 39 30 0d 0a 39 33 31 32 0d 0a 0d  0..8190..9312...
6a60: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
6a70: 0d 0a 53 45 4c 45 43 54 20 2d 20 2b 20 63 6f 6c  ..SELECT - + col
6a80: 31 20 2a 20 37 34 20 2a 20 39 36 20 2b 20 2b 20  1 * 74 * 96 + + 
6a90: 63 6f 6c 32 20 2a 20 63 6f 6c 32 20 46 52 4f 4d  col2 * col2 FROM
6aa0: 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab2 cor0..----
6ab0: 0d 0a 2d 31 31 39 33 32 34 0d 0a 2d 32 31 39 34  ..-119324..-2194
6ac0: 39 35 0d 0a 2d 34 31 38 34 36 30 0d 0a 0d 0a 71  95..-418460....q
6ad0: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
6ae0: 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
6af0: 2b 20 35 39 20 2d 20 2d 20 74 61 62 31 2e 63 6f  + 59 - - tab1.co
6b00: 6c 30 20 46 52 4f 4d 20 74 61 62 31 2c 20 74 61  l0 FROM tab1, ta
6b10: 62 31 20 41 53 20 63 6f 72 30 2c 20 74 61 62 30  b1 AS cor0, tab0
6b20: 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a   AS cor1..----..
6b30: 31 32 33 0d 0a 31 33 39 0d 0a 36 32 0d 0a 0d 0a  123..139..62....
6b40: 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75  onlyif mysql # u
6b50: 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20  se DIV operator 
6b60: 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69  for integer divi
6b70: 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f  sion..query I ro
6b80: 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 38 39 0d  wsort label-189.
6b90: 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f  .SELECT ALL + co
6ba0: 6c 31 20 44 49 56 20 2d 20 32 33 20 2b 20 2d 20  l1 DIV - 23 + - 
6bb0: 63 6f 6c 30 20 2a 20 63 6f 6c 30 20 2b 20 2d 20  col0 * col0 + - 
6bc0: 33 36 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d  36 FROM tab0..--
6bd0: 2d 2d 0d 0a 2d 31 32 36 35 0d 0a 2d 36 31 35 0d  --..-1265..-615.
6be0: 0a 2d 37 39 36 30 0d 0a 0d 0a 73 6b 69 70 69 66  .-7960....skipif
6bf0: 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
6c00: 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
6c10: 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
6c20: 38 39 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b  89..SELECT ALL +
6c30: 20 63 6f 6c 31 20 2f 20 2d 20 32 33 20 2b 20 2d   col1 / - 23 + -
6c40: 20 63 6f 6c 30 20 2a 20 63 6f 6c 30 20 2b 20 2d   col0 * col0 + -
6c50: 20 33 36 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d   36 FROM tab0..-
6c60: 2d 2d 2d 0d 0a 2d 31 32 36 35 0d 0a 2d 36 31 35  ---..-1265..-615
6c70: 0d 0a 2d 37 39 36 30 0d 0a 0d 0a 71 75 65 72 79  ..-7960....query
6c80: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
6c90: 43 54 20 2d 20 63 6f 6c 30 20 2b 20 33 32 20 46  CT - col0 + 32 F
6ca0: 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
6cb0: 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 32 0d 0a 2d 34 38  ..----..-32..-48
6cc0: 0d 0a 32 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..29....query I 
6cd0: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
6ce0: 2d 20 38 35 20 2b 20 63 6f 6c 32 20 41 53 20 63  - 85 + col2 AS c
6cf0: 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol0 FROM tab2 AS
6d00: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 37   cor0..----..-47
6d10: 0d 0a 2d 35 38 0d 0a 2d 35 39 0d 0a 0d 0a 71 75  ..-58..-59....qu
6d20: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
6d30: 45 4c 45 43 54 20 2b 20 2d 20 28 20 33 35 20 29  ELECT + - ( 35 )
6d40: 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
6d50: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 35 0d 0a 2d  r0..----..-35..-
6d60: 33 35 0d 0a 2d 33 35 0d 0a 0d 0a 71 75 65 72 79  35..-35....query
6d70: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
6d80: 43 54 20 32 31 20 46 52 4f 4d 20 74 61 62 31 2c  CT 21 FROM tab1,
6d90: 20 74 61 62 30 20 41 53 20 63 6f 72 30 2c 20 74   tab0 AS cor0, t
6da0: 61 62 31 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d  ab1 AS cor1..---
6db0: 2d 0d 0a 32 37 20 76 61 6c 75 65 73 20 68 61 73  -..27 values has
6dc0: 68 69 6e 67 20 74 6f 20 33 31 32 63 31 36 36 66  hing to 312c166f
6dd0: 34 64 63 34 31 32 37 33 30 63 34 33 35 35 35 31  4dc412730c435551
6de0: 30 35 62 31 66 34 34 62 0d 0a 0d 0a 71 75 65 72  05b1f44b....quer
6df0: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
6e00: 45 43 54 20 44 49 53 54 49 4e 43 54 20 37 20 2a  ECT DISTINCT 7 *
6e10: 20 2d 20 34 30 20 46 52 4f 4d 20 74 61 62 30 2c   - 40 FROM tab0,
6e20: 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab2 cor0..----
6e30: 0d 0a 2d 32 38 30 0d 0a 0d 0a 71 75 65 72 79 20  ..-280....query 
6e40: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
6e50: 54 20 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c 32 20  T col0 * - col2 
6e60: 2b 20 2d 20 33 39 20 41 53 20 63 6f 6c 30 20 46  + - 39 AS col0 F
6e70: 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab0..----..
6e80: 2d 37 33 33 37 0d 0a 2d 37 34 0d 0a 2d 38 33 31  -7337..-74..-831
6e90: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
6ea0: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 32  ort..SELECT col2
6eb0: 20 2a 20 2b 20 28 20 63 6f 6c 31 20 29 20 46 52   * + ( col1 ) FR
6ec0: 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31  OM tab2..----..1
6ed0: 35 33 34 0d 0a 36 34 36 0d 0a 38 33 37 0d 0a 0d  534..646..837...
6ee0: 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73  .skipif postgres
6ef0: 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20  ql # PostgreSQL 
6f00: 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e  requires AS when
6f10: 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74   renaming output
6f20: 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20   columns..query 
6f30: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
6f40: 54 20 2d 20 28 20 2d 20 33 39 20 29 20 63 6f 6c  T - ( - 39 ) col
6f50: 32 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30  2 FROM tab0 cor0
6f60: 0d 0a 2d 2d 2d 2d 0d 0a 33 39 0d 0a 33 39 0d 0a  ..----..39..39..
6f70: 33 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  39....query I ro
6f80: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
6f90: 2d 20 33 33 20 2b 20 63 6f 6c 31 20 46 52 4f 4d  - 33 + col1 FROM
6fa0: 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
6fb0: 2d 2d 2d 0d 0a 35 30 0d 0a 36 34 0d 0a 39 32 0d  ---..50..64..92.
6fc0: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
6fd0: 72 74 0d 0a 53 45 4c 45 43 54 20 39 30 20 46 52  rt..SELECT 90 FR
6fe0: 4f 4d 20 74 61 62 30 2c 20 74 61 62 30 20 63 6f  OM tab0, tab0 co
6ff0: 72 30 2c 20 74 61 62 31 2c 20 74 61 62 32 20 41  r0, tab1, tab2 A
7000: 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 38 31  S cor1..----..81
7010: 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20   values hashing 
7020: 74 6f 20 33 62 34 36 34 34 65 66 30 37 33 34 65  to 3b4644ef0734e
7030: 64 32 32 30 39 35 32 63 61 65 37 65 30 36 34 38  d220952cae7e0648
7040: 63 34 62 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  c4b....query I r
7050: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
7060: 20 63 6f 72 30 2e 63 6f 6c 32 20 2b 20 34 30 20   cor0.col2 + 40 
7070: 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
7080: 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
7090: 0a 2d 34 32 0d 0a 33 39 0d 0a 37 0d 0a 0d 0a 73  .-42..39..7....s
70a0: 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c  kipif postgresql
70b0: 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65   # PostgreSQL re
70c0: 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72  quires AS when r
70d0: 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63  enaming output c
70e0: 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20  olumns..query I 
70f0: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
7100: 44 49 53 54 49 4e 43 54 20 2d 20 28 20 2d 20 39  DISTINCT - ( - 9
7110: 35 20 29 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61  5 ) col0 FROM ta
7120: 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
7130: 0d 0a 39 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..95....query I 
7140: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
7150: 2d 20 36 32 20 46 52 4f 4d 20 74 61 62 30 20 63  - 62 FROM tab0 c
7160: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 36 32 0d 0a  or0..----..-62..
7170: 2d 36 32 0d 0a 2d 36 32 0d 0a 0d 0a 71 75 65 72  -62..-62....quer
7180: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
7190: 45 43 54 20 41 4c 4c 20 2b 20 34 34 20 2a 20 2b  ECT ALL + 44 * +
71a0: 20 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46 52   col0 AS col1 FR
71b0: 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d  OM tab1 cor0..--
71c0: 2d 2d 0d 0a 31 33 32 0d 0a 32 38 31 36 0d 0a 33  --..132..2816..3
71d0: 35 32 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  520....query I r
71e0: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
71f0: 49 53 54 49 4e 43 54 20 2d 20 63 6f 72 30 2e 63  ISTINCT - cor0.c
7200: 6f 6c 31 20 2b 20 2b 20 63 6f 6c 30 20 41 53 20  ol1 + + col0 AS 
7210: 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41  col2 FROM tab0 A
7220: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32  S cor0..----..-2
7230: 0d 0a 2d 36 32 0d 0a 0d 0a 73 6b 69 70 69 66 20  ..-62....skipif 
7240: 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73  postgresql # Pos
7250: 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73  tgreSQL requires
7260: 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e   AS when renamin
7270: 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73  g output columns
7280: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
7290: 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 31  t..SELECT + col1
72a0: 20 2a 20 28 20 2b 20 63 6f 6c 30 20 29 20 63 6f   * ( + col0 ) co
72b0: 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l0 FROM tab1 AS 
72c0: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 34 30  cor0..----..1040
72d0: 0d 0a 36 34 30 0d 0a 37 38 0d 0a 0d 0a 71 75 65  ..640..78....que
72e0: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
72f0: 4c 45 43 54 20 2b 20 63 6f 6c 31 20 2a 20 63 6f  LECT + col1 * co
7300: 6c 30 20 2d 20 63 6f 6c 30 20 41 53 20 63 6f 6c  l0 - col0 AS col
7310: 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  2 FROM tab2 AS c
7320: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 36 34 0d  or0..----..1264.
7330: 0a 32 31 30 0d 0a 34 35 32 34 0d 0a 0d 0a 71 75  .210..4524....qu
7340: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
7350: 45 4c 45 43 54 20 2b 20 63 6f 6c 32 20 2b 20 2b  ELECT + col2 + +
7360: 20 37 36 20 2a 20 2d 20 63 6f 6c 30 20 46 52 4f   76 * - col0 FRO
7370: 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
7380: 2d 2d 2d 2d 0d 0a 2d 31 37 34 0d 0a 2d 34 38 30  ----..-174..-480
7390: 37 0d 0a 2d 35 39 38 34 0d 0a 0d 0a 71 75 65 72  7..-5984....quer
73a0: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
73b0: 45 43 54 20 2b 20 63 6f 6c 30 20 2d 20 28 20 2d  ECT + col0 - ( -
73c0: 20 63 6f 6c 31 20 29 20 46 52 4f 4d 20 74 61 62   col1 ) FROM tab
73d0: 31 0d 0a 2d 2d 2d 2d 0d 0a 32 39 0d 0a 37 34 0d  1..----..29..74.
73e0: 0a 39 33 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  .93....onlyif my
73f0: 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f  sql # support fo
7400: 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63  r MySQL specific
7410: 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e   system types an
7420: 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20  d syntax..query 
7430: 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
7440: 32 30 39 0d 0a 53 45 4c 45 43 54 20 43 41 53 54  209..SELECT CAST
7450: 28 20 4e 55 4c 4c 20 41 53 20 53 49 47 4e 45 44  ( NULL AS SIGNED
7460: 20 29 20 2b 20 2d 20 37 33 20 2a 20 63 6f 6c 32   ) + - 73 * col2
7470: 20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d   FROM tab1 cor0.
7480: 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c  .----..NULL..NUL
7490: 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69  L..NULL....skipi
74a0: 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
74b0: 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
74c0: 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
74d0: 32 30 39 0d 0a 53 45 4c 45 43 54 20 43 41 53 54  209..SELECT CAST
74e0: 20 28 20 4e 55 4c 4c 20 41 53 20 49 4e 54 45 47   ( NULL AS INTEG
74f0: 45 52 20 29 20 2b 20 2d 20 37 33 20 2a 20 63 6f  ER ) + - 73 * co
7500: 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72  l2 FROM tab1 cor
7510: 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e  0..----..NULL..N
7520: 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75 65  ULL..NULL....que
7530: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
7540: 4c 45 43 54 20 2b 20 63 6f 6c 31 20 2a 20 63 6f  LECT + col1 * co
7550: 6c 30 20 2b 20 31 31 20 41 53 20 63 6f 6c 31 20  l0 + 11 AS col1 
7560: 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
7570: 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 35 31 0d 0a 36  0..----..1051..6
7580: 35 31 0d 0a 38 39 0d 0a 0d 0a 71 75 65 72 79 20  51..89....query 
7590: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
75a0: 54 20 63 6f 6c 32 20 2b 20 2d 20 63 6f 6c 32 20  T col2 + - col2 
75b0: 2a 20 63 6f 6c 31 20 2d 20 35 37 20 46 52 4f 4d  * col1 - 57 FROM
75c0: 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
75d0: 2d 2d 2d 0d 0a 2d 31 35 33 0d 0a 2d 32 38 36 32  ---..-153..-2862
75e0: 0d 0a 2d 37 34 33 37 0d 0a 0d 0a 71 75 65 72 79  ..-7437....query
75f0: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
7600: 43 54 20 41 4c 4c 20 2d 20 36 36 20 2d 20 63 6f  CT ALL - 66 - co
7610: 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l0 FROM tab1 AS 
7620: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 30  cor0..----..-130
7630: 0d 0a 2d 31 34 36 0d 0a 2d 36 39 0d 0a 0d 0a 71  ..-146..-69....q
7640: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
7650: 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
7660: 37 36 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  76 AS col2 FROM 
7670: 74 61 62 30 2c 20 74 61 62 30 20 63 6f 72 30 0d  tab0, tab0 cor0.
7680: 0a 2d 2d 2d 2d 0d 0a 37 36 0d 0a 0d 0a 71 75 65  .----..76....que
7690: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
76a0: 4c 45 43 54 20 2b 20 63 6f 6c 30 20 2a 20 28 20  LECT + col0 * ( 
76b0: 28 20 63 6f 6c 30 20 29 20 2a 20 63 6f 6c 32 20  ( col0 ) * col2 
76c0: 29 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  ) AS col2 FROM t
76d0: 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 32 35 0d  ab0..----..1225.
76e0: 0a 31 39 30 30 38 0d 0a 36 34 39 35 32 32 0d 0a  .19008..649522..
76f0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
7700: 74 0d 0a 53 45 4c 45 43 54 20 2b 20 28 20 63 6f  t..SELECT + ( co
7710: 6c 31 20 29 20 2a 20 63 6f 6c 31 20 46 52 4f 4d  l1 ) * col1 FROM
7720: 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab0 cor0..----
7730: 0d 0a 37 33 39 36 0d 0a 38 32 38 31 0d 0a 39 34  ..7396..8281..94
7740: 30 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  09....query I ro
7750: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
7760: 38 31 20 2a 20 63 6f 72 30 2e 63 6f 6c 30 20 46  81 * cor0.col0 F
7770: 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
7780: 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 39 34 34 0d 0a 2d  ..----..-1944..-
7790: 32 38 33 35 0d 0a 2d 37 32 30 39 0d 0a 0d 0a 71  2835..-7209....q
77a0: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
77b0: 53 45 4c 45 43 54 20 2b 20 2b 20 28 20 2b 20 37  SELECT + + ( + 7
77c0: 20 29 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20   ) FROM tab0 AS 
77d0: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 37 0d 0a 37  cor0..----..7..7
77e0: 0d 0a 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  ..7....query I r
77f0: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
7800: 20 2b 20 28 20 2b 20 33 36 20 29 20 2a 20 2d 20   + ( + 36 ) * - 
7810: 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41  col2 FROM tab1 A
7820: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 39  S cor0..----..19
7830: 34 34 0d 0a 32 30 35 32 0d 0a 33 34 35 36 0d 0a  44..2052..3456..
7840: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
7850: 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 31  t..SELECT - col1
7860: 20 2b 20 31 31 20 2a 20 63 6f 6c 32 20 46 52 4f   + 11 * col2 FRO
7870: 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
7880: 2d 2d 2d 2d 0d 0a 31 30 34 33 0d 0a 35 36 38 0d  ----..1043..568.
7890: 0a 36 31 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .617....query I 
78a0: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
78b0: 28 20 2d 20 63 6f 6c 30 20 29 20 2a 20 63 6f 6c  ( - col0 ) * col
78c0: 30 20 2a 20 63 6f 72 30 2e 63 6f 6c 32 20 41 53  0 * cor0.col2 AS
78d0: 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20   col2 FROM tab0 
78e0: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32 32  cor0..----..-122
78f0: 35 0d 0a 2d 31 39 30 30 38 0d 0a 2d 36 34 39 35  5..-19008..-6495
7900: 32 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  22....query I ro
7910: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
7920: 53 54 49 4e 43 54 20 74 61 62 31 2e 63 6f 6c 30  STINCT tab1.col0
7930: 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
7940: 62 31 2c 20 74 61 62 30 20 41 53 20 63 6f 72 30  b1, tab0 AS cor0
7950: 2c 20 74 61 62 31 20 41 53 20 63 6f 72 31 0d 0a  , tab1 AS cor1..
7960: 2d 2d 2d 2d 0d 0a 33 0d 0a 36 34 0d 0a 38 30 0d  ----..3..64..80.
7970: 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72  ...skipif postgr
7980: 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51  esql # PostgreSQ
7990: 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68  L requires AS wh
79a0: 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70  en renaming outp
79b0: 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72  ut columns..quer
79c0: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
79d0: 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 2d  ECT DISTINCT - -
79e0: 20 28 20 63 6f 6c 30 20 29 20 2b 20 63 6f 6c 30   ( col0 ) + col0
79f0: 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20   col2 FROM tab2 
7a00: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
7a10: 34 0d 0a 31 35 36 0d 0a 31 35 38 0d 0a 0d 0a 6f  4..156..158....o
7a20: 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75  nlyif mysql # su
7a30: 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20  pport for MySQL 
7a40: 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20  specific system 
7a50: 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78  types and syntax
7a60: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
7a70: 74 20 6c 61 62 65 6c 2d 32 32 33 0d 0a 53 45 4c  t label-223..SEL
7a80: 45 43 54 20 41 4c 4c 20 2d 20 2b 20 43 41 53 54  ECT ALL - + CAST
7a90: 28 20 2d 20 63 6f 6c 32 20 41 53 20 53 49 47 4e  ( - col2 AS SIGN
7aa0: 45 44 20 29 20 2b 20 2d 20 63 6f 6c 32 20 2a 20  ED ) + - col2 * 
7ab0: 35 37 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  57 FROM tab0 AS 
7ac0: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 38 34  cor0..----..-184
7ad0: 38 0d 0a 2d 34 35 39 32 0d 0a 2d 35 36 0d 0a 0d  8..-4592..-56...
7ae0: 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
7af0: 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
7b00: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
7b10: 6c 61 62 65 6c 2d 32 32 33 0d 0a 53 45 4c 45 43  label-223..SELEC
7b20: 54 20 41 4c 4c 20 2d 20 2b 20 43 41 53 54 20 28  T ALL - + CAST (
7b30: 20 2d 20 63 6f 6c 32 20 41 53 20 49 4e 54 45 47   - col2 AS INTEG
7b40: 45 52 20 29 20 2b 20 2d 20 63 6f 6c 32 20 2a 20  ER ) + - col2 * 
7b50: 35 37 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  57 FROM tab0 AS 
7b60: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 38 34  cor0..----..-184
7b70: 38 0d 0a 2d 34 35 39 32 0d 0a 2d 35 36 0d 0a 0d  8..-4592..-56...
7b80: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
7b90: 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
7ba0: 54 20 2b 20 2d 20 33 39 20 2a 20 63 6f 6c 32 20  T + - 39 * col2 
7bb0: 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
7bc0: 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32 38 37 0d 0a  0..----..-1287..
7bd0: 2d 33 31 39 38 0d 0a 2d 33 39 0d 0a 0d 0a 71 75  -3198..-39....qu
7be0: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
7bf0: 45 4c 45 43 54 20 2b 20 32 34 20 41 53 20 63 6f  ELECT + 24 AS co
7c00: 6c 31 20 46 52 4f 4d 20 74 61 62 30 2c 20 74 61  l1 FROM tab0, ta
7c10: 62 32 20 41 53 20 63 6f 72 30 2c 20 74 61 62 32  b2 AS cor0, tab2
7c20: 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a   AS cor1..----..
7c30: 32 37 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e  27 values hashin
7c40: 67 20 74 6f 20 61 65 65 61 63 34 33 31 64 32 32  g to aeeac431d22
7c50: 35 32 38 31 38 38 65 38 61 35 61 32 61 36 30 64  528188e8a5a2a60d
7c60: 32 64 30 38 30 0d 0a 0d 0a 71 75 65 72 79 20 49  2d080....query I
7c70: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
7c80: 20 41 4c 4c 20 63 6f 6c 30 20 2b 20 2d 20 63 6f   ALL col0 + - co
7c90: 6c 31 20 2a 20 2b 20 63 6f 6c 32 20 41 53 20 63  l1 * + col2 AS c
7ca0: 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 63 6f  ol0 FROM tab0 co
7cb0: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 38 31 34 0d  r0..----..-2814.
7cc0: 0a 2d 36 32 0d 0a 2d 37 33 37 33 0d 0a 0d 0a 6f  .-62..-7373....o
7cd0: 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73  nlyif mysql # us
7ce0: 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66  e DIV operator f
7cf0: 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73  or integer divis
7d00: 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ion..query I row
7d10: 73 6f 72 74 20 6c 61 62 65 6c 2d 32 32 37 0d 0a  sort label-227..
7d20: 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
7d30: 2d 20 36 20 2b 20 63 6f 6c 32 20 44 49 56 20 63  - 6 + col2 DIV c
7d40: 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  ol1 AS col1 FROM
7d50: 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
7d60: 2d 2d 2d 0d 0a 2d 36 0d 0a 0d 0a 73 6b 69 70 69  ---..-6....skipi
7d70: 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
7d80: 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
7d90: 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
7da0: 32 32 37 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  227..SELECT DIST
7db0: 49 4e 43 54 20 2d 20 36 20 2b 20 63 6f 6c 32 20  INCT - 6 + col2 
7dc0: 2f 20 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46  / col1 AS col1 F
7dd0: 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
7de0: 0d 0a 2d 2d 2d 2d 0d 0a 2d 36 0d 0a 0d 0a 71 75  ..----..-6....qu
7df0: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
7e00: 45 4c 45 43 54 20 2b 20 2d 20 35 37 20 2b 20 2d  ELECT + - 57 + -
7e10: 20 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c 31 20 46   col2 * - col1 F
7e20: 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
7e30: 0d 0a 2d 2d 2d 2d 0d 0a 31 34 37 37 0d 0a 35 38  ..----..1477..58
7e40: 39 0d 0a 37 38 30 0d 0a 0d 0a 71 75 65 72 79 20  9..780....query 
7e50: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
7e60: 54 20 2b 20 28 20 2b 20 33 32 20 29 20 41 53 20  T + ( + 32 ) AS 
7e70: 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41  col0 FROM tab1 A
7e80: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 32  S cor0..----..32
7e90: 0d 0a 33 32 0d 0a 33 32 0d 0a 0d 0a 6f 6e 6c 79  ..32..32....only
7ea0: 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f  if mysql # suppo
7eb0: 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65  rt for MySQL spe
7ec0: 63 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70  cific system typ
7ed0: 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71  es and syntax..q
7ee0: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
7ef0: 61 62 65 6c 2d 32 33 30 0d 0a 53 45 4c 45 43 54  abel-230..SELECT
7f00: 20 44 49 53 54 49 4e 43 54 20 2d 20 43 41 53 54   DISTINCT - CAST
7f10: 28 20 4e 55 4c 4c 20 41 53 20 53 49 47 4e 45 44  ( NULL AS SIGNED
7f20: 20 29 20 2b 20 2d 20 63 6f 6c 30 20 2a 20 2d 20   ) + - col0 * - 
7f30: 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46 52 4f  col2 AS col2 FRO
7f40: 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
7f50: 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b  ----..NULL....sk
7f60: 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
7f70: 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
7f80: 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
7f90: 65 6c 2d 32 33 30 0d 0a 53 45 4c 45 43 54 20 44  el-230..SELECT D
7fa0: 49 53 54 49 4e 43 54 20 2d 20 43 41 53 54 20 28  ISTINCT - CAST (
7fb0: 20 4e 55 4c 4c 20 41 53 20 49 4e 54 45 47 45 52   NULL AS INTEGER
7fc0: 20 29 20 2b 20 2d 20 63 6f 6c 30 20 2a 20 2d 20   ) + - col0 * - 
7fd0: 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46 52 4f  col2 AS col2 FRO
7fe0: 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
7ff0: 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75  ----..NULL....qu
8000: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
8010: 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 28  ELECT DISTINCT (
8020: 20 2d 20 63 6f 6c 30 20 29 20 2b 20 63 6f 6c 30   - col0 ) + col0
8030: 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
8040: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 0d 0a 71  r0..----..0....q
8050: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
8060: 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 2d 20 63  SELECT ALL - - c
8070: 6f 6c 32 20 2a 20 28 20 2b 20 63 6f 72 30 2e 63  ol2 * ( + cor0.c
8080: 6f 6c 31 20 29 20 46 52 4f 4d 20 74 61 62 32 20  ol1 ) FROM tab2 
8090: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 35 33 34  cor0..----..1534
80a0: 0d 0a 36 34 36 0d 0a 38 33 37 0d 0a 0d 0a 71 75  ..646..837....qu
80b0: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
80c0: 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b  ELECT DISTINCT +
80d0: 20 35 31 20 2b 20 63 6f 6c 30 20 2a 20 2b 20 34   51 + col0 * + 4
80e0: 35 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  5 FROM tab0 AS c
80f0: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 33 31 0d  or0..----..1131.
8100: 0a 31 36 32 36 0d 0a 34 30 35 36 0d 0a 0d 0a 6f  .1626..4056....o
8110: 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73  nlyif mysql # us
8120: 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66  e DIV operator f
8130: 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73  or integer divis
8140: 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ion..query I row
8150: 73 6f 72 74 20 6c 61 62 65 6c 2d 32 33 34 0d 0a  sort label-234..
8160: 53 45 4c 45 43 54 20 2b 20 28 20 63 6f 6c 32 20  SELECT + ( col2 
8170: 29 20 44 49 56 20 2b 20 63 6f 72 30 2e 63 6f 6c  ) DIV + cor0.col
8180: 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  0 FROM tab1 AS c
8190: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 31 0d  or0..----..0..1.
81a0: 0a 31 38 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  .18....skipif my
81b0: 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
81c0: 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
81d0: 77 73 6f 72 74 20 6c 61 62 65 6c 2d 32 33 34 0d  wsort label-234.
81e0: 0a 53 45 4c 45 43 54 20 2b 20 28 20 63 6f 6c 32  .SELECT + ( col2
81f0: 20 29 20 2f 20 2b 20 63 6f 72 30 2e 63 6f 6c 30   ) / + cor0.col0
8200: 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
8210: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 31 0d 0a  r0..----..0..1..
8220: 31 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  18....query I ro
8230: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
8240: 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 2a 20 2d 20  + cor0.col0 * - 
8250: 63 6f 72 30 2e 63 6f 6c 31 20 46 52 4f 4d 20 74  cor0.col1 FROM t
8260: 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
8270: 2d 0d 0a 2d 31 33 34 33 0d 0a 2d 32 31 37 0d 0a  -..-1343..-217..
8280: 2d 34 36 30 32 0d 0a 0d 0a 71 75 65 72 79 20 49  -4602....query I
8290: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
82a0: 20 41 4c 4c 20 2d 20 2d 20 63 6f 6c 30 20 2a 20   ALL - - col0 * 
82b0: 63 6f 6c 30 20 2b 20 37 37 20 41 53 20 63 6f 6c  col0 + 77 AS col
82c0: 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  2 FROM tab2 AS c
82d0: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 36 0d 0a  or0..----..126..
82e0: 36 31 36 31 0d 0a 36 33 31 38 0d 0a 0d 0a 6f 6e  6161..6318....on
82f0: 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70  lyif mysql # sup
8300: 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73  port for MySQL s
8310: 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20 74  pecific system t
8320: 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d  ypes and syntax.
8330: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
8340: 20 6c 61 62 65 6c 2d 32 33 37 0d 0a 53 45 4c 45   label-237..SELE
8350: 43 54 20 43 41 53 54 28 20 63 6f 6c 32 20 41 53  CT CAST( col2 AS
8360: 20 53 49 47 4e 45 44 20 29 20 2a 20 74 61 62 30   SIGNED ) * tab0
8370: 2e 63 6f 6c 32 20 2d 20 74 61 62 30 2e 63 6f 6c  .col2 - tab0.col
8380: 31 20 2a 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61  1 * col2 FROM ta
8390: 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 37 34 39 0d  b0..----..-1749.
83a0: 0a 2d 37 33 38 0d 0a 2d 39 36 0d 0a 0d 0a 73 6b  .-738..-96....sk
83b0: 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
83c0: 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
83d0: 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
83e0: 65 6c 2d 32 33 37 0d 0a 53 45 4c 45 43 54 20 43  el-237..SELECT C
83f0: 41 53 54 20 28 20 63 6f 6c 32 20 41 53 20 49 4e  AST ( col2 AS IN
8400: 54 45 47 45 52 20 29 20 2a 20 74 61 62 30 2e 63  TEGER ) * tab0.c
8410: 6f 6c 32 20 2d 20 74 61 62 30 2e 63 6f 6c 31 20  ol2 - tab0.col1 
8420: 2a 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30  * col2 FROM tab0
8430: 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 37 34 39 0d 0a 2d  ..----..-1749..-
8440: 37 33 38 0d 0a 2d 39 36 0d 0a 0d 0a 71 75 65 72  738..-96....quer
8450: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
8460: 45 43 54 20 63 6f 6c 31 20 2a 20 2d 20 39 36 20  ECT col1 * - 96 
8470: 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
8480: 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32 34 38 0d 0a  1..----..-1248..
8490: 2d 32 34 39 36 0d 0a 2d 39 36 30 0d 0a 0d 0a 71  -2496..-960....q
84a0: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
84b0: 53 45 4c 45 43 54 20 41 4c 4c 20 39 33 20 2b 20  SELECT ALL 93 + 
84c0: 2b 20 36 35 20 46 52 4f 4d 20 74 61 62 30 2c 20  + 65 FROM tab0, 
84d0: 74 61 62 32 2c 20 74 61 62 30 20 41 53 20 63 6f  tab2, tab0 AS co
84e0: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c  r0..----..27 val
84f0: 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 65  ues hashing to e
8500: 30 30 62 35 61 38 36 34 37 32 37 31 62 64 65 30  00b5a8647271bde0
8510: 37 66 63 37 62 34 64 30 64 32 39 36 39 35 62 0d  7fc7b4d0d29695b.
8520: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
8530: 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b  rt..SELECT ALL +
8540: 20 63 6f 6c 31 20 2b 20 2d 20 36 35 20 41 53 20   col1 + - 65 AS 
8550: 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41  col2 FROM tab0 A
8560: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 31  S cor0..----..21
8570: 0d 0a 32 36 0d 0a 33 32 0d 0a 0d 0a 71 75 65 72  ..26..32....quer
8580: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
8590: 45 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c  ECT DISTINCT col
85a0: 32 20 2b 20 37 38 20 2d 20 2b 20 63 6f 6c 30 20  2 + 78 - + col0 
85b0: 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
85c0: 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 39 0d 0a 37 31  0..----..129..71
85d0: 0d 0a 39 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..94....query I 
85e0: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
85f0: 2d 20 63 6f 6c 32 20 2a 20 63 6f 72 30 2e 63 6f  - col2 * cor0.co
8600: 6c 30 20 2d 20 63 6f 6c 32 20 46 52 4f 4d 20 74  l0 - col2 FROM t
8610: 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
8620: 2d 0d 0a 2d 33 36 0d 0a 2d 37 33 38 30 0d 0a 2d  -..-36..-7380..-
8630: 38 32 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  825....query I r
8640: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
8650: 49 53 54 49 4e 43 54 20 63 6f 6c 32 20 2a 20 2d  ISTINCT col2 * -
8660: 20 36 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d   60 AS col1 FROM
8670: 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
8680: 2d 2d 2d 0d 0a 2d 33 32 34 30 0d 0a 2d 33 34 32  ---..-3240..-342
8690: 30 0d 0a 2d 35 37 36 30 0d 0a 0d 0a 71 75 65 72  0..-5760....quer
86a0: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
86b0: 45 43 54 20 41 4c 4c 20 2d 20 63 6f 72 30 2e 63  ECT ALL - cor0.c
86c0: 6f 6c 32 20 2a 20 2d 20 37 34 20 2b 20 63 6f 6c  ol2 * - 74 + col
86d0: 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  0 FROM tab2 AS c
86e0: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 30 30 32 0d  or0..----..2002.
86f0: 0a 32 30 30 35 0d 0a 32 38 39 31 0d 0a 0d 0a 71  .2005..2891....q
8700: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
8710: 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
8720: 2b 20 2d 20 63 6f 6c 30 20 2d 20 35 33 20 41 53  + - col0 - 53 AS
8730: 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20   col1 FROM tab2 
8740: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
8750: 31 33 31 0d 0a 2d 31 33 32 0d 0a 2d 36 30 0d 0a  131..-132..-60..
8760: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
8770: 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
8780: 43 54 20 2b 20 63 6f 6c 31 20 2a 20 2b 20 37 36  CT + col1 * + 76
8790: 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
87a0: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 39 37 36 0d 0a  r0..----..1976..
87b0: 37 36 30 0d 0a 39 38 38 0d 0a 0d 0a 6f 6e 6c 79  760..988....only
87c0: 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f  if mysql # suppo
87d0: 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65  rt for MySQL spe
87e0: 63 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70  cific system typ
87f0: 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71  es and syntax..q
8800: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
8810: 61 62 65 6c 2d 32 34 37 0d 0a 53 45 4c 45 43 54  abel-247..SELECT
8820: 20 41 4c 4c 20 2b 20 63 6f 6c 31 20 2a 20 43 41   ALL + col1 * CA
8830: 53 54 28 20 63 6f 6c 30 20 41 53 20 53 49 47 4e  ST( col0 AS SIGN
8840: 45 44 20 29 20 41 53 20 63 6f 6c 32 20 46 52 4f  ED ) AS col2 FRO
8850: 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
8860: 2d 2d 2d 2d 0d 0a 31 30 34 30 0d 0a 36 34 30 0d  ----..1040..640.
8870: 0a 37 38 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  .78....skipif my
8880: 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
8890: 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
88a0: 77 73 6f 72 74 20 6c 61 62 65 6c 2d 32 34 37 0d  wsort label-247.
88b0: 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f  .SELECT ALL + co
88c0: 6c 31 20 2a 20 43 41 53 54 20 28 20 63 6f 6c 30  l1 * CAST ( col0
88d0: 20 41 53 20 49 4e 54 45 47 45 52 20 29 20 41 53   AS INTEGER ) AS
88e0: 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20   col2 FROM tab1 
88f0: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
8900: 30 34 30 0d 0a 36 34 30 0d 0a 37 38 0d 0a 0d 0a  040..640..78....
8910: 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75  onlyif mysql # u
8920: 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20  se DIV operator 
8930: 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69  for integer divi
8940: 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f  sion..query I ro
8950: 77 73 6f 72 74 20 6c 61 62 65 6c 2d 32 34 38 0d  wsort label-248.
8960: 0a 53 45 4c 45 43 54 20 63 6f 72 30 2e 63 6f 6c  .SELECT cor0.col
8970: 30 20 44 49 56 20 2d 20 33 30 20 2b 20 2b 20 63  0 DIV - 30 + + c
8980: 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol2 FROM tab0 AS
8990: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a   cor0..----..0..
89a0: 33 33 0d 0a 38 30 0d 0a 0d 0a 73 6b 69 70 69 66  33..80....skipif
89b0: 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
89c0: 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
89d0: 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 32   rowsort label-2
89e0: 34 38 0d 0a 53 45 4c 45 43 54 20 63 6f 72 30 2e  48..SELECT cor0.
89f0: 63 6f 6c 30 20 2f 20 2d 20 33 30 20 2b 20 2b 20  col0 / - 30 + + 
8a00: 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41  col2 FROM tab0 A
8a10: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d  S cor0..----..0.
8a20: 0a 33 33 0d 0a 38 30 0d 0a 0d 0a 71 75 65 72 79  .33..80....query
8a30: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
8a40: 43 54 20 2d 20 63 6f 6c 32 20 2a 20 2b 20 63 6f  CT - col2 * + co
8a50: 6c 31 20 2d 20 63 6f 6c 32 20 46 52 4f 4d 20 74  l1 - col2 FROM t
8a60: 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
8a70: 2d 0d 0a 2d 31 35 36 30 0d 0a 2d 36 38 34 0d 0a  -..-1560..-684..
8a80: 2d 38 36 34 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  -864....onlyif m
8a90: 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66  ysql # support f
8aa0: 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69  or MySQL specifi
8ab0: 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61  c system types a
8ac0: 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79  nd syntax..query
8ad0: 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
8ae0: 2d 32 35 30 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  -250..SELECT ALL
8af0: 20 2d 20 63 6f 6c 30 20 2a 20 43 41 53 54 28 20   - col0 * CAST( 
8b00: 4e 55 4c 4c 20 41 53 20 53 49 47 4e 45 44 20 29  NULL AS SIGNED )
8b10: 20 2d 20 63 6f 72 30 2e 63 6f 6c 30 20 41 53 20   - cor0.col0 AS 
8b20: 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41  col1 FROM tab1 A
8b30: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55  S cor0..----..NU
8b40: 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a  LL..NULL..NULL..
8b50: 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
8b60: 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
8b70: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
8b80: 20 6c 61 62 65 6c 2d 32 35 30 0d 0a 53 45 4c 45   label-250..SELE
8b90: 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 30 20 2a 20  CT ALL - col0 * 
8ba0: 43 41 53 54 20 28 20 4e 55 4c 4c 20 41 53 20 49  CAST ( NULL AS I
8bb0: 4e 54 45 47 45 52 20 29 20 2d 20 63 6f 72 30 2e  NTEGER ) - cor0.
8bc0: 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46 52 4f  col0 AS col1 FRO
8bd0: 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
8be0: 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c  ----..NULL..NULL
8bf0: 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75 65 72 79 20  ..NULL....query 
8c00: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
8c10: 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c  T DISTINCT - col
8c20: 32 20 2b 20 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c  2 + col2 * + col
8c30: 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  0 FROM tab2 AS c
8c40: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 36 32 0d 0a  or0..----..162..
8c50: 32 30 30 32 0d 0a 32 39 36 34 0d 0a 0d 0a 71 75  2002..2964....qu
8c60: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
8c70: 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 32 20 2a  ELECT ALL col2 *
8c80: 20 2b 20 37 39 20 2b 20 35 30 20 46 52 4f 4d 20   + 79 + 50 FROM 
8c90: 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab2 cor0..----.
8ca0: 0a 32 31 30 34 0d 0a 32 31 38 33 0d 0a 33 30 35  .2104..2183..305
8cb0: 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  2....query I row
8cc0: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
8cd0: 20 2d 20 28 20 2d 20 63 6f 6c 32 20 2a 20 63 6f   - ( - col2 * co
8ce0: 6c 32 20 29 20 46 52 4f 4d 20 74 61 62 32 0d 0a  l2 ) FROM tab2..
8cf0: 2d 2d 2d 2d 0d 0a 31 34 34 34 0d 0a 36 37 36 0d  ----..1444..676.
8d00: 0a 37 32 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .729....query I 
8d10: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
8d20: 34 36 20 2a 20 2b 20 63 6f 6c 30 20 46 52 4f 4d  46 * + col0 FROM
8d30: 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 33 38   tab1..----..138
8d40: 0d 0a 32 39 34 34 0d 0a 33 36 38 30 0d 0a 0d 0a  ..2944..3680....
8d50: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
8d60: 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
8d70: 20 32 36 20 46 52 4f 4d 20 74 61 62 31 2c 20 74   26 FROM tab1, t
8d80: 61 62 30 20 41 53 20 63 6f 72 30 2c 20 74 61 62  ab0 AS cor0, tab
8d90: 31 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d  1 AS cor1..----.
8da0: 0a 32 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .26....query I r
8db0: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
8dc0: 49 53 54 49 4e 43 54 20 28 20 32 39 20 29 20 46  ISTINCT ( 29 ) F
8dd0: 52 4f 4d 20 74 61 62 30 2c 20 74 61 62 31 20 41  ROM tab0, tab1 A
8de0: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 39  S cor0..----..29
8df0: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
8e00: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2d 20  ort..SELECT - - 
8e10: 63 6f 6c 30 20 2b 20 2b 20 33 20 2a 20 2d 20 63  col0 + + 3 * - c
8e20: 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol2 FROM tab2 AS
8e30: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 35   cor0..----..-35
8e40: 0d 0a 2d 37 34 0d 0a 30 0d 0a 0d 0a 6f 6e 6c 79  ..-74..0....only
8e50: 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44  if mysql # use D
8e60: 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20  IV operator for 
8e70: 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e  integer division
8e80: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
8e90: 74 20 6c 61 62 65 6c 2d 32 35 38 0d 0a 53 45 4c  t label-258..SEL
8ea0: 45 43 54 20 2b 20 63 6f 6c 30 20 2b 20 63 6f 6c  ECT + col0 + col
8eb0: 30 20 44 49 56 20 2b 20 63 6f 72 30 2e 63 6f 6c  0 DIV + cor0.col
8ec0: 31 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32  1 col0 FROM tab2
8ed0: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
8ee0: 37 0d 0a 37 39 0d 0a 38 33 0d 0a 0d 0a 73 6b 69  7..79..83....ski
8ef0: 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23  pif postgresql #
8f00: 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75   PostgreSQL requ
8f10: 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e  ires AS when ren
8f20: 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c  aming output col
8f30: 75 6d 6e 73 0d 0a 73 6b 69 70 69 66 20 6d 79 73  umns..skipif mys
8f40: 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
8f50: 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
8f60: 73 6f 72 74 20 6c 61 62 65 6c 2d 32 35 38 0d 0a  sort label-258..
8f70: 53 45 4c 45 43 54 20 2b 20 63 6f 6c 30 20 2b 20  SELECT + col0 + 
8f80: 63 6f 6c 30 20 2f 20 2b 20 63 6f 72 30 2e 63 6f  col0 / + cor0.co
8f90: 6c 31 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  l1 col0 FROM tab
8fa0: 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
8fb0: 0a 37 0d 0a 37 39 0d 0a 38 33 0d 0a 0d 0a 6f 6e  .7..79..83....on
8fc0: 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70  lyif mysql # sup
8fd0: 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73  port for MySQL s
8fe0: 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20 74  pecific system t
8ff0: 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d  ypes and syntax.
9000: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
9010: 20 6c 61 62 65 6c 2d 32 35 39 0d 0a 53 45 4c 45   label-259..SELE
9020: 43 54 20 41 4c 4c 20 2b 20 74 61 62 30 2e 63 6f  CT ALL + tab0.co
9030: 6c 31 20 2b 20 43 41 53 54 28 20 2d 20 39 32 20  l1 + CAST( - 92 
9040: 41 53 20 53 49 47 4e 45 44 20 29 20 63 6f 6c 32  AS SIGNED ) col2
9050: 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d   FROM tab0..----
9060: 0d 0a 2d 31 0d 0a 2d 36 0d 0a 35 0d 0a 0d 0a 73  ..-1..-6..5....s
9070: 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c  kipif postgresql
9080: 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65   # PostgreSQL re
9090: 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72  quires AS when r
90a0: 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63  enaming output c
90b0: 6f 6c 75 6d 6e 73 0d 0a 73 6b 69 70 69 66 20 6d  olumns..skipif m
90c0: 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
90d0: 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
90e0: 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 32 35 39  owsort label-259
90f0: 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 74  ..SELECT ALL + t
9100: 61 62 30 2e 63 6f 6c 31 20 2b 20 43 41 53 54 20  ab0.col1 + CAST 
9110: 28 20 2d 20 39 32 20 41 53 20 49 4e 54 45 47 45  ( - 92 AS INTEGE
9120: 52 20 29 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61  R ) col2 FROM ta
9130: 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 2d 36  b0..----..-1..-6
9140: 0d 0a 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  ..5....query I r
9150: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
9160: 20 74 61 62 31 2e 63 6f 6c 31 20 2a 20 2d 20 28   tab1.col1 * - (
9170: 20 74 61 62 31 2e 63 6f 6c 30 20 29 20 46 52 4f   tab1.col0 ) FRO
9180: 4d 20 74 61 62 31 2c 20 74 61 62 30 20 41 53 20  M tab1, tab0 AS 
9190: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61  cor0..----..9 va
91a0: 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20  lues hashing to 
91b0: 38 31 35 66 63 63 64 34 63 33 64 33 37 32 62 32  815fccd4c3d372b2
91c0: 38 64 33 66 33 66 62 31 30 33 30 32 35 37 37 35  8d3f3fb103025775
91d0: 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67  ....skipif postg
91e0: 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53  resql # PostgreS
91f0: 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77  QL requires AS w
9200: 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74  hen renaming out
9210: 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65  put columns..que
9220: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
9230: 4c 45 43 54 20 2b 20 74 61 62 31 2e 63 6f 6c 31  LECT + tab1.col1
9240: 20 2d 20 2b 20 63 6f 6c 32 20 2a 20 2d 20 74 61   - + col2 * - ta
9250: 62 31 2e 63 6f 6c 31 20 63 6f 6c 32 20 46 52 4f  b1.col1 col2 FRO
9260: 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 32  M tab1..----..12
9270: 36 31 0d 0a 31 34 33 30 0d 0a 35 38 30 0d 0a 0d  61..1430..580...
9280: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
9290: 0d 0a 53 45 4c 45 43 54 20 2b 20 32 33 20 2b 20  ..SELECT + 23 + 
92a0: 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46 52 4f  col1 AS col2 FRO
92b0: 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 33 33  M tab1..----..33
92c0: 0d 0a 33 36 0d 0a 34 39 0d 0a 0d 0a 71 75 65 72  ..36..49....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 44 49 53 54 49 4e 43 54 20 2d 20 2d  ECT DISTINCT - -
92f0: 20 39 33 20 46 52 4f 4d 20 74 61 62 31 20 41 53   93 FROM tab1 AS
9300: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 33 0d   cor0..----..93.
9310: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
9320: 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 34  rt..SELECT ALL 4
9330: 37 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  7 AS col0 FROM t
9340: 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab1 cor0..----..
9350: 34 37 0d 0a 34 37 0d 0a 34 37 0d 0a 0d 0a 6f 6e  47..47..47....on
9360: 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
9370: 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
9380: 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
9390: 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
93a0: 6f 72 74 20 6c 61 62 65 6c 2d 32 36 35 0d 0a 53  ort label-265..S
93b0: 45 4c 45 43 54 20 41 4c 4c 20 2d 20 37 36 20 2a  ELECT ALL - 76 *
93c0: 20 63 6f 6c 31 20 44 49 56 20 63 6f 6c 31 20 46   col1 DIV col1 F
93d0: 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab1..----..
93e0: 2d 37 36 0d 0a 2d 37 36 0d 0a 2d 37 36 0d 0a 0d  -76..-76..-76...
93f0: 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
9400: 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
9410: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
9420: 6c 61 62 65 6c 2d 32 36 35 0d 0a 53 45 4c 45 43  label-265..SELEC
9430: 54 20 41 4c 4c 20 2d 20 37 36 20 2a 20 63 6f 6c  T ALL - 76 * col
9440: 31 20 2f 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61  1 / col1 FROM ta
9450: 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 37 36 0d 0a 2d  b1..----..-76..-
9460: 37 36 0d 0a 2d 37 36 0d 0a 0d 0a 71 75 65 72 79  76..-76....query
9470: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
9480: 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f 72 30  CT DISTINCT cor0
9490: 2e 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c 31 20 2a  .col0 + + col1 *
94a0: 20 2d 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62   - col1 FROM tab
94b0: 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
94c0: 0a 2d 32 31 30 0d 0a 2d 33 34 30 33 0d 0a 2d 39  .-210..-3403..-9
94d0: 35 34 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  54....onlyif mys
94e0: 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72  ql # support for
94f0: 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63 20   MySQL specific 
9500: 73 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64  system types and
9510: 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49   syntax..query I
9520: 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 32   rowsort label-2
9530: 36 37 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d  67..SELECT ALL -
9540: 20 2d 20 63 6f 6c 32 20 2a 20 2b 20 43 41 53 54   - col2 * + CAST
9550: 28 20 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c 31 20  ( col0 * + col1 
9560: 2b 20 2b 20 28 20 2d 20 63 6f 6c 32 20 29 20 41  + + ( - col2 ) A
9570: 53 20 53 49 47 4e 45 44 20 29 20 46 52 4f 4d 20  S SIGNED ) FROM 
9580: 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
9590: 2d 2d 0d 0a 33 33 39 34 0d 0a 36 35 37 33 39 34  --..3394..657394
95a0: 0d 0a 36 37 30 32 33 0d 0a 0d 0a 73 6b 69 70 69  ..67023....skipi
95b0: 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
95c0: 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
95d0: 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
95e0: 32 36 37 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  267..SELECT ALL 
95f0: 2d 20 2d 20 63 6f 6c 32 20 2a 20 2b 20 43 41 53  - - col2 * + CAS
9600: 54 20 28 20 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c  T ( col0 * + col
9610: 31 20 2b 20 2b 20 28 20 2d 20 63 6f 6c 32 20 29  1 + + ( - col2 )
9620: 20 41 53 20 49 4e 54 45 47 45 52 20 29 20 46 52   AS INTEGER ) FR
9630: 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
9640: 0a 2d 2d 2d 2d 0d 0a 33 33 39 34 0d 0a 36 35 37  .----..3394..657
9650: 33 39 34 0d 0a 36 37 30 32 33 0d 0a 0d 0a 71 75  394..67023....qu
9660: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
9670: 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 63  ELECT DISTINCT c
9680: 6f 72 30 2e 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c  or0.col2 * - col
9690: 32 20 2a 20 2b 20 63 6f 6c 32 20 46 52 4f 4d 20  2 * + col2 FROM 
96a0: 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
96b0: 2d 2d 0d 0a 2d 31 35 37 34 36 34 0d 0a 2d 31 38  --..-157464..-18
96c0: 35 31 39 33 0d 0a 2d 38 38 34 37 33 36 0d 0a 0d  5193..-884736...
96d0: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
96e0: 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 32 20  ..SELECT + col2 
96f0: 2a 20 2d 20 38 30 20 41 53 20 63 6f 6c 31 20 46  * - 80 AS col1 F
9700: 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
9710: 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 30 38 30 0d 0a 2d  ..----..-2080..-
9720: 32 31 36 30 0d 0a 2d 33 30 34 30 0d 0a 0d 0a 71  2160..-3040....q
9730: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
9740: 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
9750: 63 6f 6c 32 20 2b 20 2d 20 74 61 62 31 2e 63 6f  col2 + - tab1.co
9760: 6c 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  l0 AS col1 FROM 
9770: 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 37 0d 0a  tab1..----..-7..
9780: 31 36 0d 0a 35 31 0d 0a 0d 0a 6f 6e 6c 79 69 66  16..51....onlyif
9790: 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56   mysql # use DIV
97a0: 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e   operator for in
97b0: 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a  teger division..
97c0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
97d0: 6c 61 62 65 6c 2d 32 37 31 0d 0a 53 45 4c 45 43  label-271..SELEC
97e0: 54 20 2b 20 63 6f 6c 32 20 44 49 56 20 2b 20 39  T + col2 DIV + 9
97f0: 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  0 AS col2 FROM t
9800: 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab2 cor0..----..
9810: 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a 73 6b 69 70 69  0..0..0....skipi
9820: 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
9830: 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
9840: 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
9850: 32 37 31 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f  271..SELECT + co
9860: 6c 32 20 2f 20 2b 20 39 30 20 41 53 20 63 6f 6c  l2 / + 90 AS col
9870: 32 20 46 52 4f 4d 20 74 61 62 32 20 63 6f 72 30  2 FROM tab2 cor0
9880: 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d  ..----..0..0..0.
9890: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
98a0: 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d  rt..SELECT ALL -
98b0: 20 63 6f 6c 30 20 2a 20 63 6f 6c 30 20 2a 20 2b   col0 * col0 * +
98c0: 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20   col0 FROM tab1 
98d0: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
98e0: 32 36 32 31 34 34 0d 0a 2d 32 37 0d 0a 2d 35 31  262144..-27..-51
98f0: 32 30 30 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  2000....onlyif m
9900: 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f  ysql # use DIV o
9910: 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65  perator for inte
9920: 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75  ger division..qu
9930: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
9940: 62 65 6c 2d 32 37 33 0d 0a 53 45 4c 45 43 54 20  bel-273..SELECT 
9950: 44 49 53 54 49 4e 43 54 20 63 6f 72 30 2e 63 6f  DISTINCT cor0.co
9960: 6c 31 20 44 49 56 20 2d 20 63 6f 6c 31 20 41 53  l1 DIV - col1 AS
9970: 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20   col1 FROM tab1 
9980: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a  cor0..----..-1..
9990: 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
99a0: 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
99b0: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
99c0: 20 6c 61 62 65 6c 2d 32 37 33 0d 0a 53 45 4c 45   label-273..SELE
99d0: 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f 72 30  CT DISTINCT cor0
99e0: 2e 63 6f 6c 31 20 2f 20 2d 20 63 6f 6c 31 20 41  .col1 / - col1 A
99f0: 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31  S col1 FROM tab1
9a00: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d   cor0..----..-1.
9a10: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
9a20: 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c  rt..SELECT + col
9a30: 31 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 2a 20  1 + cor0.col2 * 
9a40: 32 33 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  23 FROM tab1 AS 
9a50: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 36 38  cor0..----..1268
9a60: 0d 0a 31 33 32 31 0d 0a 32 32 32 31 0d 0a 0d 0a  ..1321..2221....
9a70: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
9a80: 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
9a90: 20 2d 20 32 35 20 2a 20 2d 20 39 35 20 2a 20 63   - 25 * - 95 * c
9aa0: 6f 72 30 2e 63 6f 6c 31 20 41 53 20 63 6f 6c 32  or0.col1 AS col2
9ab0: 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
9ac0: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 34 30 31 32 35  r0..----..140125
9ad0: 0d 0a 34 30 33 37 35 0d 0a 37 33 36 32 35 0d 0a  ..40375..73625..
9ae0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
9af0: 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 33 20  t..SELECT ALL 3 
9b00: 2a 20 63 6f 6c 30 20 2b 20 63 6f 6c 30 20 2a 20  * col0 + col0 * 
9b10: 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41  col2 FROM tab0 A
9b20: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 34  S cor0..----..14
9b30: 30 0d 0a 37 35 36 35 0d 0a 38 36 34 0d 0a 0d 0a  0..7565..864....
9b40: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
9b50: 0a 53 45 4c 45 43 54 20 2d 20 2b 20 39 32 20 2b  .SELECT - + 92 +
9b60: 20 63 6f 72 30 2e 63 6f 6c 32 20 41 53 20 63 6f   cor0.col2 AS co
9b70: 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l1 FROM tab1 AS 
9b80: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 35 0d  cor0..----..-35.
9b90: 0a 2d 33 38 0d 0a 34 0d 0a 0d 0a 71 75 65 72 79  .-38..4....query
9ba0: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
9bb0: 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f  CT DISTINCT - co
9bc0: 6c 31 20 2a 20 34 36 20 46 52 4f 4d 20 74 61 62  l1 * 46 FROM tab
9bd0: 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
9be0: 0a 2d 33 39 35 36 0d 0a 2d 34 31 38 36 0d 0a 2d  .-3956..-4186..-
9bf0: 34 34 36 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20  4462....query I 
9c00: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
9c10: 44 49 53 54 49 4e 43 54 20 2d 20 2d 20 33 30 20  DISTINCT - - 30 
9c20: 2a 20 2b 20 38 38 20 41 53 20 63 6f 6c 30 20 46  * + 88 AS col0 F
9c30: 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
9c40: 0d 0a 2d 2d 2d 2d 0d 0a 32 36 34 30 0d 0a 0d 0a  ..----..2640....
9c50: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
9c60: 0a 53 45 4c 45 43 54 20 2b 20 28 20 2d 20 63 6f  .SELECT + ( - co
9c70: 6c 31 20 29 20 2a 20 63 6f 6c 32 20 2b 20 63 6f  l1 ) * col2 + co
9c80: 6c 30 20 2b 20 28 20 63 6f 6c 30 20 29 20 46 52  l0 + ( col0 ) FR
9c90: 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
9ca0: 0a 2d 2d 2d 2d 0d 0a 2d 31 30 38 38 0d 0a 2d 31  .----..-1088..-1
9cb0: 33 39 38 0d 0a 2d 34 34 32 0d 0a 0d 0a 6f 6e 6c  398..-442....onl
9cc0: 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70  yif mysql # supp
9cd0: 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70  ort for MySQL sp
9ce0: 65 63 69 66 69 63 20 73 79 73 74 65 6d 20 74 79  ecific system ty
9cf0: 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a  pes and syntax..
9d00: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
9d10: 6c 61 62 65 6c 2d 32 38 31 0d 0a 53 45 4c 45 43  label-281..SELEC
9d20: 54 20 44 49 53 54 49 4e 43 54 20 43 41 53 54 28  T DISTINCT CAST(
9d30: 20 4e 55 4c 4c 20 41 53 20 53 49 47 4e 45 44 20   NULL AS SIGNED 
9d40: 29 20 2a 20 63 6f 6c 30 20 41 53 20 63 6f 6c 31  ) * col0 AS col1
9d50: 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d   FROM tab0 cor0.
9d60: 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73  .----..NULL....s
9d70: 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
9d80: 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
9d90: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
9da0: 62 65 6c 2d 32 38 31 0d 0a 53 45 4c 45 43 54 20  bel-281..SELECT 
9db0: 44 49 53 54 49 4e 43 54 20 43 41 53 54 20 28 20  DISTINCT CAST ( 
9dc0: 4e 55 4c 4c 20 41 53 20 49 4e 54 45 47 45 52 20  NULL AS INTEGER 
9dd0: 29 20 2a 20 63 6f 6c 30 20 41 53 20 63 6f 6c 31  ) * col0 AS col1
9de0: 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d   FROM tab0 cor0.
9df0: 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 6f  .----..NULL....o
9e00: 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73  nlyif mysql # us
9e10: 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66  e DIV operator f
9e20: 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73  or integer divis
9e30: 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ion..query I row
9e40: 73 6f 72 74 20 6c 61 62 65 6c 2d 32 38 32 0d 0a  sort label-282..
9e50: 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
9e60: 2b 20 28 20 63 6f 6c 30 20 29 20 44 49 56 20 2b  + ( col0 ) DIV +
9e70: 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20   col0 FROM tab0 
9e80: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
9e90: 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
9ea0: 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
9eb0: 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
9ec0: 72 74 20 6c 61 62 65 6c 2d 32 38 32 0d 0a 53 45  rt label-282..SE
9ed0: 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20  LECT DISTINCT + 
9ee0: 28 20 63 6f 6c 30 20 29 20 2f 20 2b 20 63 6f 6c  ( col0 ) / + col
9ef0: 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  0 FROM tab0 AS c
9f00: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 0d 0a 0d 0a  or0..----..1....
9f10: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
9f20: 0a 53 45 4c 45 43 54 20 63 6f 6c 31 20 2a 20 2d  .SELECT col1 * -
9f30: 20 36 37 20 46 52 4f 4d 20 74 61 62 32 20 41 53   67 FROM tab2 AS
9f40: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31   cor0..----..-11
9f50: 33 39 0d 0a 2d 32 30 37 37 0d 0a 2d 33 39 35 33  39..-2077..-3953
9f60: 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
9f70: 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61   # use DIV opera
9f80: 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20  tor for integer 
9f90: 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20  division..query 
9fa0: 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
9fb0: 32 38 34 0d 0a 53 45 4c 45 43 54 20 2d 20 28 20  284..SELECT - ( 
9fc0: 2b 20 63 6f 6c 31 20 29 20 44 49 56 20 2d 20 63  + col1 ) DIV - c
9fd0: 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  ol1 AS col0 FROM
9fe0: 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab0 cor0..----
9ff0: 0d 0a 31 0d 0a 31 0d 0a 31 0d 0a 0d 0a 73 6b 69  ..1..1..1....ski
a000: 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
a010: 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
a020: 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
a030: 6c 2d 32 38 34 0d 0a 53 45 4c 45 43 54 20 2d 20  l-284..SELECT - 
a040: 28 20 2b 20 63 6f 6c 31 20 29 20 2f 20 2d 20 63  ( + col1 ) / - c
a050: 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  ol1 AS col0 FROM
a060: 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab0 cor0..----
a070: 0d 0a 31 0d 0a 31 0d 0a 31 0d 0a 0d 0a 71 75 65  ..1..1..1....que
a080: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
a090: 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 30 20  LECT ALL - col0 
a0a0: 2a 20 2b 20 63 6f 6c 32 20 2a 20 2b 20 63 6f 72  * + col2 * + cor
a0b0: 30 2e 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30  0.col0 FROM tab0
a0c0: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
a0d0: 2d 31 32 32 35 0d 0a 2d 31 39 30 30 38 0d 0a 2d  -1225..-19008..-
a0e0: 36 34 39 35 32 32 0d 0a 0d 0a 71 75 65 72 79 20  649522....query 
a0f0: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
a100: 54 20 44 49 53 54 49 4e 43 54 20 2b 20 2d 20 63  T DISTINCT + - c
a110: 6f 6c 31 20 2b 20 28 20 63 6f 6c 30 20 29 20 46  ol1 + ( col0 ) F
a120: 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
a130: 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 0d 0a 2d 36 32 0d  ..----..-2..-62.
a140: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
a150: 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 28 20 2d  rt..SELECT + ( -
a160: 20 63 6f 6c 31 20 29 20 41 53 20 63 6f 6c 30 20   col1 ) AS col0 
a170: 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a  FROM tab0 cor0..
a180: 2d 2d 2d 2d 0d 0a 2d 38 36 0d 0a 2d 39 31 0d 0a  ----..-86..-91..
a190: 2d 39 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  -97....query I r
a1a0: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
a1b0: 4c 4c 20 2d 20 2d 20 36 39 20 2a 20 63 6f 6c 30  LL - - 69 * col0
a1c0: 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62   + col0 FROM tab
a1d0: 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 36  0 cor0..----..16
a1e0: 38 30 0d 0a 32 34 35 30 0d 0a 36 32 33 30 0d 0a  80..2450..6230..
a1f0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
a200: 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
a210: 43 54 20 2b 20 2b 20 63 6f 6c 31 20 2a 20 2b 20  CT + + col1 * + 
a220: 34 31 20 2d 20 2d 20 63 6f 6c 30 20 46 52 4f 4d  41 - - col0 FROM
a230: 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
a240: 2d 2d 2d 0d 0a 31 30 36 39 0d 0a 34 37 34 0d 0a  ---..1069..474..
a250: 36 31 33 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  613....skipif my
a260: 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
a270: 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
a280: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
a290: 43 41 53 54 20 28 20 2b 20 63 6f 72 30 2e 63 6f  CAST ( + cor0.co
a2a0: 6c 31 20 41 53 20 52 45 41 4c 20 29 20 2d 20 63  l1 AS REAL ) - c
a2b0: 6f 6c 32 20 2a 20 28 20 2d 20 32 39 20 29 20 46  ol2 * ( - 29 ) F
a2c0: 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
a2d0: 0d 0a 2d 2d 2d 2d 0d 0a 2d 36 38 0d 0a 32 32 38  ..----..-68..228
a2e0: 37 0d 0a 38 37 31 0d 0a 0d 0a 71 75 65 72 79 20  7..871....query 
a2f0: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
a300: 54 20 2b 20 2b 20 63 6f 6c 31 20 2a 20 32 35 20  T + + col1 * 25 
a310: 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 2b 20 63 6f  + cor0.col1 + co
a320: 6c 31 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  l1 AS col1 FROM 
a330: 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab0 cor0..----.
a340: 0a 32 33 32 32 0d 0a 32 34 35 37 0d 0a 32 36 31  .2322..2457..261
a350: 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  9....query I row
a360: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
a370: 20 2d 20 2d 20 63 6f 6c 31 20 2b 20 63 6f 6c 31   - - col1 + col1
a380: 20 2a 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62   * col0 FROM tab
a390: 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
a3a0: 0a 32 31 35 30 0d 0a 33 34 39 32 0d 0a 38 31 39  .2150..3492..819
a3b0: 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  0....query I row
a3c0: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 31 33 20  sort..SELECT 13 
a3d0: 2a 20 2d 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30  * - col0 AS col0
a3e0: 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
a3f0: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 35 37 0d  r0..----..-1157.
a400: 0a 2d 33 31 32 0d 0a 2d 34 35 35 0d 0a 0d 0a 73  .-312..-455....s
a410: 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c  kipif postgresql
a420: 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65   # PostgreSQL re
a430: 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72  quires AS when r
a440: 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63  enaming output c
a450: 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20  olumns..query I 
a460: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
a470: 44 49 53 54 49 4e 43 54 20 2b 20 2d 20 63 6f 6c  DISTINCT + - col
a480: 30 20 2b 20 63 6f 6c 31 20 63 6f 6c 32 20 46 52  0 + col1 col2 FR
a490: 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
a4a0: 0a 2d 2d 2d 2d 0d 0a 2d 31 39 0d 0a 2d 36 32 0d  .----..-19..-62.
a4b0: 0a 32 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .24....query I r
a4c0: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63  owsort..SELECT c
a4d0: 6f 6c 32 20 2a 20 63 6f 72 30 2e 63 6f 6c 32 20  ol2 * cor0.col2 
a4e0: 2b 20 2b 20 63 6f 6c 31 20 2b 20 63 6f 6c 31 20  + + col1 + col1 
a4f0: 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
a500: 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
a510: 0a 32 39 36 38 0d 0a 33 32 36 39 0d 0a 39 32 34  .2968..3269..924
a520: 32 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  2....onlyif mysq
a530: 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20  l # support for 
a540: 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63 20 73  MySQL specific s
a550: 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20  ystem types and 
a560: 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20  syntax..query I 
a570: 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 32 39  rowsort label-29
a580: 36 0d 0a 53 45 4c 45 43 54 20 2d 20 43 41 53 54  6..SELECT - CAST
a590: 28 20 4e 55 4c 4c 20 41 53 20 53 49 47 4e 45 44  ( NULL AS SIGNED
a5a0: 20 29 20 2f 20 2b 20 31 37 20 41 53 20 63 6f 6c   ) / + 17 AS col
a5b0: 30 20 46 52 4f 4d 20 74 61 62 30 2c 20 74 61 62  0 FROM tab0, tab
a5c0: 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
a5d0: 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e  .9 values hashin
a5e0: 67 20 74 6f 20 63 64 37 61 37 39 30 31 65 34 37  g to cd7a7901e47
a5f0: 63 31 35 31 35 35 34 30 34 61 66 66 30 64 32 31  c15155404aff0d21
a600: 36 66 65 30 62 0d 0a 0d 0a 73 6b 69 70 69 66 20  6fe0b....skipif 
a610: 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
a620: 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
a630: 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 32 39  rowsort label-29
a640: 36 0d 0a 53 45 4c 45 43 54 20 2d 20 43 41 53 54  6..SELECT - CAST
a650: 20 28 20 4e 55 4c 4c 20 41 53 20 49 4e 54 45 47   ( NULL AS INTEG
a660: 45 52 20 29 20 2f 20 2b 20 31 37 20 41 53 20 63  ER ) / + 17 AS c
a670: 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 2c 20 74  ol0 FROM tab0, t
a680: 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
a690: 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68  -..9 values hash
a6a0: 69 6e 67 20 74 6f 20 63 64 37 61 37 39 30 31 65  ing to cd7a7901e
a6b0: 34 37 63 31 35 31 35 35 34 30 34 61 66 66 30 64  47c15155404aff0d
a6c0: 32 31 36 66 65 30 62 0d 0a 0d 0a 71 75 65 72 79  216fe0b....query
a6d0: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
a6e0: 43 54 20 2b 20 28 20 63 6f 6c 32 20 29 20 2a 20  CT + ( col2 ) * 
a6f0: 63 6f 6c 32 20 2b 20 63 6f 6c 30 20 46 52 4f 4d  col2 + col0 FROM
a700: 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
a710: 2d 2d 2d 0d 0a 31 35 32 33 0d 0a 37 33 36 0d 0a  ---..1523..736..
a720: 37 35 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  754....query I r
a730: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
a740: 20 63 6f 72 30 2e 63 6f 6c 32 20 2d 20 63 6f 72   cor0.col2 - cor
a750: 30 2e 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30  0.col1 FROM tab0
a760: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
a770: 2d 35 33 0d 0a 2d 39 0d 0a 2d 39 36 0d 0a 0d 0a  -53..-9..-96....
a780: 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75  onlyif mysql # u
a790: 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20  se DIV operator 
a7a0: 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69  for integer divi
a7b0: 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f  sion..query I ro
a7c0: 77 73 6f 72 74 20 6c 61 62 65 6c 2d 32 39 39 0d  wsort label-299.
a7d0: 0a 53 45 4c 45 43 54 20 2d 20 2d 20 63 6f 6c 30  .SELECT - - col0
a7e0: 20 44 49 56 20 2d 20 63 6f 72 30 2e 63 6f 6c 32   DIV - cor0.col2
a7f0: 20 2b 20 28 20 2b 20 63 6f 6c 30 20 29 20 46 52   + ( + col0 ) FR
a800: 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
a810: 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 32 34 0d 0a 38 38  .----..0..24..88
a820: 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
a830: 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
a840: 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
a850: 72 74 20 6c 61 62 65 6c 2d 32 39 39 0d 0a 53 45  rt label-299..SE
a860: 4c 45 43 54 20 2d 20 2d 20 63 6f 6c 30 20 2f 20  LECT - - col0 / 
a870: 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 2b 20 28 20  - cor0.col2 + ( 
a880: 2b 20 63 6f 6c 30 20 29 20 46 52 4f 4d 20 74 61  + col0 ) FROM ta
a890: 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
a8a0: 0d 0a 30 0d 0a 32 34 0d 0a 38 38 0d 0a 0d 0a 71  ..0..24..88....q
a8b0: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
a8c0: 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 2d 20 63  SELECT ALL + - c
a8d0: 6f 6c 31 20 2a 20 63 6f 72 30 2e 63 6f 6c 32 20  ol1 * cor0.col2 
a8e0: 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
a8f0: 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
a900: 0a 2d 32 38 33 38 0d 0a 2d 37 34 36 32 0d 0a 2d  .-2838..-7462..-
a910: 39 37 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  97....onlyif mys
a920: 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72  ql # support for
a930: 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63 20   MySQL specific 
a940: 73 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64  system types and
a950: 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49   syntax..query I
a960: 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 33   rowsort label-3
a970: 30 31 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  01..SELECT DISTI
a980: 4e 43 54 20 63 6f 6c 32 20 2b 20 63 6f 72 30 2e  NCT col2 + cor0.
a990: 63 6f 6c 32 20 2b 20 43 41 53 54 28 20 2d 20 63  col2 + CAST( - c
a9a0: 6f 6c 30 20 41 53 20 53 49 47 4e 45 44 20 29 20  ol0 AS SIGNED ) 
a9b0: 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
a9c0: 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
a9d0: 0a 31 30 35 0d 0a 31 31 32 0d 0a 35 30 0d 0a 0d  .105..112..50...
a9e0: 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
a9f0: 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
aa00: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
aa10: 6c 61 62 65 6c 2d 33 30 31 0d 0a 53 45 4c 45 43  label-301..SELEC
aa20: 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 32 20  T DISTINCT col2 
aa30: 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 2b 20 43 41  + cor0.col2 + CA
aa40: 53 54 20 28 20 2d 20 63 6f 6c 30 20 41 53 20 49  ST ( - col0 AS I
aa50: 4e 54 45 47 45 52 20 29 20 41 53 20 63 6f 6c 30  NTEGER ) AS col0
aa60: 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
aa70: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 35 0d 0a 31  r0..----..105..1
aa80: 31 32 0d 0a 35 30 0d 0a 0d 0a 73 6b 69 70 69 66  12..50....skipif
aa90: 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f   postgresql # Po
aaa0: 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65  stgreSQL require
aab0: 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69  s AS when renami
aac0: 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e  ng output column
aad0: 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  s..query I rowso
aae0: 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
aaf0: 4e 43 54 20 2b 20 2b 20 63 6f 6c 31 20 2a 20 2b  NCT + + col1 * +
ab00: 20 63 6f 6c 32 20 63 6f 6c 30 20 46 52 4f 4d 20   col2 col0 FROM 
ab10: 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
ab20: 2d 2d 0d 0a 32 38 33 38 0d 0a 37 34 36 32 0d 0a  --..2838..7462..
ab30: 39 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  97....query I ro
ab40: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
ab50: 63 6f 6c 31 20 2d 20 2d 20 63 6f 6c 30 20 41 53  col1 - - col0 AS
ab60: 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20   col2 FROM tab2 
ab70: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
ab80: 32 34 0d 0a 31 39 0d 0a 36 32 0d 0a 0d 0a 6f 6e  24..19..62....on
ab90: 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
aba0: 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
abb0: 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
abc0: 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
abd0: 6f 72 74 20 6c 61 62 65 6c 2d 33 30 34 0d 0a 53  ort label-304..S
abe0: 45 4c 45 43 54 20 63 6f 6c 30 20 44 49 56 20 2b  ELECT col0 DIV +
abf0: 20 63 6f 72 30 2e 63 6f 6c 30 20 2b 20 2b 20 37   cor0.col0 + + 7
ac00: 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  0 AS col1 FROM t
ac10: 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
ac20: 2d 0d 0a 37 31 0d 0a 37 31 0d 0a 37 31 0d 0a 0d  -..71..71..71...
ac30: 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
ac40: 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
ac50: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
ac60: 6c 61 62 65 6c 2d 33 30 34 0d 0a 53 45 4c 45 43  label-304..SELEC
ac70: 54 20 63 6f 6c 30 20 2f 20 2b 20 63 6f 72 30 2e  T col0 / + cor0.
ac80: 63 6f 6c 30 20 2b 20 2b 20 37 30 20 41 53 20 63  col0 + + 70 AS c
ac90: 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol1 FROM tab2 AS
aca0: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 37 31 0d   cor0..----..71.
acb0: 0a 37 31 0d 0a 37 31 0d 0a 0d 0a 71 75 65 72 79  .71..71....query
acc0: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
acd0: 43 54 20 2b 20 63 6f 6c 30 20 2a 20 63 6f 6c 30  CT + col0 * col0
ace0: 20 2d 20 2b 20 34 35 20 2a 20 63 6f 72 30 2e 63   - + 45 * cor0.c
acf0: 6f 6c 30 20 2a 20 63 6f 72 30 2e 63 6f 6c 31 20  ol0 * cor0.col1 
ad00: 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a  FROM tab1 cor0..
ad10: 2d 2d 2d 2d 0d 0a 2d 32 34 37 30 34 0d 0a 2d 33  ----..-24704..-3
ad20: 35 30 31 0d 0a 2d 34 30 34 30 30 0d 0a 0d 0a 71  501..-40400....q
ad30: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
ad40: 53 45 4c 45 43 54 20 2b 20 2b 20 63 6f 72 30 2e  SELECT + + cor0.
ad50: 63 6f 6c 30 20 2a 20 2b 20 39 38 20 41 53 20 63  col0 * + 98 AS c
ad60: 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol1 FROM tab1 AS
ad70: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 39 34   cor0..----..294
ad80: 0d 0a 36 32 37 32 0d 0a 37 38 34 30 0d 0a 0d 0a  ..6272..7840....
ad90: 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75  onlyif mysql # u
ada0: 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20  se DIV operator 
adb0: 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69  for integer divi
adc0: 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f  sion..query I ro
add0: 77 73 6f 72 74 20 6c 61 62 65 6c 2d 33 30 37 0d  wsort label-307.
ade0: 0a 53 45 4c 45 43 54 20 37 32 20 44 49 56 20 2b  .SELECT 72 DIV +
adf0: 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d   col0 FROM tab0.
ae00: 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 32 0d 0a 33 0d 0a  .----..0..2..3..
ae10: 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
ae20: 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
ae30: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
ae40: 20 6c 61 62 65 6c 2d 33 30 37 0d 0a 53 45 4c 45   label-307..SELE
ae50: 43 54 20 37 32 20 2f 20 2b 20 63 6f 6c 30 20 46  CT 72 / + col0 F
ae60: 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab0..----..
ae70: 30 0d 0a 32 0d 0a 33 0d 0a 0d 0a 71 75 65 72 79  0..2..3....query
ae80: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
ae90: 43 54 20 41 4c 4c 20 63 6f 72 30 2e 63 6f 6c 30  CT ALL cor0.col0
aea0: 20 2a 20 63 6f 72 30 2e 63 6f 6c 32 20 41 53 20   * cor0.col2 AS 
aeb0: 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 2c 20  col0 FROM tab1, 
aec0: 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
aed0: 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73  --..9 values has
aee0: 68 69 6e 67 20 74 6f 20 65 31 31 32 30 65 37 62  hing to e1120e7b
aef0: 36 38 37 62 33 32 32 37 30 65 66 37 30 33 39 33  687b32270ef70393
af00: 32 33 36 65 37 33 34 31 0d 0a 0d 0a 73 6b 69 70  236e7341....skip
af10: 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20  if postgresql # 
af20: 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69  PostgreSQL requi
af30: 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61  res AS when rena
af40: 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75  ming output colu
af50: 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  mns..query I row
af60: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63  sort..SELECT + c
af70: 6f 72 30 2e 63 6f 6c 30 20 63 6f 6c 32 20 46 52  or0.col0 col2 FR
af80: 4f 4d 20 74 61 62 32 20 63 6f 72 30 20 43 52 4f  OM tab2 cor0 CRO
af90: 53 53 20 4a 4f 49 4e 20 74 61 62 31 20 41 53 20  SS JOIN tab1 AS 
afa0: 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61  cor1..----..9 va
afb0: 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20  lues hashing to 
afc0: 39 35 62 39 36 63 61 31 64 62 65 32 65 33 39 61  95b96ca1dbe2e39a
afd0: 30 66 61 37 38 66 35 30 64 33 37 34 66 35 31 61  0fa78f50d374f51a
afe0: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
aff0: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
b000: 49 4e 43 54 20 2d 20 33 35 20 41 53 20 63 6f 6c  INCT - 35 AS col
b010: 30 20 46 52 4f 4d 20 74 61 62 31 2c 20 74 61 62  0 FROM tab1, tab
b020: 30 2c 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  0, tab1 AS cor0.
b030: 0a 2d 2d 2d 2d 0d 0a 2d 33 35 0d 0a 0d 0a 71 75  .----..-35....qu
b040: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
b050: 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d  ELECT DISTINCT -
b060: 20 63 6f 6c 31 20 2a 20 2b 20 34 36 20 2b 20 63   col1 * + 46 + c
b070: 6f 6c 30 20 2a 20 2d 20 63 6f 6c 32 20 46 52 4f  ol0 * - col2 FRO
b080: 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  M tab0..----..-1
b090: 31 34 38 34 0d 0a 2d 34 34 39 37 0d 0a 2d 34 37  1484..-4497..-47
b0a0: 34 38 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  48....onlyif mys
b0b0: 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72  ql # support for
b0c0: 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63 20   MySQL specific 
b0d0: 73 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64  system types and
b0e0: 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49   syntax..query I
b0f0: 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 33   rowsort label-3
b100: 31 32 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 32 20  12..SELECT col2 
b110: 2a 20 28 20 2b 20 63 6f 6c 30 20 29 20 2a 20 43  * ( + col0 ) * C
b120: 41 53 54 28 20 63 6f 6c 30 20 41 53 20 53 49 47  AST( col0 AS SIG
b130: 4e 45 44 20 29 20 41 53 20 63 6f 6c 30 20 46 52  NED ) AS col0 FR
b140: 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31  OM tab2..----..1
b150: 33 32 33 0d 0a 31 35 38 31 38 34 0d 0a 32 33 37  323..158184..237
b160: 31 35 38 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  158....skipif my
b170: 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
b180: 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
b190: 77 73 6f 72 74 20 6c 61 62 65 6c 2d 33 31 32 0d  wsort label-312.
b1a0: 0a 53 45 4c 45 43 54 20 63 6f 6c 32 20 2a 20 28  .SELECT col2 * (
b1b0: 20 2b 20 63 6f 6c 30 20 29 20 2a 20 43 41 53 54   + col0 ) * CAST
b1c0: 20 28 20 63 6f 6c 30 20 41 53 20 49 4e 54 45 47   ( col0 AS INTEG
b1d0: 45 52 20 29 20 41 53 20 63 6f 6c 30 20 46 52 4f  ER ) AS col0 FRO
b1e0: 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 33  M tab2..----..13
b1f0: 32 33 0d 0a 31 35 38 31 38 34 0d 0a 32 33 37 31  23..158184..2371
b200: 35 38 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  58....onlyif mys
b210: 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72  ql # support for
b220: 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63 20   MySQL specific 
b230: 73 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64  system types and
b240: 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49   syntax..query I
b250: 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 33   rowsort label-3
b260: 31 33 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  13..SELECT DISTI
b270: 4e 43 54 20 2d 20 28 20 2d 20 74 61 62 32 2e 63  NCT - ( - tab2.c
b280: 6f 6c 31 20 29 20 2b 20 2b 20 63 6f 6c 31 20 2a  ol1 ) + + col1 *
b290: 20 2d 20 43 41 53 54 28 20 63 6f 6c 31 20 41 53   - CAST( col1 AS
b2a0: 20 53 49 47 4e 45 44 20 29 20 46 52 4f 4d 20 74   SIGNED ) FROM t
b2b0: 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 37 32 0d  ab2..----..-272.
b2c0: 0a 2d 33 34 32 32 0d 0a 2d 39 33 30 0d 0a 0d 0a  .-3422..-930....
b2d0: 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
b2e0: 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
b2f0: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
b300: 61 62 65 6c 2d 33 31 33 0d 0a 53 45 4c 45 43 54  abel-313..SELECT
b310: 20 44 49 53 54 49 4e 43 54 20 2d 20 28 20 2d 20   DISTINCT - ( - 
b320: 74 61 62 32 2e 63 6f 6c 31 20 29 20 2b 20 2b 20  tab2.col1 ) + + 
b330: 63 6f 6c 31 20 2a 20 2d 20 43 41 53 54 20 28 20  col1 * - CAST ( 
b340: 63 6f 6c 31 20 41 53 20 49 4e 54 45 47 45 52 20  col1 AS INTEGER 
b350: 29 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d  ) FROM tab2..---
b360: 2d 0d 0a 2d 32 37 32 0d 0a 2d 33 34 32 32 0d 0a  -..-272..-3422..
b370: 2d 39 33 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20  -930....query I 
b380: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
b390: 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c 32 20 2b 20  col0 * + col2 + 
b3a0: 2b 20 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c 30 20  + col0 * + col0 
b3b0: 2b 20 2d 20 74 61 62 31 2e 63 6f 6c 32 20 46 52  + - tab1.col2 FR
b3c0: 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31  OM tab1..----..1
b3d0: 31 37 0d 0a 31 33 39 38 34 0d 0a 37 36 38 37 0d  17..13984..7687.
b3e0: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
b3f0: 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b  rt..SELECT ALL +
b400: 20 2b 20 63 6f 6c 30 20 2b 20 63 6f 6c 30 20 2a   + col0 + col0 *
b410: 20 2d 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20   - col0 AS col0 
b420: 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
b430: 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 32 0d 0a 2d 36  0..----..-42..-6
b440: 30 30 36 0d 0a 2d 36 31 36 32 0d 0a 0d 0a 71 75  006..-6162....qu
b450: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
b460: 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 28  ELECT DISTINCT (
b470: 20 63 6f 72 30 2e 63 6f 6c 30 20 29 20 2b 20 63   cor0.col0 ) + c
b480: 6f 6c 31 20 2a 20 63 6f 6c 30 20 41 53 20 63 6f  ol1 * col0 AS co
b490: 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l2 FROM tab0 AS 
b4a0: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 30 38 38  cor0..----..2088
b4b0: 0d 0a 33 34 33 30 0d 0a 38 31 38 38 0d 0a 0d 0a  ..3430..8188....
b4c0: 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71  skipif postgresq
b4d0: 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72  l # PostgreSQL r
b4e0: 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20  equires AS when 
b4f0: 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20  renaming output 
b500: 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49  columns..query I
b510: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
b520: 20 41 4c 4c 20 2d 20 63 6f 6c 30 20 2a 20 28 20   ALL - col0 * ( 
b530: 2b 20 63 6f 6c 32 20 29 20 2b 20 2b 20 63 6f 6c  + col2 ) + + col
b540: 31 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31  1 col1 FROM tab1
b550: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
b560: 2d 31 33 36 0d 0a 2d 33 36 33 38 0d 0a 2d 37 36  -136..-3638..-76
b570: 36 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  67....query I ro
b580: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
b590: 2b 20 63 6f 6c 30 20 2b 20 2d 20 36 30 20 41 53  + col0 + - 60 AS
b5a0: 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20   col1 FROM tab0 
b5b0: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
b5c0: 31 34 39 0d 0a 2d 38 34 0d 0a 2d 39 35 0d 0a 0d  149..-84..-95...
b5d0: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
b5e0: 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63  ..SELECT ALL + c
b5f0: 6f 6c 30 20 2b 20 33 36 20 2b 20 63 6f 6c 32 20  ol0 + 36 + col2 
b600: 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
b610: 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
b620: 0a 32 30 37 0d 0a 37 32 0d 0a 39 33 0d 0a 0d 0a  .207..72..93....
b630: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
b640: 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
b650: 20 63 6f 6c 31 20 2b 20 28 20 63 6f 72 30 2e 63   col1 + ( cor0.c
b660: 6f 6c 32 20 29 20 46 52 4f 4d 20 74 61 62 30 20  ol2 ) FROM tab0 
b670: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
b680: 31 39 0d 0a 31 37 33 0d 0a 39 38 0d 0a 0d 0a 71  19..173..98....q
b690: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
b6a0: 53 45 4c 45 43 54 20 2d 20 63 6f 6c 32 20 2b 20  SELECT - col2 + 
b6b0: 28 20 2b 20 63 6f 6c 30 20 29 20 41 53 20 63 6f  ( + col0 ) AS co
b6c0: 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l2 FROM tab1 AS 
b6d0: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 36 0d  cor0..----..-16.
b6e0: 0a 2d 35 31 0d 0a 37 0d 0a 0d 0a 71 75 65 72 79  .-51..7....query
b6f0: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
b700: 43 54 20 2b 20 63 6f 6c 31 20 2a 20 2d 20 31 34  CT + col1 * - 14
b710: 20 2b 20 2d 20 28 20 63 6f 72 30 2e 63 6f 6c 32   + - ( cor0.col2
b720: 20 2a 20 2d 20 63 6f 72 30 2e 63 6f 6c 31 20 29   * - cor0.col1 )
b730: 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
b740: 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  b1 cor0..----..1
b750: 30 34 30 0d 0a 31 30 36 36 0d 0a 34 33 30 0d 0a  040..1066..430..
b760: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
b770: 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 31  t..SELECT - col1
b780: 20 2a 20 63 6f 6c 30 20 2a 20 63 6f 6c 30 20 46   * col0 * col0 F
b790: 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
b7a0: 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 38 38 32 35 0d  ..----..-118825.
b7b0: 0a 2d 34 39 35 33 36 0d 0a 2d 37 32 30 38 31 31  .-49536..-720811
b7c0: 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
b7d0: 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61   # use DIV opera
b7e0: 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20  tor for integer 
b7f0: 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20  division..query 
b800: 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
b810: 33 32 34 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  324..SELECT DIST
b820: 49 4e 43 54 20 63 6f 6c 31 20 2b 20 2d 20 35 38  INCT col1 + - 58
b830: 20 44 49 56 20 63 6f 6c 31 20 2b 20 2b 20 63 6f   DIV col1 + + co
b840: 6c 31 20 44 49 56 20 63 6f 6c 30 20 41 53 20 63  l1 DIV col0 AS c
b850: 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol0 FROM tab2 AS
b860: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 34 0d   cor0..----..14.
b870: 0a 33 34 0d 0a 35 39 0d 0a 0d 0a 73 6b 69 70 69  .34..59....skipi
b880: 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
b890: 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
b8a0: 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
b8b0: 33 32 34 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  324..SELECT DIST
b8c0: 49 4e 43 54 20 63 6f 6c 31 20 2b 20 2d 20 35 38  INCT col1 + - 58
b8d0: 20 2f 20 63 6f 6c 31 20 2b 20 2b 20 63 6f 6c 31   / col1 + + col1
b8e0: 20 2f 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20   / col0 AS col0 
b8f0: 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
b900: 30 0d 0a 2d 2d 2d 2d 0d 0a 31 34 0d 0a 33 34 0d  0..----..14..34.
b910: 0a 35 39 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  .59....onlyif my
b920: 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f  sql # support fo
b930: 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63  r MySQL specific
b940: 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e   system types an
b950: 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20  d syntax..query 
b960: 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
b970: 33 32 35 0d 0a 53 45 4c 45 43 54 20 43 41 53 54  325..SELECT CAST
b980: 28 20 4e 55 4c 4c 20 41 53 20 53 49 47 4e 45 44  ( NULL AS SIGNED
b990: 20 29 20 2f 20 2d 20 63 6f 6c 31 20 41 53 20 63   ) / - col1 AS c
b9a0: 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol2 FROM tab1 AS
b9b0: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c   cor0..----..NUL
b9c0: 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d  L..NULL..NULL...
b9d0: 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
b9e0: 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
b9f0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
ba00: 6c 61 62 65 6c 2d 33 32 35 0d 0a 53 45 4c 45 43  label-325..SELEC
ba10: 54 20 43 41 53 54 20 28 20 4e 55 4c 4c 20 41 53  T CAST ( NULL AS
ba20: 20 49 4e 54 45 47 45 52 20 29 20 2f 20 2d 20 63   INTEGER ) / - c
ba30: 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  ol1 AS col2 FROM
ba40: 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
ba50: 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d  ---..NULL..NULL.
ba60: 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75 65 72 79 20 49  .NULL....query I
ba70: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
ba80: 20 41 4c 4c 20 2b 20 28 20 2b 20 28 20 2d 20 63   ALL + ( + ( - c
ba90: 6f 6c 31 20 29 20 29 20 2a 20 28 20 63 6f 6c 31  ol1 ) ) * ( col1
baa0: 20 29 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20   ) AS col0 FROM 
bab0: 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
bac0: 2d 2d 0d 0a 2d 32 38 39 0d 0a 2d 33 34 38 31 0d  --..-289..-3481.
bad0: 0a 2d 39 36 31 0d 0a 0d 0a 71 75 65 72 79 20 49  .-961....query I
bae0: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
baf0: 20 63 6f 6c 31 20 2a 20 2b 20 33 36 20 2b 20 32   col1 * + 36 + 2
bb00: 36 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d  6 FROM tab2..---
bb10: 2d 0d 0a 31 31 34 32 0d 0a 32 31 35 30 0d 0a 36  -..1142..2150..6
bb20: 33 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  38....query I ro
bb30: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
bb40: 2d 20 63 6f 6c 32 20 2a 20 28 20 63 6f 72 30 2e  - col2 * ( cor0.
bb50: 63 6f 6c 31 20 29 20 41 53 20 63 6f 6c 30 20 46  col1 ) AS col0 F
bb60: 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d  ROM tab0 cor0..-
bb70: 2d 2d 2d 0d 0a 32 38 33 38 0d 0a 37 34 36 32 0d  ---..2838..7462.
bb80: 0a 39 37 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  .97....onlyif my
bb90: 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70  sql # use DIV op
bba0: 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67  erator for integ
bbb0: 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65  er division..que
bbc0: 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
bbd0: 65 6c 2d 33 32 39 0d 0a 53 45 4c 45 43 54 20 2d  el-329..SELECT -
bbe0: 20 2d 20 63 6f 6c 32 20 2b 20 2d 20 28 20 2d 20   - col2 + - ( - 
bbf0: 34 30 20 29 20 44 49 56 20 2d 20 63 6f 72 30 2e  40 ) DIV - cor0.
bc00: 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46 52 4f  col2 AS col2 FRO
bc10: 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
bc20: 2d 2d 2d 2d 0d 0a 2d 33 39 0d 0a 33 32 0d 0a 38  ----..-39..32..8
bc30: 32 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  2....skipif mysq
bc40: 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
bc50: 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
bc60: 6f 72 74 20 6c 61 62 65 6c 2d 33 32 39 0d 0a 53  ort label-329..S
bc70: 45 4c 45 43 54 20 2d 20 2d 20 63 6f 6c 32 20 2b  ELECT - - col2 +
bc80: 20 2d 20 28 20 2d 20 34 30 20 29 20 2f 20 2d 20   - ( - 40 ) / - 
bc90: 63 6f 72 30 2e 63 6f 6c 32 20 41 53 20 63 6f 6c  cor0.col2 AS col
bca0: 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  2 FROM tab0 AS c
bcb0: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 39 0d 0a  or0..----..-39..
bcc0: 33 32 0d 0a 38 32 0d 0a 0d 0a 71 75 65 72 79 20  32..82....query 
bcd0: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
bce0: 54 20 2d 20 63 6f 6c 30 20 2a 20 2b 20 36 36 20  T - col0 * + 66 
bcf0: 2d 20 2d 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61  - - col0 FROM ta
bd00: 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 35 35 0d 0a  b2..----..-455..
bd10: 2d 35 30 37 30 0d 0a 2d 35 31 33 35 0d 0a 0d 0a  -5070..-5135....
bd20: 71 75 65 72 79 20 49 49 49 49 49 49 49 49 49 49  query IIIIIIIIII
bd30: 49 49 49 49 49 20 72 6f 77 73 6f 72 74 0d 0a 53  IIIII rowsort..S
bd40: 45 4c 45 43 54 20 2a 20 46 52 4f 4d 20 74 61 62  ELECT * FROM tab
bd50: 30 2c 20 74 61 62 32 20 41 53 20 63 6f 72 30 20  0, tab2 AS cor0 
bd60: 43 52 4f 53 53 20 4a 4f 49 4e 20 74 61 62 32 2c  CROSS JOIN tab2,
bd70: 20 74 61 62 32 20 41 53 20 63 6f 72 31 2c 20 74   tab2 AS cor1, t
bd80: 61 62 30 20 41 53 20 63 6f 72 32 0d 0a 2d 2d 2d  ab0 AS cor2..---
bd90: 2d 0d 0a 33 36 34 35 20 76 61 6c 75 65 73 20 68  -..3645 values h
bda0: 61 73 68 69 6e 67 20 74 6f 20 34 30 65 34 61 63  ashing to 40e4ac
bdb0: 64 36 31 38 36 39 38 64 64 32 33 30 35 66 31 66  d618698dd2305f1f
bdc0: 37 62 38 62 35 34 37 66 37 61 0d 0a 0d 0a 6f 6e  7b8b547f7a....on
bdd0: 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70  lyif mysql # sup
bde0: 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73  port for MySQL s
bdf0: 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20 74  pecific system t
be00: 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d  ypes and syntax.
be10: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
be20: 20 6c 61 62 65 6c 2d 33 33 32 0d 0a 53 45 4c 45   label-332..SELE
be30: 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 37 35  CT DISTINCT + 75
be40: 20 2a 20 2d 20 63 6f 6c 31 20 2b 20 43 41 53 54   * - col1 + CAST
be50: 28 20 4e 55 4c 4c 20 41 53 20 53 49 47 4e 45 44  ( NULL AS SIGNED
be60: 20 29 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20   ) AS col1 FROM 
be70: 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
be80: 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70  --..NULL....skip
be90: 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
bea0: 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
beb0: 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
bec0: 2d 33 33 32 0d 0a 53 45 4c 45 43 54 20 44 49 53  -332..SELECT DIS
bed0: 54 49 4e 43 54 20 2b 20 37 35 20 2a 20 2d 20 63  TINCT + 75 * - c
bee0: 6f 6c 31 20 2b 20 43 41 53 54 20 28 20 4e 55 4c  ol1 + CAST ( NUL
bef0: 4c 20 41 53 20 49 4e 54 45 47 45 52 20 29 20 41  L AS INTEGER ) A
bf00: 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32  S col1 FROM tab2
bf10: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
bf20: 4e 55 4c 4c 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  NULL....onlyif m
bf30: 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f  ysql # use DIV o
bf40: 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65  perator for inte
bf50: 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75  ger division..qu
bf60: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
bf70: 62 65 6c 2d 33 33 33 0d 0a 53 45 4c 45 43 54 20  bel-333..SELECT 
bf80: 44 49 53 54 49 4e 43 54 20 2d 20 2b 20 28 20 63  DISTINCT - + ( c
bf90: 6f 6c 32 20 29 20 2b 20 2b 20 63 6f 6c 30 20 44  ol2 ) + + col0 D
bfa0: 49 56 20 63 6f 72 30 2e 63 6f 6c 30 20 41 53 20  IV cor0.col0 AS 
bfb0: 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41  col1 FROM tab0 A
bfc0: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33  S cor0..----..-3
bfd0: 32 0d 0a 2d 38 31 0d 0a 30 0d 0a 0d 0a 73 6b 69  2..-81..0....ski
bfe0: 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
bff0: 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
c000: 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
c010: 6c 2d 33 33 33 0d 0a 53 45 4c 45 43 54 20 44 49  l-333..SELECT DI
c020: 53 54 49 4e 43 54 20 2d 20 2b 20 28 20 63 6f 6c  STINCT - + ( col
c030: 32 20 29 20 2b 20 2b 20 63 6f 6c 30 20 2f 20 63  2 ) + + col0 / c
c040: 6f 72 30 2e 63 6f 6c 30 20 41 53 20 63 6f 6c 31  or0.col0 AS col1
c050: 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
c060: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 32 0d 0a 2d  r0..----..-32..-
c070: 38 31 0d 0a 30 0d 0a 0d 0a 71 75 65 72 79 20 49  81..0....query I
c080: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
c090: 20 28 20 2d 20 74 61 62 32 2e 63 6f 6c 30 20 29   ( - tab2.col0 )
c0a0: 20 2a 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c   * + col1 AS col
c0b0: 30 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d  0 FROM tab2..---
c0c0: 2d 0d 0a 2d 31 33 34 33 0d 0a 2d 32 31 37 0d 0a  -..-1343..-217..
c0d0: 2d 34 36 30 32 0d 0a 0d 0a 71 75 65 72 79 20 49  -4602....query I
c0e0: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
c0f0: 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 32 20 2d   DISTINCT col2 -
c100: 20 2b 20 28 20 2b 20 63 6f 6c 30 20 29 20 46 52   + ( + col0 ) FR
c110: 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d  OM tab2..----..-
c120: 34 31 0d 0a 2d 35 32 0d 0a 32 30 0d 0a 0d 0a 71  41..-52..20....q
c130: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
c140: 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
c150: 31 38 20 2b 20 2b 20 63 6f 6c 32 20 41 53 20 63  18 + + col2 AS c
c160: 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d  ol2 FROM tab2..-
c170: 2d 2d 2d 0d 0a 34 34 0d 0a 34 35 0d 0a 35 36 0d  ---..44..45..56.
c180: 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72  ...skipif postgr
c190: 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51  esql # PostgreSQ
c1a0: 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68  L requires AS wh
c1b0: 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70  en renaming outp
c1c0: 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72  ut columns..quer
c1d0: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
c1e0: 45 43 54 20 2d 20 2b 20 63 6f 6c 30 20 2b 20 2b  ECT - + col0 + +
c1f0: 20 63 6f 6c 30 20 2a 20 2b 20 28 20 2d 20 63 6f   col0 * + ( - co
c200: 6c 31 20 29 20 2a 20 63 6f 6c 32 20 63 6f 6c 32  l1 ) * col2 col2
c210: 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
c220: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 34 33 30 0d  r0..----..-3430.
c230: 0a 2d 36 36 34 32 30 37 0d 0a 2d 36 38 31 33 36  .-664207..-68136
c240: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
c250: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
c260: 49 4e 43 54 20 39 30 20 2a 20 2d 20 63 6f 6c 31  INCT 90 * - col1
c270: 20 2b 20 2d 20 63 6f 6c 31 20 2b 20 63 6f 6c 30   + - col1 + col0
c280: 20 2a 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c   * + col0 AS col
c290: 30 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d  0 FROM tab2..---
c2a0: 2d 0d 0a 2d 32 37 37 32 0d 0a 34 36 39 34 0d 0a  -..-2772..4694..
c2b0: 37 31 35 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f  715....skipif po
c2c0: 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67  stgresql # Postg
c2d0: 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41  reSQL requires A
c2e0: 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20  S when renaming 
c2f0: 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a  output columns..
c300: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
c310: 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 31 20 2b  .SELECT + col1 +
c320: 20 63 6f 72 30 2e 63 6f 6c 30 20 63 6f 6c 32 20   cor0.col0 col2 
c330: 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
c340: 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33 37 0d 0a 33 38  0..----..137..38
c350: 0d 0a 39 36 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  ..96....onlyif m
c360: 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f  ysql # use DIV o
c370: 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65  perator for inte
c380: 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75  ger division..qu
c390: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
c3a0: 62 65 6c 2d 33 34 30 0d 0a 53 45 4c 45 43 54 20  bel-340..SELECT 
c3b0: 41 4c 4c 20 63 6f 72 30 2e 63 6f 6c 31 20 2b 20  ALL cor0.col1 + 
c3c0: 63 6f 72 30 2e 63 6f 6c 31 20 44 49 56 20 28 20  cor0.col1 DIV ( 
c3d0: 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c 32 20 29 20  col1 * + col2 ) 
c3e0: 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
c3f0: 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30  1 cor0..----..10
c400: 0d 0a 31 33 0d 0a 32 36 0d 0a 0d 0a 73 6b 69 70  ..13..26....skip
c410: 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
c420: 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
c430: 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
c440: 2d 33 34 30 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  -340..SELECT ALL
c450: 20 63 6f 72 30 2e 63 6f 6c 31 20 2b 20 63 6f 72   cor0.col1 + cor
c460: 30 2e 63 6f 6c 31 20 2f 20 28 20 63 6f 6c 31 20  0.col1 / ( col1 
c470: 2a 20 2b 20 63 6f 6c 32 20 29 20 41 53 20 63 6f  * + col2 ) AS co
c480: 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72  l2 FROM tab1 cor
c490: 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 0d 0a 31 33 0d  0..----..10..13.
c4a0: 0a 32 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .26....query I r
c4b0: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
c4c0: 20 31 38 20 2a 20 63 6f 6c 30 20 2d 20 63 6f 6c   18 * col0 - col
c4d0: 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  2 FROM tab2 AS c
c4e0: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 34 33 30  or0..----..-1430
c4f0: 0d 0a 2d 31 34 36 30 0d 0a 2d 31 35 33 0d 0a 0d  ..-1460..-153...
c500: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
c510: 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63  ..SELECT ALL - c
c520: 6f 6c 32 20 2a 20 63 6f 6c 32 20 2b 20 2d 20 28  ol2 * col2 + - (
c530: 20 2b 20 63 6f 6c 31 20 29 20 46 52 4f 4d 20 74   + col1 ) FROM t
c540: 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
c550: 2d 0d 0a 2d 32 39 34 32 0d 0a 2d 33 32 35 39 0d  -..-2942..-3259.
c560: 0a 2d 39 32 32 39 0d 0a 0d 0a 6f 6e 6c 79 69 66  .-9229....onlyif
c570: 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74   mysql # support
c580: 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69   for MySQL speci
c590: 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73  fic system types
c5a0: 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65   and syntax..que
c5b0: 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
c5c0: 65 6c 2d 33 34 33 0d 0a 53 45 4c 45 43 54 20 63  el-343..SELECT c
c5d0: 6f 6c 30 20 2a 20 2b 20 43 41 53 54 28 20 2d 20  ol0 * + CAST( - 
c5e0: 63 6f 6c 32 20 2a 20 63 6f 6c 30 20 41 53 20 53  col2 * col0 AS S
c5f0: 49 47 4e 45 44 20 29 20 46 52 4f 4d 20 74 61 62  IGNED ) FROM tab
c600: 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
c610: 0a 2d 31 33 32 33 0d 0a 2d 31 35 38 31 38 34 0d  .-1323..-158184.
c620: 0a 2d 32 33 37 31 35 38 0d 0a 0d 0a 73 6b 69 70  .-237158....skip
c630: 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
c640: 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
c650: 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
c660: 2d 33 34 33 0d 0a 53 45 4c 45 43 54 20 63 6f 6c  -343..SELECT col
c670: 30 20 2a 20 2b 20 43 41 53 54 20 28 20 2d 20 63  0 * + CAST ( - c
c680: 6f 6c 32 20 2a 20 63 6f 6c 30 20 41 53 20 49 4e  ol2 * col0 AS IN
c690: 54 45 47 45 52 20 29 20 46 52 4f 4d 20 74 61 62  TEGER ) FROM tab
c6a0: 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
c6b0: 0a 2d 31 33 32 33 0d 0a 2d 31 35 38 31 38 34 0d  .-1323..-158184.
c6c0: 0a 2d 32 33 37 31 35 38 0d 0a 0d 0a 71 75 65 72  .-237158....quer
c6d0: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
c6e0: 45 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c  ECT DISTINCT col
c6f0: 31 20 2b 20 2b 20 28 20 36 20 29 20 2a 20 63 6f  1 + + ( 6 ) * co
c700: 6c 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  l0 AS col1 FROM 
c710: 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab1 cor0..----.
c720: 0a 33 39 34 0d 0a 34 34 0d 0a 34 39 33 0d 0a 0d  .394..44..493...
c730: 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
c740: 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72  use DIV operator
c750: 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76   for integer div
c760: 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72  ision..query I r
c770: 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 33 34 35  owsort label-345
c780: 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
c790: 54 20 2d 20 63 6f 6c 32 20 44 49 56 20 63 6f 6c  T - col2 DIV col
c7a0: 30 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32  0 col0 FROM tab2
c7b0: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
c7c0: 2d 33 0d 0a 30 0d 0a 0d 0a 73 6b 69 70 69 66 20  -3..0....skipif 
c7d0: 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73  postgresql # Pos
c7e0: 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73  tgreSQL requires
c7f0: 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e   AS when renamin
c800: 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73  g output columns
c810: 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
c820: 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
c830: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
c840: 20 6c 61 62 65 6c 2d 33 34 35 0d 0a 53 45 4c 45   label-345..SELE
c850: 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f  CT DISTINCT - co
c860: 6c 32 20 2f 20 63 6f 6c 30 20 63 6f 6c 30 20 46  l2 / col0 col0 F
c870: 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
c880: 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 0d 0a 30 0d 0a 0d  ..----..-3..0...
c890: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
c8a0: 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63  ..SELECT ALL + c
c8b0: 6f 6c 30 20 2a 20 36 37 20 2b 20 2b 20 63 6f 6c  ol0 * 67 + + col
c8c0: 30 20 2a 20 63 6f 6c 32 20 2a 20 28 20 2d 20 63  0 * col2 * ( - c
c8d0: 6f 6c 30 20 29 20 41 53 20 63 6f 6c 30 20 46 52  ol0 ) AS col0 FR
c8e0: 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
c8f0: 0a 2d 2d 2d 2d 0d 0a 2d 31 35 32 39 35 38 0d 0a  .----..-152958..
c900: 2d 32 33 31 38 36 35 0d 0a 2d 38 35 34 0d 0a 0d  -231865..-854...
c910: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
c920: 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63  ..SELECT ALL - c
c930: 6f 6c 30 20 2a 20 28 20 63 6f 6c 30 20 29 20 46  ol0 * ( col0 ) F
c940: 52 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d  ROM tab2 cor0..-
c950: 2d 2d 2d 0d 0a 2d 34 39 0d 0a 2d 36 30 38 34 0d  ---..-49..-6084.
c960: 0a 2d 36 32 34 31 0d 0a 0d 0a 71 75 65 72 79 20  .-6241....query 
c970: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
c980: 54 20 41 4c 4c 20 2d 20 63 6f 6c 31 20 2b 20 2d  T ALL - col1 + -
c990: 20 63 6f 6c 30 20 2a 20 2d 20 28 20 63 6f 72 30   col0 * - ( cor0
c9a0: 2e 63 6f 6c 32 20 29 20 2b 20 2b 20 63 6f 6c 31  .col2 ) + + col1
c9b0: 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
c9c0: 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  b1 cor0..----..1
c9d0: 36 32 0d 0a 33 36 34 38 0d 0a 37 36 38 30 0d 0a  62..3648..7680..
c9e0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
c9f0: 74 0d 0a 53 45 4c 45 43 54 20 2d 20 28 20 2b 20  t..SELECT - ( + 
ca00: 36 37 20 29 20 46 52 4f 4d 20 74 61 62 30 20 41  67 ) FROM tab0 A
ca10: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 36  S cor0..----..-6
ca20: 37 0d 0a 2d 36 37 0d 0a 2d 36 37 0d 0a 0d 0a 71  7..-67..-67....q
ca30: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
ca40: 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c  SELECT ALL + col
ca50: 30 20 2b 20 63 6f 6c 30 20 2a 20 63 6f 72 30 2e  0 + col0 * cor0.
ca60: 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46 52 4f  col1 AS col1 FRO
ca70: 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab2 cor0..---
ca80: 2d 0d 0a 31 34 32 32 0d 0a 32 32 34 0d 0a 34 36  -..1422..224..46
ca90: 38 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  80....onlyif mys
caa0: 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65  ql # use DIV ope
cab0: 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65  rator for intege
cac0: 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72  r division..quer
cad0: 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
cae0: 6c 2d 33 35 31 0d 0a 53 45 4c 45 43 54 20 2b 20  l-351..SELECT + 
caf0: 43 41 53 54 28 20 2d 20 32 35 20 41 53 20 53 49  CAST( - 25 AS SI
cb00: 47 4e 45 44 20 29 20 44 49 56 20 63 6f 6c 32 20  GNED ) DIV col2 
cb10: 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
cb20: 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30  0..----..0..0..0
cb30: 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
cb40: 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
cb50: 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
cb60: 72 74 20 6c 61 62 65 6c 2d 33 35 31 0d 0a 53 45  rt label-351..SE
cb70: 4c 45 43 54 20 2b 20 43 41 53 54 20 28 20 2d 20  LECT + CAST ( - 
cb80: 32 35 20 41 53 20 49 4e 54 45 47 45 52 20 29 20  25 AS INTEGER ) 
cb90: 2f 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31  / col2 FROM tab1
cba0: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
cbb0: 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a 71 75 65 72 79  0..0..0....query
cbc0: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
cbd0: 43 54 20 41 4c 4c 20 2d 20 63 6f 72 31 2e 63 6f  CT ALL - cor1.co
cbe0: 6c 31 20 2b 20 39 30 20 41 53 20 63 6f 6c 30 20  l1 + 90 AS col0 
cbf0: 46 52 4f 4d 20 74 61 62 31 2c 20 74 61 62 30 20  FROM tab1, tab0 
cc00: 41 53 20 63 6f 72 30 2c 20 74 61 62 31 20 41 53  AS cor0, tab1 AS
cc10: 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20   cor1..----..27 
cc20: 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74  values hashing t
cc30: 6f 20 34 39 36 38 66 36 62 37 34 31 34 37 34 37  o 4968f6b7414747
cc40: 36 33 30 34 35 66 63 32 35 37 62 36 39 64 38 62  63045fc257b69d8b
cc50: 66 62 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  fb....onlyif mys
cc60: 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65  ql # use DIV ope
cc70: 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65  rator for intege
cc80: 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72  r division..quer
cc90: 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
cca0: 6c 2d 33 35 33 0d 0a 53 45 4c 45 43 54 20 44 49  l-353..SELECT DI
ccb0: 53 54 49 4e 43 54 20 2b 20 63 6f 6c 32 20 2b 20  STINCT + col2 + 
ccc0: 63 6f 6c 32 20 44 49 56 20 2b 20 63 6f 72 30 2e  col2 DIV + cor0.
ccd0: 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46 52 4f  col2 AS col0 FRO
cce0: 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab1 cor0..---
ccf0: 2d 0d 0a 35 35 0d 0a 35 38 0d 0a 39 37 0d 0a 0d  -..55..58..97...
cd00: 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
cd10: 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
cd20: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
cd30: 6c 61 62 65 6c 2d 33 35 33 0d 0a 53 45 4c 45 43  label-353..SELEC
cd40: 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c  T DISTINCT + col
cd50: 32 20 2b 20 63 6f 6c 32 20 2f 20 2b 20 63 6f 72  2 + col2 / + cor
cd60: 30 2e 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46  0.col2 AS col0 F
cd70: 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d  ROM tab1 cor0..-
cd80: 2d 2d 2d 0d 0a 35 35 0d 0a 35 38 0d 0a 39 37 0d  ---..55..58..97.
cd90: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
cda0: 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
cdb0: 4e 43 54 20 2b 20 2d 20 63 6f 72 30 2e 63 6f 6c  NCT + - cor0.col
cdc0: 32 20 2a 20 63 6f 6c 31 20 2a 20 63 6f 6c 32 20  2 * col1 * col2 
cdd0: 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
cde0: 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 32 35 39 39 0d  0..----..-22599.
cdf0: 0a 2d 32 34 35 34 38 0d 0a 2d 33 39 38 38 34 0d  .-24548..-39884.
ce00: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
ce10: 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
ce20: 4e 43 54 20 63 6f 6c 32 20 2b 20 37 34 20 2a 20  NCT col2 + 74 * 
ce30: 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41  col2 FROM tab1 A
ce40: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 34 30  S cor0..----..40
ce50: 35 30 0d 0a 34 32 37 35 0d 0a 37 32 30 30 0d 0a  50..4275..7200..
ce60: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
ce70: 74 0d 0a 53 45 4c 45 43 54 20 2b 20 36 31 20 2b  t..SELECT + 61 +
ce80: 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 2a 20 2d   + cor0.col1 * -
ce90: 20 28 20 63 6f 6c 30 20 29 20 46 52 4f 4d 20 74   ( col0 ) FROM t
cea0: 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
ceb0: 2d 0d 0a 2d 31 37 0d 0a 2d 35 37 39 0d 0a 2d 39  -..-17..-579..-9
cec0: 37 39 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73  79....skipif pos
ced0: 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72  tgresql # Postgr
cee0: 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53  eSQL requires AS
cef0: 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f   when renaming o
cf00: 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71  utput columns..q
cf10: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
cf20: 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
cf30: 2d 20 36 32 20 2a 20 2b 20 63 6f 72 30 2e 63 6f  - 62 * + cor0.co
cf40: 6c 30 20 2a 20 2b 20 63 6f 6c 30 20 63 6f 6c 30  l0 * + col0 col0
cf50: 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
cf60: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 30 33 38 0d  r0..----..-3038.
cf70: 0a 2d 33 37 37 32 30 38 0d 0a 2d 33 38 36 39 34  .-377208..-38694
cf80: 32 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  2....onlyif mysq
cf90: 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72  l # use DIV oper
cfa0: 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72  ator for integer
cfb0: 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79   division..query
cfc0: 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
cfd0: 2d 33 35 38 0d 0a 53 45 4c 45 43 54 20 2d 20 31  -358..SELECT - 1
cfe0: 32 20 44 49 56 20 2b 20 63 6f 6c 31 20 41 53 20  2 DIV + col1 AS 
cff0: 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41  col0 FROM tab2 A
d000: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d  S cor0..----..0.
d010: 0a 30 0d 0a 30 0d 0a 0d 0a 73 6b 69 70 69 66 20  .0..0....skipif 
d020: 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
d030: 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
d040: 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 33 35  rowsort label-35
d050: 38 0d 0a 53 45 4c 45 43 54 20 2d 20 31 32 20 2f  8..SELECT - 12 /
d060: 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20   + col1 AS col0 
d070: 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
d080: 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30  0..----..0..0..0
d090: 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
d0a0: 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
d0b0: 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
d0c0: 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 32 20  rt..SELECT col2 
d0d0: 2d 20 2d 20 63 6f 6c 32 20 2a 20 2d 20 28 20 63  - - col2 * - ( c
d0e0: 6f 6c 32 20 2b 20 2d 20 63 6f 72 30 2e 63 6f 6c  ol2 + - cor0.col
d0f0: 32 20 29 20 2a 20 43 41 53 54 20 28 20 63 6f 6c  2 ) * CAST ( col
d100: 31 20 41 53 20 52 45 41 4c 20 29 20 46 52 4f 4d  1 AS REAL ) FROM
d110: 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
d120: 2d 2d 2d 0d 0a 31 0d 0a 33 33 0d 0a 38 32 0d 0a  ---..1..33..82..
d130: 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65  ..skipif postgre
d140: 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c  sql # PostgreSQL
d150: 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65   requires AS whe
d160: 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75  n renaming outpu
d170: 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79  t columns..query
d180: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
d190: 43 54 20 31 35 20 2b 20 63 6f 72 30 2e 63 6f 6c  CT 15 + cor0.col
d1a0: 31 20 2a 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20  1 * + cor0.col2 
d1b0: 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41  col2 FROM tab2 A
d1c0: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 35  S cor0..----..15
d1d0: 34 39 0d 0a 36 36 31 0d 0a 38 35 32 0d 0a 0d 0a  49..661..852....
d1e0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
d1f0: 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f  .SELECT ALL + co
d200: 6c 31 20 2b 20 63 6f 6c 31 20 2a 20 39 20 41 53  l1 + col1 * 9 AS
d210: 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20   col0 FROM tab1 
d220: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 30 0d  cor0..----..100.
d230: 0a 31 33 30 0d 0a 32 36 30 0d 0a 0d 0a 73 6b 69  .130..260....ski
d240: 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23  pif postgresql #
d250: 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75   PostgreSQL requ
d260: 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e  ires AS when ren
d270: 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c  aming output col
d280: 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f  umns..query I ro
d290: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
d2a0: 4c 20 36 36 20 2a 20 63 6f 6c 30 20 63 6f 6c 30  L 66 * col0 col0
d2b0: 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
d2c0: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 34 36 32 0d 0a 35  r0..----..462..5
d2d0: 31 34 38 0d 0a 35 32 31 34 0d 0a 0d 0a 6f 6e 6c  148..5214....onl
d2e0: 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20  yif mysql # use 
d2f0: 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72  DIV operator for
d300: 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f   integer divisio
d310: 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  n..query I rowso
d320: 72 74 20 6c 61 62 65 6c 2d 33 36 33 0d 0a 53 45  rt label-363..SE
d330: 4c 45 43 54 20 28 20 63 6f 6c 31 20 29 20 2b 20  LECT ( col1 ) + 
d340: 2b 20 63 6f 6c 32 20 2d 20 33 36 20 44 49 56 20  + col2 - 36 DIV 
d350: 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52 4f  col1 AS col0 FRO
d360: 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 30  M tab1..----..10
d370: 37 0d 0a 36 34 0d 0a 37 39 0d 0a 0d 0a 73 6b 69  7..64..79....ski
d380: 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
d390: 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
d3a0: 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
d3b0: 6c 2d 33 36 33 0d 0a 53 45 4c 45 43 54 20 28 20  l-363..SELECT ( 
d3c0: 63 6f 6c 31 20 29 20 2b 20 2b 20 63 6f 6c 32 20  col1 ) + + col2 
d3d0: 2d 20 33 36 20 2f 20 63 6f 6c 31 20 41 53 20 63  - 36 / col1 AS c
d3e0: 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d  ol0 FROM tab1..-
d3f0: 2d 2d 2d 0d 0a 31 30 37 0d 0a 36 34 0d 0a 37 39  ---..107..64..79
d400: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
d410: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
d420: 49 4e 43 54 20 2b 20 63 6f 6c 32 20 2a 20 2b 20  INCT + col2 * + 
d430: 63 6f 6c 31 20 2d 20 2d 20 63 6f 6c 32 20 41 53  col1 - - col2 AS
d440: 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d   col0 FROM tab0.
d450: 0a 2d 2d 2d 2d 0d 0a 32 38 37 31 0d 0a 37 35 34  .----..2871..754
d460: 34 0d 0a 39 38 0d 0a 0d 0a 71 75 65 72 79 20 49  4..98....query I
d470: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
d480: 20 41 4c 4c 20 2b 20 2b 20 36 39 20 2a 20 63 6f   ALL + + 69 * co
d490: 6c 30 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 2b  l0 + cor0.col1 +
d4a0: 20 35 34 20 46 52 4f 4d 20 74 61 62 30 20 41 53   54 FROM tab0 AS
d4b0: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 37 39   cor0..----..179
d4c0: 36 0d 0a 32 35 36 36 0d 0a 36 32 38 36 0d 0a 0d  6..2566..6286...
d4d0: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
d4e0: 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
d4f0: 54 20 2d 20 63 6f 6c 32 20 2b 20 2b 20 34 33 20  T - col2 + + 43 
d500: 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d  FROM tab1..----.
d510: 0a 2d 31 31 0d 0a 2d 31 34 0d 0a 2d 35 33 0d 0a  .-11..-14..-53..
d520: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
d530: 74 0d 0a 53 45 4c 45 43 54 20 39 31 20 2a 20 2b  t..SELECT 91 * +
d540: 20 74 61 62 31 2e 63 6f 6c 30 20 46 52 4f 4d 20   tab1.col0 FROM 
d550: 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 32 37 33 0d  tab1..----..273.
d560: 0a 35 38 32 34 0d 0a 37 32 38 30 0d 0a 0d 0a 71  .5824..7280....q
d570: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
d580: 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
d590: 2d 20 63 6f 6c 32 20 2b 20 63 6f 6c 30 20 2b 20  - col2 + col0 + 
d5a0: 2d 20 74 61 62 30 2e 63 6f 6c 30 20 41 53 20 63  - tab0.col0 AS c
d5b0: 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d  ol0 FROM tab0..-
d5c0: 2d 2d 2d 0d 0a 2d 31 0d 0a 2d 33 33 0d 0a 2d 38  ---..-1..-33..-8
d5d0: 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  2....query I row
d5e0: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
d5f0: 54 49 4e 43 54 20 63 6f 6c 30 20 2a 20 2d 20 63  TINCT col0 * - c
d600: 6f 6c 31 20 2a 20 2d 20 63 6f 6c 32 20 2b 20 2b  ol1 * - col2 + +
d610: 20 74 61 62 32 2e 63 6f 6c 31 20 41 53 20 63 6f   tab2.col1 AS co
d620: 6c 30 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d  l0 FROM tab2..--
d630: 2d 2d 0d 0a 31 31 39 37 31 31 0d 0a 35 31 30 35  --..119711..5105
d640: 31 0d 0a 35 38 39 30 0d 0a 0d 0a 71 75 65 72 79  1..5890....query
d650: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
d660: 43 54 20 39 35 20 2a 20 2d 20 63 6f 6c 31 20 2b  CT 95 * - col1 +
d670: 20 74 61 62 30 2e 63 6f 6c 30 20 46 52 4f 4d 20   tab0.col0 FROM 
d680: 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 38 31 34  tab0..----..-814
d690: 36 0d 0a 2d 38 35 35 36 0d 0a 2d 39 31 38 30 0d  6..-8556..-9180.
d6a0: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
d6b0: 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c  rt..SELECT + col
d6c0: 32 20 2b 20 2d 20 63 6f 6c 30 20 2a 20 2d 20 63  2 + - col0 * - c
d6d0: 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d  ol2 FROM tab1..-
d6e0: 2d 2d 2d 0d 0a 32 31 36 0d 0a 33 37 30 35 0d 0a  ---..216..3705..
d6f0: 37 37 37 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20  7776....query I 
d700: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
d710: 44 49 53 54 49 4e 43 54 20 37 39 20 41 53 20 63  DISTINCT 79 AS c
d720: 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 2c 20 74  ol2 FROM tab2, t
d730: 61 62 31 20 41 53 20 63 6f 72 30 2c 20 74 61 62  ab1 AS cor0, tab
d740: 30 20 41 53 20 63 6f 72 31 2c 20 74 61 62 32 20  0 AS cor1, tab2 
d750: 41 53 20 63 6f 72 32 0d 0a 2d 2d 2d 2d 0d 0a 37  AS cor2..----..7
d760: 39 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  9....onlyif mysq
d770: 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20  l # support for 
d780: 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63 20 73  MySQL specific s
d790: 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20  ystem types and 
d7a0: 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20  syntax..query I 
d7b0: 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 33 37  rowsort label-37
d7c0: 33 0d 0a 53 45 4c 45 43 54 20 2d 20 2d 20 43 41  3..SELECT - - CA
d7d0: 53 54 28 20 2b 20 63 6f 6c 30 20 41 53 20 53 49  ST( + col0 AS SI
d7e0: 47 4e 45 44 20 29 20 2b 20 2d 20 63 6f 6c 30 20  GNED ) + - col0 
d7f0: 2a 20 2d 20 63 6f 72 30 2e 63 6f 6c 31 20 41 53  * - cor0.col1 AS
d800: 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20   col0 FROM tab0 
d810: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32  AS cor0..----..2
d820: 30 38 38 0d 0a 33 34 33 30 0d 0a 38 31 38 38 0d  088..3430..8188.
d830: 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
d840: 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
d850: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
d860: 74 20 6c 61 62 65 6c 2d 33 37 33 0d 0a 53 45 4c  t label-373..SEL
d870: 45 43 54 20 2d 20 2d 20 43 41 53 54 20 28 20 2b  ECT - - CAST ( +
d880: 20 63 6f 6c 30 20 41 53 20 49 4e 54 45 47 45 52   col0 AS INTEGER
d890: 20 29 20 2b 20 2d 20 63 6f 6c 30 20 2a 20 2d 20   ) + - col0 * - 
d8a0: 63 6f 72 30 2e 63 6f 6c 31 20 41 53 20 63 6f 6c  cor0.col1 AS col
d8b0: 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  0 FROM tab0 AS c
d8c0: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 30 38 38 0d  or0..----..2088.
d8d0: 0a 33 34 33 30 0d 0a 38 31 38 38 0d 0a 0d 0a 6f  .3430..8188....o
d8e0: 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73  nlyif mysql # us
d8f0: 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66  e DIV operator f
d900: 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73  or integer divis
d910: 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ion..query I row
d920: 73 6f 72 74 20 6c 61 62 65 6c 2d 33 37 34 0d 0a  sort label-374..
d930: 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 2d 20 34  SELECT ALL + - 4
d940: 30 20 2a 20 2b 20 63 6f 6c 30 20 2b 20 63 6f 6c  0 * + col0 + col
d950: 30 20 44 49 56 20 2b 20 32 31 20 41 53 20 63 6f  0 DIV + 21 AS co
d960: 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l1 FROM tab2 AS 
d970: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 38 30  cor0..----..-280
d980: 0d 0a 2d 33 31 31 37 0d 0a 2d 33 31 35 37 0d 0a  ..-3117..-3157..
d990: 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
d9a0: 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
d9b0: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
d9c0: 20 6c 61 62 65 6c 2d 33 37 34 0d 0a 53 45 4c 45   label-374..SELE
d9d0: 43 54 20 41 4c 4c 20 2b 20 2d 20 34 30 20 2a 20  CT ALL + - 40 * 
d9e0: 2b 20 63 6f 6c 30 20 2b 20 63 6f 6c 30 20 2f 20  + col0 + col0 / 
d9f0: 2b 20 32 31 20 41 53 20 63 6f 6c 31 20 46 52 4f  + 21 AS col1 FRO
da00: 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
da10: 2d 2d 2d 2d 0d 0a 2d 32 38 30 0d 0a 2d 33 31 31  ----..-280..-311
da20: 37 0d 0a 2d 33 31 35 37 0d 0a 0d 0a 71 75 65 72  7..-3157....quer
da30: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
da40: 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 31 20 2a  ECT ALL + col1 *
da50: 20 2b 20 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c 31   + col1 * - col1
da60: 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
da70: 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 36 33 36 30 35  b0..----..-63605
da80: 36 0d 0a 2d 37 35 33 35 37 31 0d 0a 2d 39 31 32  6..-753571..-912
da90: 36 37 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  673....query I r
daa0: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
dab0: 4c 4c 20 2d 20 31 39 20 2a 20 63 6f 6c 30 20 46  LL - 19 * col0 F
dac0: 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab0..----..
dad0: 2d 31 36 39 31 0d 0a 2d 34 35 36 0d 0a 2d 36 36  -1691..-456..-66
dae0: 35 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  5....onlyif mysq
daf0: 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20  l # support for 
db00: 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63 20 73  MySQL specific s
db10: 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20  ystem types and 
db20: 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20  syntax..query I 
db30: 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 33 37  rowsort label-37
db40: 37 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20  7..SELECT ALL - 
db50: 63 6f 72 30 2e 63 6f 6c 32 20 2b 20 43 41 53 54  cor0.col2 + CAST
db60: 28 20 63 6f 72 30 2e 63 6f 6c 32 20 41 53 20 53  ( cor0.col2 AS S
db70: 49 47 4e 45 44 20 29 20 46 52 4f 4d 20 74 61 62  IGNED ) FROM tab
db80: 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
db90: 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a 73 6b 69 70  .0..0..0....skip
dba0: 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
dbb0: 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
dbc0: 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
dbd0: 2d 33 37 37 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  -377..SELECT ALL
dbe0: 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 2b 20 43   - cor0.col2 + C
dbf0: 41 53 54 20 28 20 63 6f 72 30 2e 63 6f 6c 32 20  AST ( cor0.col2 
dc00: 41 53 20 49 4e 54 45 47 45 52 20 29 20 46 52 4f  AS INTEGER ) FRO
dc10: 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
dc20: 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d  ----..0..0..0...
dc30: 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73  .skipif postgres
dc40: 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20  ql # PostgreSQL 
dc50: 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e  requires AS when
dc60: 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74   renaming output
dc70: 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20   columns..query 
dc80: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
dc90: 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c  T DISTINCT - col
dca0: 31 20 2b 20 33 39 20 63 6f 6c 32 20 46 52 4f 4d  1 + 39 col2 FROM
dcb0: 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
dcc0: 2d 2d 2d 0d 0a 2d 32 30 0d 0a 32 32 0d 0a 38 0d  ---..-20..22..8.
dcd0: 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72  ...skipif postgr
dce0: 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51  esql # PostgreSQ
dcf0: 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68  L requires AS wh
dd00: 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70  en renaming outp
dd10: 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72  ut columns..quer
dd20: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
dd30: 45 43 54 20 41 4c 4c 20 2d 20 2b 20 63 6f 72 30  ECT ALL - + cor0
dd40: 2e 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c 32 20 2d  .col0 * - col2 -
dd50: 20 28 20 2b 20 63 6f 6c 31 20 29 20 63 6f 6c 31   ( + col1 ) col1
dd60: 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d   FROM tab0 cor0.
dd70: 0a 2d 2d 2d 2d 0d 0a 2d 36 32 0d 0a 37 30 36 0d  .----..-62..706.
dd80: 0a 37 32 30 37 0d 0a 0d 0a 71 75 65 72 79 20 49  .7207....query I
dd90: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
dda0: 20 2b 20 2b 20 63 6f 6c 32 20 2a 20 32 30 20 46   + + col2 * 20 F
ddb0: 52 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d  ROM tab2 cor0..-
ddc0: 2d 2d 2d 0d 0a 35 32 30 0d 0a 35 34 30 0d 0a 37  ---..520..540..7
ddd0: 36 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  60....query I ro
dde0: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
ddf0: 53 54 49 4e 43 54 20 2d 20 63 6f 6c 30 20 2b 20  STINCT - col0 + 
de00: 28 20 2b 20 33 20 29 20 2a 20 2d 20 63 6f 6c 32  ( + 3 ) * - col2
de10: 20 2a 20 63 6f 72 30 2e 63 6f 6c 32 20 2b 20 34   * cor0.col2 + 4
de20: 34 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  4 FROM tab0 AS c
de30: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 30 32 31  or0..----..-2021
de40: 37 0d 0a 2d 33 32 34 37 0d 0a 36 0d 0a 0d 0a 71  7..-3247..6....q
de50: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
de60: 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
de70: 2d 20 63 6f 6c 30 20 2a 20 2b 20 34 39 20 2b 20  - col0 * + 49 + 
de80: 63 6f 6c 32 20 2d 20 63 6f 6c 30 20 46 52 4f 4d  col2 - col0 FROM
de90: 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab0 cor0..----
dea0: 0d 0a 2d 31 31 36 37 0d 0a 2d 31 37 34 39 0d 0a  ..-1167..-1749..
deb0: 2d 34 33 36 38 0d 0a 0d 0a 71 75 65 72 79 20 49  -4368....query I
dec0: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
ded0: 20 41 4c 4c 20 2d 20 63 6f 6c 31 20 2a 20 63 6f   ALL - col1 * co
dee0: 72 30 2e 63 6f 6c 30 20 2b 20 63 6f 6c 32 20 2a  r0.col0 + col2 *
def0: 20 63 6f 72 30 2e 63 6f 6c 30 20 46 52 4f 4d 20   cor0.col0 FROM 
df00: 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
df10: 2d 2d 0d 0a 33 30 30 38 0d 0a 36 36 34 30 0d 0a  --..3008..6640..
df20: 38 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  84....query I ro
df30: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
df40: 63 6f 6c 31 20 2a 20 2b 20 28 20 63 6f 6c 31 20  col1 * + ( col1 
df50: 29 20 2a 20 63 6f 6c 30 20 2b 20 63 6f 6c 32 20  ) * col0 + col2 
df60: 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
df70: 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
df80: 0a 2d 31 37 37 34 37 31 0d 0a 2d 33 32 39 33 31  .-177471..-32931
df90: 34 0d 0a 2d 37 33 36 39 32 37 0d 0a 0d 0a 71 75  4..-736927....qu
dfa0: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
dfb0: 45 4c 45 43 54 20 2b 20 2d 20 63 6f 6c 32 20 2a  ELECT + - col2 *
dfc0: 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20   + col1 AS col0 
dfd0: 46 52 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a  FROM tab2 cor0..
dfe0: 2d 2d 2d 2d 0d 0a 2d 31 35 33 34 0d 0a 2d 36 34  ----..-1534..-64
dff0: 36 0d 0a 2d 38 33 37 0d 0a 0d 0a 73 6b 69 70 69  6..-837....skipi
e000: 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50  f postgresql # P
e010: 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72  ostgreSQL requir
e020: 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d  es AS when renam
e030: 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d  ing output colum
e040: 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ns..query I rows
e050: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
e060: 2d 20 2d 20 63 6f 6c 30 20 2a 20 2b 20 31 20 63  - - col0 * + 1 c
e070: 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol0 FROM tab0 AS
e080: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 34 0d   cor0..----..24.
e090: 0a 33 35 0d 0a 38 39 0d 0a 0d 0a 71 75 65 72 79  .35..89....query
e0a0: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
e0b0: 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 30 20 2a 20  CT ALL - col0 * 
e0c0: 2d 20 28 20 2b 20 63 6f 6c 31 20 29 20 46 52 4f  - ( + col1 ) FRO
e0d0: 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 33  M tab2..----..13
e0e0: 34 33 0d 0a 32 31 37 0d 0a 34 36 30 32 0d 0a 0d  43..217..4602...
e0f0: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
e100: 0d 0a 53 45 4c 45 43 54 20 28 20 2b 20 74 61 62  ..SELECT ( + tab
e110: 31 2e 63 6f 6c 30 20 29 20 41 53 20 63 6f 6c 31  1.col0 ) AS col1
e120: 20 46 52 4f 4d 20 74 61 62 31 2c 20 74 61 62 31   FROM tab1, tab1
e130: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
e140: 39 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67  9 values hashing
e150: 20 74 6f 20 64 64 31 38 62 39 33 32 36 33 61 36   to dd18b93263a6
e160: 63 64 34 32 35 66 63 37 63 63 38 34 64 39 31 33  cd425fc7cc84d913
e170: 37 38 37 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20  7870....query I 
e180: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
e190: 63 6f 6c 31 20 2a 20 2b 20 28 20 63 6f 72 30 2e  col1 * + ( cor0.
e1a0: 63 6f 6c 32 20 29 20 41 53 20 63 6f 6c 30 20 46  col2 ) AS col0 F
e1b0: 52 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d  ROM tab2 cor0..-
e1c0: 2d 2d 2d 0d 0a 31 35 33 34 0d 0a 36 34 36 0d 0a  ---..1534..646..
e1d0: 38 33 37 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f  837....skipif po
e1e0: 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67  stgresql # Postg
e1f0: 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41  reSQL requires A
e200: 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20  S when renaming 
e210: 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a  output columns..
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 41 4c 4c 20 2d 20 74 61  .SELECT ALL - ta
e240: 62 31 2e 63 6f 6c 30 20 2a 20 32 20 63 6f 6c 32  b1.col0 * 2 col2
e250: 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d   FROM tab1..----
e260: 0d 0a 2d 31 32 38 0d 0a 2d 31 36 30 0d 0a 2d 36  ..-128..-160..-6
e270: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
e280: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2d 20  ort..SELECT - - 
e290: 63 6f 6c 31 20 2a 20 2d 20 39 38 20 2a 20 2b 20  col1 * - 98 * + 
e2a0: 63 6f 72 30 2e 63 6f 6c 32 20 46 52 4f 4d 20 74  cor0.col2 FROM t
e2b0: 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
e2c0: 2d 0d 0a 2d 31 35 30 33 33 32 0d 0a 2d 36 33 33  -..-150332..-633
e2d0: 30 38 0d 0a 2d 38 32 30 32 36 0d 0a 0d 0a 71 75  08..-82026....qu
e2e0: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
e2f0: 45 4c 45 43 54 20 2b 20 63 6f 6c 30 20 2a 20 63  ELECT + col0 * c
e300: 6f 6c 30 20 2d 20 63 6f 6c 31 20 46 52 4f 4d 20  ol0 - col1 FROM 
e310: 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
e320: 2d 2d 0d 0a 31 38 0d 0a 36 30 32 35 0d 0a 36 32  --..18..6025..62
e330: 32 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  24....query I ro
e340: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
e350: 28 20 35 34 20 29 20 2b 20 63 6f 6c 30 20 46 52  ( 54 ) + col0 FR
e360: 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
e370: 0a 2d 2d 2d 2d 0d 0a 2d 34 37 0d 0a 32 34 0d 0a  .----..-47..24..
e380: 32 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  25....query I ro
e390: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
e3a0: 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c 31 20 2d 20  col0 + + col1 - 
e3b0: 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30  + col1 FROM tab0
e3c0: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
e3d0: 2d 32 34 0d 0a 2d 33 35 0d 0a 2d 38 39 0d 0a 0d  -24..-35..-89...
e3e0: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
e3f0: 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 31 20 2a 20  ..SELECT col1 * 
e400: 63 6f 6c 30 20 2d 20 2d 20 63 6f 72 30 2e 63 6f  col0 - - cor0.co
e410: 6c 31 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  l1 AS col0 FROM 
e420: 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
e430: 2d 2d 0d 0a 31 33 36 30 0d 0a 32 34 38 0d 0a 34  --..1360..248..4
e440: 36 36 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  661....query I r
e450: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 32  owsort..SELECT 2
e460: 34 20 2a 20 2d 20 34 32 20 2b 20 2d 20 63 6f 6c  4 * - 42 + - col
e470: 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  0 FROM tab1 AS c
e480: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 31 31  or0..----..-1011
e490: 0d 0a 2d 31 30 37 32 0d 0a 2d 31 30 38 38 0d 0a  ..-1072..-1088..
e4a0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
e4b0: 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
e4c0: 43 54 20 2b 20 37 37 20 2a 20 63 6f 6c 30 20 41  CT + 77 * col0 A
e4d0: 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31  S col2 FROM tab1
e4e0: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
e4f0: 32 33 31 0d 0a 34 39 32 38 0d 0a 36 31 36 30 0d  231..4928..6160.
e500: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
e510: 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 72 30 2e  rt..SELECT cor0.
e520: 63 6f 6c 30 20 2b 20 63 6f 6c 31 20 2b 20 63 6f  col0 + col1 + co
e530: 6c 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  l2 AS col2 FROM 
e540: 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab1 cor0..----.
e550: 0a 31 33 31 0d 0a 31 38 39 0d 0a 38 33 0d 0a 0d  .131..189..83...
e560: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
e570: 0d 0a 53 45 4c 45 43 54 20 2b 20 28 20 2d 20 63  ..SELECT + ( - c
e580: 6f 6c 30 20 29 20 2b 20 32 37 20 46 52 4f 4d 20  ol0 ) + 27 FROM 
e590: 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
e5a0: 2d 2d 0d 0a 2d 33 37 0d 0a 2d 35 33 0d 0a 32 34  --..-37..-53..24
e5b0: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
e5c0: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f  ort..SELECT + co
e5d0: 72 30 2e 63 6f 6c 31 20 2a 20 2b 20 28 20 63 6f  r0.col1 * + ( co
e5e0: 6c 31 20 29 20 46 52 4f 4d 20 74 61 62 32 20 41  l1 ) FROM tab2 A
e5f0: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 38  S cor0..----..28
e600: 39 0d 0a 33 34 38 31 0d 0a 39 36 31 0d 0a 0d 0a  9..3481..961....
e610: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
e620: 0a 53 45 4c 45 43 54 20 2b 20 2b 20 63 6f 72 30  .SELECT + + cor0
e630: 2e 63 6f 6c 31 20 2b 20 2b 20 63 6f 6c 30 20 2a  .col1 + + col0 *
e640: 20 2d 20 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20   - col2 AS col1 
e650: 46 52 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a  FROM tab2 cor0..
e660: 2d 2d 2d 2d 0d 0a 2d 31 35 38 0d 0a 2d 31 39 36  ----..-158..-196
e670: 39 0d 0a 2d 32 39 38 35 0d 0a 0d 0a 6f 6e 6c 79  9..-2985....only
e680: 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44  if mysql # use D
e690: 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20  IV operator for 
e6a0: 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e  integer division
e6b0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
e6c0: 74 20 6c 61 62 65 6c 2d 34 30 32 0d 0a 53 45 4c  t label-402..SEL
e6d0: 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 30 20 2b  ECT ALL + col0 +
e6e0: 20 2b 20 63 6f 6c 31 20 44 49 56 20 2b 20 63 6f   + col1 DIV + co
e6f0: 6c 30 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  l0 AS col0 FROM 
e700: 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 32 37 0d 0a  tab0..----..27..
e710: 33 37 0d 0a 39 30 0d 0a 0d 0a 73 6b 69 70 69 66  37..90....skipif
e720: 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
e730: 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
e740: 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 34   rowsort label-4
e750: 30 32 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b  02..SELECT ALL +
e760: 20 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c 31 20 2f   col0 + + col1 /
e770: 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20   + col0 AS col0 
e780: 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d  FROM tab0..----.
e790: 0a 32 37 0d 0a 33 37 0d 0a 39 30 0d 0a 0d 0a 6f  .27..37..90....o
e7a0: 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73  nlyif mysql # us
e7b0: 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66  e DIV operator f
e7c0: 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73  or integer divis
e7d0: 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ion..query I row
e7e0: 73 6f 72 74 20 6c 61 62 65 6c 2d 34 30 33 0d 0a  sort label-403..
e7f0: 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 74 61 62  SELECT ALL - tab
e800: 31 2e 63 6f 6c 32 20 2b 20 2d 20 63 6f 6c 31 20  1.col2 + - col1 
e810: 44 49 56 20 2d 20 74 61 62 31 2e 63 6f 6c 30 20  DIV - tab1.col0 
e820: 2b 20 2b 20 74 61 62 31 2e 63 6f 6c 31 20 2a 20  + + tab1.col1 * 
e830: 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52 4f  col1 AS col0 FRO
e840: 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 34 33  M tab1..----..43
e850: 0d 0a 36 33 30 0d 0a 37 33 0d 0a 0d 0a 73 6b 69  ..630..73....ski
e860: 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
e870: 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
e880: 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
e890: 6c 2d 34 30 33 0d 0a 53 45 4c 45 43 54 20 41 4c  l-403..SELECT AL
e8a0: 4c 20 2d 20 74 61 62 31 2e 63 6f 6c 32 20 2b 20  L - tab1.col2 + 
e8b0: 2d 20 63 6f 6c 31 20 2f 20 2d 20 74 61 62 31 2e  - col1 / - tab1.
e8c0: 63 6f 6c 30 20 2b 20 2b 20 74 61 62 31 2e 63 6f  col0 + + tab1.co
e8d0: 6c 31 20 2a 20 63 6f 6c 31 20 41 53 20 63 6f 6c  l1 * col1 AS col
e8e0: 30 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d  0 FROM tab1..---
e8f0: 2d 0d 0a 34 33 0d 0a 36 33 30 0d 0a 37 33 0d 0a  -..43..630..73..
e900: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
e910: 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2d 20 63 6f  t..SELECT + - co
e920: 72 30 2e 63 6f 6c 32 20 2a 20 63 6f 6c 31 20 2d  r0.col2 * col1 -
e930: 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20   col1 FROM tab0 
e940: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
e950: 31 39 34 0d 0a 2d 32 39 32 34 0d 0a 2d 37 35 35  194..-2924..-755
e960: 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  3....query I row
e970: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2d  sort..SELECT - -
e980: 20 63 6f 72 30 2e 63 6f 6c 31 20 2b 20 2d 20 63   cor0.col1 + - c
e990: 6f 72 30 2e 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c  or0.col1 * - col
e9a0: 31 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  1 AS col0 FROM t
e9b0: 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
e9c0: 2d 0d 0a 37 34 38 32 0d 0a 38 33 37 32 0d 0a 39  -..7482..8372..9
e9d0: 35 30 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  506....query I r
e9e0: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
e9f0: 49 53 54 49 4e 43 54 20 2b 20 2b 20 63 6f 72 30  ISTINCT + + cor0
ea00: 2e 63 6f 6c 32 20 2a 20 63 6f 6c 31 20 41 53 20  .col2 * col1 AS 
ea10: 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41  col0 FROM tab1 A
ea20: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32  S cor0..----..12
ea30: 34 38 0d 0a 31 34 30 34 0d 0a 35 37 30 0d 0a 0d  48..1404..570...
ea40: 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73  .skipif postgres
ea50: 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20  ql # PostgreSQL 
ea60: 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e  requires AS when
ea70: 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74   renaming output
ea80: 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20   columns..query 
ea90: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
eaa0: 54 20 63 6f 6c 30 20 2b 20 63 6f 72 30 2e 63 6f  T col0 + cor0.co
eab0: 6c 31 20 2a 20 2b 20 63 6f 72 30 2e 63 6f 6c 31  l1 * + cor0.col1
eac0: 20 2b 20 2b 20 63 6f 6c 31 20 63 6f 6c 30 20 46   + + col1 col0 F
ead0: 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
eae0: 0d 0a 2d 2d 2d 2d 0d 0a 31 37 34 0d 0a 32 36 32  ..----..174..262
eaf0: 0d 0a 37 30 35 0d 0a 0d 0a 71 75 65 72 79 20 49  ..705....query I
eb00: 49 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45  II rowsort..SELE
eb10: 43 54 20 2a 20 46 52 4f 4d 20 74 61 62 31 20 57  CT * FROM tab1 W
eb20: 48 45 52 45 20 4e 4f 54 20 28 20 63 6f 6c 32 20  HERE NOT ( col2 
eb30: 2b 20 2b 20 63 6f 6c 32 20 2b 20 2d 20 63 6f 6c  + + col2 + - col
eb40: 31 20 29 20 3e 20 28 20 4e 55 4c 4c 20 29 0d 0a  1 ) > ( NULL )..
eb50: 2d 2d 2d 2d 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ----....query I 
eb60: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
eb70: 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c 32 20 2a 20  col0 * - col2 * 
eb80: 74 61 62 32 2e 63 6f 6c 31 20 41 53 20 63 6f 6c  tab2.col1 AS col
eb90: 32 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d  2 FROM tab2..---
eba0: 2d 0d 0a 2d 31 31 39 36 35 32 0d 0a 2d 35 31 30  -..-119652..-510
ebb0: 33 34 0d 0a 2d 35 38 35 39 0d 0a 0d 0a 71 75 65  34..-5859....que
ebc0: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
ebd0: 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20  LECT DISTINCT + 
ebe0: 2d 20 63 6f 6c 32 20 2b 20 63 6f 6c 31 20 2a 20  - col2 + col1 * 
ebf0: 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41  col0 FROM tab1 A
ec00: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 34  S cor0..----..24
ec10: 0d 0a 35 38 33 0d 0a 39 34 34 0d 0a 0d 0a 71 75  ..583..944....qu
ec20: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
ec30: 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 32 20 2d  ELECT ALL col2 -
ec40: 20 2d 20 63 6f 6c 32 20 2a 20 63 6f 6c 32 20 41   - col2 * col2 A
ec50: 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32  S col2 FROM tab2
ec60: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
ec70: 31 34 38 32 0d 0a 37 30 32 0d 0a 37 35 36 0d 0a  1482..702..756..
ec80: 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
ec90: 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f   use DIV operato
eca0: 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69  r for integer di
ecb0: 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20  vision..query I 
ecc0: 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 34 31  rowsort label-41
ecd0: 32 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  2..SELECT DISTIN
ece0: 43 54 20 2d 20 74 61 62 30 2e 63 6f 6c 30 20 44  CT - tab0.col0 D
ecf0: 49 56 20 2d 20 74 61 62 30 2e 63 6f 6c 31 20 41  IV - tab0.col1 A
ed00: 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30  S col1 FROM tab0
ed10: 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 0d 0a 73 6b 69  ..----..0....ski
ed20: 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
ed30: 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
ed40: 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
ed50: 6c 2d 34 31 32 0d 0a 53 45 4c 45 43 54 20 44 49  l-412..SELECT DI
ed60: 53 54 49 4e 43 54 20 2d 20 74 61 62 30 2e 63 6f  STINCT - tab0.co
ed70: 6c 30 20 2f 20 2d 20 74 61 62 30 2e 63 6f 6c 31  l0 / - tab0.col1
ed80: 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
ed90: 62 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 0d 0a 71  b0..----..0....q
eda0: 75 65 72 79 20 49 49 49 49 49 49 49 49 49 20 72  uery IIIIIIIII r
edb0: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
edc0: 4c 4c 20 2a 20 46 52 4f 4d 20 74 61 62 31 2c 20  LL * FROM tab1, 
edd0: 74 61 62 30 2c 20 74 61 62 31 20 41 53 20 63 6f  tab0, tab1 AS co
ede0: 72 30 20 57 48 45 52 45 20 28 20 4e 55 4c 4c 20  r0 WHERE ( NULL 
edf0: 29 20 3e 3d 20 4e 55 4c 4c 0d 0a 2d 2d 2d 2d 0d  ) >= NULL..----.
ee00: 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
ee10: 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74  # use DIV operat
ee20: 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64  or for integer d
ee30: 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49  ivision..query I
ee40: 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 34   rowsort label-4
ee50: 31 34 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  14..SELECT DISTI
ee60: 4e 43 54 20 2b 20 63 6f 6c 31 20 44 49 56 20 63  NCT + col1 DIV c
ee70: 6f 6c 32 20 2d 20 2d 20 74 61 62 31 2e 63 6f 6c  ol2 - - tab1.col
ee80: 32 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  2 AS col1 FROM t
ee90: 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 35 34 0d 0a 35  ab1..----..54..5
eea0: 37 0d 0a 39 36 0d 0a 0d 0a 73 6b 69 70 69 66 20  7..96....skipif 
eeb0: 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
eec0: 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
eed0: 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 34 31  rowsort label-41
eee0: 34 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  4..SELECT DISTIN
eef0: 43 54 20 2b 20 63 6f 6c 31 20 2f 20 63 6f 6c 32  CT + col1 / col2
ef00: 20 2d 20 2d 20 74 61 62 31 2e 63 6f 6c 32 20 41   - - tab1.col2 A
ef10: 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31  S col1 FROM tab1
ef20: 0d 0a 2d 2d 2d 2d 0d 0a 35 34 0d 0a 35 37 0d 0a  ..----..54..57..
ef30: 39 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  96....query I ro
ef40: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
ef50: 4c 20 63 6f 6c 32 20 2d 20 63 6f 6c 30 20 2a 20  L col2 - col0 * 
ef60: 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 0d 0a  col1 FROM tab1..
ef70: 2d 2d 2d 2d 0d 0a 2d 32 34 0d 0a 2d 35 38 33 0d  ----..-24..-583.
ef80: 0a 2d 39 34 34 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  .-944....onlyif 
ef90: 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20  mysql # use DIV 
efa0: 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74  operator for int
efb0: 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71  eger division..q
efc0: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
efd0: 61 62 65 6c 2d 34 31 36 0d 0a 53 45 4c 45 43 54  abel-416..SELECT
efe0: 20 63 6f 6c 31 20 44 49 56 20 63 6f 6c 30 20 2b   col1 DIV col0 +
eff0: 20 2d 20 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20   - col1 AS col2 
f000: 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d  FROM tab1..----.
f010: 0a 2d 31 30 0d 0a 2d 31 33 0d 0a 2d 31 38 0d 0a  .-10..-13..-18..
f020: 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
f030: 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
f040: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
f050: 20 6c 61 62 65 6c 2d 34 31 36 0d 0a 53 45 4c 45   label-416..SELE
f060: 43 54 20 63 6f 6c 31 20 2f 20 63 6f 6c 30 20 2b  CT col1 / col0 +
f070: 20 2d 20 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20   - col1 AS col2 
f080: 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d  FROM tab1..----.
f090: 0a 2d 31 30 0d 0a 2d 31 33 0d 0a 2d 31 38 0d 0a  .-10..-13..-18..
f0a0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
f0b0: 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20  t..SELECT ALL + 
f0c0: 63 6f 6c 32 20 2b 20 63 6f 6c 32 20 2d 20 2b 20  col2 + col2 - + 
f0d0: 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46 52 4f  col0 AS col2 FRO
f0e0: 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 32  M tab2..----..-2
f0f0: 36 0d 0a 2d 33 0d 0a 34 37 0d 0a 0d 0a 71 75 65  6..-3..47....que
f100: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
f110: 4c 45 43 54 20 2b 20 74 61 62 31 2e 63 6f 6c 31  LECT + tab1.col1
f120: 20 2b 20 2b 20 63 6f 6c 31 20 2b 20 63 6f 6c 32   + + col1 + col2
f130: 20 2a 20 2d 20 74 61 62 31 2e 63 6f 6c 32 20 46   * - tab1.col2 F
f140: 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab1..----..
f150: 2d 32 38 36 34 0d 0a 2d 33 32 32 39 0d 0a 2d 39  -2864..-3229..-9
f160: 31 39 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  190....query I r
f170: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
f180: 4c 4c 20 2d 20 2d 20 63 6f 6c 30 20 2d 20 2d 20  LL - - col0 - - 
f190: 63 6f 72 30 2e 63 6f 6c 31 20 46 52 4f 4d 20 74  cor0.col1 FROM t
f1a0: 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
f1b0: 2d 0d 0a 31 31 30 0d 0a 31 33 32 0d 0a 31 38 30  -..110..132..180
f1c0: 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
f1d0: 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d   # support for M
f1e0: 79 53 51 4c 20 73 70 65 63 69 66 69 63 20 73 79  ySQL specific sy
f1f0: 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73  stem types and s
f200: 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72  yntax..query I r
f210: 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 34 32 30  owsort label-420
f220: 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
f230: 54 20 2d 20 28 20 2d 20 63 6f 6c 30 20 29 20 2a  T - ( - col0 ) *
f240: 20 2d 20 43 41 53 54 28 20 4e 55 4c 4c 20 41 53   - CAST( NULL AS
f250: 20 53 49 47 4e 45 44 20 29 20 2d 20 63 6f 6c 30   SIGNED ) - col0
f260: 20 2a 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c   * + col1 AS col
f270: 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  1 FROM tab2 AS c
f280: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d  or0..----..NULL.
f290: 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
f2a0: 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
f2b0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
f2c0: 74 20 6c 61 62 65 6c 2d 34 32 30 0d 0a 53 45 4c  t label-420..SEL
f2d0: 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 28  ECT DISTINCT - (
f2e0: 20 2d 20 63 6f 6c 30 20 29 20 2a 20 2d 20 43 41   - col0 ) * - CA
f2f0: 53 54 20 28 20 4e 55 4c 4c 20 41 53 20 49 4e 54  ST ( NULL AS INT
f300: 45 47 45 52 20 29 20 2d 20 63 6f 6c 30 20 2a 20  EGER ) - col0 * 
f310: 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46  + col1 AS col1 F
f320: 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
f330: 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 0d 0a  ..----..NULL....
f340: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
f350: 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 74 61  .SELECT ALL + ta
f360: 62 32 2e 63 6f 6c 31 20 2a 20 74 61 62 32 2e 63  b2.col1 * tab2.c
f370: 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 57 48  ol2 FROM tab2 WH
f380: 45 52 45 20 28 20 4e 55 4c 4c 20 29 20 49 4e 20  ERE ( NULL ) IN 
f390: 28 20 2b 20 63 6f 6c 32 20 29 0d 0a 2d 2d 2d 2d  ( + col2 )..----
f3a0: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
f3b0: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 31  ort..SELECT col1
f3c0: 20 2a 20 63 6f 6c 31 20 2b 20 63 6f 6c 30 20 2b   * col1 + col0 +
f3d0: 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62   + col0 FROM tab
f3e0: 31 0d 0a 2d 2d 2d 2d 0d 0a 32 32 38 0d 0a 33 32  1..----..228..32
f3f0: 39 0d 0a 36 38 32 0d 0a 0d 0a 71 75 65 72 79 20  9..682....query 
f400: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
f410: 54 20 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c 32 20  T col0 * + col2 
f420: 2a 20 2d 20 63 6f 6c 32 20 41 53 20 63 6f 6c 30  * - col2 AS col0
f430: 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d   FROM tab0..----
f440: 0d 0a 2d 32 36 31 33 36 0d 0a 2d 33 35 0d 0a 2d  ..-26136..-35..-
f450: 35 39 38 34 33 36 0d 0a 0d 0a 71 75 65 72 79 20  598436....query 
f460: 49 49 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  III rowsort..SEL
f470: 45 43 54 20 41 4c 4c 20 2a 20 46 52 4f 4d 20 74  ECT ALL * FROM t
f480: 61 62 32 20 57 48 45 52 45 20 4e 55 4c 4c 20 42  ab2 WHERE NULL B
f490: 45 54 57 45 45 4e 20 4e 55 4c 4c 20 41 4e 44 20  ETWEEN NULL AND 
f4a0: 28 20 2d 20 63 6f 6c 30 20 2b 20 63 6f 6c 31 20  ( - col0 + col1 
f4b0: 2a 20 2d 20 63 6f 6c 31 20 29 0d 0a 2d 2d 2d 2d  * - col1 )..----
f4c0: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
f4d0: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
f4e0: 49 4e 43 54 20 63 6f 6c 32 20 2d 20 63 6f 6c 30  INCT col2 - col0
f4f0: 20 2a 20 2d 20 63 6f 6c 31 20 46 52 4f 4d 20 74   * - col1 FROM t
f500: 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 33 38 31 0d  ab2..----..1381.
f510: 0a 32 34 34 0d 0a 34 36 32 38 0d 0a 0d 0a 71 75  .244..4628....qu
f520: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
f530: 45 4c 45 43 54 20 2d 20 63 6f 6c 30 20 2a 20 2d  ELECT - col0 * -
f540: 20 63 6f 6c 30 20 2b 20 2d 20 74 61 62 32 2e 63   col0 + - tab2.c
f550: 6f 6c 32 20 2b 20 2d 20 74 61 62 32 2e 63 6f 6c  ol2 + - tab2.col
f560: 32 20 2a 20 2d 20 63 6f 6c 32 20 41 53 20 63 6f  2 * - col2 AS co
f570: 6c 32 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d  l2 FROM tab2..--
f580: 2d 2d 0d 0a 36 37 33 34 0d 0a 37 35 31 0d 0a 37  --..6734..751..7
f590: 36 34 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  647....query I r
f5a0: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
f5b0: 49 53 54 49 4e 43 54 20 2d 20 74 61 62 31 2e 63  ISTINCT - tab1.c
f5c0: 6f 6c 31 20 2b 20 63 6f 6c 31 20 2a 20 2b 20 63  ol1 + col1 * + c
f5d0: 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d  ol1 FROM tab1..-
f5e0: 2d 2d 2d 0d 0a 31 35 36 0d 0a 36 35 30 0d 0a 39  ---..156..650..9
f5f0: 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  0....query I row
f600: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 74  sort..SELECT + t
f610: 61 62 32 2e 63 6f 6c 31 20 2a 20 63 6f 6c 30 20  ab2.col1 * col0 
f620: 2b 20 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c 31 20  + col0 * + col1 
f630: 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
f640: 32 0d 0a 2d 2d 2d 2d 0d 0a 32 36 38 36 0d 0a 34  2..----..2686..4
f650: 33 34 0d 0a 39 32 30 34 0d 0a 0d 0a 6f 6e 6c 79  34..9204....only
f660: 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44  if mysql # use D
f670: 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20  IV operator for 
f680: 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e  integer division
f690: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
f6a0: 74 20 6c 61 62 65 6c 2d 34 32 39 0d 0a 53 45 4c  t label-429..SEL
f6b0: 45 43 54 20 63 6f 6c 32 20 2b 20 2d 20 63 6f 6c  ECT col2 + - col
f6c0: 31 20 2b 20 2b 20 63 6f 6c 32 20 2a 20 38 37 20  1 + + col2 * 87 
f6d0: 44 49 56 20 63 6f 6c 30 20 41 53 20 63 6f 6c 31  DIV col0 AS col1
f6e0: 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d   FROM tab0..----
f6f0: 0d 0a 2d 39 34 0d 0a 36 36 0d 0a 37 31 0d 0a 0d  ..-94..66..71...
f700: 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
f710: 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
f720: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
f730: 6c 61 62 65 6c 2d 34 32 39 0d 0a 53 45 4c 45 43  label-429..SELEC
f740: 54 20 63 6f 6c 32 20 2b 20 2d 20 63 6f 6c 31 20  T col2 + - col1 
f750: 2b 20 2b 20 63 6f 6c 32 20 2a 20 38 37 20 2f 20  + + col2 * 87 / 
f760: 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46 52 4f  col0 AS col1 FRO
f770: 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 39  M tab0..----..-9
f780: 34 0d 0a 36 36 0d 0a 37 31 0d 0a 0d 0a 71 75 65  4..66..71....que
f790: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
f7a0: 4c 45 43 54 20 2b 20 2b 20 63 6f 6c 32 20 2d 20  LECT + + col2 - 
f7b0: 2d 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30  - col1 FROM tab0
f7c0: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
f7d0: 31 31 39 0d 0a 31 37 33 0d 0a 39 38 0d 0a 0d 0a  119..173..98....
f7e0: 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71  skipif postgresq
f7f0: 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72  l # PostgreSQL r
f800: 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20  equires AS when 
f810: 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20  renaming output 
f820: 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49  columns..query I
f830: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
f840: 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 31 20 2d   DISTINCT col1 -
f850: 20 2d 20 63 6f 72 30 2e 63 6f 6c 30 20 63 6f 6c   - cor0.col0 col
f860: 32 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30  2 FROM tab0 cor0
f870: 0d 0a 2d 2d 2d 2d 0d 0a 31 31 30 0d 0a 31 33 32  ..----..110..132
f880: 0d 0a 31 38 30 0d 0a 0d 0a 73 6b 69 70 69 66 20  ..180....skipif 
f890: 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73  postgresql # Pos
f8a0: 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73  tgreSQL requires
f8b0: 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e   AS when renamin
f8c0: 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73  g output columns
f8d0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
f8e0: 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20  t..SELECT ALL - 
f8f0: 63 6f 6c 31 20 2a 20 63 6f 72 30 2e 63 6f 6c 32  col1 * cor0.col2
f900: 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20   col1 FROM tab2 
f910: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
f920: 31 35 33 34 0d 0a 2d 36 34 36 0d 0a 2d 38 33 37  1534..-646..-837
f930: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
f940: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f  ort..SELECT + co
f950: 6c 32 20 2b 20 2b 20 63 6f 6c 31 20 2b 20 63 6f  l2 + + col1 + co
f960: 6c 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d  l1 FROM tab0..--
f970: 2d 2d 0d 0a 31 39 35 0d 0a 32 30 35 0d 0a 32 36  --..195..205..26
f980: 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  4....query I row
f990: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63  sort..SELECT - c
f9a0: 6f 6c 30 20 2b 20 63 6f 6c 31 20 2a 20 63 6f 6c  ol0 + col1 * col
f9b0: 30 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61  0 + col1 FROM ta
f9c0: 62 30 0d 0a 2d 2d 2d 2d 0d 0a 32 31 32 36 0d 0a  b0..----..2126..
f9d0: 33 34 35 37 0d 0a 38 31 30 31 0d 0a 0d 0a 71 75  3457..8101....qu
f9e0: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
f9f0: 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 63  ELECT DISTINCT c
fa00: 6f 6c 32 20 2b 20 2b 20 74 61 62 32 2e 63 6f 6c  ol2 + + tab2.col
fa10: 32 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  2 AS col0 FROM t
fa20: 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 35 32 0d 0a 35  ab2..----..52..5
fa30: 34 0d 0a 37 36 0d 0a 0d 0a 71 75 65 72 79 20 49  4..76....query I
fa40: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
fa50: 20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c 30   DISTINCT - col0
fa60: 20 2d 20 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20   - col1 AS col2 
fa70: 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d  FROM tab0..----.
fa80: 0a 2d 31 31 30 0d 0a 2d 31 33 32 0d 0a 2d 31 38  .-110..-132..-18
fa90: 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  0....query I row
faa0: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
fab0: 54 49 4e 43 54 20 63 6f 6c 30 20 41 53 20 63 6f  TINCT col0 AS co
fac0: 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 57 48 45  l0 FROM tab1 WHE
fad0: 52 45 20 4e 55 4c 4c 20 4e 4f 54 20 49 4e 20 28  RE NULL NOT IN (
fae0: 20 2d 20 63 6f 6c 30 20 2a 20 63 6f 6c 31 20 29   - col0 * col1 )
faf0: 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a 6f 6e 6c 79 69 66  ..----....onlyif
fb00: 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56   mysql # use DIV
fb10: 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e   operator for in
fb20: 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a  teger division..
fb30: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
fb40: 6c 61 62 65 6c 2d 34 33 38 0d 0a 53 45 4c 45 43  label-438..SELEC
fb50: 54 20 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c 32 20  T col0 + - col2 
fb60: 44 49 56 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20  DIV + col1 FROM 
fb70: 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 32 34 0d 0a  tab0..----..24..
fb80: 33 35 0d 0a 38 39 0d 0a 0d 0a 73 6b 69 70 69 66  35..89....skipif
fb90: 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
fba0: 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
fbb0: 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 34   rowsort label-4
fbc0: 33 38 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 30 20  38..SELECT col0 
fbd0: 2b 20 2d 20 63 6f 6c 32 20 2f 20 2b 20 63 6f 6c  + - col2 / + col
fbe0: 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d  1 FROM tab0..---
fbf0: 2d 0d 0a 32 34 0d 0a 33 35 0d 0a 38 39 0d 0a 0d  -..24..35..89...
fc00: 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73  .skipif postgres
fc10: 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20  ql # PostgreSQL 
fc20: 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e  requires AS when
fc30: 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74   renaming output
fc40: 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20   columns..query 
fc50: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
fc60: 54 20 63 6f 6c 32 20 63 6f 6c 32 20 46 52 4f 4d  T col2 col2 FROM
fc70: 20 74 61 62 32 20 57 48 45 52 45 20 4e 4f 54 20   tab2 WHERE NOT 
fc80: 4e 55 4c 4c 20 49 4e 20 28 20 2b 20 74 61 62 32  NULL IN ( + tab2
fc90: 2e 63 6f 6c 30 20 2a 20 63 6f 6c 30 20 2b 20 2d  .col0 * col0 + -
fca0: 20 63 6f 6c 32 20 2a 20 74 61 62 32 2e 63 6f 6c   col2 * tab2.col
fcb0: 31 20 29 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a 71 75 65  1 )..----....que
fcc0: 72 79 20 49 49 49 20 72 6f 77 73 6f 72 74 0d 0a  ry III rowsort..
fcd0: 53 45 4c 45 43 54 20 41 4c 4c 20 2a 20 46 52 4f  SELECT ALL * FRO
fce0: 4d 20 74 61 62 30 20 57 48 45 52 45 20 4e 4f 54  M tab0 WHERE NOT
fcf0: 20 2b 20 63 6f 6c 31 20 4e 4f 54 20 49 4e 20 28   + col1 NOT IN (
fd00: 20 2b 20 63 6f 6c 31 20 29 0d 0a 2d 2d 2d 2d 0d   + col1 )..----.
fd10: 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e  .9 values hashin
fd20: 67 20 74 6f 20 33 38 61 31 36 37 33 65 32 65 30  g to 38a1673e2e0
fd30: 39 64 36 39 34 63 38 63 65 63 34 35 63 37 39 37  9d694c8cec45c797
fd40: 30 33 34 61 37 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  034a7....onlyif 
fd50: 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20  mysql # use DIV 
fd60: 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74  operator for int
fd70: 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71  eger division..q
fd80: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
fd90: 61 62 65 6c 2d 34 34 31 0d 0a 53 45 4c 45 43 54  abel-441..SELECT
fda0: 20 63 6f 6c 32 20 2d 20 2b 20 74 61 62 30 2e 63   col2 - + tab0.c
fdb0: 6f 6c 30 20 44 49 56 20 63 6f 6c 30 20 46 52 4f  ol0 DIV col0 FRO
fdc0: 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d  M tab0..----..0.
fdd0: 0a 33 32 0d 0a 38 31 0d 0a 0d 0a 73 6b 69 70 69  .32..81....skipi
fde0: 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
fdf0: 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
fe00: 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
fe10: 34 34 31 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 32  441..SELECT col2
fe20: 20 2d 20 2b 20 74 61 62 30 2e 63 6f 6c 30 20 2f   - + tab0.col0 /
fe30: 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d   col0 FROM tab0.
fe40: 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 33 32 0d 0a 38 31  .----..0..32..81
fe50: 0d 0a 0d 0a 71 75 65 72 79 20 49 49 49 20 72 6f  ....query III ro
fe60: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2a 20  wsort..SELECT * 
fe70: 46 52 4f 4d 20 74 61 62 32 20 57 48 45 52 45 20  FROM tab2 WHERE 
fe80: 4e 4f 54 20 4e 55 4c 4c 20 4e 4f 54 20 49 4e 20  NOT NULL NOT IN 
fe90: 28 20 63 6f 6c 30 20 2b 20 63 6f 6c 30 20 2b 20  ( col0 + col0 + 
fea0: 63 6f 6c 30 20 29 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a  col0 )..----....
feb0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
fec0: 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
fed0: 20 74 61 62 30 2e 63 6f 6c 31 20 41 53 20 63 6f   tab0.col1 AS co
fee0: 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 57 48 45  l1 FROM tab0 WHE
fef0: 52 45 20 4e 55 4c 4c 20 42 45 54 57 45 45 4e 20  RE NULL BETWEEN 
ff00: 4e 55 4c 4c 20 41 4e 44 20 28 20 4e 55 4c 4c 20  NULL AND ( NULL 
ff10: 29 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a 71 75 65 72 79  )..----....query
ff20: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
ff30: 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 74 61  CT DISTINCT + ta
ff40: 62 32 2e 63 6f 6c 31 20 2d 20 2b 20 63 6f 6c 31  b2.col1 - + col1
ff50: 20 2a 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74   * + col1 FROM t
ff60: 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 37 32 0d  ab2..----..-272.
ff70: 0a 2d 33 34 32 32 0d 0a 2d 39 33 30 0d 0a 0d 0a  .-3422..-930....
ff80: 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71  skipif postgresq
ff90: 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72  l # PostgreSQL r
ffa0: 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20  equires AS when 
ffb0: 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20  renaming output 
ffc0: 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49  columns..query I
ffd0: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
ffe0: 20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c 30   DISTINCT - col0
fff0: 20 2d 20 63 6f 6c 32 20 63 6f 6c 30 20 46 52 4f   - col2 col0 FRO
10000 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  M tab1..----..-1
10010 32 31 0d 0a 2d 31 37 36 0d 0a 2d 35 37 0d 0a 0d  21..-176..-57...
10020 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
10030 0d 0a 53 45 4c 45 43 54 20 28 20 2d 20 63 6f 6c  ..SELECT ( - col
10040 32 20 29 20 2a 20 2b 20 32 32 20 46 52 4f 4d 20  2 ) * + 22 FROM 
10050 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 38  tab1..----..-118
10060 38 0d 0a 2d 31 32 35 34 0d 0a 2d 32 31 31 32 0d  8..-1254..-2112.
10070 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
10080 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
10090 4e 43 54 20 2b 20 37 20 2a 20 63 6f 72 30 2e 63  NCT + 7 * cor0.c
100a0 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  ol2 AS col0 FROM
100b0 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
100c0 2d 2d 2d 0d 0a 32 33 31 0d 0a 35 37 34 0d 0a 37  ---..231..574..7
100d0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
100e0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2d 20  ort..SELECT + - 
100f0 35 36 20 2d 20 2b 20 63 6f 6c 31 20 41 53 20 63  56 - + col1 AS c
10100 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol0 FROM tab1 AS
10110 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 36 36   cor0..----..-66
10120 0d 0a 2d 36 39 0d 0a 2d 38 32 0d 0a 0d 0a 71 75  ..-69..-82....qu
10130 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
10140 45 4c 45 43 54 20 2b 20 2b 20 63 6f 72 30 2e 63  ELECT + + cor0.c
10150 6f 6c 32 20 2b 20 2d 20 63 6f 72 30 2e 63 6f 6c  ol2 + - cor0.col
10160 31 20 2a 20 2d 20 36 36 20 46 52 4f 4d 20 74 61  1 * - 66 FROM ta
10170 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
10180 0d 0a 35 37 30 39 0d 0a 36 30 38 38 0d 0a 36 34  ..5709..6088..64
10190 30 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  03....query I ro
101a0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
101b0 2d 20 38 32 20 2b 20 63 6f 72 30 2e 63 6f 6c 30  - 82 + cor0.col0
101c0 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
101d0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 38 0d 0a 2d  r0..----..-18..-
101e0 32 0d 0a 2d 37 39 0d 0a 0d 0a 71 75 65 72 79 20  2..-79....query 
101f0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
10200 54 20 41 4c 4c 20 2b 20 2d 20 63 6f 6c 32 20 2b  T ALL + - col2 +
10210 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20   + col1 AS col2 
10220 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
10230 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 38 0d 0a 2d 34  0..----..-28..-4
10240 37 0d 0a 2d 38 33 0d 0a 0d 0a 71 75 65 72 79 20  7..-83....query 
10250 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
10260 54 20 2d 20 31 38 20 41 53 20 63 6f 6c 31 20 46  T - 18 AS col1 F
10270 52 4f 4d 20 74 61 62 32 2c 20 74 61 62 32 20 41  ROM tab2, tab2 A
10280 53 20 63 6f 72 30 2c 20 74 61 62 30 20 41 53 20  S cor0, tab0 AS 
10290 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76  cor1..----..27 v
102a0 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f  alues hashing to
102b0 20 32 64 62 65 30 39 64 39 32 39 35 63 66 64 35   2dbe09d9295cfd5
102c0 32 64 38 35 34 66 65 66 61 62 66 32 63 65 63 34  2d854fefabf2cec4
102d0 65 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  e....query I row
102e0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
102f0 20 38 34 20 2a 20 63 6f 6c 32 20 2b 20 2b 20 63   84 * col2 + + c
10300 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  ol0 AS col2 FROM
10310 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 34 35 33   tab1..----..453
10320 39 0d 0a 34 38 35 32 0d 0a 38 31 34 34 0d 0a 0d  9..4852..8144...
10330 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
10340 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
10350 54 20 2b 20 74 61 62 32 2e 63 6f 6c 30 20 2b 20  T + tab2.col0 + 
10360 63 6f 6c 32 20 2a 20 2d 20 36 33 20 2b 20 2d 20  col2 * - 63 + - 
10370 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46 52 4f  col2 AS col0 FRO
10380 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  M tab2..----..-1
10390 35 38 36 0d 0a 2d 31 37 32 31 0d 0a 2d 32 33 35  586..-1721..-235
103a0 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  3....query I row
103b0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
103c0 20 63 6f 6c 32 20 2b 20 2b 20 74 61 62 31 2e 63   col2 + + tab1.c
103d0 6f 6c 32 20 2b 20 28 20 2d 20 33 34 20 29 20 41  ol2 + ( - 34 ) A
103e0 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31  S col0 FROM tab1
103f0 0d 0a 2d 2d 2d 2d 0d 0a 31 35 38 0d 0a 37 34 0d  ..----..158..74.
10400 0a 38 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .80....query I r
10410 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63  owsort..SELECT c
10420 6f 6c 32 20 2d 20 63 6f 6c 31 20 2a 20 2d 20 63  ol2 - col1 * - c
10430 6f 6c 31 20 2a 20 63 6f 72 30 2e 63 6f 6c 31 20  ol1 * cor0.col1 
10440 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
10450 30 0d 0a 2d 2d 2d 2d 0d 0a 32 30 35 34 30 35 0d  0..----..205405.
10460 0a 32 39 38 31 38 0d 0a 34 39 35 31 0d 0a 0d 0a  .29818..4951....
10470 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
10480 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 31 20 2a  .SELECT + col1 *
10490 20 2b 20 63 6f 6c 31 20 2a 20 63 6f 6c 30 20 2b   + col1 * col0 +
104a0 20 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46 52   col1 AS col1 FR
104b0 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
104c0 0a 2d 2d 2d 2d 0d 0a 31 33 35 33 33 0d 0a 32 30  .----..13533..20
104d0 35 34 0d 0a 36 34 31 30 0d 0a 0d 0a 6f 6e 6c 79  54..6410....only
104e0 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f  if mysql # suppo
104f0 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65  rt for MySQL spe
10500 63 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70  cific system typ
10510 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71  es and syntax..q
10520 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
10530 61 62 65 6c 2d 34 35 38 0d 0a 53 45 4c 45 43 54  abel-458..SELECT
10540 20 44 49 53 54 49 4e 43 54 20 28 20 2d 20 63 6f   DISTINCT ( - co
10550 6c 30 20 29 20 2f 20 43 41 53 54 28 20 4e 55 4c  l0 ) / CAST( NUL
10560 4c 20 41 53 20 53 49 47 4e 45 44 20 29 20 46 52  L AS SIGNED ) FR
10570 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 4e  OM tab2..----..N
10580 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  ULL....skipif my
10590 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
105a0 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
105b0 77 73 6f 72 74 20 6c 61 62 65 6c 2d 34 35 38 0d  wsort label-458.
105c0 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
105d0 20 28 20 2d 20 63 6f 6c 30 20 29 20 2f 20 43 41   ( - col0 ) / CA
105e0 53 54 20 28 20 4e 55 4c 4c 20 41 53 20 49 4e 54  ST ( NULL AS INT
105f0 45 47 45 52 20 29 20 46 52 4f 4d 20 74 61 62 32  EGER ) FROM tab2
10600 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 0d 0a  ..----..NULL....
10610 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75  onlyif mysql # u
10620 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20  se DIV operator 
10630 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69  for integer divi
10640 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f  sion..query I ro
10650 77 73 6f 72 74 20 6c 61 62 65 6c 2d 34 35 39 0d  wsort label-459.
10660 0a 53 45 4c 45 43 54 20 2d 20 74 61 62 30 2e 63  .SELECT - tab0.c
10670 6f 6c 31 20 44 49 56 20 2d 20 74 61 62 30 2e 63  ol1 DIV - tab0.c
10680 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  ol2 AS col2 FROM
10690 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 0d 0a   tab0..----..1..
106a0 32 0d 0a 39 37 0d 0a 0d 0a 73 6b 69 70 69 66 20  2..97....skipif 
106b0 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
106c0 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
106d0 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 34 35  rowsort label-45
106e0 39 0d 0a 53 45 4c 45 43 54 20 2d 20 74 61 62 30  9..SELECT - tab0
106f0 2e 63 6f 6c 31 20 2f 20 2d 20 74 61 62 30 2e 63  .col1 / - tab0.c
10700 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  ol2 AS col2 FROM
10710 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 0d 0a   tab0..----..1..
10720 32 0d 0a 39 37 0d 0a 0d 0a 71 75 65 72 79 20 49  2..97....query I
10730 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
10740 20 44 49 53 54 49 4e 43 54 20 2b 20 38 20 2b 20   DISTINCT + 8 + 
10750 74 61 62 30 2e 63 6f 6c 31 20 46 52 4f 4d 20 74  tab0.col1 FROM t
10760 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 35 0d 0a  ab0..----..105..
10770 39 34 0d 0a 39 39 0d 0a 0d 0a 71 75 65 72 79 20  94..99....query 
10780 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
10790 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c  T DISTINCT + col
107a0 32 20 2a 20 2d 20 63 6f 6c 31 20 2a 20 37 20 2b  2 * - col1 * 7 +
107b0 20 2d 20 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c 31   - col2 * - col1
107c0 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
107d0 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 34 32 30 0d  b1..----..-3420.
107e0 0a 2d 37 34 38 38 0d 0a 2d 38 34 32 34 0d 0a 0d  .-7488..-8424...
107f0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
10800 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 31 20  ..SELECT + col1 
10810 2a 20 2d 20 63 6f 6c 31 20 2b 20 33 30 20 41 53  * - col1 + 30 AS
10820 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 0d   col1 FROM tab0.
10830 0a 2d 2d 2d 2d 0d 0a 2d 37 33 36 36 0d 0a 2d 38  .----..-7366..-8
10840 32 35 31 0d 0a 2d 39 33 37 39 0d 0a 0d 0a 71 75  251..-9379....qu
10850 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
10860 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b  ELECT DISTINCT +
10870 20 32 33 20 2b 20 2b 20 63 6f 72 30 2e 63 6f 6c   23 + + cor0.col
10880 32 20 2b 20 2d 20 63 6f 6c 32 20 2a 20 63 6f 6c  2 + - col2 * col
10890 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  0 AS col2 FROM t
108a0 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
108b0 2d 0d 0a 2d 31 31 0d 0a 2d 37 31 39 33 0d 0a 2d  -..-11..-7193..-
108c0 37 33 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  736....query I r
108d0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
108e0 20 35 34 20 2a 20 36 37 20 46 52 4f 4d 20 74 61   54 * 67 FROM ta
108f0 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
10900 0d 0a 2d 33 36 31 38 0d 0a 2d 33 36 31 38 0d 0a  ..-3618..-3618..
10910 2d 33 36 31 38 0d 0a 0d 0a 71 75 65 72 79 20 49  -3618....query I
10920 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
10930 20 44 49 53 54 49 4e 43 54 20 28 20 2b 20 63 6f   DISTINCT ( + co
10940 6c 30 20 29 20 2b 20 2d 20 63 6f 6c 30 20 2a 20  l0 ) + - col0 * 
10950 63 6f 72 30 2e 63 6f 6c 30 20 46 52 4f 4d 20 74  cor0.col0 FROM t
10960 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab2 cor0..----..
10970 2d 34 32 0d 0a 2d 36 30 30 36 0d 0a 2d 36 31 36  -42..-6006..-616
10980 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  2....query I row
10990 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 28  sort..SELECT + (
109a0 20 2b 20 63 6f 6c 32 20 29 20 2b 20 2d 20 63 6f   + col2 ) + - co
109b0 6c 31 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  l1 AS col0 FROM 
109c0 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
109d0 2d 2d 0d 0a 32 38 0d 0a 34 37 0d 0a 38 33 0d 0a  --..28..47..83..
109e0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
109f0 74 0d 0a 53 45 4c 45 43 54 20 2b 20 28 20 37 20  t..SELECT + ( 7 
10a00 29 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  ) FROM tab0 AS c
10a10 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 37 0d 0a 37 0d  or0..----..7..7.
10a20 0a 37 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  .7....onlyif mys
10a30 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72  ql # support for
10a40 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63 20   MySQL specific 
10a50 73 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64  system types and
10a60 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49   syntax..query I
10a70 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 34   rowsort label-4
10a80 36 38 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  68..SELECT DISTI
10a90 4e 43 54 20 2d 20 2d 20 43 41 53 54 28 20 4e 55  NCT - - CAST( NU
10aa0 4c 4c 20 41 53 20 53 49 47 4e 45 44 20 29 20 2b  LL AS SIGNED ) +
10ab0 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62   + col1 FROM tab
10ac0 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
10ad0 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20  .NULL....skipif 
10ae0 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
10af0 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
10b00 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 34 36  rowsort label-46
10b10 38 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  8..SELECT DISTIN
10b20 43 54 20 2d 20 2d 20 43 41 53 54 20 28 20 4e 55  CT - - CAST ( NU
10b30 4c 4c 20 41 53 20 49 4e 54 45 47 45 52 20 29 20  LL AS INTEGER ) 
10b40 2b 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61  + + col1 FROM ta
10b50 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
10b60 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75 65 72 79 20  ..NULL....query 
10b70 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
10b80 54 20 44 49 53 54 49 4e 43 54 20 2b 20 2b 20 63  T DISTINCT + + c
10b90 6f 6c 31 20 2b 20 63 6f 6c 31 20 2a 20 2b 20 63  ol1 + col1 * + c
10ba0 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  ol2 AS col0 FROM
10bb0 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab0 cor0..----
10bc0 0d 0a 31 39 34 0d 0a 32 39 32 34 0d 0a 37 35 35  ..194..2924..755
10bd0 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  3....query I row
10be0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c  sort..SELECT col
10bf0 32 20 2a 20 36 36 20 2b 20 2d 20 63 6f 6c 30 20  2 * 66 + - col0 
10c00 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
10c10 30 0d 0a 2d 2d 2d 2d 0d 0a 32 31 35 34 0d 0a 33  0..----..2154..3
10c20 31 0d 0a 35 33 32 33 0d 0a 0d 0a 6f 6e 6c 79 69  1..5323....onlyi
10c30 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49  f mysql # use DI
10c40 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69  V operator for i
10c50 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d  nteger division.
10c60 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
10c70 20 6c 61 62 65 6c 2d 34 37 31 0d 0a 53 45 4c 45   label-471..SELE
10c80 43 54 20 63 6f 6c 31 20 2b 20 2b 20 63 6f 6c 32  CT col1 + + col2
10c90 20 44 49 56 20 63 6f 6c 32 20 46 52 4f 4d 20 74   DIV col2 FROM t
10ca0 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 38 37 0d 0a 39  ab0..----..87..9
10cb0 32 0d 0a 39 38 0d 0a 0d 0a 73 6b 69 70 69 66 20  2..98....skipif 
10cc0 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
10cd0 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
10ce0 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 34 37  rowsort label-47
10cf0 31 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 31 20 2b  1..SELECT col1 +
10d00 20 2b 20 63 6f 6c 32 20 2f 20 63 6f 6c 32 20 46   + col2 / col2 F
10d10 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab0..----..
10d20 38 37 0d 0a 39 32 0d 0a 39 38 0d 0a 0d 0a 71 75  87..92..98....qu
10d30 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
10d40 45 4c 45 43 54 20 2b 20 28 20 2d 20 32 34 20 2a  ELECT + ( - 24 *
10d50 20 2b 20 63 6f 6c 32 20 29 20 2b 20 63 6f 6c 31   + col2 ) + col1
10d60 20 2a 20 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20   * col1 AS col1 
10d70 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d  FROM tab1..----.
10d80 0a 2d 31 32 36 38 0d 0a 2d 32 31 33 35 0d 0a 2d  .-1268..-2135..-
10d90 36 32 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  620....query I r
10da0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
10db0 20 34 38 20 2b 20 2d 20 63 6f 6c 31 20 41 53 20   48 + - col1 AS 
10dc0 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41  col2 FROM tab1 A
10dd0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 32  S cor0..----..22
10de0 0d 0a 33 35 0d 0a 33 38 0d 0a 0d 0a 71 75 65 72  ..35..38....quer
10df0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
10e00 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63  ECT DISTINCT - c
10e10 6f 6c 32 20 2b 20 2b 20 39 30 20 46 52 4f 4d 20  ol2 + + 90 FROM 
10e20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
10e30 2d 2d 0d 0a 35 37 0d 0a 38 0d 0a 38 39 0d 0a 0d  --..57..8..89...
10e40 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73  .skipif postgres
10e50 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20  ql # PostgreSQL 
10e60 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e  requires AS when
10e70 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74   renaming output
10e80 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20   columns..query 
10e90 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
10ea0 54 20 41 4c 4c 20 63 6f 6c 30 20 2b 20 2d 20 28  T ALL col0 + - (
10eb0 20 2d 20 63 6f 6c 31 20 29 20 63 6f 6c 31 20 46   - col1 ) col1 F
10ec0 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
10ed0 0d 0a 2d 2d 2d 2d 0d 0a 31 31 30 0d 0a 31 33 32  ..----..110..132
10ee0 0d 0a 31 38 30 0d 0a 0d 0a 71 75 65 72 79 20 49  ..180....query I
10ef0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
10f00 20 44 49 53 54 49 4e 43 54 20 2d 20 2b 20 39 38   DISTINCT - + 98
10f10 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
10f20 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
10f30 0d 0a 2d 39 38 0d 0a 0d 0a 71 75 65 72 79 20 49  ..-98....query I
10f40 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
10f50 20 41 4c 4c 20 2d 20 2b 20 28 20 2d 20 63 6f 6c   ALL - + ( - col
10f60 30 20 29 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20  0 ) + col1 FROM 
10f70 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
10f80 2d 2d 0d 0a 32 39 0d 0a 37 34 0d 0a 39 33 0d 0a  --..29..74..93..
10f90 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
10fa0 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 31  t..SELECT - col1
10fb0 20 2a 20 31 20 41 53 20 63 6f 6c 30 20 46 52 4f   * 1 AS col0 FRO
10fc0 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
10fd0 2d 2d 2d 2d 0d 0a 2d 38 36 0d 0a 2d 39 31 0d 0a  ----..-86..-91..
10fe0 2d 39 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  -97....query I r
10ff0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
11000 49 53 54 49 4e 43 54 20 2d 20 2d 20 63 6f 6c 30  ISTINCT - - col0
11010 20 2d 20 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c 32   - col0 * - col2
11020 20 2a 20 2d 20 35 30 20 46 52 4f 4d 20 74 61 62   * - 50 FROM tab
11030 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
11040 0a 2d 31 37 31 35 0d 0a 2d 33 36 34 38 31 31 0d  .-1715..-364811.
11050 0a 2d 33 39 35 37 36 0d 0a 0d 0a 73 6b 69 70 69  .-39576....skipi
11060 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50  f postgresql # P
11070 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72  ostgreSQL requir
11080 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d  es AS when renam
11090 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d  ing output colum
110a0 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ns..query I rows
110b0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f  ort..SELECT + co
110c0 6c 30 20 2b 20 2b 20 39 20 2a 20 63 6f 6c 31 20  l0 + + 9 * col1 
110d0 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 0d 0a  col1 FROM tab1..
110e0 2d 2d 2d 2d 0d 0a 31 35 34 0d 0a 31 39 37 0d 0a  ----..154..197..
110f0 32 33 37 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f  237....skipif po
11100 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67  stgresql # Postg
11110 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41  reSQL requires A
11120 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20  S when renaming 
11130 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a  output columns..
11140 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
11150 0a 53 45 4c 45 43 54 20 2b 20 36 20 63 6f 6c 32  .SELECT + 6 col2
11160 20 46 52 4f 4d 20 74 61 62 32 2c 20 74 61 62 32   FROM tab2, tab2
11170 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
11180 39 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67  9 values hashing
11190 20 74 6f 20 35 64 31 63 62 39 30 65 64 35 38 66   to 5d1cb90ed58f
111a0 61 37 35 37 33 38 39 35 64 32 66 39 35 62 32 31  a7573895d2f95b21
111b0 31 38 32 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20  1821....query I 
111c0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
111d0 44 49 53 54 49 4e 43 54 20 2d 20 28 20 2b 20 74  DISTINCT - ( + t
111e0 61 62 30 2e 63 6f 6c 31 20 29 20 2a 20 63 6f 6c  ab0.col1 ) * col
111f0 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d  0 FROM tab0..---
11200 2d 0d 0a 2d 32 30 36 34 0d 0a 2d 33 33 39 35 0d  -..-2064..-3395.
11210 0a 2d 38 30 39 39 0d 0a 0d 0a 71 75 65 72 79 20  .-8099....query 
11220 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
11230 54 20 41 4c 4c 20 2d 20 2b 20 34 32 20 2b 20 2b  T ALL - + 42 + +
11240 20 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46 52   col2 AS col0 FR
11250 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
11260 0a 2d 2d 2d 2d 0d 0a 31 32 0d 0a 31 35 0d 0a 35  .----..12..15..5
11270 34 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74  4....skipif post
11280 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65  gresql # Postgre
11290 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20  SQL requires AS 
112a0 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75  when renaming ou
112b0 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75  tput columns..qu
112c0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
112d0 45 4c 45 43 54 20 28 20 63 6f 6c 30 20 29 20 63  ELECT ( col0 ) c
112e0 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d  ol2 FROM tab1..-
112f0 2d 2d 2d 0d 0a 33 0d 0a 36 34 0d 0a 38 30 0d 0a  ---..3..64..80..
11300 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
11310 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 72 31  t..SELECT - cor1
11320 2e 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20  .col0 FROM tab2 
11330 41 53 20 63 6f 72 30 20 43 52 4f 53 53 20 4a 4f  AS cor0 CROSS JO
11340 49 4e 20 74 61 62 30 20 63 6f 72 31 0d 0a 2d 2d  IN tab0 cor1..--
11350 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73  --..9 values has
11360 68 69 6e 67 20 74 6f 20 30 39 64 38 61 39 31 32  hing to 09d8a912
11370 64 65 31 62 38 61 62 37 36 32 65 35 66 66 62 65  de1b8ab762e5ffbe
11380 30 32 38 63 65 39 39 65 0d 0a 0d 0a 71 75 65 72  028ce99e....quer
11390 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
113a0 45 43 54 20 35 35 20 2b 20 63 6f 6c 30 20 41 53  ECT 55 + col0 AS
113b0 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20   col0 FROM tab2 
113c0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
113d0 33 33 0d 0a 31 33 34 0d 0a 36 32 0d 0a 0d 0a 71  33..134..62....q
113e0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
113f0 53 45 4c 45 43 54 20 2d 20 63 6f 6c 32 20 2b 20  SELECT - col2 + 
11400 63 6f 72 30 2e 63 6f 6c 32 20 2a 20 63 6f 6c 32  cor0.col2 * col2
11410 20 2a 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c   * + col1 AS col
11420 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  1 FROM tab0 AS c
11430 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 36 31 31 38 30  or0..----..61180
11440 32 0d 0a 39 33 36 32 31 0d 0a 39 36 0d 0a 0d 0a  2..93621..96....
11450 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
11460 0a 53 45 4c 45 43 54 20 2d 20 38 39 20 2a 20 63  .SELECT - 89 * c
11470 6f 72 30 2e 63 6f 6c 30 20 2a 20 2d 20 63 6f 72  or0.col0 * - cor
11480 30 2e 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30  0.col2 FROM tab0
11490 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
114a0 33 31 31 35 0d 0a 36 34 39 35 32 32 0d 0a 37 30  3115..649522..70
114b0 34 38 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  488....query I r
114c0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
114d0 20 2d 20 35 37 20 2b 20 63 6f 6c 31 20 2a 20 63   - 57 + col1 * c
114e0 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol1 FROM tab2 AS
114f0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 33 32   cor0..----..232
11500 0d 0a 33 34 32 34 0d 0a 39 30 34 0d 0a 0d 0a 6f  ..3424..904....o
11510 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75  nlyif mysql # su
11520 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20  pport for MySQL 
11530 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20  specific system 
11540 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78  types and syntax
11550 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
11560 74 20 6c 61 62 65 6c 2d 34 39 30 0d 0a 53 45 4c  t label-490..SEL
11570 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 2d  ECT DISTINCT - -
11580 20 63 6f 6c 31 20 2b 20 43 41 53 54 28 20 63 6f   col1 + CAST( co
11590 6c 31 20 41 53 20 53 49 47 4e 45 44 20 29 20 46  l1 AS SIGNED ) F
115a0 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
115b0 0d 0a 2d 2d 2d 2d 0d 0a 32 30 0d 0a 32 36 0d 0a  ..----..20..26..
115c0 35 32 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  52....skipif mys
115d0 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
115e0 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
115f0 73 6f 72 74 20 6c 61 62 65 6c 2d 34 39 30 0d 0a  sort label-490..
11600 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
11610 2d 20 2d 20 63 6f 6c 31 20 2b 20 43 41 53 54 20  - - col1 + CAST 
11620 28 20 63 6f 6c 31 20 41 53 20 49 4e 54 45 47 45  ( col1 AS INTEGE
11630 52 20 29 20 46 52 4f 4d 20 74 61 62 31 20 41 53  R ) FROM tab1 AS
11640 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 30 0d   cor0..----..20.
11650 0a 32 36 0d 0a 35 32 0d 0a 0d 0a 71 75 65 72 79  .26..52....query
11660 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
11670 43 54 20 41 4c 4c 20 2b 20 2b 20 63 6f 6c 31 20  CT ALL + + col1 
11680 2a 20 28 20 2b 20 63 6f 6c 30 20 2a 20 2d 20 63  * ( + col0 * - c
11690 6f 6c 31 20 29 20 41 53 20 63 6f 6c 31 20 46 52  ol1 ) AS col1 FR
116a0 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
116b0 0a 2d 2d 2d 2d 0d 0a 2d 31 33 35 32 30 0d 0a 2d  .----..-13520..-
116c0 32 30 32 38 0d 0a 2d 36 34 30 30 0d 0a 0d 0a 6f  2028..-6400....o
116d0 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73  nlyif mysql # us
116e0 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66  e DIV operator f
116f0 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73  or integer divis
11700 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ion..query I row
11710 73 6f 72 74 20 6c 61 62 65 6c 2d 34 39 32 0d 0a  sort label-492..
11720 53 45 4c 45 43 54 20 2b 20 2b 20 63 6f 6c 30 20  SELECT + + col0 
11730 2d 20 39 20 2a 20 63 6f 6c 30 20 44 49 56 20 2d  - 9 * col0 DIV -
11740 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20   col2 FROM tab0 
11750 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33  AS cor0..----..3
11760 30 0d 0a 33 35 30 0d 0a 39 38 0d 0a 0d 0a 73 6b  0..350..98....sk
11770 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
11780 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
11790 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
117a0 65 6c 2d 34 39 32 0d 0a 53 45 4c 45 43 54 20 2b  el-492..SELECT +
117b0 20 2b 20 63 6f 6c 30 20 2d 20 39 20 2a 20 63 6f   + col0 - 9 * co
117c0 6c 30 20 2f 20 2d 20 63 6f 6c 32 20 46 52 4f 4d  l0 / - col2 FROM
117d0 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
117e0 2d 2d 2d 0d 0a 33 30 0d 0a 33 35 30 0d 0a 39 38  ---..30..350..98
117f0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
11800 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f  ort..SELECT - co
11810 6c 31 20 2a 20 2b 20 63 6f 6c 30 20 2d 20 2d 20  l1 * + col0 - - 
11820 63 6f 72 30 2e 63 6f 6c 30 20 2a 20 2b 20 63 6f  cor0.col0 * + co
11830 6c 32 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  l2 AS col1 FROM 
11840 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab2 cor0..----.
11850 0a 2d 32 35 37 34 0d 0a 2d 32 38 0d 0a 31 36 35  .-2574..-28..165
11860 39 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74  9....skipif post
11870 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65  gresql # Postgre
11880 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20  SQL requires AS 
11890 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75  when renaming ou
118a0 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75  tput columns..qu
118b0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
118c0 45 4c 45 43 54 20 2d 20 63 6f 72 30 2e 63 6f 6c  ELECT - cor0.col
118d0 31 20 2a 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20  1 * + cor0.col0 
118e0 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41  col2 FROM tab1 A
118f0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
11900 30 34 30 0d 0a 2d 36 34 30 0d 0a 2d 37 38 0d 0a  040..-640..-78..
11910 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
11920 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 32  t..SELECT + col2
11930 20 2a 20 2d 20 38 33 20 41 53 20 63 6f 6c 31 20   * - 83 AS col1 
11940 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
11950 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 34 38 32 0d 0a  0..----..-4482..
11960 2d 34 37 33 31 0d 0a 2d 37 39 36 38 0d 0a 0d 0a  -4731..-7968....
11970 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75  onlyif mysql # u
11980 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20  se DIV operator 
11990 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69  for integer divi
119a0 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f  sion..query I ro
119b0 77 73 6f 72 74 20 6c 61 62 65 6c 2d 34 39 36 0d  wsort label-496.
119c0 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f  .SELECT ALL - co
119d0 6c 31 20 2a 20 63 6f 6c 32 20 44 49 56 20 63 6f  l1 * col2 DIV co
119e0 72 30 2e 63 6f 6c 31 20 2b 20 63 6f 6c 32 20 44  r0.col1 + col2 D
119f0 49 56 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  IV col1 FROM tab
11a00 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
11a10 0a 2d 32 36 0d 0a 2d 32 37 0d 0a 2d 33 36 0d 0a  .-26..-27..-36..
11a20 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
11a30 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
11a40 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
11a50 20 6c 61 62 65 6c 2d 34 39 36 0d 0a 53 45 4c 45   label-496..SELE
11a60 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 31 20 2a 20  CT ALL - col1 * 
11a70 63 6f 6c 32 20 2f 20 63 6f 72 30 2e 63 6f 6c 31  col2 / cor0.col1
11a80 20 2b 20 63 6f 6c 32 20 2f 20 63 6f 6c 31 20 46   + col2 / col1 F
11a90 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
11aa0 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 36 0d 0a 2d 32 37  ..----..-26..-27
11ab0 0d 0a 2d 33 36 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  ..-36....onlyif 
11ac0 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20  mysql # use DIV 
11ad0 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74  operator for int
11ae0 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71  eger division..q
11af0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
11b00 61 62 65 6c 2d 34 39 37 0d 0a 53 45 4c 45 43 54  abel-497..SELECT
11b10 20 41 4c 4c 20 2b 20 63 6f 6c 31 20 44 49 56 20   ALL + col1 DIV 
11b20 34 37 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  47 AS col0 FROM 
11b30 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
11b40 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a 73  --..0..0..0....s
11b50 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
11b60 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
11b70 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
11b80 62 65 6c 2d 34 39 37 0d 0a 53 45 4c 45 43 54 20  bel-497..SELECT 
11b90 41 4c 4c 20 2b 20 63 6f 6c 31 20 2f 20 34 37 20  ALL + col1 / 47 
11ba0 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
11bb0 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
11bc0 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a 71 75 65 72  .0..0..0....quer
11bd0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
11be0 45 43 54 20 2d 20 63 6f 6c 32 20 2b 20 33 31 20  ECT - col2 + 31 
11bf0 2a 20 28 20 2d 20 63 6f 6c 30 20 2a 20 63 6f 72  * ( - col0 * cor
11c00 30 2e 63 6f 6c 32 20 2b 20 63 6f 6c 30 20 29 20  0.col2 + col0 ) 
11c10 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
11c20 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  1 cor0..----..-1
11c30 31 31 31 36 31 0d 0a 2d 32 33 35 36 39 36 0d 0a  11161..-235696..
11c40 2d 34 39 38 33 0d 0a 0d 0a 71 75 65 72 79 20 49  -4983....query I
11c50 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
11c60 20 2d 20 63 6f 6c 30 20 2b 20 39 36 20 2a 20 2b   - col0 + 96 * +
11c70 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20   col1 FROM tab2 
11c80 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 35 35 33  cor0..----..1553
11c90 0d 0a 32 39 36 39 0d 0a 35 35 38 36 0d 0a 0d 0a  ..2969..5586....
11ca0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
11cb0 0a 53 45 4c 45 43 54 20 2d 20 31 33 20 2a 20 63  .SELECT - 13 * c
11cc0 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 63 6f  ol0 FROM tab2 co
11cd0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 31 34 0d  r0..----..-1014.
11ce0 0a 2d 31 30 32 37 0d 0a 2d 39 31 0d 0a 0d 0a 71  .-1027..-91....q
11cf0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
11d00 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
11d10 63 6f 6c 30 20 2b 20 63 6f 6c 32 20 2b 20 2b 20  col0 + col2 + + 
11d20 36 34 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  64 AS col1 FROM 
11d30 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 36 38 0d  tab2..----..168.
11d40 0a 31 38 31 0d 0a 39 38 0d 0a 0d 0a 71 75 65 72  .181..98....quer
11d50 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
11d60 45 43 54 20 41 4c 4c 20 74 61 62 31 2e 63 6f 6c  ECT ALL tab1.col
11d70 31 20 2a 20 63 6f 6c 31 20 2b 20 74 61 62 31 2e  1 * col1 + tab1.
11d80 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c 32 20 2a 20  col0 + + col2 * 
11d90 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 0d 0a  col1 FROM tab1..
11da0 2d 2d 2d 2d 0d 0a 31 34 39 37 0d 0a 32 30 38 33  ----..1497..2083
11db0 0d 0a 37 33 34 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  ..734....onlyif 
11dc0 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20  mysql # use DIV 
11dd0 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74  operator for int
11de0 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71  eger division..q
11df0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
11e00 61 62 65 6c 2d 35 30 33 0d 0a 53 45 4c 45 43 54  abel-503..SELECT
11e10 20 41 4c 4c 20 2b 20 74 61 62 31 2e 63 6f 6c 32   ALL + tab1.col2
11e20 20 2a 20 2b 20 63 6f 6c 30 20 2a 20 2d 20 63 6f   * + col0 * - co
11e30 6c 32 20 2b 20 63 6f 6c 30 20 44 49 56 20 74 61  l2 + col0 DIV ta
11e40 62 31 2e 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  b1.col1 FROM tab
11e50 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 30 37 39 33 30  1..----..-207930
11e60 0d 0a 2d 37 33 37 32 37 34 0d 0a 2d 38 37 34 38  ..-737274..-8748
11e70 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
11e80 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
11e90 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
11ea0 72 74 20 6c 61 62 65 6c 2d 35 30 33 0d 0a 53 45  rt label-503..SE
11eb0 4c 45 43 54 20 41 4c 4c 20 2b 20 74 61 62 31 2e  LECT ALL + tab1.
11ec0 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c 30 20 2a 20  col2 * + col0 * 
11ed0 2d 20 63 6f 6c 32 20 2b 20 63 6f 6c 30 20 2f 20  - col2 + col0 / 
11ee0 74 61 62 31 2e 63 6f 6c 31 20 46 52 4f 4d 20 74  tab1.col1 FROM t
11ef0 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 30 37 39  ab1..----..-2079
11f00 33 30 0d 0a 2d 37 33 37 32 37 34 0d 0a 2d 38 37  30..-737274..-87
11f10 34 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  48....query I ro
11f20 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f  wsort..SELECT co
11f30 72 30 2e 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  r0.col0 FROM tab
11f40 31 20 63 6f 72 30 20 43 52 4f 53 53 20 4a 4f 49  1 cor0 CROSS JOI
11f50 4e 20 74 61 62 31 20 41 53 20 63 6f 72 31 0d 0a  N tab1 AS cor1..
11f60 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68  ----..9 values h
11f70 61 73 68 69 6e 67 20 74 6f 20 64 64 31 38 62 39  ashing to dd18b9
11f80 33 32 36 33 61 36 63 64 34 32 35 66 63 37 63 63  3263a6cd425fc7cc
11f90 38 34 64 39 31 33 37 38 37 30 0d 0a 0d 0a 71 75  84d9137870....qu
11fa0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
11fb0 45 4c 45 43 54 20 41 4c 4c 20 2d 20 2d 20 63 6f  ELECT ALL - - co
11fc0 72 30 2e 63 6f 6c 32 20 2a 20 2b 20 63 6f 72 30  r0.col2 * + cor0
11fd0 2e 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46 52  .col1 AS col2 FR
11fe0 4f 4d 20 74 61 62 31 2c 20 74 61 62 32 20 41 53  OM tab1, tab2 AS
11ff0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76   cor0..----..9 v
12000 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f  alues hashing to
12010 20 66 35 36 30 35 63 65 36 63 62 64 36 65 63 63   f5605ce6cbd6ecc
12020 37 39 61 34 61 38 38 37 34 38 38 62 62 36 39 34  79a4a887488bb694
12030 37 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  7....onlyif mysq
12040 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72  l # use DIV oper
12050 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72  ator for integer
12060 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79   division..query
12070 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
12080 2d 35 30 36 0d 0a 53 45 4c 45 43 54 20 44 49 53  -506..SELECT DIS
12090 54 49 4e 43 54 20 2d 20 63 6f 6c 30 20 2a 20 2d  TINCT - col0 * -
120a0 20 63 6f 72 30 2e 63 6f 6c 32 20 2b 20 2d 20 63   cor0.col2 + - c
120b0 6f 6c 31 20 44 49 56 20 32 37 20 46 52 4f 4d 20  ol1 DIV 27 FROM 
120c0 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
120d0 2d 2d 0d 0a 31 38 38 0d 0a 32 30 32 36 0d 0a 33  --..188..2026..3
120e0 30 30 32 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  002....skipif my
120f0 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
12100 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
12110 77 73 6f 72 74 20 6c 61 62 65 6c 2d 35 30 36 0d  wsort label-506.
12120 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
12130 20 2d 20 63 6f 6c 30 20 2a 20 2d 20 63 6f 72 30   - col0 * - cor0
12140 2e 63 6f 6c 32 20 2b 20 2d 20 63 6f 6c 31 20 2f  .col2 + - col1 /
12150 20 32 37 20 46 52 4f 4d 20 74 61 62 32 20 41 53   27 FROM tab2 AS
12160 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 38 38   cor0..----..188
12170 0d 0a 32 30 32 36 0d 0a 33 30 30 32 0d 0a 0d 0a  ..2026..3002....
12180 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
12190 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 32  .SELECT ALL col2
121a0 20 2a 20 2d 20 63 6f 6c 32 20 2d 20 2b 20 74 61   * - col2 - + ta
121b0 62 30 2e 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  b0.col0 FROM tab
121c0 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 31 33 0d 0a  0..----..-1113..
121d0 2d 33 36 0d 0a 2d 36 38 31 33 0d 0a 0d 0a 6f 6e  -36..-6813....on
121e0 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
121f0 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
12200 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
12210 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
12220 6f 72 74 20 6c 61 62 65 6c 2d 35 30 38 0d 0a 53  ort label-508..S
12230 45 4c 45 43 54 20 41 4c 4c 20 74 61 62 31 2e 63  ELECT ALL tab1.c
12240 6f 6c 31 20 44 49 56 20 63 6f 6c 31 20 2d 20 2b  ol1 DIV col1 - +
12250 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 0d   col2 FROM tab1.
12260 0a 2d 2d 2d 2d 0d 0a 2d 35 33 0d 0a 2d 35 36 0d  .----..-53..-56.
12270 0a 2d 39 35 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  .-95....skipif m
12280 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
12290 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
122a0 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 35 30 38  owsort label-508
122b0 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 74 61 62  ..SELECT ALL tab
122c0 31 2e 63 6f 6c 31 20 2f 20 63 6f 6c 31 20 2d 20  1.col1 / col1 - 
122d0 2b 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31  + col2 FROM tab1
122e0 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 33 0d 0a 2d 35 36  ..----..-53..-56
122f0 0d 0a 2d 39 35 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  ..-95....onlyif 
12300 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20  mysql # support 
12310 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66  for MySQL specif
12320 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20  ic system types 
12330 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72  and syntax..quer
12340 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
12350 6c 2d 35 30 39 0d 0a 53 45 4c 45 43 54 20 2d 20  l-509..SELECT - 
12360 2d 20 43 41 53 54 28 20 2b 20 63 6f 6c 31 20 41  - CAST( + col1 A
12370 53 20 53 49 47 4e 45 44 20 29 20 46 52 4f 4d 20  S SIGNED ) FROM 
12380 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
12390 2d 2d 0d 0a 31 30 0d 0a 31 33 0d 0a 32 36 0d 0a  --..10..13..26..
123a0 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
123b0 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
123c0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
123d0 20 6c 61 62 65 6c 2d 35 30 39 0d 0a 53 45 4c 45   label-509..SELE
123e0 43 54 20 2d 20 2d 20 43 41 53 54 20 28 20 2b 20  CT - - CAST ( + 
123f0 63 6f 6c 31 20 41 53 20 49 4e 54 45 47 45 52 20  col1 AS INTEGER 
12400 29 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  ) FROM tab1 AS c
12410 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 0d 0a 31  or0..----..10..1
12420 33 0d 0a 32 36 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  3..26....onlyif 
12430 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20  mysql # support 
12440 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66  for MySQL specif
12450 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20  ic system types 
12460 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72  and syntax..quer
12470 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
12480 6c 2d 35 31 30 0d 0a 53 45 4c 45 43 54 20 44 49  l-510..SELECT DI
12490 53 54 49 4e 43 54 20 2d 20 43 41 53 54 28 20 2d  STINCT - CAST( -
124a0 20 63 6f 6c 32 20 41 53 20 53 49 47 4e 45 44 20   col2 AS SIGNED 
124b0 29 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  ) AS col1 FROM t
124c0 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
124d0 2d 0d 0a 31 0d 0a 33 33 0d 0a 38 32 0d 0a 0d 0a  -..1..33..82....
124e0 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
124f0 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
12500 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
12510 61 62 65 6c 2d 35 31 30 0d 0a 53 45 4c 45 43 54  abel-510..SELECT
12520 20 44 49 53 54 49 4e 43 54 20 2d 20 43 41 53 54   DISTINCT - CAST
12530 20 28 20 2d 20 63 6f 6c 32 20 41 53 20 49 4e 54   ( - col2 AS INT
12540 45 47 45 52 20 29 20 41 53 20 63 6f 6c 31 20 46  EGER ) AS col1 F
12550 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
12560 0d 0a 2d 2d 2d 2d 0d 0a 31 0d 0a 33 33 0d 0a 38  ..----..1..33..8
12570 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  2....query I row
12580 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2d  sort..SELECT + -
12590 20 31 38 20 2a 20 2b 20 39 37 20 2b 20 2b 20 63   18 * + 97 + + c
125a0 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  ol0 AS col1 FROM
125b0 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab0 cor0..----
125c0 0d 0a 2d 31 36 35 37 0d 0a 2d 31 37 31 31 0d 0a  ..-1657..-1711..
125d0 2d 31 37 32 32 0d 0a 0d 0a 71 75 65 72 79 20 49  -1722....query I
125e0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
125f0 20 44 49 53 54 49 4e 43 54 20 2d 20 33 35 20 2b   DISTINCT - 35 +
12600 20 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46 52   col2 AS col1 FR
12610 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
12620 0a 2d 2d 2d 2d 0d 0a 31 39 0d 0a 32 32 0d 0a 36  .----..19..22..6
12630 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  1....query I row
12640 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 28 20 63  sort..SELECT ( c
12650 6f 6c 32 20 29 20 2b 20 63 6f 6c 31 20 2a 20 2b  ol2 ) + col1 * +
12660 20 36 39 20 46 52 4f 4d 20 74 61 62 30 20 41 53   69 FROM tab0 AS
12670 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 35 39 36   cor0..----..596
12680 37 0d 0a 36 33 36 31 0d 0a 36 36 39 34 0d 0a 0d  7..6361..6694...
12690 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
126a0 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 30 20  ..SELECT + col0 
126b0 2a 20 2d 20 63 6f 6c 32 20 2d 20 63 6f 6c 31 20  * - col2 - col1 
126c0 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
126d0 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
126e0 0a 2d 31 33 32 0d 0a 2d 37 33 38 39 0d 0a 2d 38  .-132..-7389..-8
126f0 37 38 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  78....onlyif mys
12700 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72  ql # support for
12710 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63 20   MySQL specific 
12720 73 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64  system types and
12730 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49   syntax..query I
12740 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 35   rowsort label-5
12750 31 35 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  15..SELECT DISTI
12760 4e 43 54 20 2b 20 2b 20 43 41 53 54 28 20 4e 55  NCT + + CAST( NU
12770 4c 4c 20 41 53 20 53 49 47 4e 45 44 20 29 20 2b  LL AS SIGNED ) +
12780 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20   col0 FROM tab1 
12790 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e  AS cor0..----..N
127a0 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  ULL....skipif my
127b0 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
127c0 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
127d0 77 73 6f 72 74 20 6c 61 62 65 6c 2d 35 31 35 0d  wsort label-515.
127e0 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
127f0 20 2b 20 2b 20 43 41 53 54 20 28 20 4e 55 4c 4c   + + CAST ( NULL
12800 20 41 53 20 49 4e 54 45 47 45 52 20 29 20 2b 20   AS INTEGER ) + 
12810 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41  col0 FROM tab1 A
12820 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55  S cor0..----..NU
12830 4c 4c 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  LL....query I ro
12840 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
12850 4c 20 2d 20 63 6f 6c 31 20 2a 20 39 32 20 2d 20  L - col1 * 92 - 
12860 2d 20 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46  - col2 AS col0 F
12870 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
12880 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 35 32 36 0d 0a 2d  ..----..-1526..-
12890 32 38 32 35 0d 0a 2d 35 34 30 32 0d 0a 0d 0a 73  2825..-5402....s
128a0 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c  kipif postgresql
128b0 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65   # PostgreSQL re
128c0 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72  quires AS when r
128d0 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63  enaming output c
128e0 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20  olumns..query I 
128f0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
12900 41 4c 4c 20 2d 20 31 33 20 63 6f 6c 32 20 46 52  ALL - 13 col2 FR
12910 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
12920 0a 2d 2d 2d 2d 0d 0a 2d 31 33 0d 0a 2d 31 33 0d  .----..-13..-13.
12930 0a 2d 31 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .-13....query I 
12940 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
12950 2b 20 63 6f 6c 30 20 2a 20 63 6f 6c 32 20 2b 20  + col0 * col2 + 
12960 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 41 53 20 63  - cor0.col2 AS c
12970 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 63 6f  ol2 FROM tab1 co
12980 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 38 0d 0a 33  r0..----..108..3
12990 35 39 31 0d 0a 37 35 38 34 0d 0a 0d 0a 71 75 65  591..7584....que
129a0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
129b0 4c 45 43 54 20 2b 20 2b 20 63 6f 6c 30 20 2a 20  LECT + + col0 * 
129c0 2d 20 63 6f 6c 32 20 2b 20 2d 20 63 6f 6c 32 20  - col2 + - col2 
129d0 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
129e0 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
129f0 0a 2d 33 36 0d 0a 2d 37 33 38 30 0d 0a 2d 38 32  .-36..-7380..-82
12a00 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  5....query I row
12a10 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
12a20 54 49 4e 43 54 20 28 20 37 35 20 29 20 46 52 4f  TINCT ( 75 ) FRO
12a30 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
12a40 2d 2d 2d 2d 0d 0a 37 35 0d 0a 0d 0a 71 75 65 72  ----..75....quer
12a50 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
12a60 45 43 54 20 41 4c 4c 20 35 32 20 2a 20 2b 20 36  ECT ALL 52 * + 6
12a70 39 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  9 AS col0 FROM t
12a80 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
12a90 2d 0d 0a 33 35 38 38 0d 0a 33 35 38 38 0d 0a 33  -..3588..3588..3
12aa0 35 38 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  588....query I r
12ab0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
12ac0 20 2d 20 63 6f 72 30 2e 63 6f 6c 30 20 2b 20 63   - cor0.col0 + c
12ad0 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  ol0 AS col0 FROM
12ae0 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
12af0 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a  ---..0..0..0....
12b00 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71  skipif postgresq
12b10 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72  l # PostgreSQL r
12b20 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20  equires AS when 
12b30 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20  renaming output 
12b40 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49  columns..query I
12b50 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
12b60 20 2b 20 35 31 20 63 6f 6c 32 20 46 52 4f 4d 20   + 51 col2 FROM 
12b70 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
12b80 2d 2d 0d 0a 35 31 0d 0a 35 31 0d 0a 35 31 0d 0a  --..51..51..51..
12b90 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
12ba0 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53   support for MyS
12bb0 51 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74  QL specific syst
12bc0 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e  em types and syn
12bd0 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  tax..query I row
12be0 73 6f 72 74 20 6c 61 62 65 6c 2d 35 32 34 0d 0a  sort label-524..
12bf0 53 45 4c 45 43 54 20 63 6f 6c 32 20 2b 20 2b 20  SELECT col2 + + 
12c00 43 41 53 54 28 20 2b 20 63 6f 6c 32 20 41 53 20  CAST( + col2 AS 
12c10 53 49 47 4e 45 44 20 29 20 41 53 20 63 6f 6c 30  SIGNED ) AS col0
12c20 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
12c30 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 38 0d 0a 31  r0..----..108..1
12c40 31 34 0d 0a 31 39 32 0d 0a 0d 0a 73 6b 69 70 69  14..192....skipi
12c50 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
12c60 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
12c70 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
12c80 35 32 34 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 32  524..SELECT col2
12c90 20 2b 20 2b 20 43 41 53 54 20 28 20 2b 20 63 6f   + + CAST ( + co
12ca0 6c 32 20 41 53 20 49 4e 54 45 47 45 52 20 29 20  l2 AS INTEGER ) 
12cb0 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
12cc0 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
12cd0 0a 31 30 38 0d 0a 31 31 34 0d 0a 31 39 32 0d 0a  .108..114..192..
12ce0 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
12cf0 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f   use DIV operato
12d00 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69  r for integer di
12d10 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20  vision..query I 
12d20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 35 32  rowsort label-52
12d30 35 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  5..SELECT DISTIN
12d40 43 54 20 63 6f 6c 32 20 44 49 56 20 2b 20 63 6f  CT col2 DIV + co
12d50 6c 31 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  l1 AS col2 FROM 
12d60 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
12d70 2d 2d 0d 0a 30 0d 0a 0d 0a 73 6b 69 70 69 66 20  --..0....skipif 
12d80 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
12d90 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
12da0 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 35 32  rowsort label-52
12db0 35 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  5..SELECT DISTIN
12dc0 43 54 20 63 6f 6c 32 20 2f 20 2b 20 63 6f 6c 31  CT col2 / + col1
12dd0 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
12de0 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
12df0 0d 0a 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  ..0....query I r
12e00 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
12e10 20 63 6f 6c 32 20 2b 20 2b 20 63 6f 6c 30 20 2a   col2 + + col0 *
12e20 20 2d 20 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20   - col2 AS col1 
12e30 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
12e40 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 36 32 0d 0a 2d  0..----..-162..-
12e50 32 30 30 32 0d 0a 2d 32 39 36 34 0d 0a 0d 0a 73  2002..-2964....s
12e60 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c  kipif postgresql
12e70 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65   # PostgreSQL re
12e80 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72  quires AS when r
12e90 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63  enaming output c
12ea0 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20  olumns..query I 
12eb0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
12ec0 2b 20 2d 20 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c  + - col1 * + col
12ed0 30 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31  0 col0 FROM tab1
12ee0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
12ef0 2d 31 30 34 30 0d 0a 2d 36 34 30 0d 0a 2d 37 38  -1040..-640..-78
12f00 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
12f10 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
12f20 63 6f 6c 30 20 2a 20 28 20 63 6f 72 30 2e 63 6f  col0 * ( cor0.co
12f30 6c 30 20 29 20 46 52 4f 4d 20 74 61 62 30 20 41  l0 ) FROM tab0 A
12f40 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32  S cor0..----..12
12f50 32 35 0d 0a 35 37 36 0d 0a 37 39 32 31 0d 0a 0d  25..576..7921...
12f60 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
12f70 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
12f80 54 20 2d 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20  T - + cor0.col1 
12f90 2b 20 2b 20 63 6f 6c 32 20 41 53 20 63 6f 6c 30  + + col2 AS col0
12fa0 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
12fb0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 38 0d 0a 34 37  r0..----..28..47
12fc0 0d 0a 38 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..83....query I 
12fd0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
12fe0 44 49 53 54 49 4e 43 54 20 2d 20 2d 20 63 6f 6c  DISTINCT - - col
12ff0 31 20 2a 20 63 6f 6c 32 20 2b 20 36 39 20 2a 20  1 * col2 + 69 * 
13000 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46 52 4f  col0 AS col1 FRO
13010 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
13020 2d 2d 2d 2d 0d 0a 31 33 32 30 0d 0a 36 30 39 37  ----..1320..6097
13030 0d 0a 36 39 31 36 0d 0a 0d 0a 6f 6e 6c 79 69 66  ..6916....onlyif
13040 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56   mysql # use DIV
13050 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e   operator for in
13060 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a  teger division..
13070 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
13080 6c 61 62 65 6c 2d 35 33 31 0d 0a 53 45 4c 45 43  label-531..SELEC
13090 54 20 41 4c 4c 20 2d 20 2b 20 63 6f 6c 31 20 44  T ALL - + col1 D
130a0 49 56 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 41  IV + cor0.col1 A
130b0 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31  S col2 FROM tab1
130c0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
130d0 2d 31 0d 0a 2d 31 0d 0a 2d 31 0d 0a 0d 0a 73 6b  -1..-1..-1....sk
130e0 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
130f0 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
13100 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
13110 65 6c 2d 35 33 31 0d 0a 53 45 4c 45 43 54 20 41  el-531..SELECT A
13120 4c 4c 20 2d 20 2b 20 63 6f 6c 31 20 2f 20 2b 20  LL - + col1 / + 
13130 63 6f 72 30 2e 63 6f 6c 31 20 41 53 20 63 6f 6c  cor0.col1 AS col
13140 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  2 FROM tab1 AS c
13150 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 2d  or0..----..-1..-
13160 31 0d 0a 2d 31 0d 0a 0d 0a 73 6b 69 70 69 66 20  1..-1....skipif 
13170 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73  postgresql # Pos
13180 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73  tgreSQL requires
13190 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e   AS when renamin
131a0 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73  g output columns
131b0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
131c0 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
131d0 43 54 20 2d 20 63 6f 6c 31 20 2a 20 63 6f 6c 30  CT - col1 * col0
131e0 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20   col1 FROM tab2 
131f0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
13200 31 33 34 33 0d 0a 2d 32 31 37 0d 0a 2d 34 36 30  1343..-217..-460
13210 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  2....query I row
13220 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 33 32 20  sort..SELECT 32 
13230 2b 20 74 61 62 31 2e 63 6f 6c 30 20 2a 20 2b 20  + tab1.col0 * + 
13240 28 20 2d 20 63 6f 6c 31 20 2a 20 63 6f 6c 31 20  ( - col1 * col1 
13250 29 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d  ) FROM tab1..---
13260 2d 0d 0a 2d 31 33 34 38 38 0d 0a 2d 31 39 39 36  -..-13488..-1996
13270 0d 0a 2d 36 33 36 38 0d 0a 0d 0a 71 75 65 72 79  ..-6368....query
13280 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
13290 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 32 20 2a 20  CT ALL + col2 * 
132a0 63 6f 6c 30 20 2a 20 36 30 20 46 52 4f 4d 20 74  col0 * 60 FROM t
132b0 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 32 31 38 38 38  ab1..----..21888
132c0 30 0d 0a 34 36 30 38 30 30 0d 0a 39 37 32 30 0d  0..460800..9720.
132d0 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
132e0 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74  # use DIV operat
132f0 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64  or for integer d
13300 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49  ivision..query I
13310 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 35   rowsort label-5
13320 33 35 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  35..SELECT DISTI
13330 4e 43 54 20 34 36 20 44 49 56 20 74 61 62 30 2e  NCT 46 DIV tab0.
13340 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52 4f  col1 AS col0 FRO
13350 4d 20 74 61 62 30 2c 20 74 61 62 31 20 41 53 20  M tab0, tab1 AS 
13360 63 6f 72 30 2c 20 74 61 62 32 20 63 6f 72 31 0d  cor0, tab2 cor1.
13370 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 0d 0a 73 6b 69 70  .----..0....skip
13380 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
13390 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
133a0 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
133b0 2d 35 33 35 0d 0a 53 45 4c 45 43 54 20 44 49 53  -535..SELECT DIS
133c0 54 49 4e 43 54 20 34 36 20 2f 20 74 61 62 30 2e  TINCT 46 / tab0.
133d0 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52 4f  col1 AS col0 FRO
133e0 4d 20 74 61 62 30 2c 20 74 61 62 31 20 41 53 20  M tab0, tab1 AS 
133f0 63 6f 72 30 2c 20 74 61 62 32 20 63 6f 72 31 0d  cor0, tab2 cor1.
13400 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 0d 0a 71 75 65 72  .----..0....quer
13410 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
13420 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 2d  ECT DISTINCT + -
13430 20 63 6f 6c 32 20 2a 20 63 6f 6c 32 20 2b 20 34   col2 * col2 + 4
13440 32 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  2 AS col1 FROM t
13450 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
13460 2d 0d 0a 2d 31 34 30 32 0d 0a 2d 36 33 34 0d 0a  -..-1402..-634..
13470 2d 36 38 37 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  -687....onlyif m
13480 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f  ysql # use DIV o
13490 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65  perator for inte
134a0 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75  ger division..qu
134b0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
134c0 62 65 6c 2d 35 33 37 0d 0a 53 45 4c 45 43 54 20  bel-537..SELECT 
134d0 44 49 53 54 49 4e 43 54 20 2b 20 63 6f 72 30 2e  DISTINCT + cor0.
134e0 63 6f 6c 30 20 44 49 56 20 2d 20 28 20 38 35 20  col0 DIV - ( 85 
134f0 29 20 2b 20 2d 20 63 6f 6c 32 20 41 53 20 63 6f  ) + - col2 AS co
13500 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l2 FROM tab1 AS 
13510 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 34 0d  cor0..----..-54.
13520 0a 2d 35 37 0d 0a 2d 39 36 0d 0a 0d 0a 73 6b 69  .-57..-96....ski
13530 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
13540 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
13550 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
13560 6c 2d 35 33 37 0d 0a 53 45 4c 45 43 54 20 44 49  l-537..SELECT DI
13570 53 54 49 4e 43 54 20 2b 20 63 6f 72 30 2e 63 6f  STINCT + cor0.co
13580 6c 30 20 2f 20 2d 20 28 20 38 35 20 29 20 2b 20  l0 / - ( 85 ) + 
13590 2d 20 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46  - col2 AS col2 F
135a0 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
135b0 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 34 0d 0a 2d 35 37  ..----..-54..-57
135c0 0d 0a 2d 39 36 0d 0a 0d 0a 71 75 65 72 79 20 49  ..-96....query I
135d0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
135e0 20 44 49 53 54 49 4e 43 54 20 2b 20 2b 20 63 6f   DISTINCT + + co
135f0 6c 31 20 2a 20 2b 20 33 32 20 46 52 4f 4d 20 74  l1 * + 32 FROM t
13600 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab2 cor0..----..
13610 31 38 38 38 0d 0a 35 34 34 0d 0a 39 39 32 0d 0a  1888..544..992..
13620 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
13630 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
13640 43 54 20 2d 20 63 6f 6c 31 20 2b 20 2d 20 28 20  CT - col1 + - ( 
13650 63 6f 6c 32 20 29 20 2a 20 63 6f 6c 31 20 2a 20  col2 ) * col1 * 
13660 2b 20 63 6f 6c 31 20 2b 20 2d 20 28 20 63 6f 6c  + col1 + - ( col
13670 30 20 29 20 2a 20 34 34 20 2a 20 38 32 20 41 53  0 ) * 44 * 82 AS
13680 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20   col0 FROM tab1 
13690 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
136a0 32 33 36 36 32 32 0d 0a 2d 33 30 34 38 37 37 0d  236622..-304877.
136b0 0a 2d 34 37 33 35 34 0d 0a 0d 0a 71 75 65 72 79  .-47354....query
136c0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
136d0 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 31 20 2a 20  CT ALL - col1 * 
136e0 63 6f 6c 31 20 2b 20 2b 20 63 6f 6c 32 20 46 52  col1 + + col2 FR
136f0 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d  OM tab2 cor0..--
13700 2d 2d 0d 0a 2d 32 35 31 0d 0a 2d 33 34 35 35 0d  --..-251..-3455.
13710 0a 2d 39 33 34 0d 0a 0d 0a 71 75 65 72 79 20 49  .-934....query I
13720 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
13730 20 41 4c 4c 20 31 36 20 46 52 4f 4d 20 74 61 62   ALL 16 FROM tab
13740 32 2c 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d  2, tab2 cor0..--
13750 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73  --..9 values has
13760 68 69 6e 67 20 74 6f 20 33 66 64 62 30 38 65 63  hing to 3fdb08ec
13770 32 65 33 64 34 62 36 34 32 64 64 34 35 39 34 37  2e3d4b642dd45947
13780 37 38 63 63 61 38 62 33 0d 0a 0d 0a 6f 6e 6c 79  78cca8b3....only
13790 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44  if mysql # use D
137a0 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20  IV operator for 
137b0 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e  integer division
137c0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
137d0 74 20 6c 61 62 65 6c 2d 35 34 32 0d 0a 53 45 4c  t label-542..SEL
137e0 45 43 54 20 2d 20 2b 20 63 6f 6c 31 20 44 49 56  ECT - + col1 DIV
137f0 20 63 6f 6c 30 20 63 6f 6c 32 20 46 52 4f 4d 20   col0 col2 FROM 
13800 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
13810 2d 2d 0d 0a 2d 38 0d 0a 30 0d 0a 30 0d 0a 0d 0a  --..-8..0..0....
13820 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71  skipif postgresq
13830 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72  l # PostgreSQL r
13840 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20  equires AS when 
13850 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20  renaming output 
13860 63 6f 6c 75 6d 6e 73 0d 0a 73 6b 69 70 69 66 20  columns..skipif 
13870 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
13880 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
13890 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 35 34  rowsort label-54
138a0 32 0d 0a 53 45 4c 45 43 54 20 2d 20 2b 20 63 6f  2..SELECT - + co
138b0 6c 31 20 2f 20 63 6f 6c 30 20 63 6f 6c 32 20 46  l1 / col0 col2 F
138c0 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
138d0 0d 0a 2d 2d 2d 2d 0d 0a 2d 38 0d 0a 30 0d 0a 30  ..----..-8..0..0
138e0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
138f0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f  ort..SELECT + co
13900 6c 32 20 2b 20 32 32 20 46 52 4f 4d 20 74 61 62  l2 + 22 FROM tab
13910 32 0d 0a 2d 2d 2d 2d 0d 0a 34 38 0d 0a 34 39 0d  2..----..48..49.
13920 0a 36 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .60....query I r
13930 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 38  owsort..SELECT 8
13940 32 20 2a 20 2b 20 63 6f 6c 32 20 41 53 20 63 6f  2 * + col2 AS co
13950 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l0 FROM tab2 AS 
13960 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 31 33 32  cor0..----..2132
13970 0d 0a 32 32 31 34 0d 0a 33 31 31 36 0d 0a 0d 0a  ..2214..3116....
13980 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
13990 0a 53 45 4c 45 43 54 20 41 4c 4c 20 38 32 20 2b  .SELECT ALL 82 +
139a0 20 2b 20 63 6f 6c 32 20 2a 20 63 6f 6c 31 20 46   + col2 * col1 F
139b0 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d  ROM tab0 cor0..-
139c0 2d 2d 2d 0d 0a 31 37 39 0d 0a 32 39 32 30 0d 0a  ---..179..2920..
139d0 37 35 34 34 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  7544....onlyif m
139e0 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f  ysql # use DIV o
139f0 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65  perator for inte
13a00 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75  ger division..qu
13a10 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
13a20 62 65 6c 2d 35 34 36 0d 0a 53 45 4c 45 43 54 20  bel-546..SELECT 
13a30 41 4c 4c 20 2b 20 28 20 63 6f 6c 31 20 29 20 2a  ALL + ( col1 ) *
13a40 20 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c 31 20 2b   col1 * - col1 +
13a50 20 63 6f 6c 32 20 44 49 56 20 63 6f 6c 30 20 46   col2 DIV col0 F
13a60 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
13a70 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 30 30 0d 0a 2d  ..----..-1000..-
13a80 31 37 35 35 38 0d 0a 2d 32 31 39 36 0d 0a 0d 0a  17558..-2196....
13a90 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
13aa0 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
13ab0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
13ac0 61 62 65 6c 2d 35 34 36 0d 0a 53 45 4c 45 43 54  abel-546..SELECT
13ad0 20 41 4c 4c 20 2b 20 28 20 63 6f 6c 31 20 29 20   ALL + ( col1 ) 
13ae0 2a 20 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c 31 20  * col1 * - col1 
13af0 2b 20 63 6f 6c 32 20 2f 20 63 6f 6c 30 20 46 52  + col2 / col0 FR
13b00 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
13b10 0a 2d 2d 2d 2d 0d 0a 2d 31 30 30 30 0d 0a 2d 31  .----..-1000..-1
13b20 37 35 35 38 0d 0a 2d 32 31 39 36 0d 0a 0d 0a 73  7558..-2196....s
13b30 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c  kipif postgresql
13b40 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65   # PostgreSQL re
13b50 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72  quires AS when r
13b60 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63  enaming output c
13b70 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20  olumns..query I 
13b80 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
13b90 41 4c 4c 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20  ALL + cor0.col2 
13ba0 2a 20 63 6f 6c 32 20 63 6f 6c 30 20 46 52 4f 4d  * col2 col0 FROM
13bb0 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
13bc0 2d 2d 2d 0d 0a 32 39 31 36 0d 0a 33 32 34 39 0d  ---..2916..3249.
13bd0 0a 39 32 31 36 0d 0a 0d 0a 71 75 65 72 79 20 49  .9216....query I
13be0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
13bf0 20 2d 20 2d 20 33 35 20 41 53 20 63 6f 6c 32 20   - - 35 AS col2 
13c00 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
13c10 30 0d 0a 2d 2d 2d 2d 0d 0a 33 35 0d 0a 33 35 0d  0..----..35..35.
13c20 0a 33 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .35....query I r
13c30 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
13c40 4c 4c 20 2b 20 2b 20 38 37 20 2a 20 2b 20 63 6f  LL + + 87 * + co
13c50 6c 31 20 2b 20 63 6f 6c 32 20 41 53 20 63 6f 6c  l1 + col2 AS col
13c60 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  2 FROM tab0 AS c
13c70 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 37 35 31 35 0d  or0..----..7515.
13c80 0a 37 39 39 39 0d 0a 38 34 34 30 0d 0a 0d 0a 73  .7999..8440....s
13c90 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c  kipif postgresql
13ca0 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65   # PostgreSQL re
13cb0 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72  quires AS when r
13cc0 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63  enaming output c
13cd0 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20  olumns..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 2d 20 63 6f 72 30 2e  DISTINCT - cor0.
13d00 63 6f 6c 32 20 2a 20 63 6f 6c 31 20 63 6f 6c 32  col2 * col1 col2
13d10 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
13d20 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32 34 38 0d  r0..----..-1248.
13d30 0a 2d 31 34 30 34 0d 0a 2d 35 37 30 0d 0a 0d 0a  .-1404..-570....
13d40 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73  onlyif mysql # s
13d50 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c  upport for MySQL
13d60 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d   specific system
13d70 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61   types and synta
13d80 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  x..query I rowso
13d90 72 74 20 6c 61 62 65 6c 2d 35 35 31 0d 0a 53 45  rt label-551..SE
13da0 4c 45 43 54 20 41 4c 4c 20 2b 20 28 20 63 6f 6c  LECT ALL + ( col
13db0 31 20 29 20 2b 20 63 6f 6c 31 20 2b 20 2b 20 43  1 ) + col1 + + C
13dc0 41 53 54 28 20 2d 20 63 6f 6c 31 20 41 53 20 53  AST( - col1 AS S
13dd0 49 47 4e 45 44 20 29 20 46 52 4f 4d 20 74 61 62  IGNED ) FROM tab
13de0 30 0d 0a 2d 2d 2d 2d 0d 0a 38 36 0d 0a 39 31 0d  0..----..86..91.
13df0 0a 39 37 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  .97....skipif my
13e00 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
13e10 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
13e20 77 73 6f 72 74 20 6c 61 62 65 6c 2d 35 35 31 0d  wsort label-551.
13e30 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 28 20  .SELECT ALL + ( 
13e40 63 6f 6c 31 20 29 20 2b 20 63 6f 6c 31 20 2b 20  col1 ) + col1 + 
13e50 2b 20 43 41 53 54 20 28 20 2d 20 63 6f 6c 31 20  + CAST ( - col1 
13e60 41 53 20 49 4e 54 45 47 45 52 20 29 20 46 52 4f  AS INTEGER ) FRO
13e70 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 38 36  M tab0..----..86
13e80 0d 0a 39 31 0d 0a 39 37 0d 0a 0d 0a 71 75 65 72  ..91..97....quer
13e90 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
13ea0 45 43 54 20 2d 20 28 20 38 32 20 29 20 2a 20 2d  ECT - ( 82 ) * -
13eb0 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 0d   col1 FROM tab0.
13ec0 0a 2d 2d 2d 2d 0d 0a 37 30 35 32 0d 0a 37 34 36  .----..7052..746
13ed0 32 0d 0a 37 39 35 34 0d 0a 0d 0a 6f 6e 6c 79 69  2..7954....onlyi
13ee0 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49  f mysql # use DI
13ef0 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69  V operator for i
13f00 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d  nteger division.
13f10 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
13f20 20 6c 61 62 65 6c 2d 35 35 33 0d 0a 53 45 4c 45   label-553..SELE
13f30 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 74 61  CT DISTINCT - ta
13f40 62 30 2e 63 6f 6c 32 20 2b 20 63 6f 6c 31 20 44  b0.col2 + col1 D
13f50 49 56 20 2b 20 74 61 62 30 2e 63 6f 6c 31 20 41  IV + tab0.col1 A
13f60 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30  S col0 FROM tab0
13f70 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 32 0d 0a 2d 38 31  ..----..-32..-81
13f80 0d 0a 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  ..0....skipif my
13f90 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
13fa0 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
13fb0 77 73 6f 72 74 20 6c 61 62 65 6c 2d 35 35 33 0d  wsort label-553.
13fc0 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
13fd0 20 2d 20 74 61 62 30 2e 63 6f 6c 32 20 2b 20 63   - tab0.col2 + c
13fe0 6f 6c 31 20 2f 20 2b 20 74 61 62 30 2e 63 6f 6c  ol1 / + tab0.col
13ff0 31 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  1 AS col0 FROM t
14000 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 32 0d 0a  ab0..----..-32..
14010 2d 38 31 0d 0a 30 0d 0a 0d 0a 71 75 65 72 79 20  -81..0....query 
14020 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
14030 54 20 63 6f 6c 30 20 2b 20 36 31 20 2a 20 2d 20  T col0 + 61 * - 
14040 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a  col1 FROM tab0..
14050 2d 2d 2d 2d 0d 0a 2d 35 32 32 32 0d 0a 2d 35 34  ----..-5222..-54
14060 36 32 0d 0a 2d 35 38 38 32 0d 0a 0d 0a 71 75 65  62..-5882....que
14070 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
14080 4c 45 43 54 20 2b 20 63 6f 72 31 2e 63 6f 6c 30  LECT + cor1.col0
14090 20 46 52 4f 4d 20 74 61 62 32 2c 20 74 61 62 31   FROM tab2, tab1
140a0 20 41 53 20 63 6f 72 30 2c 20 74 61 62 30 20 41   AS cor0, tab0 A
140b0 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 32 37  S cor1..----..27
140c0 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20   values hashing 
140d0 74 6f 20 39 66 63 31 64 63 64 37 36 66 65 61 66  to 9fc1dcd76feaf
140e0 34 33 65 35 63 35 64 63 30 36 30 61 30 32 30 31  43e5c5dc060a0201
140f0 34 63 64 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  4cd....query I r
14100 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
14110 20 74 61 62 30 2e 63 6f 6c 31 20 2a 20 2b 20 63   tab0.col1 * + c
14120 6f 72 30 2e 63 6f 6c 30 20 46 52 4f 4d 20 74 61  or0.col0 FROM ta
14130 62 30 2c 20 74 61 62 30 20 41 53 20 63 6f 72 30  b0, tab0 AS cor0
14140 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73  ..----..9 values
14150 20 68 61 73 68 69 6e 67 20 74 6f 20 31 31 36 34   hashing to 1164
14160 35 34 66 32 32 36 38 65 32 31 63 31 33 35 31 64  54f2268e21c1351d
14170 61 66 33 66 35 38 30 33 63 39 38 37 0d 0a 0d 0a  af3f5803c987....
14180 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
14190 0a 53 45 4c 45 43 54 20 2b 20 74 61 62 31 2e 63  .SELECT + tab1.c
141a0 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  ol0 AS col0 FROM
141b0 20 74 61 62 31 2c 20 74 61 62 31 20 41 53 20 63   tab1, tab1 AS c
141c0 6f 72 30 2c 20 74 61 62 31 20 63 6f 72 31 0d 0a  or0, tab1 cor1..
141d0 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75 65 73 20  ----..27 values 
141e0 68 61 73 68 69 6e 67 20 74 6f 20 37 37 38 62 35  hashing to 778b5
141f0 30 35 37 35 61 39 62 39 31 34 34 38 31 31 39 65  0575a9b91448119e
14200 65 30 65 65 31 61 39 63 34 34 66 0d 0a 0d 0a 73  e0ee1a9c44f....s
14210 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c  kipif postgresql
14220 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65   # PostgreSQL re
14230 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72  quires AS when r
14240 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63  enaming output c
14250 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20  olumns..query I 
14260 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
14270 44 49 53 54 49 4e 43 54 20 2b 20 37 32 20 2b 20  DISTINCT + 72 + 
14280 63 6f 72 30 2e 63 6f 6c 30 20 2a 20 2b 20 63 6f  cor0.col0 * + co
14290 72 30 2e 63 6f 6c 32 20 2a 20 2b 20 31 31 20 63  r0.col2 * + 11 c
142a0 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol2 FROM tab1 AS
142b0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 38 35   cor0..----..185
142c0 34 0d 0a 34 30 32 30 30 0d 0a 38 34 35 35 32 0d  4..40200..84552.
142d0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
142e0 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 38  rt..SELECT ALL 8
142f0 33 20 46 52 4f 4d 20 74 61 62 30 2c 20 74 61 62  3 FROM tab0, tab
14300 30 20 63 6f 72 30 2c 20 74 61 62 30 20 41 53 20  0 cor0, tab0 AS 
14310 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76  cor1..----..27 v
14320 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f  alues hashing to
14330 20 30 30 32 61 37 31 37 61 33 64 39 30 32 64 39   002a717a3d902d9
14340 37 32 32 30 37 35 39 30 36 35 66 62 31 30 37 63  7220759065fb107c
14350 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  3....query I row
14360 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
14370 54 49 4e 43 54 20 2b 20 28 20 74 61 62 30 2e 63  TINCT + ( tab0.c
14380 6f 6c 31 20 2b 20 2d 20 35 31 20 2a 20 63 6f 72  ol1 + - 51 * cor
14390 30 2e 63 6f 6c 31 20 29 20 46 52 4f 4d 20 74 61  0.col1 ) FROM ta
143a0 62 30 2c 20 74 61 62 30 20 41 53 20 63 6f 72 30  b0, tab0 AS cor0
143b0 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73  ..----..9 values
143c0 20 68 61 73 68 69 6e 67 20 74 6f 20 35 31 62 65   hashing to 51be
143d0 65 37 39 39 65 30 61 63 33 35 66 61 65 35 30 32  e799e0ac35fae502
143e0 33 64 37 64 63 63 62 36 63 66 37 35 0d 0a 0d 0a  3d7dccb6cf75....
143f0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
14400 0a 53 45 4c 45 43 54 20 63 6f 6c 32 20 2a 20 2d  .SELECT col2 * -
14410 20 28 20 63 6f 6c 32 20 29 20 2a 20 2b 20 63 6f   ( col2 ) * + co
14420 6c 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  l2 AS col2 FROM 
14430 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
14440 2d 2d 0d 0a 2d 31 0d 0a 2d 33 35 39 33 37 0d 0a  --..-1..-35937..
14450 2d 35 35 31 33 36 38 0d 0a 0d 0a 71 75 65 72 79  -551368....query
14460 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
14470 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 2d 20  CT DISTINCT + - 
14480 31 31 20 2b 20 2d 20 63 6f 6c 32 20 41 53 20 63  11 + - col2 AS c
14490 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol2 FROM tab0 AS
144a0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32   cor0..----..-12
144b0 0d 0a 2d 34 34 0d 0a 2d 39 33 0d 0a 0d 0a 71 75  ..-44..-93....qu
144c0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
144d0 45 4c 45 43 54 20 28 20 2b 20 63 6f 6c 30 20 29  ELECT ( + col0 )
144e0 20 2a 20 2d 20 63 6f 6c 31 20 46 52 4f 4d 20 74   * - col1 FROM t
144f0 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
14500 2d 0d 0a 2d 31 30 34 30 0d 0a 2d 36 34 30 0d 0a  -..-1040..-640..
14510 2d 37 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  -78....query I r
14520 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63  owsort..SELECT c
14530 6f 6c 31 20 2a 20 2b 20 37 39 20 46 52 4f 4d 20  ol1 * + 79 FROM 
14540 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab1 cor0..----.
14550 0a 31 30 32 37 0d 0a 32 30 35 34 0d 0a 37 39 30  .1027..2054..790
14560 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
14570 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61   # use DIV opera
14580 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20  tor for integer 
14590 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20  division..query 
145a0 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
145b0 35 36 35 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  565..SELECT ALL 
145c0 2d 20 63 6f 6c 31 20 44 49 56 20 63 6f 6c 32 20  - col1 DIV col2 
145d0 2d 20 2b 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61  - + col2 FROM ta
145e0 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
145f0 0d 0a 2d 33 35 0d 0a 2d 38 33 0d 0a 2d 39 38 0d  ..-35..-83..-98.
14600 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
14610 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
14620 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
14630 74 20 6c 61 62 65 6c 2d 35 36 35 0d 0a 53 45 4c  t label-565..SEL
14640 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 31 20 2f  ECT ALL - col1 /
14650 20 63 6f 6c 32 20 2d 20 2b 20 63 6f 6c 32 20 46   col2 - + col2 F
14660 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
14670 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 35 0d 0a 2d 38 33  ..----..-35..-83
14680 0d 0a 2d 39 38 0d 0a 0d 0a 71 75 65 72 79 20 49  ..-98....query I
14690 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
146a0 20 74 61 62 32 2e 63 6f 6c 32 20 46 52 4f 4d 20   tab2.col2 FROM 
146b0 74 61 62 31 2c 20 74 61 62 32 20 41 53 20 63 6f  tab1, tab2 AS co
146c0 72 30 20 43 52 4f 53 53 20 4a 4f 49 4e 20 74 61  r0 CROSS JOIN ta
146d0 62 32 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c  b2..----..27 val
146e0 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 34  ues hashing to 4
146f0 30 66 64 38 63 63 30 64 65 39 32 65 61 36 38 64  0fd8cc0de92ea68d
14700 37 33 36 33 34 63 32 64 38 66 37 35 62 66 35 0d  73634c2d8f75bf5.
14710 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
14720 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74  # use DIV operat
14730 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64  or for integer d
14740 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49  ivision..query I
14750 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 35   rowsort label-5
14760 36 37 0d 0a 53 45 4c 45 43 54 20 2b 20 2b 20 28  67..SELECT + + (
14770 20 2d 20 39 35 20 29 20 44 49 56 20 63 6f 6c 30   - 95 ) DIV col0
14780 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
14790 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
147a0 0d 0a 2d 31 0d 0a 2d 31 0d 0a 2d 31 33 0d 0a 0d  ..-1..-1..-13...
147b0 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
147c0 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
147d0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
147e0 6c 61 62 65 6c 2d 35 36 37 0d 0a 53 45 4c 45 43  label-567..SELEC
147f0 54 20 2b 20 2b 20 28 20 2d 20 39 35 20 29 20 2f  T + + ( - 95 ) /
14800 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46 52   col0 AS col0 FR
14810 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
14820 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 2d 31 0d 0a 2d  .----..-1..-1..-
14830 31 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  13....query I ro
14840 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
14850 2b 20 63 6f 6c 31 20 2a 20 63 6f 72 30 2e 63 6f  + col1 * cor0.co
14860 6c 32 20 2a 20 2d 20 36 39 20 46 52 4f 4d 20 74  l2 * - 69 FROM t
14870 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
14880 2d 0d 0a 2d 31 39 35 38 32 32 0d 0a 2d 35 31 34  -..-195822..-514
14890 38 37 38 0d 0a 2d 36 36 39 33 0d 0a 0d 0a 71 75  878..-6693....qu
148a0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
148b0 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 31 20 2b  ELECT ALL col1 +
148c0 20 2b 20 63 6f 6c 32 20 2a 20 2b 20 63 6f 72 30   + col2 * + cor0
148d0 2e 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52  .col1 AS col0 FR
148e0 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
148f0 0a 2d 2d 2d 2d 0d 0a 31 32 36 31 0d 0a 31 34 33  .----..1261..143
14900 30 0d 0a 35 38 30 0d 0a 0d 0a 6f 6e 6c 79 69 66  0..580....onlyif
14910 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74   mysql # support
14920 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69   for MySQL speci
14930 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73  fic system types
14940 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65   and syntax..que
14950 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
14960 65 6c 2d 35 37 30 0d 0a 53 45 4c 45 43 54 20 41  el-570..SELECT A
14970 4c 4c 20 2d 20 2d 20 63 6f 6c 32 20 2b 20 63 6f  LL - - col2 + co
14980 6c 30 20 2a 20 2b 20 43 41 53 54 28 20 4e 55 4c  l0 * + CAST( NUL
14990 4c 20 41 53 20 44 45 43 49 4d 41 4c 20 29 20 2b  L AS DECIMAL ) +
149a0 20 34 35 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d   45 AS col1 FROM
149b0 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab0 cor0..----
149c0 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55  ..NULL..NULL..NU
149d0 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  LL....skipif mys
149e0 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
149f0 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
14a00 73 6f 72 74 20 6c 61 62 65 6c 2d 35 37 30 0d 0a  sort label-570..
14a10 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 2d 20 63  SELECT ALL - - c
14a20 6f 6c 32 20 2b 20 63 6f 6c 30 20 2a 20 2b 20 43  ol2 + col0 * + C
14a30 41 53 54 20 28 20 4e 55 4c 4c 20 41 53 20 52 45  AST ( NULL AS RE
14a40 41 4c 20 29 20 2b 20 34 35 20 41 53 20 63 6f 6c  AL ) + 45 AS col
14a50 31 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30  1 FROM tab0 cor0
14a60 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55  ..----..NULL..NU
14a70 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75 65 72  LL..NULL....quer
14a80 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
14a90 45 43 54 20 63 6f 72 32 2e 63 6f 6c 31 20 41 53  ECT cor2.col1 AS
14aa0 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 2c   col1 FROM tab1,
14ab0 20 74 61 62 32 20 41 53 20 63 6f 72 30 2c 20 74   tab2 AS cor0, t
14ac0 61 62 30 20 41 53 20 63 6f 72 31 2c 20 74 61 62  ab0 AS cor1, tab
14ad0 32 20 41 53 20 63 6f 72 32 0d 0a 2d 2d 2d 2d 0d  2 AS cor2..----.
14ae0 0a 38 31 20 76 61 6c 75 65 73 20 68 61 73 68 69  .81 values hashi
14af0 6e 67 20 74 6f 20 61 35 62 36 61 63 62 34 37 31  ng to a5b6acb471
14b00 39 31 30 65 61 34 61 64 37 66 33 31 63 61 65 33  910ea4ad7f31cae3
14b10 62 38 31 38 66 37 0d 0a 0d 0a 71 75 65 72 79 20  b818f7....query 
14b20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
14b30 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c  T DISTINCT - col
14b40 31 20 2b 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20  1 + - cor0.col2 
14b50 2a 20 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46  * col1 AS col1 F
14b60 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
14b70 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 39 34 0d 0a 2d 32  ..----..-194..-2
14b80 39 32 34 0d 0a 2d 37 35 35 33 0d 0a 0d 0a 71 75  924..-7553....qu
14b90 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
14ba0 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 31 20 2a  ELECT ALL col1 *
14bb0 20 33 38 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d   38 AS col0 FROM
14bc0 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 33 32 36   tab0..----..326
14bd0 38 0d 0a 33 34 35 38 0d 0a 33 36 38 36 0d 0a 0d  8..3458..3686...
14be0 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73  .skipif postgres
14bf0 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20  ql # PostgreSQL 
14c00 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e  requires AS when
14c10 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74   renaming output
14c20 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20   columns..query 
14c30 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
14c40 54 20 41 4c 4c 20 63 6f 6c 32 20 2a 20 35 32 20  T ALL col2 * 52 
14c50 2a 20 2b 20 32 34 20 63 6f 6c 30 20 46 52 4f 4d  * + 24 col0 FROM
14c60 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 31 39   tab1..----..119
14c70 38 30 38 0d 0a 36 37 33 39 32 0d 0a 37 31 31 33  808..67392..7113
14c80 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  6....query I row
14c90 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2d  sort..SELECT - -
14ca0 20 63 6f 6c 31 20 2d 20 28 20 2d 20 63 6f 6c 32   col1 - ( - col2
14cb0 20 29 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20   ) AS col1 FROM 
14cc0 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
14cd0 2d 2d 0d 0a 35 35 0d 0a 35 38 0d 0a 38 35 0d 0a  --..55..58..85..
14ce0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
14cf0 74 0d 0a 53 45 4c 45 43 54 20 2b 20 35 32 20 2b  t..SELECT + 52 +
14d00 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46 52   col0 AS col0 FR
14d10 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
14d20 0a 2d 2d 2d 2d 0d 0a 31 31 36 0d 0a 31 33 32 0d  .----..116..132.
14d30 0a 35 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .55....query I r
14d40 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
14d50 20 32 31 20 2b 20 2d 20 63 6f 6c 31 20 41 53 20   21 + - col1 AS 
14d60 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41  col1 FROM tab1 A
14d70 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 35  S cor0..----..-5
14d80 0d 0a 31 31 0d 0a 38 0d 0a 0d 0a 71 75 65 72 79  ..11..8....query
14d90 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
14da0 43 54 20 2d 20 32 31 20 2b 20 2b 20 63 6f 6c 30  CT - 21 + + col0
14db0 20 2a 20 2d 20 63 6f 6c 32 20 41 53 20 63 6f 6c   * - col2 AS col
14dc0 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  0 FROM tab0 AS c
14dd0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 36 0d 0a  or0..----..-56..
14de0 2d 37 33 31 39 0d 0a 2d 38 31 33 0d 0a 0d 0a 71  -7319..-813....q
14df0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
14e00 53 45 4c 45 43 54 20 2b 20 63 6f 6c 30 20 2b 20  SELECT + col0 + 
14e10 2b 20 63 6f 6c 30 20 2a 20 63 6f 6c 32 20 41 53  + col0 * col2 AS
14e20 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20   col2 FROM tab1 
14e30 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 36 35 0d  cor0..----..165.
14e40 0a 33 37 31 32 0d 0a 37 37 36 30 0d 0a 0d 0a 6f  .3712..7760....o
14e50 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75  nlyif mysql # su
14e60 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20  pport for MySQL 
14e70 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20  specific system 
14e80 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78  types and syntax
14e90 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
14ea0 74 20 6c 61 62 65 6c 2d 35 38 30 0d 0a 53 45 4c  t label-580..SEL
14eb0 45 43 54 20 2d 20 2b 20 43 41 53 54 28 20 2d 20  ECT - + CAST( - 
14ec0 63 6f 6c 31 20 41 53 20 53 49 47 4e 45 44 20 29  col1 AS SIGNED )
14ed0 20 2a 20 63 6f 72 30 2e 63 6f 6c 32 20 2a 20 2d   * cor0.col2 * -
14ee0 20 39 34 20 46 52 4f 4d 20 74 61 62 30 20 41 53   94 FROM tab0 AS
14ef0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 36   cor0..----..-26
14f00 36 37 37 32 0d 0a 2d 37 30 31 34 32 38 0d 0a 2d  6772..-701428..-
14f10 39 31 31 38 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  9118....skipif m
14f20 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
14f30 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
14f40 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 35 38 30  owsort label-580
14f50 0d 0a 53 45 4c 45 43 54 20 2d 20 2b 20 43 41 53  ..SELECT - + CAS
14f60 54 20 28 20 2d 20 63 6f 6c 31 20 41 53 20 49 4e  T ( - col1 AS IN
14f70 54 45 47 45 52 20 29 20 2a 20 63 6f 72 30 2e 63  TEGER ) * cor0.c
14f80 6f 6c 32 20 2a 20 2d 20 39 34 20 46 52 4f 4d 20  ol2 * - 94 FROM 
14f90 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
14fa0 2d 2d 0d 0a 2d 32 36 36 37 37 32 0d 0a 2d 37 30  --..-266772..-70
14fb0 31 34 32 38 0d 0a 2d 39 31 31 38 0d 0a 0d 0a 71  1428..-9118....q
14fc0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
14fd0 53 45 4c 45 43 54 20 63 6f 6c 30 20 2a 20 33 35  SELECT col0 * 35
14fe0 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
14ff0 62 32 0d 0a 2d 2d 2d 2d 0d 0a 32 34 35 0d 0a 32  b2..----..245..2
15000 37 33 30 0d 0a 32 37 36 35 0d 0a 0d 0a 71 75 65  730..2765....que
15010 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
15020 4c 45 43 54 20 63 6f 6c 32 20 2a 20 36 34 20 2a  LECT col2 * 64 *
15030 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62   + col0 FROM tab
15040 32 0d 0a 2d 2d 2d 2d 0d 0a 31 32 30 39 36 0d 0a  2..----..12096..
15050 31 32 39 37 39 32 0d 0a 31 39 32 31 32 38 0d 0a  129792..192128..
15060 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
15070 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f   use DIV operato
15080 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69  r for integer di
15090 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20  vision..query I 
150a0 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 35 38  rowsort label-58
150b0 33 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 31 20 44  3..SELECT col1 D
150c0 49 56 20 2b 20 63 6f 6c 30 20 2b 20 2b 20 63 6f  IV + col0 + + co
150d0 6c 31 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  l1 AS col1 FROM 
150e0 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 37 0d 0a  tab2..----..17..
150f0 33 35 0d 0a 35 39 0d 0a 0d 0a 73 6b 69 70 69 66  35..59....skipif
15100 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
15110 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
15120 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 35   rowsort label-5
15130 38 33 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 31 20  83..SELECT col1 
15140 2f 20 2b 20 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c  / + col0 + + col
15150 31 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  1 AS col1 FROM t
15160 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 37 0d 0a 33  ab2..----..17..3
15170 35 0d 0a 35 39 0d 0a 0d 0a 71 75 65 72 79 20 49  5..59....query I
15180 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
15190 20 44 49 53 54 49 4e 43 54 20 74 61 62 30 2e 63   DISTINCT tab0.c
151a0 6f 6c 30 20 2b 20 2d 20 28 20 2d 20 30 20 2b 20  ol0 + - ( - 0 + 
151b0 2b 20 63 6f 6c 32 20 29 20 41 53 20 63 6f 6c 31  + col2 ) AS col1
151c0 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d   FROM tab0..----
151d0 0d 0a 2d 39 0d 0a 33 34 0d 0a 37 0d 0a 0d 0a 71  ..-9..34..7....q
151e0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
151f0 53 45 4c 45 43 54 20 63 6f 6c 30 20 2a 20 28 20  SELECT col0 * ( 
15200 2b 20 74 61 62 30 2e 63 6f 6c 32 20 29 20 2a 20  + tab0.col2 ) * 
15210 63 6f 6c 32 20 2b 20 35 33 20 41 53 20 63 6f 6c  col2 + 53 AS col
15220 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d  1 FROM tab0..---
15230 2d 0d 0a 32 36 31 38 39 0d 0a 35 39 38 34 38 39  -..26189..598489
15240 0d 0a 38 38 0d 0a 0d 0a 73 6b 69 70 69 66 20 70  ..88....skipif p
15250 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74  ostgresql # Post
15260 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20  greSQL requires 
15270 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67  AS when renaming
15280 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d   output columns.
15290 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
152a0 0d 0a 53 45 4c 45 43 54 20 2b 20 2b 20 63 6f 6c  ..SELECT + + col
152b0 31 20 2b 20 2d 20 63 6f 6c 32 20 63 6f 6c 30 20  1 + - col2 col0 
152c0 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
152d0 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 31 0d 0a 33 33  0..----..-21..33
152e0 0d 0a 34 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  ..4....onlyif my
152f0 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f  sql # support fo
15300 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63  r MySQL specific
15310 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e   system types an
15320 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20  d syntax..query 
15330 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
15340 35 38 37 0d 0a 53 45 4c 45 43 54 20 2b 20 2b 20  587..SELECT + + 
15350 43 41 53 54 28 20 4e 55 4c 4c 20 41 53 20 53 49  CAST( NULL AS SI
15360 47 4e 45 44 20 29 20 2f 20 2b 20 35 33 20 46 52  GNED ) / + 53 FR
15370 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
15380 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c  .----..NULL..NUL
15390 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69  L..NULL....skipi
153a0 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
153b0 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
153c0 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
153d0 35 38 37 0d 0a 53 45 4c 45 43 54 20 2b 20 2b 20  587..SELECT + + 
153e0 43 41 53 54 20 28 20 4e 55 4c 4c 20 41 53 20 49  CAST ( NULL AS I
153f0 4e 54 45 47 45 52 20 29 20 2f 20 2b 20 35 33 20  NTEGER ) / + 53 
15400 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
15410 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e  0..----..NULL..N
15420 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75 65  ULL..NULL....que
15430 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
15440 4c 45 43 54 20 41 4c 4c 20 38 33 20 41 53 20 63  LECT ALL 83 AS c
15450 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 2c 20 74  ol2 FROM tab1, t
15460 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
15470 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68  -..9 values hash
15480 69 6e 67 20 74 6f 20 31 38 66 34 30 35 63 33 31  ing to 18f405c31
15490 61 30 66 62 34 37 63 65 33 63 63 39 66 37 65 66  a0fb47ce3cc9f7ef
154a0 66 61 38 38 35 35 63 0d 0a 0d 0a 71 75 65 72 79  fa8855c....query
154b0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
154c0 43 54 20 2b 20 31 36 20 41 53 20 63 6f 6c 30 20  CT + 16 AS col0 
154d0 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a  FROM tab1 cor0..
154e0 2d 2d 2d 2d 0d 0a 31 36 0d 0a 31 36 0d 0a 31 36  ----..16..16..16
154f0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
15500 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 31 30  ort..SELECT + 10
15510 20 2b 20 2d 20 63 6f 6c 32 20 2a 20 2d 20 63 6f   + - col2 * - co
15520 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72  l0 FROM tab1 cor
15530 30 0d 0a 2d 2d 2d 2d 0d 0a 31 37 32 0d 0a 33 36  0..----..172..36
15540 35 38 0d 0a 37 36 39 30 0d 0a 0d 0a 6f 6e 6c 79  58..7690....only
15550 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44  if mysql # use D
15560 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20  IV operator for 
15570 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e  integer division
15580 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
15590 74 20 6c 61 62 65 6c 2d 35 39 31 0d 0a 53 45 4c  t label-591..SEL
155a0 45 43 54 20 41 4c 4c 20 2d 20 28 20 2d 20 34 32  ECT ALL - ( - 42
155b0 20 29 20 44 49 56 20 63 6f 6c 31 20 46 52 4f 4d   ) DIV col1 FROM
155c0 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a   tab2..----..0..
155d0 31 0d 0a 32 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  1..2....skipif m
155e0 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
155f0 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
15600 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 35 39 31  owsort label-591
15610 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 28  ..SELECT ALL - (
15620 20 2d 20 34 32 20 29 20 2f 20 63 6f 6c 31 20 46   - 42 ) / col1 F
15630 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab2..----..
15640 30 0d 0a 31 0d 0a 32 0d 0a 0d 0a 71 75 65 72 79  0..1..2....query
15650 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
15660 43 54 20 41 4c 4c 20 2b 20 39 35 20 2a 20 2b 20  CT ALL + 95 * + 
15670 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46 52 4f  col0 AS col0 FRO
15680 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
15690 2d 2d 2d 2d 0d 0a 36 36 35 0d 0a 37 34 31 30 0d  ----..665..7410.
156a0 0a 37 35 30 35 0d 0a 0d 0a 71 75 65 72 79 20 49  .7505....query I
156b0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
156c0 20 2b 20 35 20 2a 20 2d 20 63 6f 72 30 2e 63 6f   + 5 * - cor0.co
156d0 6c 30 20 2a 20 2b 20 35 35 20 41 53 20 63 6f 6c  l0 * + 55 AS col
156e0 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  2 FROM tab2 AS c
156f0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 39 32 35  or0..----..-1925
15700 0d 0a 2d 32 31 34 35 30 0d 0a 2d 32 31 37 32 35  ..-21450..-21725
15710 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
15720 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 32 33  ort..SELECT + 23
15730 20 2a 20 34 32 20 2b 20 63 6f 6c 32 20 46 52 4f   * 42 + col2 FRO
15740 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 30  M tab1..----..10
15750 32 30 0d 0a 31 30 32 33 0d 0a 31 30 36 32 0d 0a  20..1023..1062..
15760 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
15770 74 0d 0a 53 45 4c 45 43 54 20 38 31 20 2b 20 63  t..SELECT 81 + c
15780 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d  ol0 FROM tab0..-
15790 2d 2d 2d 0d 0a 31 30 35 0d 0a 31 31 36 0d 0a 31  ---..105..116..1
157a0 37 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  70....query I ro
157b0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
157c0 53 54 49 4e 43 54 20 2b 20 39 38 20 2b 20 63 6f  STINCT + 98 + co
157d0 6c 32 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  l2 AS col0 FROM 
157e0 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 32 34 0d  tab2..----..124.
157f0 0a 31 32 35 0d 0a 31 33 36 0d 0a 0d 0a 71 75 65  .125..136....que
15800 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
15810 4c 45 43 54 20 63 6f 6c 32 20 2b 20 2d 20 63 6f  LECT col2 + - co
15820 6c 32 20 2a 20 74 61 62 30 2e 63 6f 6c 30 20 2b  l2 * tab0.col0 +
15830 20 2d 20 37 37 20 2a 20 63 6f 6c 32 20 41 53 20   - 77 * col2 AS 
15840 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a  col1 FROM tab0..
15850 2d 2d 2d 2d 0d 0a 2d 31 31 31 0d 0a 2d 31 33 35  ----..-111..-135
15860 33 30 0d 0a 2d 33 33 30 30 0d 0a 0d 0a 6f 6e 6c  30..-3300....onl
15870 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20  yif mysql # use 
15880 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72  DIV operator for
15890 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f   integer divisio
158a0 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  n..query I rowso
158b0 72 74 20 6c 61 62 65 6c 2d 35 39 38 0d 0a 53 45  rt label-598..SE
158c0 4c 45 43 54 20 2d 20 2b 20 63 6f 6c 31 20 44 49  LECT - + col1 DI
158d0 56 20 63 6f 6c 30 20 2d 20 2b 20 63 6f 6c 32 20  V col0 - + col2 
158e0 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
158f0 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
15900 0a 2d 33 0d 0a 2d 33 36 0d 0a 2d 38 33 0d 0a 0d  .-3..-36..-83...
15910 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
15920 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
15930 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
15940 6c 61 62 65 6c 2d 35 39 38 0d 0a 53 45 4c 45 43  label-598..SELEC
15950 54 20 2d 20 2b 20 63 6f 6c 31 20 2f 20 63 6f 6c  T - + col1 / col
15960 30 20 2d 20 2b 20 63 6f 6c 32 20 41 53 20 63 6f  0 - + col2 AS co
15970 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l2 FROM tab0 AS 
15980 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 0d 0a  cor0..----..-3..
15990 2d 33 36 0d 0a 2d 38 33 0d 0a 0d 0a 71 75 65 72  -36..-83....quer
159a0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
159b0 45 43 54 20 44 49 53 54 49 4e 43 54 20 32 31 20  ECT DISTINCT 21 
159c0 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
159d0 31 2c 20 74 61 62 30 2c 20 74 61 62 30 20 41 53  1, tab0, tab0 AS
159e0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 31 0d   cor0..----..21.
159f0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
15a00 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 31 20  rt..SELECT col1 
15a10 2d 20 2d 20 63 6f 6c 30 20 2a 20 2d 20 63 6f 72  - - col0 * - cor
15a20 30 2e 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46  0.col0 AS col1 F
15a30 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d  ROM tab1 cor0..-
15a40 2d 2d 2d 0d 0a 2d 34 30 38 36 0d 0a 2d 36 33 38  ---..-4086..-638
15a50 37 0d 0a 31 37 0d 0a 0d 0a 71 75 65 72 79 20 49  7..17....query I
15a60 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
15a70 20 2d 20 63 6f 6c 30 20 2d 20 2b 20 28 20 2b 20   - col0 - + ( + 
15a80 63 6f 72 30 2e 63 6f 6c 30 20 29 20 41 53 20 63  cor0.col0 ) AS c
15a90 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 63 6f  ol1 FROM tab0 co
15aa0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 37 38 0d 0a  r0..----..-178..
15ab0 2d 34 38 0d 0a 2d 37 30 0d 0a 0d 0a 6f 6e 6c 79  -48..-70....only
15ac0 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f  if mysql # suppo
15ad0 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65  rt for MySQL spe
15ae0 63 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70  cific system typ
15af0 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71  es and syntax..q
15b00 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
15b10 61 62 65 6c 2d 36 30 32 0d 0a 53 45 4c 45 43 54  abel-602..SELECT
15b20 20 2b 20 63 6f 6c 31 20 2b 20 43 41 53 54 28 20   + col1 + CAST( 
15b30 2d 20 63 6f 6c 31 20 41 53 20 53 49 47 4e 45 44  - col1 AS SIGNED
15b40 20 29 20 2a 20 63 6f 6c 30 20 41 53 20 63 6f 6c   ) * col0 AS col
15b50 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  1 FROM tab2 AS c
15b60 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 32 36  or0..----..-1326
15b70 0d 0a 2d 31 38 36 0d 0a 2d 34 35 34 33 0d 0a 0d  ..-186..-4543...
15b80 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
15b90 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
15ba0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
15bb0 6c 61 62 65 6c 2d 36 30 32 0d 0a 53 45 4c 45 43  label-602..SELEC
15bc0 54 20 2b 20 63 6f 6c 31 20 2b 20 43 41 53 54 20  T + col1 + CAST 
15bd0 28 20 2d 20 63 6f 6c 31 20 41 53 20 49 4e 54 45  ( - col1 AS INTE
15be0 47 45 52 20 29 20 2a 20 63 6f 6c 30 20 41 53 20  GER ) * col0 AS 
15bf0 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41  col1 FROM tab2 A
15c00 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
15c10 33 32 36 0d 0a 2d 31 38 36 0d 0a 2d 34 35 34 33  326..-186..-4543
15c20 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
15c30 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
15c40 2d 20 34 39 20 2a 20 63 6f 6c 30 20 2b 20 2d 20  - 49 * col0 + - 
15c50 63 6f 72 30 2e 63 6f 6c 31 20 41 53 20 63 6f 6c  cor0.col1 AS col
15c60 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  0 FROM tab2 AS c
15c70 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 37 34 0d  or0..----..-374.
15c80 0a 2d 33 38 38 31 0d 0a 2d 33 38 38 38 0d 0a 0d  .-3881..-3888...
15c90 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
15ca0 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
15cb0 54 20 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c 30 20  T col0 * + col0 
15cc0 2b 20 2d 20 28 20 2d 20 63 6f 6c 30 20 2a 20 63  + - ( - col0 * c
15cd0 6f 6c 30 20 29 20 46 52 4f 4d 20 74 61 62 30 20  ol0 ) FROM tab0 
15ce0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 35 32  cor0..----..1152
15cf0 0d 0a 31 35 38 34 32 0d 0a 32 34 35 30 0d 0a 0d  ..15842..2450...
15d00 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
15d10 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72  use DIV operator
15d20 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76   for integer div
15d30 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72  ision..query I r
15d40 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 36 30 35  owsort label-605
15d50 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 2b  ..SELECT ALL + +
15d60 20 39 35 20 2a 20 63 6f 6c 30 20 44 49 56 20 63   95 * col0 DIV c
15d70 6f 6c 32 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61  ol2 col2 FROM ta
15d80 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
15d90 0d 0a 31 30 33 0d 0a 33 33 32 35 0d 0a 36 39 0d  ..103..3325..69.
15da0 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72  ...skipif postgr
15db0 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51  esql # PostgreSQ
15dc0 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68  L requires AS wh
15dd0 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70  en renaming outp
15de0 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 73 6b 69 70  ut columns..skip
15df0 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
15e00 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
15e10 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
15e20 2d 36 30 35 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  -605..SELECT ALL
15e30 20 2b 20 2b 20 39 35 20 2a 20 63 6f 6c 30 20 2f   + + 95 * col0 /
15e40 20 63 6f 6c 32 20 63 6f 6c 32 20 46 52 4f 4d 20   col2 col2 FROM 
15e50 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
15e60 2d 2d 0d 0a 31 30 33 0d 0a 33 33 32 35 0d 0a 36  --..103..3325..6
15e70 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  9....query I row
15e80 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
15e90 54 49 4e 43 54 20 28 20 34 35 20 29 20 41 53 20  TINCT ( 45 ) AS 
15ea0 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 0d 0a  col0 FROM tab1..
15eb0 2d 2d 2d 2d 0d 0a 34 35 0d 0a 0d 0a 71 75 65 72  ----..45....quer
15ec0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
15ed0 45 43 54 20 44 49 53 54 49 4e 43 54 20 34 30 20  ECT DISTINCT 40 
15ee0 2b 20 63 6f 6c 32 20 2a 20 63 6f 6c 31 20 41 53  + col2 * col1 AS
15ef0 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20   col1 FROM tab1 
15f00 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
15f10 32 38 38 0d 0a 31 34 34 34 0d 0a 36 31 30 0d 0a  288..1444..610..
15f20 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
15f30 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20  t..SELECT ALL - 
15f40 38 30 20 2a 20 63 6f 72 30 2e 63 6f 6c 30 20 2b  80 * cor0.col0 +
15f50 20 37 37 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d   77 AS col2 FROM
15f60 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
15f70 2d 2d 2d 0d 0a 2d 34 38 33 0d 0a 2d 36 31 36 33  ---..-483..-6163
15f80 0d 0a 2d 36 32 34 33 0d 0a 0d 0a 71 75 65 72 79  ..-6243....query
15f90 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
15fa0 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63 6f  CT DISTINCT + co
15fb0 6c 32 20 2b 20 63 6f 6c 31 20 2a 20 28 20 63 6f  l2 + col1 * ( co
15fc0 6c 32 20 29 20 41 53 20 63 6f 6c 30 20 46 52 4f  l2 ) AS col0 FRO
15fd0 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
15fe0 2d 2d 2d 2d 0d 0a 32 38 37 31 0d 0a 37 35 34 34  ----..2871..7544
15ff0 0d 0a 39 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..98....query I 
16000 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
16010 2b 20 38 35 20 2b 20 63 6f 6c 31 20 41 53 20 63  + 85 + col1 AS c
16020 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 63 6f  ol2 FROM tab1 co
16030 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 31 0d 0a 39  r0..----..111..9
16040 35 0d 0a 39 38 0d 0a 0d 0a 71 75 65 72 79 20 49  5..98....query I
16050 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
16060 20 44 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c 30   DISTINCT + col0
16070 20 2a 20 2b 20 63 6f 6c 30 20 2b 20 2d 20 35 39   * + col0 + - 59
16080 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
16090 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
160a0 0d 0a 2d 35 30 0d 0a 34 30 33 37 0d 0a 36 33 34  ..-50..4037..634
160b0 31 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74  1....skipif post
160c0 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65  gresql # Postgre
160d0 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20  SQL requires AS 
160e0 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75  when renaming ou
160f0 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75  tput columns..qu
16100 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
16110 45 4c 45 43 54 20 63 6f 6c 31 20 2a 20 2d 20 34  ELECT col1 * - 4
16120 36 20 2b 20 63 6f 6c 31 20 63 6f 6c 30 20 46 52  6 + col1 col0 FR
16130 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  OM tab0..----..-
16140 33 38 37 30 0d 0a 2d 34 30 39 35 0d 0a 2d 34 33  3870..-4095..-43
16150 36 35 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  65....onlyif mys
16160 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65  ql # use DIV ope
16170 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65  rator for intege
16180 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72  r division..quer
16190 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
161a0 6c 2d 36 31 33 0d 0a 53 45 4c 45 43 54 20 63 6f  l-613..SELECT co
161b0 6c 30 20 44 49 56 20 2d 20 63 6f 6c 31 20 63 6f  l0 DIV - col1 co
161c0 6c 31 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d  l1 FROM tab1..--
161d0 2d 2d 0d 0a 2d 36 0d 0a 2d 36 0d 0a 30 0d 0a 0d  --..-6..-6..0...
161e0 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73  .skipif postgres
161f0 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20  ql # PostgreSQL 
16200 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e  requires AS when
16210 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74   renaming output
16220 20 63 6f 6c 75 6d 6e 73 0d 0a 73 6b 69 70 69 66   columns..skipif
16230 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
16240 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
16250 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 36   rowsort label-6
16260 31 33 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 30 20  13..SELECT col0 
16270 2f 20 2d 20 63 6f 6c 31 20 63 6f 6c 31 20 46 52  / - col1 col1 FR
16280 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d  OM tab1..----..-
16290 36 0d 0a 2d 36 0d 0a 30 0d 0a 0d 0a 71 75 65 72  6..-6..0....quer
162a0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
162b0 45 43 54 20 33 38 20 2d 20 2b 20 63 6f 6c 30 20  ECT 38 - + col0 
162c0 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
162d0 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 31 0d 0a 31 34  0..----..-51..14
162e0 0d 0a 33 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  ..3....onlyif my
162f0 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70  sql # use DIV op
16300 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67  erator for integ
16310 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65  er division..que
16320 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
16330 65 6c 2d 36 31 35 0d 0a 53 45 4c 45 43 54 20 41  el-615..SELECT A
16340 4c 4c 20 2b 20 2b 20 63 6f 6c 31 20 2a 20 63 6f  LL + + col1 * co
16350 6c 31 20 2b 20 63 6f 6c 30 20 44 49 56 20 63 6f  l1 + col0 DIV co
16360 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l0 FROM tab2 AS 
16370 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 39 30 0d  cor0..----..290.
16380 0a 33 34 38 32 0d 0a 39 36 32 0d 0a 0d 0a 73 6b  .3482..962....sk
16390 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
163a0 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
163b0 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
163c0 65 6c 2d 36 31 35 0d 0a 53 45 4c 45 43 54 20 41  el-615..SELECT A
163d0 4c 4c 20 2b 20 2b 20 63 6f 6c 31 20 2a 20 63 6f  LL + + col1 * co
163e0 6c 31 20 2b 20 63 6f 6c 30 20 2f 20 63 6f 6c 30  l1 + col0 / col0
163f0 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
16400 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 39 30 0d 0a 33  r0..----..290..3
16410 34 38 32 0d 0a 39 36 32 0d 0a 0d 0a 71 75 65 72  482..962....quer
16420 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
16430 45 43 54 20 36 37 20 2b 20 2d 20 63 6f 72 30 2e  ECT 67 + - cor0.
16440 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41  col1 FROM tab0 A
16450 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
16460 39 0d 0a 2d 32 34 0d 0a 2d 33 30 0d 0a 0d 0a 71  9..-24..-30....q
16470 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
16480 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c  SELECT ALL + col
16490 31 20 2a 20 2b 20 30 20 41 53 20 63 6f 6c 32 20  1 * + 0 AS col2 
164a0 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d  FROM tab2..----.
164b0 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a 71 75 65 72  .0..0..0....quer
164c0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
164d0 45 43 54 20 63 6f 6c 31 20 2a 20 2b 20 32 20 41  ECT col1 * + 2 A
164e0 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30  S col2 FROM tab0
164f0 0d 0a 2d 2d 2d 2d 0d 0a 31 37 32 0d 0a 31 38 32  ..----..172..182
16500 0d 0a 31 39 34 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  ..194....onlyif 
16510 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20  mysql # use DIV 
16520 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74  operator for int
16530 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71  eger division..q
16540 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
16550 61 62 65 6c 2d 36 31 39 0d 0a 53 45 4c 45 43 54  abel-619..SELECT
16560 20 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c 32 20 2b   col0 * + col2 +
16570 20 2d 20 37 32 20 2b 20 2d 20 63 6f 6c 32 20 44   - 72 + - col2 D
16580 49 56 20 2d 20 39 33 20 46 52 4f 4d 20 74 61 62  IV - 93 FROM tab
16590 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
165a0 0a 31 31 37 0d 0a 31 39 35 36 0d 0a 32 39 33 30  .117..1956..2930
165b0 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
165c0 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
165d0 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
165e0 72 74 20 6c 61 62 65 6c 2d 36 31 39 0d 0a 53 45  rt label-619..SE
165f0 4c 45 43 54 20 63 6f 6c 30 20 2a 20 2b 20 63 6f  LECT col0 * + co
16600 6c 32 20 2b 20 2d 20 37 32 20 2b 20 2d 20 63 6f  l2 + - 72 + - co
16610 6c 32 20 2f 20 2d 20 39 33 20 46 52 4f 4d 20 74  l2 / - 93 FROM t
16620 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
16630 2d 0d 0a 31 31 37 0d 0a 31 39 35 36 0d 0a 32 39  -..117..1956..29
16640 33 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  30....query I ro
16650 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
16660 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c 31 20 2a 20  col0 + + col1 * 
16670 32 39 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  29 FROM tab1 AS 
16680 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 35 34 0d  cor0..----..354.
16690 0a 34 35 37 0d 0a 37 35 37 0d 0a 0d 0a 73 6b 69  .457..757....ski
166a0 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23  pif postgresql #
166b0 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75   PostgreSQL requ
166c0 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e  ires AS when ren
166d0 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c  aming output col
166e0 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f  umns..query I ro
166f0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
16700 4c 20 2d 20 74 61 62 32 2e 63 6f 6c 32 20 2b 20  L - tab2.col2 + 
16710 74 61 62 32 2e 63 6f 6c 31 20 63 6f 6c 31 20 46  tab2.col1 col1 F
16720 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab2..----..
16730 2d 32 31 0d 0a 33 33 0d 0a 34 0d 0a 0d 0a 71 75  -21..33..4....qu
16740 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
16750 45 4c 45 43 54 20 2d 20 2b 20 28 20 35 20 29 20  ELECT - + ( 5 ) 
16760 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
16770 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
16780 0a 2d 35 0d 0a 2d 35 0d 0a 2d 35 0d 0a 0d 0a 6f  .-5..-5..-5....o
16790 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73  nlyif mysql # us
167a0 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66  e DIV operator f
167b0 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73  or integer divis
167c0 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ion..query I row
167d0 73 6f 72 74 20 6c 61 62 65 6c 2d 36 32 33 0d 0a  sort label-623..
167e0 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
167f0 2b 20 37 38 20 44 49 56 20 63 6f 6c 30 20 46 52  + 78 DIV col0 FR
16800 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
16810 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 32 0d 0a 33 0d 0a  .----..0..2..3..
16820 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
16830 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
16840 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
16850 20 6c 61 62 65 6c 2d 36 32 33 0d 0a 53 45 4c 45   label-623..SELE
16860 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 37 38  CT DISTINCT + 78
16870 20 2f 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62   / col0 FROM tab
16880 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
16890 0a 30 0d 0a 32 0d 0a 33 0d 0a 0d 0a 71 75 65 72  .0..2..3....quer
168a0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
168b0 45 43 54 20 2d 20 63 6f 6c 31 20 2a 20 2b 20 63  ECT - col1 * + c
168c0 6f 6c 32 20 2b 20 63 6f 6c 32 20 2a 20 2b 20 63  ol2 + col2 * + c
168d0 6f 6c 30 20 2a 20 2b 20 28 20 63 6f 72 30 2e 63  ol0 * + ( cor0.c
168e0 6f 6c 31 20 2a 20 2b 20 36 20 29 20 2b 20 2d 20  ol1 * + 6 ) + - 
168f0 63 6f 72 30 2e 63 6f 6c 31 20 46 52 4f 4d 20 74  cor0.col1 FROM t
16900 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
16910 2d 0d 0a 33 30 35 35 34 31 0d 0a 33 34 32 38 36  -..305541..34286
16920 0d 0a 37 31 36 33 31 39 0d 0a 0d 0a 71 75 65 72  ..716319....quer
16930 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
16940 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 31 20 2a  ECT ALL - col1 *
16950 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 2b 20 63   - cor0.col2 + c
16960 6f 6c 30 20 2a 20 2d 20 38 31 20 41 53 20 63 6f  ol0 * - 81 AS co
16970 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72  l2 FROM tab0 cor
16980 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 37 33 38 0d 0a  0..----..-2738..
16990 32 35 33 0d 0a 38 39 34 0d 0a 0d 0a 71 75 65 72  253..894....quer
169a0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
169b0 45 43 54 20 2d 20 35 31 20 2b 20 2d 20 36 34 20  ECT - 51 + - 64 
169c0 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
169d0 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
169e0 0a 2d 31 31 35 0d 0a 2d 31 31 35 0d 0a 2d 31 31  .-115..-115..-11
169f0 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  5....query I row
16a00 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2d  sort..SELECT - -
16a10 20 28 20 63 6f 6c 31 20 29 20 2a 20 63 6f 6c 30   ( col1 ) * col0
16a20 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
16a30 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
16a40 0d 0a 32 30 36 34 0d 0a 33 33 39 35 0d 0a 38 30  ..2064..3395..80
16a50 39 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  99....query I ro
16a60 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
16a70 4c 20 2b 20 28 20 2d 20 28 20 2d 20 63 6f 6c 32  L + ( - ( - col2
16a80 20 29 20 29 20 46 52 4f 4d 20 74 61 62 32 20 41   ) ) FROM tab2 A
16a90 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 36  S cor0..----..26
16aa0 0d 0a 32 37 0d 0a 33 38 0d 0a 0d 0a 6f 6e 6c 79  ..27..38....only
16ab0 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f  if mysql # suppo
16ac0 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65  rt for MySQL spe
16ad0 63 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70  cific system typ
16ae0 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71  es and syntax..q
16af0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
16b00 61 62 65 6c 2d 36 32 39 0d 0a 53 45 4c 45 43 54  abel-629..SELECT
16b10 20 41 4c 4c 20 43 41 53 54 28 20 2b 20 38 35 20   ALL CAST( + 85 
16b20 41 53 20 53 49 47 4e 45 44 20 29 20 46 52 4f 4d  AS SIGNED ) FROM
16b30 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
16b40 2d 2d 2d 0d 0a 38 35 0d 0a 38 35 0d 0a 38 35 0d  ---..85..85..85.
16b50 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
16b60 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
16b70 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
16b80 74 20 6c 61 62 65 6c 2d 36 32 39 0d 0a 53 45 4c  t label-629..SEL
16b90 45 43 54 20 41 4c 4c 20 43 41 53 54 20 28 20 2b  ECT ALL CAST ( +
16ba0 20 38 35 20 41 53 20 49 4e 54 45 47 45 52 20 29   85 AS INTEGER )
16bb0 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
16bc0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 38 35 0d 0a 38 35  r0..----..85..85
16bd0 0d 0a 38 35 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  ..85....onlyif m
16be0 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66  ysql # support f
16bf0 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69  or MySQL specifi
16c00 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61  c system types a
16c10 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79  nd syntax..query
16c20 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
16c30 2d 36 33 30 0d 0a 53 45 4c 45 43 54 20 2d 20 2b  -630..SELECT - +
16c40 20 43 41 53 54 28 20 2b 20 63 6f 6c 31 20 41 53   CAST( + col1 AS
16c50 20 44 45 43 49 4d 41 4c 20 29 20 2a 20 63 6f 6c   DECIMAL ) * col
16c60 30 20 2b 20 43 41 53 54 28 20 4e 55 4c 4c 20 41  0 + CAST( NULL A
16c70 53 20 53 49 47 4e 45 44 20 29 20 2a 20 63 6f 6c  S SIGNED ) * col
16c80 30 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  0 AS col0 FROM t
16c90 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
16ca0 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e  -..NULL..NULL..N
16cb0 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  ULL....skipif my
16cc0 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
16cd0 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
16ce0 77 73 6f 72 74 20 6c 61 62 65 6c 2d 36 33 30 0d  wsort label-630.
16cf0 0a 53 45 4c 45 43 54 20 2d 20 2b 20 43 41 53 54  .SELECT - + CAST
16d00 20 28 20 2b 20 63 6f 6c 31 20 41 53 20 52 45 41   ( + col1 AS REA
16d10 4c 20 29 20 2a 20 63 6f 6c 30 20 2b 20 43 41 53  L ) * col0 + CAS
16d20 54 20 28 20 4e 55 4c 4c 20 41 53 20 49 4e 54 45  T ( NULL AS INTE
16d30 47 45 52 20 29 20 2a 20 63 6f 6c 30 20 41 53 20  GER ) * col0 AS 
16d40 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41  col0 FROM tab0 A
16d50 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55  S cor0..----..NU
16d60 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a  LL..NULL..NULL..
16d70 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
16d80 74 0d 0a 53 45 4c 45 43 54 20 28 20 2d 20 38 37  t..SELECT ( - 87
16d90 20 29 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d   ) FROM tab1..--
16da0 2d 2d 0d 0a 2d 38 37 0d 0a 2d 38 37 0d 0a 2d 38  --..-87..-87..-8
16db0 37 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74  7....skipif post
16dc0 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65  gresql # Postgre
16dd0 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20  SQL requires AS 
16de0 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75  when renaming ou
16df0 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75  tput columns..qu
16e00 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
16e10 45 4c 45 43 54 20 41 4c 4c 20 2d 20 2d 20 28 20  ELECT ALL - - ( 
16e20 63 6f 6c 30 20 29 20 2b 20 2d 20 63 6f 6c 31 20  col0 ) + - col1 
16e30 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41  col1 FROM tab1 A
16e40 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32  S cor0..----..-2
16e50 33 0d 0a 35 34 0d 0a 36 37 0d 0a 0d 0a 71 75 65  3..54..67....que
16e60 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
16e70 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 36 39  LECT DISTINCT 69
16e80 20 2b 20 2d 20 37 32 20 2b 20 2d 20 63 6f 6c 31   + - 72 + - col1
16e90 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d   FROM tab0 cor0.
16ea0 0a 2d 2d 2d 2d 0d 0a 2d 31 30 30 0d 0a 2d 38 39  .----..-100..-89
16eb0 0d 0a 2d 39 34 0d 0a 0d 0a 71 75 65 72 79 20 49  ..-94....query I
16ec0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
16ed0 20 44 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c 32   DISTINCT + col2
16ee0 20 2a 20 2d 20 35 37 20 41 53 20 63 6f 6c 30 20   * - 57 AS col0 
16ef0 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
16f00 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 34 38 32 0d 0a  0..----..-1482..
16f10 2d 31 35 33 39 0d 0a 2d 32 31 36 36 0d 0a 0d 0a  -1539..-2166....
16f20 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
16f30 0a 53 45 4c 45 43 54 20 63 6f 6c 31 20 2a 20 32  .SELECT col1 * 2
16f40 33 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  3 AS col0 FROM t
16f50 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
16f60 2d 0d 0a 31 33 35 37 0d 0a 33 39 31 0d 0a 37 31  -..1357..391..71
16f70 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  3....query I row
16f80 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
16f90 54 49 4e 43 54 20 2d 20 63 6f 6c 32 20 2a 20 2d  TINCT - col2 * -
16fa0 20 32 36 20 46 52 4f 4d 20 74 61 62 31 20 41 53   26 FROM tab1 AS
16fb0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 34 30   cor0..----..140
16fc0 34 0d 0a 31 34 38 32 0d 0a 32 34 39 36 0d 0a 0d  4..1482..2496...
16fd0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
16fe0 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63  ..SELECT ALL + c
16ff0 6f 6c 32 20 2b 20 63 6f 6c 32 20 2b 20 63 6f 6c  ol2 + col2 + col
17000 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  0 AS col2 FROM t
17010 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab1 cor0..----..
17020 31 31 31 0d 0a 31 37 38 0d 0a 32 37 32 0d 0a 0d  111..178..272...
17030 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
17040 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
17050 54 20 2d 20 2d 20 38 37 20 46 52 4f 4d 20 74 61  T - - 87 FROM ta
17060 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
17070 0d 0a 38 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..87....query I 
17080 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
17090 44 49 53 54 49 4e 43 54 20 2d 20 33 30 20 2a 20  DISTINCT - 30 * 
170a0 2d 20 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c 30 20  - col0 * + col0 
170b0 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
170c0 30 0d 0a 2d 2d 2d 2d 0d 0a 31 37 32 38 30 0d 0a  0..----..17280..
170d0 32 33 37 36 33 30 0d 0a 33 36 37 35 30 0d 0a 0d  237630..36750...
170e0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
170f0 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
17100 54 20 2b 20 2b 20 37 38 20 2a 20 2b 20 63 6f 6c  T + + 78 * + col
17110 32 20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30  2 FROM tab1 cor0
17120 0d 0a 2d 2d 2d 2d 0d 0a 34 32 31 32 0d 0a 34 34  ..----..4212..44
17130 34 36 0d 0a 37 34 38 38 0d 0a 0d 0a 6f 6e 6c 79  46..7488....only
17140 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44  if mysql # use D
17150 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20  IV operator for 
17160 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e  integer division
17170 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
17180 74 20 6c 61 62 65 6c 2d 36 34 31 0d 0a 53 45 4c  t label-641..SEL
17190 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 39  ECT DISTINCT - 9
171a0 34 20 44 49 56 20 34 39 20 46 52 4f 4d 20 74 61  4 DIV 49 FROM ta
171b0 62 32 2c 20 74 61 62 30 20 63 6f 72 30 2c 20 74  b2, tab0 cor0, t
171c0 61 62 31 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a  ab1 cor1..----..
171d0 2d 31 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  -1....skipif mys
171e0 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
171f0 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
17200 73 6f 72 74 20 6c 61 62 65 6c 2d 36 34 31 0d 0a  sort label-641..
17210 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
17220 2d 20 39 34 20 2f 20 34 39 20 46 52 4f 4d 20 74  - 94 / 49 FROM t
17230 61 62 32 2c 20 74 61 62 30 20 63 6f 72 30 2c 20  ab2, tab0 cor0, 
17240 74 61 62 31 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d  tab1 cor1..----.
17250 0a 2d 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .-1....query I r
17260 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
17270 20 63 6f 6c 31 20 2a 20 63 6f 6c 30 20 2a 20 2b   col1 * col0 * +
17280 20 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46 52   col1 AS col1 FR
17290 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
172a0 0a 2d 2d 2d 2d 0d 0a 31 33 35 32 30 0d 0a 32 30  .----..13520..20
172b0 32 38 0d 0a 36 34 30 30 0d 0a 0d 0a 6f 6e 6c 79  28..6400....only
172c0 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f  if mysql # suppo
172d0 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65  rt for MySQL spe
172e0 63 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70  cific system typ
172f0 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71  es and syntax..q
17300 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
17310 61 62 65 6c 2d 36 34 33 0d 0a 53 45 4c 45 43 54  abel-643..SELECT
17320 20 44 49 53 54 49 4e 43 54 20 43 41 53 54 28 20   DISTINCT CAST( 
17330 4e 55 4c 4c 20 41 53 20 53 49 47 4e 45 44 20 29  NULL AS SIGNED )
17340 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
17350 62 30 2c 20 74 61 62 31 20 41 53 20 63 6f 72 30  b0, tab1 AS cor0
17360 2c 20 74 61 62 31 20 41 53 20 63 6f 72 31 0d 0a  , tab1 AS cor1..
17370 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b  ----..NULL....sk
17380 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
17390 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
173a0 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
173b0 65 6c 2d 36 34 33 0d 0a 53 45 4c 45 43 54 20 44  el-643..SELECT D
173c0 49 53 54 49 4e 43 54 20 43 41 53 54 20 28 20 4e  ISTINCT CAST ( N
173d0 55 4c 4c 20 41 53 20 49 4e 54 45 47 45 52 20 29  ULL AS INTEGER )
173e0 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
173f0 62 30 2c 20 74 61 62 31 20 41 53 20 63 6f 72 30  b0, tab1 AS cor0
17400 2c 20 74 61 62 31 20 41 53 20 63 6f 72 31 0d 0a  , tab1 AS cor1..
17410 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75  ----..NULL....qu
17420 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
17430 45 4c 45 43 54 20 35 30 20 2b 20 2b 20 38 20 41  ELECT 50 + + 8 A
17440 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32  S col0 FROM tab2
17450 2c 20 74 61 62 30 20 41 53 20 63 6f 72 30 20 43  , tab0 AS cor0 C
17460 52 4f 53 53 20 4a 4f 49 4e 20 74 61 62 30 0d 0a  ROSS JOIN tab0..
17470 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75 65 73 20  ----..27 values 
17480 68 61 73 68 69 6e 67 20 74 6f 20 39 65 65 33 36  hashing to 9ee36
17490 33 63 36 61 63 31 39 63 66 64 62 38 61 35 30 63  3c6ac19cfdb8a50c
174a0 37 64 66 64 35 63 63 32 62 38 61 0d 0a 0d 0a 71  7dfd5cc2b8a....q
174b0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
174c0 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
174d0 63 6f 6c 30 20 2a 20 63 6f 72 30 2e 63 6f 6c 30  col0 * cor0.col0
174e0 20 2a 20 36 36 20 2b 20 2b 20 63 6f 6c 31 20 46   * 66 + + col1 F
174f0 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
17500 0d 0a 2d 2d 2d 2d 0d 0a 32 37 30 33 34 36 0d 0a  ..----..270346..
17510 34 32 32 34 31 33 0d 0a 36 32 30 0d 0a 0d 0a 71  422413..620....q
17520 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
17530 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 31 20  SELECT ALL col1 
17540 2a 20 63 6f 6c 32 20 2b 20 2d 20 34 32 20 41 53  * col2 + - 42 AS
17550 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20   col0 FROM tab1 
17560 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
17570 32 30 36 0d 0a 31 33 36 32 0d 0a 35 32 38 0d 0a  206..1362..528..
17580 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
17590 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53   support for MyS
175a0 51 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74  QL specific syst
175b0 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e  em types and syn
175c0 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  tax..query I row
175d0 73 6f 72 74 20 6c 61 62 65 6c 2d 36 34 37 0d 0a  sort label-647..
175e0 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 32 20  SELECT ALL col2 
175f0 2b 20 2d 20 43 41 53 54 28 20 63 6f 6c 31 20 2b  + - CAST( col1 +
17600 20 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c 32 20 41   col1 * + col2 A
17610 53 20 53 49 47 4e 45 44 20 29 20 46 52 4f 4d 20  S SIGNED ) FROM 
17620 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab0 cor0..----.
17630 0a 2d 31 39 33 0d 0a 2d 32 38 39 31 0d 0a 2d 37  .-193..-2891..-7
17640 34 37 31 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  471....skipif my
17650 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
17660 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
17670 77 73 6f 72 74 20 6c 61 62 65 6c 2d 36 34 37 0d  wsort label-647.
17680 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 32  .SELECT ALL col2
17690 20 2b 20 2d 20 43 41 53 54 20 28 20 63 6f 6c 31   + - CAST ( col1
176a0 20 2b 20 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c 32   + col1 * + col2
176b0 20 41 53 20 49 4e 54 45 47 45 52 20 29 20 46 52   AS INTEGER ) FR
176c0 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d  OM tab0 cor0..--
176d0 2d 2d 0d 0a 2d 31 39 33 0d 0a 2d 32 38 39 31 0d  --..-193..-2891.
176e0 0a 2d 37 34 37 31 0d 0a 0d 0a 73 6b 69 70 69 66  .-7471....skipif
176f0 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f   postgresql # Po
17700 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65  stgreSQL require
17710 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69  s AS when renami
17720 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e  ng output column
17730 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  s..query I rowso
17740 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b  rt..SELECT ALL +
17750 20 39 33 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   93 col1 FROM ta
17760 62 30 2c 20 74 61 62 31 20 41 53 20 63 6f 72 30  b0, tab1 AS cor0
17770 2c 20 74 61 62 30 20 41 53 20 63 6f 72 31 0d 0a  , tab0 AS cor1..
17780 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75 65 73 20  ----..27 values 
17790 68 61 73 68 69 6e 67 20 74 6f 20 38 35 65 66 31  hashing to 85ef1
177a0 39 31 62 66 31 62 33 30 37 66 33 30 30 62 33 66  91bf1b307f300b3f
177b0 64 34 39 39 39 32 66 63 61 65 37 0d 0a 0d 0a 71  d49992fcae7....q
177c0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
177d0 53 45 4c 45 43 54 20 2d 20 2b 20 63 6f 6c 31 20  SELECT - + col1 
177e0 2d 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61  - + col1 FROM ta
177f0 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
17800 0d 0a 2d 31 31 38 0d 0a 2d 33 34 0d 0a 2d 36 32  ..-118..-34..-62
17810 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
17820 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f  ort..SELECT - co
17830 6c 31 20 2d 20 38 39 20 2a 20 2b 20 63 6f 6c 32  l1 - 89 * + col2
17840 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
17850 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
17860 0d 0a 2d 34 38 33 32 0d 0a 2d 35 30 38 33 0d 0a  ..-4832..-5083..
17870 2d 38 35 35 37 0d 0a 0d 0a 71 75 65 72 79 20 49  -8557....query I
17880 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
17890 20 63 6f 6c 30 20 2a 20 63 6f 6c 32 20 2b 20 2d   col0 * col2 + -
178a0 20 63 6f 6c 30 20 2a 20 63 6f 72 30 2e 63 6f 6c   col0 * cor0.col
178b0 31 20 2b 20 63 6f 6c 32 20 41 53 20 63 6f 6c 31  1 + col2 AS col1
178c0 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
178d0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33 38 0d 0a 33  r0..----..138..3
178e0 30 36 35 0d 0a 36 37 33 36 0d 0a 0d 0a 71 75 65  065..6736....que
178f0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
17900 4c 45 43 54 20 41 4c 4c 20 2b 20 2b 20 63 6f 6c  LECT ALL + + col
17910 30 20 2a 20 2d 20 28 20 2d 20 35 39 20 2a 20 63  0 * - ( - 59 * c
17920 6f 72 30 2e 63 6f 6c 32 20 29 20 41 53 20 63 6f  or0.col2 ) AS co
17930 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 63 6f 72  l0 FROM tab2 cor
17940 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 31 35 31 0d 0a  0..----..11151..
17950 31 31 39 36 35 32 0d 0a 31 37 37 31 31 38 0d 0a  119652..177118..
17960 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
17970 74 0d 0a 53 45 4c 45 43 54 20 2b 20 38 34 20 2d  t..SELECT + 84 -
17980 20 2b 20 35 38 20 41 53 20 63 6f 6c 31 20 46 52   + 58 AS col1 FR
17990 4f 4d 20 74 61 62 30 2c 20 74 61 62 31 2c 20 74  OM tab0, tab1, t
179a0 61 62 30 20 41 53 20 63 6f 72 30 2c 20 74 61 62  ab0 AS cor0, tab
179b0 32 0d 0a 2d 2d 2d 2d 0d 0a 38 31 20 76 61 6c 75  2..----..81 valu
179c0 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 38 62  es hashing to 8b
179d0 36 61 36 32 34 65 62 39 32 66 62 30 31 39 64 39  6a624eb92fb019d9
179e0 36 36 34 33 31 38 65 35 31 39 66 30 36 32 0d 0a  664318e519f062..
179f0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
17a00 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
17a10 43 54 20 2d 20 63 6f 6c 31 20 2b 20 2d 20 28 20  CT - col1 + - ( 
17a20 63 6f 6c 32 20 29 20 41 53 20 63 6f 6c 31 20 46  col2 ) AS col1 F
17a30 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab2..----..
17a40 2d 35 35 0d 0a 2d 35 38 0d 0a 2d 38 35 0d 0a 0d  -55..-58..-85...
17a50 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
17a60 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72  use DIV operator
17a70 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76   for integer div
17a80 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72  ision..query I r
17a90 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 36 35 35  owsort label-655
17aa0 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
17ab0 54 20 2b 20 63 6f 6c 30 20 2a 20 63 6f 6c 32 20  T + col0 * col2 
17ac0 44 49 56 20 2d 20 63 6f 6c 31 20 46 52 4f 4d 20  DIV - col1 FROM 
17ad0 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
17ae0 2d 2d 0d 0a 2d 33 36 34 0d 0a 2d 35 39 30 0d 0a  --..-364..-590..
17af0 2d 36 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  -6....skipif mys
17b00 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
17b10 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
17b20 73 6f 72 74 20 6c 61 62 65 6c 2d 36 35 35 0d 0a  sort label-655..
17b30 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
17b40 2b 20 63 6f 6c 30 20 2a 20 63 6f 6c 32 20 2f 20  + col0 * col2 / 
17b50 2d 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31  - col1 FROM tab1
17b60 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
17b70 2d 33 36 34 0d 0a 2d 35 39 30 0d 0a 2d 36 0d 0a  -364..-590..-6..
17b80 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
17b90 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
17ba0 43 54 20 2b 20 2b 20 32 34 20 46 52 4f 4d 20 74  CT + + 24 FROM t
17bb0 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
17bc0 2d 0d 0a 32 34 0d 0a 0d 0a 73 6b 69 70 69 66 20  -..24....skipif 
17bd0 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73  postgresql # Pos
17be0 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73  tgreSQL requires
17bf0 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e   AS when renamin
17c00 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73  g output columns
17c10 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
17c20 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 32  t..SELECT - col2
17c30 20 2b 20 39 33 20 2a 20 2d 20 63 6f 6c 31 20 63   + 93 * - col1 c
17c40 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol1 FROM tab1 AS
17c50 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33   cor0..----..-13
17c60 30 35 0d 0a 2d 32 34 37 32 0d 0a 2d 39 38 37 0d  05..-2472..-987.
17c70 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
17c80 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 28 20 63  rt..SELECT + ( c
17c90 6f 72 30 2e 63 6f 6c 30 20 29 20 2b 20 63 6f 6c  or0.col0 ) + col
17ca0 30 20 2b 20 28 20 63 6f 6c 32 20 29 20 46 52 4f  0 + ( col2 ) FRO
17cb0 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
17cc0 2d 2d 2d 2d 0d 0a 31 38 32 0d 0a 31 39 36 0d 0a  ----..182..196..
17cd0 34 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  41....query I ro
17ce0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
17cf0 53 54 49 4e 43 54 20 2b 20 74 61 62 32 2e 63 6f  STINCT + tab2.co
17d00 6c 32 20 2b 20 2d 20 36 35 20 41 53 20 63 6f 6c  l2 + - 65 AS col
17d10 32 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d  2 FROM tab2..---
17d20 2d 0d 0a 2d 32 37 0d 0a 2d 33 38 0d 0a 2d 33 39  -..-27..-38..-39
17d30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
17d40 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
17d50 49 4e 43 54 20 74 61 62 30 2e 63 6f 6c 30 20 2b  INCT tab0.col0 +
17d60 20 2b 20 31 37 20 41 53 20 63 6f 6c 30 20 46 52   + 17 AS col0 FR
17d70 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31  OM tab0..----..1
17d80 30 36 0d 0a 34 31 0d 0a 35 32 0d 0a 0d 0a 71 75  06..41..52....qu
17d90 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
17da0 45 4c 45 43 54 20 2d 20 63 6f 6c 30 20 2a 20 2b  ELECT - col0 * +
17db0 20 63 6f 72 30 2e 63 6f 6c 32 20 2b 20 28 20 2d   cor0.col2 + ( -
17dc0 20 63 6f 6c 31 20 29 20 41 53 20 63 6f 6c 31 20   col1 ) AS col1 
17dd0 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
17de0 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 32 0d 0a 2d  0..----..-132..-
17df0 37 33 38 39 0d 0a 2d 38 37 38 0d 0a 0d 0a 71 75  7389..-878....qu
17e00 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
17e10 45 4c 45 43 54 20 63 6f 6c 32 20 2a 20 34 31 20  ELECT col2 * 41 
17e20 2b 20 2b 20 35 31 20 46 52 4f 4d 20 74 61 62 32  + + 51 FROM tab2
17e30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 31   cor0..----..111
17e40 37 0d 0a 31 31 35 38 0d 0a 31 36 30 39 0d 0a 0d  7..1158..1609...
17e50 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
17e60 0d 0a 53 45 4c 45 43 54 20 33 38 20 2a 20 74 61  ..SELECT 38 * ta
17e70 62 30 2e 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20  b0.col0 AS col2 
17e80 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d  FROM tab0..----.
17e90 0a 31 33 33 30 0d 0a 33 33 38 32 0d 0a 39 31 32  .1330..3382..912
17ea0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
17eb0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
17ec0 2d 20 2d 20 74 61 62 30 2e 63 6f 6c 30 20 41 53  - - tab0.col0 AS
17ed0 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 2c   col2 FROM tab0,
17ee0 20 74 61 62 32 2c 20 74 61 62 31 20 41 53 20 63   tab2, tab1 AS c
17ef0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61  or0..----..27 va
17f00 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20  lues hashing to 
17f10 39 66 63 31 64 63 64 37 36 66 65 61 66 34 33 65  9fc1dcd76feaf43e
17f20 35 63 35 64 63 30 36 30 61 30 32 30 31 34 63 64  5c5dc060a02014cd
17f30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
17f40 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
17f50 49 4e 43 54 20 2b 20 63 6f 6c 31 20 2b 20 35 31  INCT + col1 + 51
17f60 20 2a 20 2b 20 28 20 63 6f 6c 32 20 29 20 2a 20   * + ( col2 ) * 
17f70 2d 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32  - col0 FROM tab2
17f80 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
17f90 2d 31 30 33 33 36 39 0d 0a 2d 31 35 33 30 38 35  -103369..-153085
17fa0 0d 0a 2d 39 36 30 38 0d 0a 0d 0a 71 75 65 72 79  ..-9608....query
17fb0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
17fc0 43 54 20 2b 20 2b 20 39 38 20 46 52 4f 4d 20 74  CT + + 98 FROM t
17fd0 61 62 32 2c 20 74 61 62 32 20 41 53 20 63 6f 72  ab2, tab2 AS cor
17fe0 30 2c 20 74 61 62 30 20 41 53 20 63 6f 72 31 2c  0, tab0 AS cor1,
17ff0 20 74 61 62 30 2c 20 74 61 62 31 20 41 53 20 63   tab0, tab1 AS c
18000 6f 72 32 0d 0a 2d 2d 2d 2d 0d 0a 32 34 33 20 76  or2..----..243 v
18010 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f  alues hashing to
18020 20 64 31 33 30 30 38 36 62 38 64 38 61 31 38 61   d130086b8d8a18a
18030 33 61 63 34 39 63 65 32 33 32 31 64 33 35 65 30  3ac49ce2321d35e0
18040 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  0....query I row
18050 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2b  sort..SELECT + +
18060 20 74 61 62 30 2e 63 6f 6c 30 20 41 53 20 63 6f   tab0.col0 AS co
18070 6c 30 20 46 52 4f 4d 20 74 61 62 30 2c 20 74 61  l0 FROM tab0, ta
18080 62 32 2c 20 74 61 62 30 20 41 53 20 63 6f 72 30  b2, tab0 AS cor0
18090 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75 65  ..----..27 value
180a0 73 20 68 61 73 68 69 6e 67 20 74 6f 20 39 66 63  s hashing to 9fc
180b0 31 64 63 64 37 36 66 65 61 66 34 33 65 35 63 35  1dcd76feaf43e5c5
180c0 64 63 30 36 30 61 30 32 30 31 34 63 64 0d 0a 0d  dc060a02014cd...
180d0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
180e0 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 31 20 2a 20  ..SELECT col1 * 
180f0 63 6f 6c 32 20 2a 20 2b 20 33 35 20 46 52 4f 4d  col2 * + 35 FROM
18100 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
18110 2d 2d 2d 0d 0a 32 32 36 31 30 0d 0a 32 39 32 39  ---..22610..2929
18120 35 0d 0a 35 33 36 39 30 0d 0a 0d 0a 71 75 65 72  5..53690....quer
18130 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
18140 45 43 54 20 41 4c 4c 20 2d 20 2b 20 63 6f 6c 30  ECT ALL - + col0
18150 20 2a 20 63 6f 6c 32 20 2b 20 39 20 46 52 4f 4d   * col2 + 9 FROM
18160 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
18170 2d 2d 2d 0d 0a 2d 31 35 33 0d 0a 2d 33 36 33 39  ---..-153..-3639
18180 0d 0a 2d 37 36 37 31 0d 0a 0d 0a 73 6b 69 70 69  ..-7671....skipi
18190 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50  f postgresql # P
181a0 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72  ostgreSQL requir
181b0 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d  es AS when renam
181c0 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d  ing output colum
181d0 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ns..query I rows
181e0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
181f0 49 4e 43 54 20 2d 20 63 6f 72 30 2e 63 6f 6c 30  INCT - cor0.col0
18200 20 2b 20 2b 20 37 37 20 2b 20 37 39 20 2a 20 63   + + 77 + 79 * c
18210 6f 6c 31 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61  ol1 col1 FROM ta
18220 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
18230 0d 0a 36 38 34 37 0d 0a 37 31 37 37 0d 0a 37 37  ..6847..7177..77
18240 30 35 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  05....onlyif mys
18250 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65  ql # use DIV ope
18260 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65  rator for intege
18270 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72  r division..quer
18280 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
18290 6c 2d 36 37 31 0d 0a 53 45 4c 45 43 54 20 2b 20  l-671..SELECT + 
182a0 28 20 2b 20 63 6f 6c 32 20 29 20 44 49 56 20 63  ( + col2 ) DIV c
182b0 6f 6c 30 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61  ol0 col1 FROM ta
182c0 62 31 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 31 0d 0a  b1..----..0..1..
182d0 31 38 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73  18....skipif pos
182e0 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72  tgresql # Postgr
182f0 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53  eSQL requires AS
18300 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f   when renaming o
18310 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 73  utput columns..s
18320 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
18330 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
18340 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
18350 62 65 6c 2d 36 37 31 0d 0a 53 45 4c 45 43 54 20  bel-671..SELECT 
18360 2b 20 28 20 2b 20 63 6f 6c 32 20 29 20 2f 20 63  + ( + col2 ) / c
18370 6f 6c 30 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61  ol0 col1 FROM ta
18380 62 31 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 31 0d 0a  b1..----..0..1..
18390 31 38 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  18....onlyif mys
183a0 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65  ql # use DIV ope
183b0 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65  rator for intege
183c0 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72  r division..quer
183d0 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
183e0 6c 2d 36 37 32 0d 0a 53 45 4c 45 43 54 20 44 49  l-672..SELECT DI
183f0 53 54 49 4e 43 54 20 2b 20 63 6f 6c 30 20 2b 20  STINCT + col0 + 
18400 2b 20 63 6f 6c 32 20 44 49 56 20 63 6f 6c 31 20  + col2 DIV col1 
18410 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d  FROM tab1..----.
18420 0a 35 0d 0a 36 39 0d 0a 38 37 0d 0a 0d 0a 73 6b  .5..69..87....sk
18430 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
18440 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
18450 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
18460 65 6c 2d 36 37 32 0d 0a 53 45 4c 45 43 54 20 44  el-672..SELECT D
18470 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c 30 20 2b  ISTINCT + col0 +
18480 20 2b 20 63 6f 6c 32 20 2f 20 63 6f 6c 31 20 46   + col2 / col1 F
18490 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab1..----..
184a0 35 0d 0a 36 39 0d 0a 38 37 0d 0a 0d 0a 73 6b 69  5..69..87....ski
184b0 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23  pif postgresql #
184c0 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75   PostgreSQL requ
184d0 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e  ires AS when ren
184e0 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c  aming output col
184f0 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f  umns..query I ro
18500 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 35 20  wsort..SELECT 5 
18510 2b 20 74 61 62 30 2e 63 6f 6c 31 20 63 6f 6c 32  + tab0.col1 col2
18520 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d   FROM tab0..----
18530 0d 0a 31 30 32 0d 0a 39 31 0d 0a 39 36 0d 0a 0d  ..102..91..96...
18540 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
18550 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72  use DIV operator
18560 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76   for integer div
18570 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72  ision..query I r
18580 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 36 37 34  owsort label-674
18590 0d 0a 53 45 4c 45 43 54 20 2d 20 33 39 20 44 49  ..SELECT - 39 DI
185a0 56 20 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46  V col0 AS col2 F
185b0 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab2..----..
185c0 2d 35 0d 0a 30 0d 0a 30 0d 0a 0d 0a 73 6b 69 70  -5..0..0....skip
185d0 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
185e0 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..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 34 0d 0a 53 45 4c 45 43 54 20 2d 20 33  -674..SELECT - 3
18610 39 20 2f 20 63 6f 6c 30 20 41 53 20 63 6f 6c 32  9 / col0 AS col2
18620 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d   FROM tab2..----
18630 0d 0a 2d 35 0d 0a 30 0d 0a 30 0d 0a 0d 0a 71 75  ..-5..0..0....qu
18640 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
18650 45 4c 45 43 54 20 63 6f 6c 30 20 2b 20 2b 20 74  ELECT col0 + + t
18660 61 62 31 2e 63 6f 6c 32 20 2b 20 63 6f 6c 30 20  ab1.col2 + col0 
18670 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d  FROM tab1..----.
18680 0a 31 38 35 0d 0a 32 35 36 0d 0a 36 30 0d 0a 0d  .185..256..60...
18690 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
186a0 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
186b0 54 20 2b 20 63 6f 6c 30 20 2b 20 32 36 20 46 52  T + col0 + 26 FR
186c0 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31  OM tab1..----..1
186d0 30 36 0d 0a 32 39 0d 0a 39 30 0d 0a 0d 0a 6f 6e  06..29..90....on
186e0 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
186f0 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
18700 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
18710 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
18720 6f 72 74 20 6c 61 62 65 6c 2d 36 37 37 0d 0a 53  ort label-677..S
18730 45 4c 45 43 54 20 2b 20 63 6f 6c 30 20 2a 20 2b  ELECT + col0 * +
18740 20 74 61 62 31 2e 63 6f 6c 32 20 2a 20 63 6f 6c   tab1.col2 * col
18750 32 20 2b 20 2d 20 63 6f 6c 32 20 44 49 56 20 2b  2 + - col2 DIV +
18760 20 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46 52   col1 AS col2 FR
18770 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 32  OM tab1..----..2
18780 30 37 39 33 31 0d 0a 37 33 37 32 37 33 0d 0a 38  07931..737273..8
18790 37 34 36 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  746....skipif my
187a0 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
187b0 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
187c0 77 73 6f 72 74 20 6c 61 62 65 6c 2d 36 37 37 0d  wsort label-677.
187d0 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 30 20 2a  .SELECT + col0 *
187e0 20 2b 20 74 61 62 31 2e 63 6f 6c 32 20 2a 20 63   + tab1.col2 * c
187f0 6f 6c 32 20 2b 20 2d 20 63 6f 6c 32 20 2f 20 2b  ol2 + - col2 / +
18800 20 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46 52   col1 AS col2 FR
18810 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 32  OM tab1..----..2
18820 30 37 39 33 31 0d 0a 37 33 37 32 37 33 0d 0a 38  07931..737273..8
18830 37 34 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  746....query I r
18840 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
18850 4c 4c 20 2d 20 28 20 63 6f 72 30 2e 63 6f 6c 32  LL - ( cor0.col2
18860 20 29 20 2b 20 2b 20 63 6f 6c 32 20 2a 20 2d 20   ) + + col2 * - 
18870 35 39 20 2b 20 2b 20 63 6f 6c 32 20 46 52 4f 4d  59 + + col2 FROM
18880 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab2 cor0..----
18890 0d 0a 2d 31 35 33 34 0d 0a 2d 31 35 39 33 0d 0a  ..-1534..-1593..
188a0 2d 32 32 34 32 0d 0a 0d 0a 71 75 65 72 79 20 49  -2242....query I
188b0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
188c0 20 41 4c 4c 20 2d 20 34 20 2a 20 2b 20 63 6f 72   ALL - 4 * + cor
188d0 30 2e 63 6f 6c 32 20 2b 20 63 6f 72 30 2e 63 6f  0.col2 + cor0.co
188e0 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l2 FROM tab0 AS 
188f0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 34 36  cor0..----..-246
18900 0d 0a 2d 33 0d 0a 2d 39 39 0d 0a 0d 0a 73 6b 69  ..-3..-99....ski
18910 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23  pif postgresql #
18920 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75   PostgreSQL requ
18930 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e  ires AS when ren
18940 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c  aming output col
18950 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f  umns..query I ro
18960 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
18970 63 6f 6c 32 20 2d 20 39 20 63 6f 6c 32 20 46 52  col2 - 9 col2 FR
18980 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
18990 0a 2d 2d 2d 2d 0d 0a 2d 33 35 0d 0a 2d 33 36 0d  .----..-35..-36.
189a0 0a 2d 34 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .-47....query I 
189b0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
189c0 2b 20 2b 20 63 6f 6c 32 20 2a 20 63 6f 6c 30 20  + + col2 * col0 
189d0 2b 20 63 6f 6c 31 20 2a 20 2d 20 30 20 2a 20 2b  + col1 * - 0 * +
189e0 20 63 6f 6c 31 20 2d 20 2b 20 63 6f 6c 31 20 41   col1 - + col1 A
189f0 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32  S col0 FROM tab2
18a00 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
18a10 31 35 38 0d 0a 31 39 36 39 0d 0a 32 39 38 35 0d  158..1969..2985.
18a20 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
18a30 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d  rt..SELECT ALL -
18a40 20 28 20 36 35 20 29 20 41 53 20 63 6f 6c 30 20   ( 65 ) AS col0 
18a50 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
18a60 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 36 35 0d 0a 2d 36  0..----..-65..-6
18a70 35 0d 0a 2d 36 35 0d 0a 0d 0a 71 75 65 72 79 20  5..-65....query 
18a80 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
18a90 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c  T DISTINCT + col
18aa0 32 20 2b 20 63 6f 6c 32 20 2a 20 63 6f 6c 31 20  2 + col2 * col1 
18ab0 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
18ac0 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
18ad0 0a 31 35 36 30 0d 0a 36 38 34 0d 0a 38 36 34 0d  .1560..684..864.
18ae0 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
18af0 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79  # support for My
18b00 53 51 4c 20 73 70 65 63 69 66 69 63 20 73 79 73  SQL specific sys
18b10 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79  tem types and sy
18b20 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f  ntax..query I ro
18b30 77 73 6f 72 74 20 6c 61 62 65 6c 2d 36 38 34 0d  wsort label-684.
18b40 0a 53 45 4c 45 43 54 20 2b 20 43 41 53 54 28 20  .SELECT + CAST( 
18b50 2d 20 28 20 63 6f 6c 30 20 29 20 41 53 20 53 49  - ( col0 ) AS SI
18b60 47 4e 45 44 20 29 20 2f 20 43 41 53 54 28 20 4e  GNED ) / CAST( N
18b70 55 4c 4c 20 41 53 20 44 45 43 49 4d 41 4c 20 29  ULL AS DECIMAL )
18b80 20 2b 20 2d 20 63 6f 6c 32 20 63 6f 6c 31 20 46   + - col2 col1 F
18b90 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d  ROM tab1 cor0..-
18ba0 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d  ---..NULL..NULL.
18bb0 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20  .NULL....skipif 
18bc0 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73  postgresql # Pos
18bd0 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73  tgreSQL requires
18be0 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e   AS when renamin
18bf0 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73  g output columns
18c00 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
18c10 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
18c20 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
18c30 20 6c 61 62 65 6c 2d 36 38 34 0d 0a 53 45 4c 45   label-684..SELE
18c40 43 54 20 2b 20 43 41 53 54 20 28 20 2d 20 28 20  CT + CAST ( - ( 
18c50 63 6f 6c 30 20 29 20 41 53 20 49 4e 54 45 47 45  col0 ) AS INTEGE
18c60 52 20 29 20 2f 20 43 41 53 54 20 28 20 4e 55 4c  R ) / CAST ( NUL
18c70 4c 20 41 53 20 52 45 41 4c 20 29 20 2b 20 2d 20  L AS REAL ) + - 
18c80 63 6f 6c 32 20 63 6f 6c 31 20 46 52 4f 4d 20 74  col2 col1 FROM t
18c90 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab1 cor0..----..
18ca0 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c  NULL..NULL..NULL
18cb0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
18cc0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
18cd0 49 4e 43 54 20 2b 20 34 37 20 2a 20 63 6f 6c 32  INCT + 47 * col2
18ce0 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
18cf0 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
18d00 0d 0a 31 35 35 31 0d 0a 33 38 35 34 0d 0a 34 37  ..1551..3854..47
18d10 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
18d20 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61   # use DIV opera
18d30 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20  tor for integer 
18d40 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20  division..query 
18d50 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
18d60 36 38 36 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  686..SELECT DIST
18d70 49 4e 43 54 20 2b 20 63 6f 6c 31 20 2b 20 2b 20  INCT + col1 + + 
18d80 63 6f 72 30 2e 63 6f 6c 32 20 2b 20 63 6f 6c 31  cor0.col2 + col1
18d90 20 44 49 56 20 63 6f 6c 31 20 41 53 20 63 6f 6c   DIV col1 AS col
18da0 32 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30  2 FROM tab0 cor0
18db0 0d 0a 2d 2d 2d 2d 0d 0a 31 32 30 0d 0a 31 37 34  ..----..120..174
18dc0 0d 0a 39 39 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  ..99....skipif m
18dd0 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
18de0 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
18df0 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 36 38 36  owsort label-686
18e00 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
18e10 54 20 2b 20 63 6f 6c 31 20 2b 20 2b 20 63 6f 72  T + col1 + + cor
18e20 30 2e 63 6f 6c 32 20 2b 20 63 6f 6c 31 20 2f 20  0.col2 + col1 / 
18e30 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46 52 4f  col1 AS col2 FRO
18e40 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab0 cor0..---
18e50 2d 0d 0a 31 32 30 0d 0a 31 37 34 0d 0a 39 39 0d  -..120..174..99.
18e60 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
18e70 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74  # use DIV operat
18e80 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64  or for integer d
18e90 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49  ivision..query I
18ea0 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 36   rowsort label-6
18eb0 38 37 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d  87..SELECT ALL -
18ec0 20 37 35 20 44 49 56 20 63 6f 6c 30 20 2d 20 63   75 DIV col0 - c
18ed0 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  ol2 AS col1 FROM
18ee0 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
18ef0 2d 2d 2d 0d 0a 2d 35 38 0d 0a 2d 37 39 0d 0a 2d  ---..-58..-79..-
18f00 39 36 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  96....skipif mys
18f10 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
18f20 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
18f30 73 6f 72 74 20 6c 61 62 65 6c 2d 36 38 37 0d 0a  sort label-687..
18f40 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 37 35 20  SELECT ALL - 75 
18f50 2f 20 63 6f 6c 30 20 2d 20 63 6f 6c 32 20 41 53  / col0 - col2 AS
18f60 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20   col1 FROM tab1 
18f70 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
18f80 35 38 0d 0a 2d 37 39 0d 0a 2d 39 36 0d 0a 0d 0a  58..-79..-96....
18f90 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
18fa0 0a 53 45 4c 45 43 54 20 39 37 20 2a 20 63 6f 6c  .SELECT 97 * col
18fb0 30 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c 30  0 + col1 AS col0
18fc0 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
18fd0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 34 31 34 0d 0a  r0..----..2414..
18fe0 33 34 39 32 0d 0a 38 37 32 34 0d 0a 0d 0a 71 75  3492..8724....qu
18ff0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
19000 45 4c 45 43 54 20 2b 20 63 6f 6c 31 20 2a 20 2b  ELECT + col1 * +
19010 20 63 6f 72 30 2e 63 6f 6c 31 20 2a 20 37 32 20   cor0.col1 * 72 
19020 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a  FROM tab1 cor0..
19030 2d 2d 2d 2d 0d 0a 31 32 31 36 38 0d 0a 34 38 36  ----..12168..486
19040 37 32 0d 0a 37 32 30 30 0d 0a 0d 0a 71 75 65 72  72..7200....quer
19050 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
19060 45 43 54 20 41 4c 4c 20 63 6f 72 30 2e 63 6f 6c  ECT ALL cor0.col
19070 30 20 2a 20 2d 20 63 6f 6c 31 20 2a 20 63 6f 6c  0 * - col1 * col
19080 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  1 FROM tab0 AS c
19090 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 37 37 35  or0..----..-1775
190a0 30 34 0d 0a 2d 33 32 39 33 31 35 0d 0a 2d 37 33  04..-329315..-73
190b0 37 30 30 39 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  7009....onlyif m
190c0 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66  ysql # support f
190d0 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69  or MySQL specifi
190e0 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61  c system types a
190f0 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79  nd syntax..query
19100 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
19110 2d 36 39 31 0d 0a 53 45 4c 45 43 54 20 63 6f 6c  -691..SELECT col
19120 31 20 2a 20 2b 20 63 6f 6c 30 20 2b 20 2d 20 43  1 * + col0 + - C
19130 41 53 54 28 20 4e 55 4c 4c 20 41 53 20 53 49 47  AST( NULL AS SIG
19140 4e 45 44 20 29 20 41 53 20 63 6f 6c 31 20 46 52  NED ) AS col1 FR
19150 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d  OM tab2 cor0..--
19160 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a  --..NULL..NULL..
19170 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  NULL....skipif m
19180 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
19190 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
191a0 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 36 39 31  owsort label-691
191b0 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 31 20 2a 20  ..SELECT col1 * 
191c0 2b 20 63 6f 6c 30 20 2b 20 2d 20 43 41 53 54 20  + col0 + - CAST 
191d0 28 20 4e 55 4c 4c 20 41 53 20 49 4e 54 45 47 45  ( NULL AS INTEGE
191e0 52 20 29 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  R ) AS col1 FROM
191f0 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab2 cor0..----
19200 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55  ..NULL..NULL..NU
19210 4c 4c 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  LL....query I ro
19220 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
19230 53 54 49 4e 43 54 20 2b 20 63 6f 6c 30 20 2b 20  STINCT + col0 + 
19240 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46 52 4f  col1 AS col1 FRO
19250 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab0 cor0..---
19260 2d 0d 0a 31 31 30 0d 0a 31 33 32 0d 0a 31 38 30  -..110..132..180
19270 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67  ....skipif postg
19280 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53  resql # PostgreS
19290 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77  QL requires AS w
192a0 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74  hen renaming out
192b0 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65  put columns..que
192c0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
192d0 4c 45 43 54 20 63 6f 6c 32 20 2a 20 63 6f 6c 30  LECT col2 * col0
192e0 20 2b 20 63 6f 6c 32 20 63 6f 6c 31 20 46 52 4f   + col2 col1 FRO
192f0 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
19300 2d 2d 2d 2d 0d 0a 33 36 0d 0a 37 33 38 30 0d 0a  ----..36..7380..
19310 38 32 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  825....query I r
19320 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
19330 49 53 54 49 4e 43 54 20 32 38 20 2a 20 63 6f 6c  ISTINCT 28 * col
19340 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  2 AS col2 FROM t
19350 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
19360 2d 0d 0a 31 30 36 34 0d 0a 37 32 38 0d 0a 37 35  -..1064..728..75
19370 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  6....query I row
19380 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
19390 20 2b 20 2d 20 63 6f 6c 32 20 2a 20 63 6f 72 30   + - col2 * cor0
193a0 2e 63 6f 6c 30 20 2d 20 2b 20 63 6f 6c 32 20 41  .col0 - + col2 A
193b0 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31  S col1 FROM tab1
193c0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
193d0 2d 32 31 36 0d 0a 2d 33 37 30 35 0d 0a 2d 37 37  -216..-3705..-77
193e0 37 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  76....query I ro
193f0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
19400 31 33 20 2a 20 2d 20 63 6f 6c 31 20 41 53 20 63  13 * - col1 AS c
19410 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 63 6f  ol1 FROM tab1 co
19420 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 30 0d 0a  r0..----..-130..
19430 2d 31 36 39 0d 0a 2d 33 33 38 0d 0a 0d 0a 71 75  -169..-338....qu
19440 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
19450 45 4c 45 43 54 20 41 4c 4c 20 2b 20 74 61 62 30  ELECT ALL + tab0
19460 2e 63 6f 6c 32 20 2b 20 74 61 62 30 2e 63 6f 6c  .col2 + tab0.col
19470 30 20 2a 20 63 6f 6c 32 20 41 53 20 63 6f 6c 31  0 * col2 AS col1
19480 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d   FROM tab0..----
19490 0d 0a 33 36 0d 0a 37 33 38 30 0d 0a 38 32 35 0d  ..36..7380..825.
194a0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
194b0 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b  rt..SELECT ALL +
194c0 20 37 39 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20   79 + col1 FROM 
194d0 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 36 35 0d  tab0..----..165.
194e0 0a 31 37 30 0d 0a 31 37 36 0d 0a 0d 0a 71 75 65  .170..176....que
194f0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
19500 4c 45 43 54 20 2b 20 63 6f 6c 30 20 2b 20 2b 20  LECT + col0 + + 
19510 63 6f 6c 30 20 2a 20 63 6f 6c 32 20 2a 20 63 6f  col0 * col2 * co
19520 6c 32 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  l2 AS col0 FROM 
19530 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
19540 2d 2d 0d 0a 31 31 34 31 35 35 0d 0a 35 31 31 30  --..114155..5110
19550 0d 0a 35 32 38 30 36 0d 0a 0d 0a 6f 6e 6c 79 69  ..52806....onlyi
19560 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49  f mysql # use DI
19570 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69  V operator for i
19580 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d  nteger division.
19590 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
195a0 20 6c 61 62 65 6c 2d 37 30 30 0d 0a 53 45 4c 45   label-700..SELE
195b0 43 54 20 2b 20 63 6f 6c 32 20 44 49 56 20 63 6f  CT + col2 DIV co
195c0 6c 30 20 2d 20 63 6f 6c 30 20 2a 20 35 39 20 41  l0 - col0 * 59 A
195d0 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31  S col0 FROM tab1
195e0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 35   cor0..----..-15
195f0 39 0d 0a 2d 33 37 37 36 0d 0a 2d 34 37 31 39 0d  9..-3776..-4719.
19600 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
19610 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
19620 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
19630 74 20 6c 61 62 65 6c 2d 37 30 30 0d 0a 53 45 4c  t label-700..SEL
19640 45 43 54 20 2b 20 63 6f 6c 32 20 2f 20 63 6f 6c  ECT + col2 / col
19650 30 20 2d 20 63 6f 6c 30 20 2a 20 35 39 20 41 53  0 - col0 * 59 AS
19660 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20   col0 FROM tab1 
19670 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 35 39  cor0..----..-159
19680 0d 0a 2d 33 37 37 36 0d 0a 2d 34 37 31 39 0d 0a  ..-3776..-4719..
19690 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
196a0 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20  t..SELECT ALL - 
196b0 28 20 2b 20 63 6f 6c 32 20 2b 20 63 6f 6c 32 20  ( + col2 + col2 
196c0 29 20 2a 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30  ) * col0 AS col0
196d0 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d   FROM tab0..----
196e0 0d 0a 2d 31 34 35 39 36 0d 0a 2d 31 35 38 34 0d  ..-14596..-1584.
196f0 0a 2d 37 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .-70....query I 
19700 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
19710 2d 20 63 6f 6c 32 20 2d 20 2b 20 63 6f 72 30 2e  - col2 - + cor0.
19720 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 63  col0 FROM tab1 c
19730 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32 31 0d  or0..----..-121.
19740 0a 2d 31 37 36 0d 0a 2d 35 37 0d 0a 0d 0a 71 75  .-176..-57....qu
19750 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
19760 45 4c 45 43 54 20 2d 20 2b 20 63 6f 6c 30 20 2b  ELECT - + col0 +
19770 20 63 6f 72 30 2e 63 6f 6c 32 20 2a 20 28 20 2d   cor0.col2 * ( -
19780 20 63 6f 6c 30 20 29 20 46 52 4f 4d 20 74 61 62   col0 ) FROM tab
19790 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
197a0 0a 2d 31 39 36 0d 0a 2d 32 31 30 36 0d 0a 2d 33  .-196..-2106..-3
197b0 30 38 31 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f  081....skipif po
197c0 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67  stgresql # Postg
197d0 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41  reSQL requires A
197e0 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20  S when renaming 
197f0 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a  output columns..
19800 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
19810 0a 53 45 4c 45 43 54 20 2b 20 35 34 20 63 6f 6c  .SELECT + 54 col
19820 30 20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30  0 FROM tab1 cor0
19830 0d 0a 2d 2d 2d 2d 0d 0a 35 34 0d 0a 35 34 0d 0a  ..----..54..54..
19840 35 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  54....query I ro
19850 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f  wsort..SELECT co
19860 72 30 2e 63 6f 6c 31 20 2b 20 2b 20 32 34 20 2b  r0.col1 + + 24 +
19870 20 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46 52   col0 AS col1 FR
19880 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
19890 0a 2d 2d 2d 2d 0d 0a 31 33 34 0d 0a 31 35 36 0d  .----..134..156.
198a0 0a 32 30 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .204....query I 
198b0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
198c0 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 72 30 2e  DISTINCT - cor0.
198d0 63 6f 6c 30 20 2b 20 2b 20 28 20 2b 20 63 6f 6c  col0 + + ( + col
198e0 30 20 29 20 2a 20 2d 20 63 6f 6c 32 20 46 52 4f  0 ) * - col2 FRO
198f0 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
19900 2d 2d 2d 2d 0d 0a 2d 37 30 0d 0a 2d 37 33 38 37  ----..-70..-7387
19910 0d 0a 2d 38 31 36 0d 0a 0d 0a 6f 6e 6c 79 69 66  ..-816....onlyif
19920 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74   mysql # support
19930 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69   for MySQL speci
19940 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73  fic system types
19950 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65   and syntax..que
19960 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
19970 65 6c 2d 37 30 37 0d 0a 53 45 4c 45 43 54 20 2b  el-707..SELECT +
19980 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 2a 20 2b   + cor0.col2 * +
19990 20 43 41 53 54 28 20 4e 55 4c 4c 20 41 53 20 53   CAST( NULL AS S
199a0 49 47 4e 45 44 20 29 20 41 53 20 63 6f 6c 32 20  IGNED ) AS col2 
199b0 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
199c0 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e  0..----..NULL..N
199d0 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69  ULL..NULL....ski
199e0 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
199f0 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
19a00 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
19a10 6c 2d 37 30 37 0d 0a 53 45 4c 45 43 54 20 2b 20  l-707..SELECT + 
19a20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 2a 20 2b 20  + cor0.col2 * + 
19a30 43 41 53 54 20 28 20 4e 55 4c 4c 20 41 53 20 49  CAST ( NULL AS I
19a40 4e 54 45 47 45 52 20 29 20 41 53 20 63 6f 6c 32  NTEGER ) AS col2
19a50 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
19a60 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a  r0..----..NULL..
19a70 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75  NULL..NULL....qu
19a80 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
19a90 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d  ELECT DISTINCT -
19aa0 20 2d 20 63 6f 72 30 2e 63 6f 6c 31 20 2a 20 63   - cor0.col1 * c
19ab0 6f 6c 31 20 2b 20 2b 20 36 38 20 41 53 20 63 6f  ol1 + + 68 AS co
19ac0 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l2 FROM tab2 AS 
19ad0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 32 39  cor0..----..1029
19ae0 0d 0a 33 35 34 39 0d 0a 33 35 37 0d 0a 0d 0a 73  ..3549..357....s
19af0 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c  kipif postgresql
19b00 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65   # PostgreSQL re
19b10 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72  quires AS when r
19b20 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63  enaming output c
19b30 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20  olumns..query I 
19b40 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
19b50 63 6f 6c 32 20 2a 20 63 6f 6c 30 20 2a 20 2d 20  col2 * col0 * - 
19b60 63 6f 6c 31 20 2b 20 2b 20 63 6f 6c 30 20 63 6f  col1 + + col0 co
19b70 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 63 6f 72  l2 FROM tab2 cor
19b80 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 39 35 37 34  0..----..-119574
19b90 0d 0a 2d 35 30 39 35 35 0d 0a 2d 35 38 35 32 0d  ..-50955..-5852.
19ba0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
19bb0 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c  rt..SELECT + col
19bc0 30 20 2a 20 2b 20 74 61 62 30 2e 63 6f 6c 30 20  0 * + tab0.col0 
19bd0 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
19be0 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 32 35 0d 0a 35  0..----..1225..5
19bf0 37 36 0d 0a 37 39 32 31 0d 0a 0d 0a 6f 6e 6c 79  76..7921....only
19c00 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f  if mysql # suppo
19c10 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65  rt for MySQL spe
19c20 63 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70  cific system typ
19c30 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71  es and syntax..q
19c40 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
19c50 61 62 65 6c 2d 37 31 31 0d 0a 53 45 4c 45 43 54  abel-711..SELECT
19c60 20 41 4c 4c 20 28 20 63 6f 6c 31 20 29 20 2a 20   ALL ( col1 ) * 
19c70 43 41 53 54 28 20 63 6f 6c 30 20 2a 20 63 6f 6c  CAST( col0 * col
19c80 32 20 41 53 20 53 49 47 4e 45 44 20 29 20 46 52  2 AS SIGNED ) FR
19c90 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 33  OM tab1..----..3
19ca0 36 34 38 30 0d 0a 34 32 31 32 0d 0a 39 39 38 34  6480..4212..9984
19cb0 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  0....skipif mysq
19cc0 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
19cd0 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
19ce0 6f 72 74 20 6c 61 62 65 6c 2d 37 31 31 0d 0a 53  ort label-711..S
19cf0 45 4c 45 43 54 20 41 4c 4c 20 28 20 63 6f 6c 31  ELECT ALL ( col1
19d00 20 29 20 2a 20 43 41 53 54 20 28 20 63 6f 6c 30   ) * CAST ( col0
19d10 20 2a 20 63 6f 6c 32 20 41 53 20 49 4e 54 45 47   * col2 AS INTEG
19d20 45 52 20 29 20 46 52 4f 4d 20 74 61 62 31 0d 0a  ER ) FROM tab1..
19d30 2d 2d 2d 2d 0d 0a 33 36 34 38 30 0d 0a 34 32 31  ----..36480..421
19d40 32 0d 0a 39 39 38 34 30 0d 0a 0d 0a 6f 6e 6c 79  2..99840....only
19d50 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44  if mysql # use D
19d60 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20  IV operator for 
19d70 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e  integer division
19d80 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
19d90 74 20 6c 61 62 65 6c 2d 37 31 32 0d 0a 53 45 4c  t label-712..SEL
19da0 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 39  ECT DISTINCT + 9
19db0 36 20 44 49 56 20 2b 20 63 6f 6c 32 20 41 53 20  6 DIV + col2 AS 
19dc0 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a  col0 FROM tab0..
19dd0 2d 2d 2d 2d 0d 0a 31 0d 0a 32 0d 0a 39 36 0d 0a  ----..1..2..96..
19de0 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
19df0 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
19e00 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
19e10 20 6c 61 62 65 6c 2d 37 31 32 0d 0a 53 45 4c 45   label-712..SELE
19e20 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 39 36  CT DISTINCT + 96
19e30 20 2f 20 2b 20 63 6f 6c 32 20 41 53 20 63 6f 6c   / + col2 AS col
19e40 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d  0 FROM tab0..---
19e50 2d 0d 0a 31 0d 0a 32 0d 0a 39 36 0d 0a 0d 0a 71  -..1..2..96....q
19e60 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
19e70 53 45 4c 45 43 54 20 74 61 62 30 2e 63 6f 6c 30  SELECT tab0.col0
19e80 20 46 52 4f 4d 20 74 61 62 30 2c 20 74 61 62 32   FROM tab0, tab2
19e90 2c 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d  , tab0 cor0..---
19ea0 2d 0d 0a 32 37 20 76 61 6c 75 65 73 20 68 61 73  -..27 values has
19eb0 68 69 6e 67 20 74 6f 20 39 66 63 31 64 63 64 37  hing to 9fc1dcd7
19ec0 36 66 65 61 66 34 33 65 35 63 35 64 63 30 36 30  6feaf43e5c5dc060
19ed0 61 30 32 30 31 34 63 64 0d 0a 0d 0a 73 6b 69 70  a02014cd....skip
19ee0 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20  if postgresql # 
19ef0 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69  PostgreSQL requi
19f00 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61  res AS when rena
19f10 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75  ming output colu
19f20 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  mns..query I row
19f30 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 39  sort..SELECT - 9
19f40 37 20 2b 20 32 38 20 63 6f 6c 32 20 46 52 4f 4d  7 + 28 col2 FROM
19f50 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
19f60 2d 2d 2d 0d 0a 2d 36 39 0d 0a 2d 36 39 0d 0a 2d  ---..-69..-69..-
19f70 36 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  69....query I ro
19f80 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
19f90 2d 20 34 31 20 2a 20 39 33 20 41 53 20 63 6f 6c  - 41 * 93 AS col
19fa0 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  1 FROM tab1 AS c
19fb0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 38 31 33 0d  or0..----..3813.
19fc0 0a 33 38 31 33 0d 0a 33 38 31 33 0d 0a 0d 0a 71  .3813..3813....q
19fd0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
19fe0 53 45 4c 45 43 54 20 2b 20 28 20 2b 20 63 6f 6c  SELECT + ( + col
19ff0 32 20 29 20 2a 20 63 6f 72 30 2e 63 6f 6c 30 20  2 ) * cor0.col0 
1a000 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
1a010 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
1a020 0a 31 36 32 0d 0a 33 36 34 38 0d 0a 37 36 38 30  .162..3648..7680
1a030 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
1a040 6f 72 74 0d 0a 53 45 4c 45 43 54 20 28 20 2d 20  ort..SELECT ( - 
1a050 63 6f 6c 32 20 29 20 2b 20 63 6f 6c 30 20 2a 20  col2 ) + col0 * 
1a060 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41  col0 FROM tab0 A
1a070 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32  S cor0..----..12
1a080 32 34 0d 0a 35 34 33 0d 0a 37 38 33 39 0d 0a 0d  24..543..7839...
1a090 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73  .skipif postgres
1a0a0 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20  ql # PostgreSQL 
1a0b0 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e  requires AS when
1a0c0 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74   renaming output
1a0d0 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20   columns..query 
1a0e0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
1a0f0 54 20 44 49 53 54 49 4e 43 54 20 33 32 20 63 6f  T DISTINCT 32 co
1a100 6c 32 20 46 52 4f 4d 20 74 61 62 30 2c 20 74 61  l2 FROM tab0, ta
1a110 62 30 20 41 53 20 63 6f 72 30 2c 20 74 61 62 31  b0 AS cor0, tab1
1a120 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a   AS cor1..----..
1a130 33 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  32....query I ro
1a140 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
1a150 63 6f 6c 31 20 2b 20 2d 20 63 6f 72 30 2e 63 6f  col1 + - cor0.co
1a160 6c 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  l0 AS col2 FROM 
1a170 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab1 cor0..----.
1a180 0a 2d 35 34 0d 0a 2d 36 37 0d 0a 32 33 0d 0a 0d  .-54..-67..23...
1a190 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1a1a0 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 34  ..SELECT ALL + 4
1a1b0 32 20 2a 20 37 34 20 41 53 20 63 6f 6c 30 20 46  2 * 74 AS col0 F
1a1c0 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab1..----..
1a1d0 33 31 30 38 0d 0a 33 31 30 38 0d 0a 33 31 30 38  3108..3108..3108
1a1e0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
1a1f0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
1a200 32 38 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  28 AS col2 FROM 
1a210 74 61 62 32 2c 20 74 61 62 31 20 41 53 20 63 6f  tab2, tab1 AS co
1a220 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75  r0..----..9 valu
1a230 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 61 61  es hashing to aa
1a240 64 33 32 32 33 32 63 34 32 38 62 33 65 63 62 35  d32232c428b3ecb5
1a250 61 64 61 36 33 66 37 65 39 62 30 61 39 37 0d 0a  ada63f7e9b0a97..
1a260 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1a270 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
1a280 43 54 20 34 31 20 2a 20 2d 20 63 6f 6c 32 20 46  CT 41 * - col2 F
1a290 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
1a2a0 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 32 31 34 0d 0a 2d  ..----..-2214..-
1a2b0 32 33 33 37 0d 0a 2d 33 39 33 36 0d 0a 0d 0a 71  2337..-3936....q
1a2c0 75 65 72 79 20 49 49 49 49 49 49 49 49 49 49 49  uery IIIIIIIIIII
1a2d0 49 49 49 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  IIII rowsort..SE
1a2e0 4c 45 43 54 20 41 4c 4c 20 2a 20 46 52 4f 4d 20  LECT ALL * FROM 
1a2f0 74 61 62 32 2c 20 74 61 62 32 20 41 53 20 63 6f  tab2, tab2 AS co
1a300 72 30 20 43 52 4f 53 53 20 4a 4f 49 4e 20 74 61  r0 CROSS JOIN ta
1a310 62 31 2c 20 74 61 62 31 20 41 53 20 63 6f 72 31  b1, tab1 AS cor1
1a320 2c 20 74 61 62 31 20 63 6f 72 32 0d 0a 2d 2d 2d  , tab1 cor2..---
1a330 2d 0d 0a 33 36 34 35 20 76 61 6c 75 65 73 20 68  -..3645 values h
1a340 61 73 68 69 6e 67 20 74 6f 20 34 34 35 34 35 61  ashing to 44545a
1a350 36 32 39 37 61 61 32 39 62 62 37 33 30 66 66 62  6297aa29bb730ffb
1a360 39 30 37 63 31 33 62 63 35 38 0d 0a 0d 0a 71 75  907c13bc58....qu
1a370 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
1a380 45 4c 45 43 54 20 63 6f 6c 31 20 2b 20 2b 20 63  ELECT col1 + + c
1a390 6f 6c 31 20 2a 20 63 6f 6c 30 20 2a 20 63 6f 6c  ol1 * col0 * col
1a3a0 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  1 FROM tab2 AS c
1a3b0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 32 38 34 38  or0..----..22848
1a3c0 0d 0a 32 37 31 35 37 37 0d 0a 36 37 35 38 0d 0a  ..271577..6758..
1a3d0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1a3e0 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 31 20 2b  t..SELECT col1 +
1a3f0 20 2b 20 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c 31   + col1 * + col1
1a400 20 2a 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c   * + col1 AS col
1a410 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  0 FROM tab0 AS c
1a420 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 36 33 36 31 34  or0..----..63614
1a430 32 0d 0a 37 35 33 36 36 32 0d 0a 39 31 32 37 37  2..753662..91277
1a440 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  0....query I row
1a450 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
1a460 20 2d 20 63 6f 6c 32 20 2b 20 2b 20 63 6f 72 30   - col2 + + cor0
1a470 2e 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20  .col0 FROM tab1 
1a480 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 36 0d  cor0..----..-16.
1a490 0a 2d 35 31 0d 0a 37 0d 0a 0d 0a 71 75 65 72 79  .-51..7....query
1a4a0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
1a4b0 43 54 20 41 4c 4c 20 2b 20 2d 20 63 6f 6c 32 20  CT ALL + - col2 
1a4c0 2a 20 63 6f 72 30 2e 63 6f 6c 31 20 2d 20 2d 20  * cor0.col1 - - 
1a4d0 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46 52 4f  col1 AS col2 FRO
1a4e0 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
1a4f0 2d 2d 2d 2d 0d 0a 2d 32 37 35 32 0d 0a 2d 37 33  ----..-2752..-73
1a500 37 31 0d 0a 30 0d 0a 0d 0a 71 75 65 72 79 20 49  71..0....query I
1a510 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
1a520 20 2b 20 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c 31   + col1 * + col1
1a530 20 2a 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c   * + col1 AS col
1a540 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  1 FROM tab0 AS c
1a550 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 36 33 36 30 35  or0..----..63605
1a560 36 0d 0a 37 35 33 35 37 31 0d 0a 39 31 32 36 37  6..753571..91267
1a570 33 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  3....onlyif mysq
1a580 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72  l # use DIV oper
1a590 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72  ator for integer
1a5a0 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79   division..query
1a5b0 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
1a5c0 2d 37 32 39 0d 0a 53 45 4c 45 43 54 20 2b 20 63  -729..SELECT + c
1a5d0 6f 6c 30 20 2b 20 2d 20 63 6f 6c 30 20 44 49 56  ol0 + - col0 DIV
1a5e0 20 2d 20 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20   - col1 AS col2 
1a5f0 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d  FROM tab0..----.
1a600 0a 32 34 0d 0a 33 35 0d 0a 38 39 0d 0a 0d 0a 73  .24..35..89....s
1a610 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
1a620 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
1a630 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
1a640 62 65 6c 2d 37 32 39 0d 0a 53 45 4c 45 43 54 20  bel-729..SELECT 
1a650 2b 20 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c 30 20  + col0 + - col0 
1a660 2f 20 2d 20 63 6f 6c 31 20 41 53 20 63 6f 6c 32  / - col1 AS col2
1a670 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d   FROM tab0..----
1a680 0d 0a 32 34 0d 0a 33 35 0d 0a 38 39 0d 0a 0d 0a  ..24..35..89....
1a690 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
1a6a0 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
1a6b0 20 2d 20 63 6f 6c 31 20 2b 20 63 6f 72 30 2e 63   - col1 + cor0.c
1a6c0 6f 6c 31 20 2a 20 2b 20 63 6f 6c 32 20 2b 20 2d  ol1 * + col2 + -
1a6d0 20 63 6f 72 30 2e 63 6f 6c 31 20 2a 20 63 6f 6c   cor0.col1 * col
1a6e0 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  2 AS col2 FROM t
1a6f0 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
1a700 2d 0d 0a 2d 31 37 0d 0a 2d 33 31 0d 0a 2d 35 39  -..-17..-31..-59
1a710 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
1a720 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
1a730 49 4e 43 54 20 2d 20 2b 20 63 6f 6c 30 20 2a 20  INCT - + col0 * 
1a740 2b 20 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c 30 20  + col1 * - col0 
1a750 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31  + col1 FROM tab1
1a760 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
1a770 32 36 30 0d 0a 34 30 39 37 30 0d 0a 38 33 32 31  260..40970..8321
1a780 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  3....query I row
1a790 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c  sort..SELECT col
1a7a0 30 20 2a 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20  0 * + cor0.col1 
1a7b0 2b 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61  + + col1 FROM ta
1a7c0 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
1a7d0 0d 0a 31 33 36 30 0d 0a 32 34 38 0d 0a 34 36 36  ..1360..248..466
1a7e0 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  1....query I row
1a7f0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 31  sort..SELECT - 1
1a800 36 20 2a 20 63 6f 72 30 2e 63 6f 6c 32 20 2a 20  6 * cor0.col2 * 
1a810 2d 20 63 6f 6c 30 20 2b 20 63 6f 6c 32 20 46 52  - col0 + col2 FR
1a820 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
1a830 0a 2d 2d 2d 2d 0d 0a 33 30 35 31 0d 0a 33 32 34  .----..3051..324
1a840 37 34 0d 0a 34 38 30 37 30 0d 0a 0d 0a 6f 6e 6c  74..48070....onl
1a850 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20  yif mysql # use 
1a860 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72  DIV operator for
1a870 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f   integer divisio
1a880 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  n..query I rowso
1a890 72 74 20 6c 61 62 65 6c 2d 37 33 34 0d 0a 53 45  rt label-734..SE
1a8a0 4c 45 43 54 20 2d 20 63 6f 6c 30 20 44 49 56 20  LECT - col0 DIV 
1a8b0 2d 20 63 6f 6c 30 20 2b 20 63 6f 72 30 2e 63 6f  - col0 + cor0.co
1a8c0 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l2 FROM tab0 AS 
1a8d0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 0d 0a 33  cor0..----..2..3
1a8e0 34 0d 0a 38 33 0d 0a 0d 0a 73 6b 69 70 69 66 20  4..83....skipif 
1a8f0 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
1a900 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
1a910 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 37 33  rowsort label-73
1a920 34 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 30  4..SELECT - col0
1a930 20 2f 20 2d 20 63 6f 6c 30 20 2b 20 63 6f 72 30   / - col0 + cor0
1a940 2e 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20  .col2 FROM tab0 
1a950 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32  AS cor0..----..2
1a960 0d 0a 33 34 0d 0a 38 33 0d 0a 0d 0a 71 75 65 72  ..34..83....quer
1a970 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
1a980 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63  ECT DISTINCT + c
1a990 6f 72 30 2e 63 6f 6c 31 20 2b 20 63 6f 6c 31 20  or0.col1 + col1 
1a9a0 2a 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61  * + col0 FROM ta
1a9b0 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
1a9c0 0d 0a 31 33 36 30 0d 0a 32 34 38 0d 0a 34 36 36  ..1360..248..466
1a9d0 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  1....query I row
1a9e0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2b  sort..SELECT + +
1a9f0 20 31 30 20 2d 20 63 6f 6c 32 20 46 52 4f 4d 20   10 - col2 FROM 
1aa00 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
1aa10 2d 2d 0d 0a 2d 31 36 0d 0a 2d 31 37 0d 0a 2d 32  --..-16..-17..-2
1aa20 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  8....query I row
1aa30 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
1aa40 20 2d 20 36 30 20 2a 20 63 6f 6c 31 20 46 52 4f   - 60 * col1 FRO
1aa50 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
1aa60 2d 2d 2d 2d 0d 0a 2d 31 35 36 30 0d 0a 2d 36 30  ----..-1560..-60
1aa70 30 0d 0a 2d 37 38 30 0d 0a 0d 0a 71 75 65 72 79  0..-780....query
1aa80 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
1aa90 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 36 30  CT DISTINCT - 60
1aaa0 20 2b 20 63 6f 6c 30 20 2a 20 63 6f 6c 32 20 46   + col0 * col2 F
1aab0 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
1aac0 0d 0a 2d 2d 2d 2d 0d 0a 31 30 32 0d 0a 33 35 38  ..----..102..358
1aad0 38 0d 0a 37 36 32 30 0d 0a 0d 0a 71 75 65 72 79  8..7620....query
1aae0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
1aaf0 43 54 20 41 4c 4c 20 33 38 20 2b 20 63 6f 6c 30  CT ALL 38 + col0
1ab00 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20   + col1 AS col2 
1ab10 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
1ab20 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 32 0d 0a 31 33  0..----..112..13
1ab30 31 0d 0a 36 37 0d 0a 0d 0a 71 75 65 72 79 20 49  1..67....query I
1ab40 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
1ab50 20 44 49 53 54 49 4e 43 54 20 2d 20 31 30 20 2b   DISTINCT - 10 +
1ab60 20 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c 31 20 41   col1 * + col1 A
1ab70 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31  S col2 FROM tab1
1ab80 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
1ab90 31 35 39 0d 0a 36 36 36 0d 0a 39 30 0d 0a 0d 0a  159..666..90....
1aba0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
1abb0 0a 53 45 4c 45 43 54 20 32 35 20 2a 20 2d 20 63  .SELECT 25 * - c
1abc0 6f 6c 30 20 2a 20 63 6f 6c 31 20 41 53 20 63 6f  ol0 * col1 AS co
1abd0 6c 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d  l1 FROM tab0..--
1abe0 2d 2d 0d 0a 2d 32 30 32 34 37 35 0d 0a 2d 35 31  --..-202475..-51
1abf0 36 30 30 0d 0a 2d 38 34 38 37 35 0d 0a 0d 0a 71  600..-84875....q
1ac00 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
1ac10 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
1ac20 36 33 20 2a 20 2d 20 63 6f 6c 31 20 2b 20 2d 20  63 * - col1 + - 
1ac30 63 6f 6c 30 20 2b 20 63 6f 6c 31 20 46 52 4f 4d  col0 + col1 FROM
1ac40 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 33   tab0..----..-53
1ac50 35 36 0d 0a 2d 35 37 33 31 0d 0a 2d 36 30 34 39  56..-5731..-6049
1ac60 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67  ....skipif postg
1ac70 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53  resql # PostgreS
1ac80 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77  QL requires AS w
1ac90 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74  hen renaming out
1aca0 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65  put columns..que
1acb0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
1acc0 4c 45 43 54 20 63 6f 6c 31 20 2a 20 2d 20 74 61  LECT col1 * - ta
1acd0 62 30 2e 63 6f 6c 32 20 2b 20 2d 20 63 6f 6c 30  b0.col2 + - col0
1ace0 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 0d   col2 FROM tab0.
1acf0 0a 2d 2d 2d 2d 0d 0a 2d 31 33 32 0d 0a 2d 32 38  .----..-132..-28
1ad00 36 32 0d 0a 2d 37 35 35 31 0d 0a 0d 0a 71 75 65  62..-7551....que
1ad10 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
1ad20 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f  LECT DISTINCT co
1ad30 6c 31 20 2b 20 63 6f 6c 32 20 2b 20 63 6f 6c 30  l1 + col2 + col0
1ad40 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
1ad50 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33 33 0d 0a 31  b0..----..133..1
1ad60 34 33 0d 0a 32 36 32 0d 0a 0d 0a 71 75 65 72 79  43..262....query
1ad70 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
1ad80 43 54 20 2b 20 31 37 20 2a 20 2d 20 63 6f 6c 31  CT + 17 * - col1
1ad90 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
1ada0 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 34 36 32 0d  b0..----..-1462.
1adb0 0a 2d 31 35 34 37 0d 0a 2d 31 36 34 39 0d 0a 0d  .-1547..-1649...
1adc0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1add0 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
1ade0 54 20 28 20 63 6f 6c 32 20 29 20 2a 20 63 6f 6c  T ( col2 ) * col
1adf0 32 20 2a 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20  2 * + col0 FROM 
1ae00 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 32 30 37 39  tab1..----..2079
1ae10 33 36 0d 0a 37 33 37 32 38 30 0d 0a 38 37 34 38  36..737280..8748
1ae20 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
1ae30 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61   # use DIV opera
1ae40 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20  tor for integer 
1ae50 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20  division..query 
1ae60 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
1ae70 37 34 37 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  747..SELECT ALL 
1ae80 2d 20 74 61 62 32 2e 63 6f 6c 32 20 44 49 56 20  - tab2.col2 DIV 
1ae90 2d 20 74 61 62 32 2e 63 6f 6c 30 20 41 53 20 63  - tab2.col0 AS c
1aea0 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 2c 20 74  ol1 FROM tab2, t
1aeb0 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
1aec0 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68  -..9 values hash
1aed0 69 6e 67 20 74 6f 20 38 33 63 31 36 33 34 34 32  ing to 83c163442
1aee0 39 33 31 64 32 38 65 34 31 36 30 33 36 39 64 34  931d28e4160369d4
1aef0 30 30 34 37 65 61 37 0d 0a 0d 0a 73 6b 69 70 69  0047ea7....skipi
1af00 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
1af10 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
1af20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
1af30 37 34 37 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  747..SELECT ALL 
1af40 2d 20 74 61 62 32 2e 63 6f 6c 32 20 2f 20 2d 20  - tab2.col2 / - 
1af50 74 61 62 32 2e 63 6f 6c 30 20 41 53 20 63 6f 6c  tab2.col0 AS col
1af60 31 20 46 52 4f 4d 20 74 61 62 32 2c 20 74 61 62  1 FROM tab2, tab
1af70 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
1af80 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e  .9 values hashin
1af90 67 20 74 6f 20 38 33 63 31 36 33 34 34 32 39 33  g to 83c16344293
1afa0 31 64 32 38 65 34 31 36 30 33 36 39 64 34 30 30  1d28e4160369d400
1afb0 34 37 65 61 37 0d 0a 0d 0a 71 75 65 72 79 20 49  47ea7....query I
1afc0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
1afd0 20 41 4c 4c 20 35 30 20 2b 20 2d 20 63 6f 6c 32   ALL 50 + - col2
1afe0 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d   FROM tab2..----
1aff0 0d 0a 31 32 0d 0a 32 33 0d 0a 32 34 0d 0a 0d 0a  ..12..23..24....
1b000 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
1b010 0a 53 45 4c 45 43 54 20 63 6f 6c 31 20 2a 20 63  .SELECT col1 * c
1b020 6f 6c 31 20 2b 20 2d 20 63 6f 6c 32 20 41 53 20  ol1 + - col2 AS 
1b030 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41  col1 FROM tab1 A
1b040 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 34 33  S cor0..----..43
1b050 0d 0a 36 32 32 0d 0a 37 33 0d 0a 0d 0a 71 75 65  ..622..73....que
1b060 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
1b070 4c 45 43 54 20 2d 20 63 6f 6c 30 20 2a 20 63 6f  LECT - col0 * co
1b080 6c 31 20 2b 20 63 6f 6c 30 20 2a 20 2d 20 63 6f  l1 + col0 * - co
1b090 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l0 FROM tab1 AS 
1b0a0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 37 33  cor0..----..-473
1b0b0 36 0d 0a 2d 37 34 34 30 0d 0a 2d 38 37 0d 0a 0d  6..-7440..-87...
1b0c0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1b0d0 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c  ..SELECT ALL col
1b0e0 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  0 AS col2 FROM t
1b0f0 61 62 30 20 57 48 45 52 45 20 4e 4f 54 20 4e 55  ab0 WHERE NOT NU
1b100 4c 4c 20 4e 4f 54 20 42 45 54 57 45 45 4e 20 28  LL NOT BETWEEN (
1b110 20 2b 20 63 6f 6c 30 20 29 20 41 4e 44 20 4e 55   + col0 ) AND NU
1b120 4c 4c 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a 6f 6e 6c 79  LL..----....only
1b130 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44  if mysql # use D
1b140 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20  IV operator for 
1b150 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e  integer division
1b160 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1b170 74 20 6c 61 62 65 6c 2d 37 35 32 0d 0a 53 45 4c  t label-752..SEL
1b180 45 43 54 20 2d 20 63 6f 6c 31 20 2a 20 2b 20 63  ECT - col1 * + c
1b190 6f 6c 30 20 2b 20 2b 20 63 6f 6c 31 20 44 49 56  ol0 + + col1 DIV
1b1a0 20 2d 20 63 6f 6c 31 20 2b 20 63 6f 6c 30 20 46   - col1 + col0 F
1b1b0 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab2..----..
1b1c0 2d 31 32 36 35 0d 0a 2d 32 31 31 0d 0a 2d 34 35  -1265..-211..-45
1b1d0 32 35 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  25....skipif mys
1b1e0 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
1b1f0 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
1b200 73 6f 72 74 20 6c 61 62 65 6c 2d 37 35 32 0d 0a  sort label-752..
1b210 53 45 4c 45 43 54 20 2d 20 63 6f 6c 31 20 2a 20  SELECT - col1 * 
1b220 2b 20 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c 31 20  + col0 + + col1 
1b230 2f 20 2d 20 63 6f 6c 31 20 2b 20 63 6f 6c 30 20  / - col1 + col0 
1b240 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d  FROM tab2..----.
1b250 0a 2d 31 32 36 35 0d 0a 2d 32 31 31 0d 0a 2d 34  .-1265..-211..-4
1b260 35 32 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  525....query I r
1b270 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 74  owsort..SELECT t
1b280 61 62 31 2e 63 6f 6c 32 20 2a 20 63 6f 6c 31 20  ab1.col2 * col1 
1b290 2a 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31  * col0 FROM tab1
1b2a0 0d 0a 2d 2d 2d 2d 0d 0a 33 36 34 38 30 0d 0a 34  ..----..36480..4
1b2b0 32 31 32 0d 0a 39 39 38 34 30 0d 0a 0d 0a 71 75  212..99840....qu
1b2c0 65 72 79 20 49 49 49 20 72 6f 77 73 6f 72 74 0d  ery III rowsort.
1b2d0 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2a 20 46 52  .SELECT ALL * FR
1b2e0 4f 4d 20 74 61 62 30 20 57 48 45 52 45 20 63 6f  OM tab0 WHERE co
1b2f0 6c 30 20 2b 20 63 6f 6c 31 20 4e 4f 54 20 49 4e  l0 + col1 NOT IN
1b300 20 28 20 74 61 62 30 2e 63 6f 6c 30 20 2b 20 63   ( tab0.col0 + c
1b310 6f 6c 30 20 29 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76  ol0 )..----..9 v
1b320 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f  alues hashing to
1b330 20 33 38 61 31 36 37 33 65 32 65 30 39 64 36 39   38a1673e2e09d69
1b340 34 63 38 63 65 63 34 35 63 37 39 37 30 33 34 61  4c8cec45c797034a
1b350 37 0d 0a 0d 0a 71 75 65 72 79 20 49 49 49 20 72  7....query III r
1b360 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2a  owsort..SELECT *
1b370 20 46 52 4f 4d 20 74 61 62 32 20 57 48 45 52 45   FROM tab2 WHERE
1b380 20 4e 4f 54 20 28 20 4e 55 4c 4c 20 29 20 3c 20   NOT ( NULL ) < 
1b390 28 20 63 6f 6c 31 20 29 0d 0a 2d 2d 2d 2d 0d 0a  ( col1 )..----..
1b3a0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1b3b0 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f  t..SELECT ALL co
1b3c0 6c 32 20 2a 20 2d 20 63 6f 6c 32 20 2a 20 2b 20  l2 * - col2 * + 
1b3d0 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46 52 4f  col2 AS col1 FRO
1b3e0 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  M tab0..----..-1
1b3f0 0d 0a 2d 33 35 39 33 37 0d 0a 2d 35 35 31 33 36  ..-35937..-55136
1b400 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  8....query I row
1b410 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
1b420 54 49 4e 43 54 20 2b 20 74 61 62 31 2e 63 6f 6c  TINCT + tab1.col
1b430 32 20 2a 20 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c  2 * col0 * + col
1b440 30 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d  0 FROM tab1..---
1b450 2d 0d 0a 32 33 33 34 37 32 0d 0a 34 38 36 0d 0a  -..233472..486..
1b460 36 31 34 34 30 30 0d 0a 0d 0a 71 75 65 72 79 20  614400....query 
1b470 49 49 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  III rowsort..SEL
1b480 45 43 54 20 2a 20 46 52 4f 4d 20 74 61 62 31 20  ECT * FROM tab1 
1b490 57 48 45 52 45 20 4e 4f 54 20 4e 55 4c 4c 20 42  WHERE NOT NULL B
1b4a0 45 54 57 45 45 4e 20 28 20 63 6f 6c 30 20 29 20  ETWEEN ( col0 ) 
1b4b0 41 4e 44 20 63 6f 6c 32 20 2f 20 63 6f 6c 30 0d  AND col2 / col0.
1b4c0 0a 2d 2d 2d 2d 0d 0a 0d 0a 71 75 65 72 79 20 49  .----....query I
1b4d0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
1b4e0 20 41 4c 4c 20 2d 20 63 6f 6c 31 20 46 52 4f 4d   ALL - col1 FROM
1b4f0 20 74 61 62 30 20 57 48 45 52 45 20 4e 4f 54 20   tab0 WHERE NOT 
1b500 28 20 4e 55 4c 4c 20 29 20 49 4e 20 28 20 63 6f  ( NULL ) IN ( co
1b510 6c 32 20 29 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a 6f 6e  l2 )..----....on
1b520 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
1b530 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
1b540 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
1b550 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
1b560 6f 72 74 20 6c 61 62 65 6c 2d 37 36 30 0d 0a 53  ort label-760..S
1b570 45 4c 45 43 54 20 63 6f 6c 32 20 2a 20 63 6f 6c  ELECT col2 * col
1b580 30 20 2a 20 2d 20 63 6f 6c 30 20 2b 20 74 61 62  0 * - col0 + tab
1b590 32 2e 63 6f 6c 31 20 2a 20 74 61 62 32 2e 63 6f  2.col1 * tab2.co
1b5a0 6c 30 20 44 49 56 20 2d 20 63 6f 6c 31 20 41 53  l0 DIV - col1 AS
1b5b0 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 0d   col0 FROM tab2.
1b5c0 0a 2d 2d 2d 2d 0d 0a 2d 31 33 33 30 0d 0a 2d 31  .----..-1330..-1
1b5d0 35 38 32 36 32 0d 0a 2d 32 33 37 32 33 37 0d 0a  58262..-237237..
1b5e0 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
1b5f0 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
1b600 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1b610 20 6c 61 62 65 6c 2d 37 36 30 0d 0a 53 45 4c 45   label-760..SELE
1b620 43 54 20 63 6f 6c 32 20 2a 20 63 6f 6c 30 20 2a  CT col2 * col0 *
1b630 20 2d 20 63 6f 6c 30 20 2b 20 74 61 62 32 2e 63   - col0 + tab2.c
1b640 6f 6c 31 20 2a 20 74 61 62 32 2e 63 6f 6c 30 20  ol1 * tab2.col0 
1b650 2f 20 2d 20 63 6f 6c 31 20 41 53 20 63 6f 6c 30  / - col1 AS col0
1b660 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d   FROM tab2..----
1b670 0d 0a 2d 31 33 33 30 0d 0a 2d 31 35 38 32 36 32  ..-1330..-158262
1b680 0d 0a 2d 32 33 37 32 33 37 0d 0a 0d 0a 71 75 65  ..-237237....que
1b690 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
1b6a0 4c 45 43 54 20 41 4c 4c 20 74 61 62 30 2e 63 6f  LECT ALL tab0.co
1b6b0 6c 31 20 2a 20 74 61 62 30 2e 63 6f 6c 31 20 41  l1 * tab0.col1 A
1b6c0 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30  S col0 FROM tab0
1b6d0 0d 0a 2d 2d 2d 2d 0d 0a 37 33 39 36 0d 0a 38 32  ..----..7396..82
1b6e0 38 31 0d 0a 39 34 30 39 0d 0a 0d 0a 71 75 65 72  81..9409....quer
1b6f0 79 20 49 49 49 20 72 6f 77 73 6f 72 74 0d 0a 53  y III rowsort..S
1b700 45 4c 45 43 54 20 2a 20 46 52 4f 4d 20 74 61 62  ELECT * FROM tab
1b710 32 20 57 48 45 52 45 20 28 20 63 6f 6c 32 20 2b  2 WHERE ( col2 +
1b720 20 63 6f 6c 30 20 2a 20 63 6f 6c 30 20 29 20 49   col0 * col0 ) I
1b730 4e 20 28 20 2b 20 63 6f 6c 31 20 29 0d 0a 2d 2d  N ( + col1 )..--
1b740 2d 2d 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  --....onlyif mys
1b750 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65  ql # use DIV ope
1b760 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65  rator for intege
1b770 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72  r division..quer
1b780 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
1b790 6c 2d 37 36 33 0d 0a 53 45 4c 45 43 54 20 63 6f  l-763..SELECT co
1b7a0 6c 32 20 2b 20 2d 20 63 6f 6c 30 20 2d 20 63 6f  l2 + - col0 - co
1b7b0 6c 30 20 44 49 56 20 63 6f 6c 30 20 46 52 4f 4d  l0 DIV col0 FROM
1b7c0 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 38 0d   tab1..----..-8.
1b7d0 0a 31 35 0d 0a 35 30 0d 0a 0d 0a 73 6b 69 70 69  .15..50....skipi
1b7e0 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
1b7f0 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
1b800 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
1b810 37 36 33 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 32  763..SELECT col2
1b820 20 2b 20 2d 20 63 6f 6c 30 20 2d 20 63 6f 6c 30   + - col0 - col0
1b830 20 2f 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62   / col0 FROM tab
1b840 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 38 0d 0a 31 35 0d  1..----..-8..15.
1b850 0a 35 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .50....query I r
1b860 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
1b870 49 53 54 49 4e 43 54 20 74 61 62 32 2e 63 6f 6c  ISTINCT tab2.col
1b880 30 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  0 AS col0 FROM t
1b890 61 62 32 20 57 48 45 52 45 20 28 20 63 6f 6c 32  ab2 WHERE ( col2
1b8a0 20 29 20 49 4e 20 28 20 2b 20 63 6f 6c 30 20 2d   ) IN ( + col0 -
1b8b0 20 63 6f 6c 31 20 29 0d 0a 2d 2d 2d 2d 0d 0a 0d   col1 )..----...
1b8c0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1b8d0 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 31 20  ..SELECT - col1 
1b8e0 2f 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32  / col2 FROM tab2
1b8f0 20 57 48 45 52 45 20 28 20 4e 55 4c 4c 20 29 20   WHERE ( NULL ) 
1b900 49 4e 20 28 20 2d 20 63 6f 6c 30 20 2a 20 2b 20  IN ( - col0 * + 
1b910 63 6f 6c 31 20 2a 20 63 6f 6c 32 20 29 0d 0a 2d  col1 * col2 )..-
1b920 2d 2d 2d 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  ---....query I r
1b930 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63  owsort..SELECT c
1b940 6f 6c 32 20 2a 20 2d 20 63 6f 6c 32 20 2b 20 2b  ol2 * - col2 + +
1b950 20 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46 52   col1 AS col2 FR
1b960 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  OM tab0..----..-
1b970 31 30 30 33 0d 0a 2d 36 36 33 33 0d 0a 39 36 0d  1003..-6633..96.
1b980 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
1b990 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
1b9a0 4e 43 54 20 63 6f 6c 31 20 2a 20 63 6f 6c 32 20  NCT col1 * col2 
1b9b0 2d 20 2d 20 63 6f 6c 30 20 2a 20 74 61 62 32 2e  - - col0 * tab2.
1b9c0 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 0d 0a  col2 FROM tab2..
1b9d0 2d 2d 2d 2d 0d 0a 31 30 32 36 0d 0a 33 35 36 32  ----..1026..3562
1b9e0 0d 0a 33 36 34 38 0d 0a 0d 0a 73 6b 69 70 69 66  ..3648....skipif
1b9f0 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f   postgresql # Po
1ba00 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65  stgreSQL require
1ba10 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69  s AS when renami
1ba20 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e  ng output column
1ba30 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  s..query I rowso
1ba40 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 32 20  rt..SELECT col2 
1ba50 2a 20 2d 20 63 6f 6c 32 20 2b 20 2b 20 74 61 62  * - col2 + + tab
1ba60 32 2e 63 6f 6c 31 20 63 6f 6c 31 20 46 52 4f 4d  2.col1 col1 FROM
1ba70 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 34   tab2..----..-14
1ba80 32 37 0d 0a 2d 36 31 37 0d 0a 2d 36 39 38 0d 0a  27..-617..-698..
1ba90 0d 0a 71 75 65 72 79 20 49 49 49 20 72 6f 77 73  ..query III rows
1baa0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2a 20 46 52  ort..SELECT * FR
1bab0 4f 4d 20 74 61 62 30 20 57 48 45 52 45 20 28 20  OM tab0 WHERE ( 
1bac0 63 6f 6c 31 20 29 20 49 4e 20 28 20 63 6f 6c 31  col1 ) IN ( col1
1bad0 20 29 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75   )..----..9 valu
1bae0 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 33 38  es hashing to 38
1baf0 61 31 36 37 33 65 32 65 30 39 64 36 39 34 63 38  a1673e2e09d694c8
1bb00 63 65 63 34 35 63 37 39 37 30 33 34 61 37 0d 0a  cec45c797034a7..
1bb10 0d 0a 71 75 65 72 79 20 49 49 49 20 72 6f 77 73  ..query III rows
1bb20 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
1bb30 49 4e 43 54 20 2a 20 46 52 4f 4d 20 74 61 62 31  INCT * FROM tab1
1bb40 20 57 48 45 52 45 20 4e 4f 54 20 28 20 4e 55 4c   WHERE NOT ( NUL
1bb50 4c 20 29 20 49 4e 20 28 20 2d 20 63 6f 6c 32 20  L ) IN ( - col2 
1bb60 2a 20 2b 20 63 6f 6c 31 20 2b 20 74 61 62 31 2e  * + col1 + tab1.
1bb70 63 6f 6c 32 20 29 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a  col2 )..----....
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 2b 20 2d 20 63 6f 6c 30  .SELECT + - col0
1bba0 20 2b 20 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c 31   + col1 * + col1
1bbb0 20 2a 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62   * col0 FROM tab
1bbc0 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
1bbd0 0a 31 33 34 34 30 0d 0a 32 30 32 35 0d 0a 36 33  .13440..2025..63
1bbe0 33 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  36....query I ro
1bbf0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
1bc00 4c 20 63 6f 6c 31 20 2a 20 2d 20 63 6f 72 30 2e  L col1 * - cor0.
1bc10 63 6f 6c 30 20 2b 20 63 6f 6c 32 20 2a 20 2d 20  col0 + col2 * - 
1bc20 63 6f 6c 31 20 2b 20 2d 20 63 6f 6c 31 20 46 52  col1 + - col1 FR
1bc30 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
1bc40 0a 2d 2d 2d 2d 0d 0a 2d 31 32 32 30 0d 0a 2d 31  .----..-1220..-1
1bc50 35 30 38 0d 0a 2d 32 33 30 31 0d 0a 0d 0a 71 75  508..-2301....qu
1bc60 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
1bc70 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 63  ELECT DISTINCT c
1bc80 6f 6c 32 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20  ol2 - cor0.col2 
1bc90 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
1bca0 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 0d 0a 71 75  0..----..0....qu
1bcb0 65 72 79 20 49 49 49 20 72 6f 77 73 6f 72 74 0d  ery III rowsort.
1bcc0 0a 53 45 4c 45 43 54 20 2a 20 46 52 4f 4d 20 74  .SELECT * FROM t
1bcd0 61 62 31 20 41 53 20 63 6f 72 30 20 57 48 45 52  ab1 AS cor0 WHER
1bce0 45 20 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c 31 20  E col1 * - col1 
1bcf0 49 4e 20 28 20 2b 20 63 6f 6c 32 20 2a 20 63 6f  IN ( + col2 * co
1bd00 6c 31 20 29 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a 71 75  l1 )..----....qu
1bd10 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
1bd20 45 4c 45 43 54 20 63 6f 6c 31 20 2a 20 2d 20 63  ELECT col1 * - c
1bd30 6f 6c 31 20 2d 20 2b 20 63 6f 72 30 2e 63 6f 6c  ol1 - + cor0.col
1bd40 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  2 FROM tab1 AS c
1bd50 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 35 37 0d  or0..----..-157.
1bd60 0a 2d 32 36 35 0d 0a 2d 37 33 30 0d 0a 0d 0a 71  .-265..-730....q
1bd70 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
1bd80 53 45 4c 45 43 54 20 2d 20 63 6f 6c 30 20 2d 20  SELECT - col0 - 
1bd90 2d 20 63 6f 6c 31 20 2a 20 63 6f 72 30 2e 63 6f  - col1 * cor0.co
1bda0 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l2 FROM tab0 AS 
1bdb0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 38 31 34  cor0..----..2814
1bdc0 0d 0a 36 32 0d 0a 37 33 37 33 0d 0a 0d 0a 6f 6e  ..62..7373....on
1bdd0 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
1bde0 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
1bdf0 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
1be00 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
1be10 6f 72 74 20 6c 61 62 65 6c 2d 37 37 37 0d 0a 53  ort label-777..S
1be20 45 4c 45 43 54 20 63 6f 6c 32 20 2b 20 2d 20 63  ELECT col2 + - c
1be30 6f 6c 31 20 44 49 56 20 2d 20 63 6f 6c 30 20 2b  ol1 DIV - col0 +
1be40 20 2d 20 31 33 20 44 49 56 20 2b 20 63 6f 6c 32   - 13 DIV + col2
1be50 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20   col2 FROM tab0 
1be60 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 0d  cor0..----..-10.
1be70 0a 33 36 0d 0a 38 33 0d 0a 0d 0a 73 6b 69 70 69  .36..83....skipi
1be80 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50  f postgresql # P
1be90 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72  ostgreSQL requir
1bea0 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d  es AS when renam
1beb0 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d  ing output colum
1bec0 6e 73 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ns..skipif mysql
1bed0 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
1bee0 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
1bef0 72 74 20 6c 61 62 65 6c 2d 37 37 37 0d 0a 53 45  rt label-777..SE
1bf00 4c 45 43 54 20 63 6f 6c 32 20 2b 20 2d 20 63 6f  LECT col2 + - co
1bf10 6c 31 20 2f 20 2d 20 63 6f 6c 30 20 2b 20 2d 20  l1 / - col0 + - 
1bf20 31 33 20 2f 20 2b 20 63 6f 6c 32 20 63 6f 6c 32  13 / + col2 col2
1bf30 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d   FROM tab0 cor0.
1bf40 0a 2d 2d 2d 2d 0d 0a 2d 31 30 0d 0a 33 36 0d 0a  .----..-10..36..
1bf50 38 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  83....query I ro
1bf60 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
1bf70 2d 20 63 6f 6c 30 20 2b 20 63 6f 6c 32 20 2a 20  - col0 + col2 * 
1bf80 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c 30 20 41 53  col0 + + col0 AS
1bf90 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20   col0 FROM tab2 
1bfa0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
1bfb0 38 39 0d 0a 32 30 32 38 0d 0a 33 30 30 32 0d 0a  89..2028..3002..
1bfc0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1bfd0 74 0d 0a 53 45 4c 45 43 54 20 35 32 20 2a 20 2b  t..SELECT 52 * +
1bfe0 20 63 6f 6c 32 20 2b 20 63 6f 6c 32 20 2b 20 63   col2 + col2 + c
1bff0 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 63 6f  ol1 FROM tab0 co
1c000 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 35 30 0d 0a 31  r0..----..150..1
1c010 38 33 35 0d 0a 34 34 33 37 0d 0a 0d 0a 71 75 65  835..4437....que
1c020 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
1c030 4c 45 43 54 20 41 4c 4c 20 2d 20 2b 20 39 39 20  LECT ALL - + 99 
1c040 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
1c050 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 39 39 0d 0a 2d 39  0..----..-99..-9
1c060 39 0d 0a 2d 39 39 0d 0a 0d 0a 71 75 65 72 79 20  9..-99....query 
1c070 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
1c080 54 20 28 20 63 6f 6c 30 20 29 20 2a 20 2b 20 63  T ( col0 ) * + c
1c090 6f 6c 31 20 2b 20 2d 20 28 20 2d 20 34 38 20 29  ol1 + - ( - 48 )
1c0a0 20 2a 20 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20   * col0 AS col1 
1c0b0 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
1c0c0 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 33 37 31 0d 0a  0..----..12371..
1c0d0 33 32 31 36 0d 0a 35 30 37 35 0d 0a 0d 0a 71 75  3216..5075....qu
1c0e0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
1c0f0 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b  ELECT DISTINCT +
1c100 20 28 20 2b 20 33 36 20 29 20 46 52 4f 4d 20 74   ( + 36 ) FROM t
1c110 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
1c120 2d 0d 0a 33 36 0d 0a 0d 0a 71 75 65 72 79 20 49  -..36....query I
1c130 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
1c140 20 37 31 20 2b 20 63 6f 6c 32 20 41 53 20 63 6f   71 + col2 AS co
1c150 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l2 FROM tab0 AS 
1c160 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 34 0d  cor0..----..104.
1c170 0a 31 35 33 0d 0a 37 32 0d 0a 0d 0a 71 75 65 72  .153..72....quer
1c180 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
1c190 45 43 54 20 41 4c 4c 20 2b 20 28 20 63 6f 6c 31  ECT ALL + ( col1
1c1a0 20 29 20 2a 20 2b 20 63 6f 6c 31 20 2a 20 38 31   ) * + col1 * 81
1c1b0 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
1c1c0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 33 34 30 39 0d  r0..----..23409.
1c1d0 0a 32 38 31 39 36 31 0d 0a 37 37 38 34 31 0d 0a  .281961..77841..
1c1e0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1c1f0 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 30  t..SELECT + col0
1c200 20 2a 20 2b 20 63 6f 6c 31 20 2a 20 63 6f 6c 32   * + col1 * col2
1c210 20 2b 20 2b 20 63 6f 6c 31 20 2b 20 33 30 20 2a   + + col1 + 30 *
1c220 20 2d 20 63 6f 6c 30 20 2a 20 2d 20 63 6f 72 30   - col0 * - cor0
1c230 2e 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52  .col1 AS col0 FR
1c240 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
1c250 0a 2d 2d 2d 2d 0d 0a 31 32 34 30 30 0d 0a 32 35  .----..12400..25
1c260 37 37 37 31 0d 0a 39 31 33 34 31 0d 0a 0d 0a 6f  7771..91341....o
1c270 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75  nlyif mysql # su
1c280 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20  pport for MySQL 
1c290 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20  specific system 
1c2a0 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78  types and syntax
1c2b0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1c2c0 74 20 6c 61 62 65 6c 2d 37 38 36 0d 0a 53 45 4c  t label-786..SEL
1c2d0 45 43 54 20 2b 20 63 6f 6c 32 20 2a 20 63 6f 72  ECT + col2 * cor
1c2e0 30 2e 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c 30 20  0.col1 * + col0 
1c2f0 2d 20 43 41 53 54 28 20 63 6f 6c 31 20 41 53 20  - CAST( col1 AS 
1c300 53 49 47 4e 45 44 20 29 20 46 52 4f 4d 20 74 61  SIGNED ) FROM ta
1c310 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
1c320 0d 0a 31 31 39 35 39 33 0d 0a 35 31 30 31 37 0d  ..119593..51017.
1c330 0a 35 38 32 38 0d 0a 0d 0a 73 6b 69 70 69 66 20  .5828....skipif 
1c340 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
1c350 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
1c360 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 37 38  rowsort label-78
1c370 36 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 32  6..SELECT + col2
1c380 20 2a 20 63 6f 72 30 2e 63 6f 6c 31 20 2a 20 2b   * cor0.col1 * +
1c390 20 63 6f 6c 30 20 2d 20 43 41 53 54 20 28 20 63   col0 - CAST ( c
1c3a0 6f 6c 31 20 41 53 20 49 4e 54 45 47 45 52 20 29  ol1 AS INTEGER )
1c3b0 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
1c3c0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 39 35 39 33  r0..----..119593
1c3d0 0d 0a 35 31 30 31 37 0d 0a 35 38 32 38 0d 0a 0d  ..51017..5828...
1c3e0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1c3f0 0d 0a 53 45 4c 45 43 54 20 74 61 62 32 2e 63 6f  ..SELECT tab2.co
1c400 6c 31 20 2a 20 28 20 63 6f 6c 32 20 29 20 46 52  l1 * ( col2 ) FR
1c410 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31  OM tab2..----..1
1c420 35 33 34 0d 0a 36 34 36 0d 0a 38 33 37 0d 0a 0d  534..646..837...
1c430 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1c440 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 32 20  ..SELECT + col2 
1c450 2a 20 32 20 2a 20 2d 20 63 6f 6c 31 20 41 53 20  * 2 * - col1 AS 
1c460 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 0d 0a  col1 FROM tab1..
1c470 2d 2d 2d 2d 0d 0a 2d 31 31 34 30 0d 0a 2d 32 34  ----..-1140..-24
1c480 39 36 0d 0a 2d 32 38 30 38 0d 0a 0d 0a 71 75 65  96..-2808....que
1c490 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
1c4a0 4c 45 43 54 20 2b 20 38 33 20 2a 20 2d 20 63 6f  LECT + 83 * - co
1c4b0 6c 32 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 41  l2 - cor0.col2 A
1c4c0 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32  S col1 FROM tab2
1c4d0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
1c4e0 2d 32 31 38 34 0d 0a 2d 32 32 36 38 0d 0a 2d 33  -2184..-2268..-3
1c4f0 31 39 32 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f  192....skipif po
1c500 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67  stgresql # Postg
1c510 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41  reSQL requires A
1c520 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20  S when renaming 
1c530 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a  output columns..
1c540 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
1c550 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
1c560 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
1c570 53 45 4c 45 43 54 20 41 4c 4c 20 43 41 53 54 20  SELECT ALL CAST 
1c580 28 20 63 6f 6c 32 20 41 53 20 52 45 41 4c 20 29  ( col2 AS REAL )
1c590 20 2a 20 2b 20 63 6f 6c 32 20 63 6f 6c 32 20 46   * + col2 col2 F
1c5a0 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab2..----..
1c5b0 31 34 34 34 0d 0a 36 37 36 0d 0a 37 32 39 0d 0a  1444..676..729..
1c5c0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1c5d0 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 72 30  t..SELECT + cor0
1c5e0 2e 63 6f 6c 31 20 2a 20 28 20 2b 20 63 6f 6c 32  .col1 * ( + col2
1c5f0 20 29 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20   ) FROM tab2 AS 
1c600 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 35 33 34  cor0..----..1534
1c610 0d 0a 36 34 36 0d 0a 38 33 37 0d 0a 0d 0a 71 75  ..646..837....qu
1c620 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
1c630 45 4c 45 43 54 20 63 6f 6c 30 20 2a 20 63 6f 6c  ELECT col0 * col
1c640 31 20 2b 20 32 33 20 2a 20 63 6f 6c 30 20 41 53  1 + 23 * col0 AS
1c650 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 0d   col1 FROM tab1.
1c660 0a 2d 2d 2d 2d 0d 0a 31 34 37 0d 0a 32 31 31 32  .----..147..2112
1c670 0d 0a 32 38 38 30 0d 0a 0d 0a 71 75 65 72 79 20  ..2880....query 
1c680 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
1c690 54 20 63 6f 6c 30 20 2a 20 34 34 20 2b 20 2b 20  T col0 * 44 + + 
1c6a0 63 6f 6c 32 20 2a 20 63 6f 6c 31 20 41 53 20 63  col2 * col1 AS c
1c6b0 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d  ol1 FROM tab2..-
1c6c0 2d 2d 2d 0d 0a 31 31 34 35 0d 0a 34 31 32 32 0d  ---..1145..4122.
1c6d0 0a 34 39 36 36 0d 0a 0d 0a 71 75 65 72 79 20 49  .4966....query I
1c6e0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
1c6f0 20 74 61 62 32 2e 63 6f 6c 31 20 2a 20 32 20 46   tab2.col1 * 2 F
1c700 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab2..----..
1c710 31 31 38 0d 0a 33 34 0d 0a 36 32 0d 0a 0d 0a 6f  118..34..62....o
1c720 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73  nlyif mysql # us
1c730 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66  e DIV operator f
1c740 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73  or integer divis
1c750 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ion..query I row
1c760 73 6f 72 74 20 6c 61 62 65 6c 2d 37 39 35 0d 0a  sort label-795..
1c770 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
1c780 2b 20 63 6f 6c 30 20 44 49 56 20 2b 20 31 38 20  + col0 DIV + 18 
1c790 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d  FROM tab0..----.
1c7a0 0a 31 0d 0a 34 0d 0a 0d 0a 73 6b 69 70 69 66 20  .1..4....skipif 
1c7b0 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
1c7c0 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
1c7d0 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 37 39  rowsort label-79
1c7e0 35 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  5..SELECT DISTIN
1c7f0 43 54 20 2b 20 63 6f 6c 30 20 2f 20 2b 20 31 38  CT + col0 / + 18
1c800 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d   FROM tab0..----
1c810 0d 0a 31 0d 0a 34 0d 0a 0d 0a 6f 6e 6c 79 69 66  ..1..4....onlyif
1c820 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56   mysql # use DIV
1c830 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e   operator for in
1c840 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a  teger division..
1c850 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
1c860 6c 61 62 65 6c 2d 37 39 36 0d 0a 53 45 4c 45 43  label-796..SELEC
1c870 54 20 2d 20 63 6f 6c 30 20 44 49 56 20 2b 20 28  T - col0 DIV + (
1c880 20 2b 20 63 6f 6c 31 20 29 20 63 6f 6c 31 20 46   + col1 ) col1 F
1c890 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab1..----..
1c8a0 2d 36 0d 0a 2d 36 0d 0a 30 0d 0a 0d 0a 73 6b 69  -6..-6..0....ski
1c8b0 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23  pif postgresql #
1c8c0 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75   PostgreSQL requ
1c8d0 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e  ires AS when ren
1c8e0 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c  aming output col
1c8f0 75 6d 6e 73 0d 0a 73 6b 69 70 69 66 20 6d 79 73  umns..skipif mys
1c900 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
1c910 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
1c920 73 6f 72 74 20 6c 61 62 65 6c 2d 37 39 36 0d 0a  sort label-796..
1c930 53 45 4c 45 43 54 20 2d 20 63 6f 6c 30 20 2f 20  SELECT - col0 / 
1c940 2b 20 28 20 2b 20 63 6f 6c 31 20 29 20 63 6f 6c  + ( + col1 ) col
1c950 31 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d  1 FROM tab1..---
1c960 2d 0d 0a 2d 36 0d 0a 2d 36 0d 0a 30 0d 0a 0d 0a  -..-6..-6..0....
1c970 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71  skipif postgresq
1c980 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72  l # PostgreSQL r
1c990 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20  equires AS when 
1c9a0 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20  renaming output 
1c9b0 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49  columns..query I
1c9c0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
1c9d0 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 32 20 2b   DISTINCT col2 +
1c9e0 20 2d 20 33 20 63 6f 6c 32 20 46 52 4f 4d 20 74   - 3 col2 FROM t
1c9f0 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 35 31 0d 0a 35  ab1..----..51..5
1ca00 34 0d 0a 39 33 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  4..93....onlyif 
1ca10 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20  mysql # use DIV 
1ca20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74  operator for int
1ca30 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71  eger division..q
1ca40 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
1ca50 61 62 65 6c 2d 37 39 38 0d 0a 53 45 4c 45 43 54  abel-798..SELECT
1ca60 20 41 4c 4c 20 2b 20 74 61 62 32 2e 63 6f 6c 31   ALL + tab2.col1
1ca70 20 2a 20 2d 20 63 6f 6c 32 20 2a 20 31 34 20 2b   * - col2 * 14 +
1ca80 20 2b 20 63 6f 6c 32 20 44 49 56 20 2b 20 63 6f   + col2 DIV + co
1ca90 6c 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  l0 AS col1 FROM 
1caa0 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 37  tab2..----..-117
1cab0 31 35 0d 0a 2d 32 31 34 37 36 0d 0a 2d 39 30 34  15..-21476..-904
1cac0 34 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  4....skipif mysq
1cad0 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
1cae0 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
1caf0 6f 72 74 20 6c 61 62 65 6c 2d 37 39 38 0d 0a 53  ort label-798..S
1cb00 45 4c 45 43 54 20 41 4c 4c 20 2b 20 74 61 62 32  ELECT ALL + tab2
1cb10 2e 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c 32 20 2a  .col1 * - col2 *
1cb20 20 31 34 20 2b 20 2b 20 63 6f 6c 32 20 2f 20 2b   14 + + col2 / +
1cb30 20 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46 52   col0 AS col1 FR
1cb40 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d  OM tab2..----..-
1cb50 31 31 37 31 35 0d 0a 2d 32 31 34 37 36 0d 0a 2d  11715..-21476..-
1cb60 39 30 34 34 0d 0a 0d 0a 73 6b 69 70 69 66 20 70  9044....skipif p
1cb70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74  ostgresql # Post
1cb80 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20  greSQL requires 
1cb90 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67  AS when renaming
1cba0 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d   output columns.
1cbb0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1cbc0 0d 0a 53 45 4c 45 43 54 20 36 37 20 63 6f 6c 30  ..SELECT 67 col0
1cbd0 20 46 52 4f 4d 20 74 61 62 31 2c 20 74 61 62 31   FROM tab1, tab1
1cbe0 20 41 53 20 63 6f 72 30 2c 20 74 61 62 31 20 41   AS cor0, tab1 A
1cbf0 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 32 37  S cor1..----..27
1cc00 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20   values hashing 
1cc10 74 6f 20 65 65 61 38 61 30 37 33 38 37 32 38 65  to eea8a0738728e
1cc20 61 35 35 65 34 65 37 62 61 31 35 30 36 63 39 39  a55e4e7ba1506c99
1cc30 30 35 61 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  05a....query I r
1cc40 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63  owsort..SELECT c
1cc50 6f 6c 30 20 2a 20 35 38 20 2a 20 63 6f 6c 30 20  ol0 * 58 * col0 
1cc60 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d  FROM tab2..----.
1cc70 0a 32 38 34 32 0d 0a 33 35 32 38 37 32 0d 0a 33  .2842..352872..3
1cc80 36 31 39 37 38 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  61978....onlyif 
1cc90 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20  mysql # use DIV 
1cca0 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74  operator for int
1ccb0 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71  eger division..q
1ccc0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
1ccd0 61 62 65 6c 2d 38 30 31 0d 0a 53 45 4c 45 43 54  abel-801..SELECT
1cce0 20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c 32   DISTINCT - col2
1ccf0 20 2a 20 63 6f 6c 31 20 44 49 56 20 63 6f 6c 31   * col1 DIV col1
1cd00 20 2b 20 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20   + col2 AS col1 
1cd10 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
1cd20 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 0d 0a 73 6b  0..----..0....sk
1cd30 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
1cd40 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
1cd50 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
1cd60 65 6c 2d 38 30 31 0d 0a 53 45 4c 45 43 54 20 44  el-801..SELECT D
1cd70 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c 32 20 2a  ISTINCT - col2 *
1cd80 20 63 6f 6c 31 20 2f 20 63 6f 6c 31 20 2b 20 63   col1 / col1 + c
1cd90 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  ol2 AS col1 FROM
1cda0 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
1cdb0 2d 2d 2d 0d 0a 30 0d 0a 0d 0a 71 75 65 72 79 20  ---..0....query 
1cdc0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
1cdd0 54 20 41 4c 4c 20 28 20 2d 20 38 34 20 29 20 41  T ALL ( - 84 ) A
1cde0 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32  S col1 FROM tab2
1cdf0 2c 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  , tab1 AS cor0..
1ce00 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68  ----..9 values h
1ce10 61 73 68 69 6e 67 20 74 6f 20 39 37 35 65 32 65  ashing to 975e2e
1ce20 66 32 61 33 62 66 31 65 65 32 36 32 32 33 36 32  f2a3bf1ee2622362
1ce30 66 34 65 34 33 35 37 35 32 66 0d 0a 0d 0a 71 75  f4e435752f....qu
1ce40 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
1ce50 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 63  ELECT DISTINCT c
1ce60 6f 6c 30 20 2a 20 2b 20 63 6f 72 30 2e 63 6f 6c  ol0 * + cor0.col
1ce70 30 20 2b 20 63 6f 6c 30 20 2a 20 63 6f 6c 32 20  0 + col0 * col2 
1ce80 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
1ce90 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 36 30 0d 0a 31  0..----..1260..1
1cea0 33 36 38 0d 0a 31 35 32 31 39 0d 0a 0d 0a 6f 6e  368..15219....on
1ceb0 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70  lyif mysql # sup
1cec0 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73  port for MySQL s
1ced0 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20 74  pecific system t
1cee0 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d  ypes and syntax.
1cef0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1cf00 20 6c 61 62 65 6c 2d 38 30 34 0d 0a 53 45 4c 45   label-804..SELE
1cf10 43 54 20 41 4c 4c 20 2d 20 63 6f 72 30 2e 63 6f  CT ALL - cor0.co
1cf20 6c 31 20 2b 20 2d 20 43 41 53 54 28 20 4e 55 4c  l1 + - CAST( NUL
1cf30 4c 20 41 53 20 53 49 47 4e 45 44 20 29 20 41 53  L AS SIGNED ) AS
1cf40 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20   col1 FROM tab1 
1cf50 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e  AS cor0..----..N
1cf60 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d  ULL..NULL..NULL.
1cf70 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
1cf80 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
1cf90 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1cfa0 74 20 6c 61 62 65 6c 2d 38 30 34 0d 0a 53 45 4c  t label-804..SEL
1cfb0 45 43 54 20 41 4c 4c 20 2d 20 63 6f 72 30 2e 63  ECT ALL - cor0.c
1cfc0 6f 6c 31 20 2b 20 2d 20 43 41 53 54 20 28 20 4e  ol1 + - CAST ( N
1cfd0 55 4c 4c 20 41 53 20 49 4e 54 45 47 45 52 20 29  ULL AS INTEGER )
1cfe0 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
1cff0 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
1d000 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55  ..NULL..NULL..NU
1d010 4c 4c 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  LL....query I ro
1d020 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
1d030 4c 20 2b 20 28 20 63 6f 72 30 2e 63 6f 6c 30 20  L + ( cor0.col0 
1d040 29 20 46 52 4f 4d 20 74 61 62 30 2c 20 74 61 62  ) FROM tab0, tab
1d050 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
1d060 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e  .9 values hashin
1d070 67 20 74 6f 20 38 62 34 39 37 39 39 39 34 32 61  g to 8b49799942a
1d080 39 65 33 35 33 61 33 64 32 37 39 63 66 36 34 65  9e353a3d279cf64e
1d090 66 33 66 36 33 0d 0a 0d 0a 71 75 65 72 79 20 49  f3f63....query I
1d0a0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
1d0b0 20 2d 20 63 6f 72 30 2e 63 6f 6c 30 20 2b 20 39   - cor0.col0 + 9
1d0c0 33 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  3 AS col0 FROM t
1d0d0 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
1d0e0 2d 0d 0a 31 34 0d 0a 31 35 0d 0a 38 36 0d 0a 0d  -..14..15..86...
1d0f0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1d100 0d 0a 53 45 4c 45 43 54 20 2b 20 2b 20 63 6f 72  ..SELECT + + cor
1d110 30 2e 63 6f 6c 30 20 2a 20 2d 20 39 38 20 2b 20  0.col0 * - 98 + 
1d120 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46  + col1 AS col0 F
1d130 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
1d140 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 32 36 36 0d 0a 2d  ..----..-2266..-
1d150 33 33 33 33 0d 0a 2d 38 36 33 31 0d 0a 0d 0a 6f  3333..-8631....o
1d160 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73  nlyif mysql # us
1d170 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66  e DIV operator f
1d180 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73  or integer divis
1d190 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ion..query I row
1d1a0 73 6f 72 74 20 6c 61 62 65 6c 2d 38 30 38 0d 0a  sort label-808..
1d1b0 53 45 4c 45 43 54 20 41 4c 4c 20 74 61 62 31 2e  SELECT ALL tab1.
1d1c0 63 6f 6c 32 20 2b 20 2d 20 32 32 20 2d 20 63 6f  col2 + - 22 - co
1d1d0 6c 32 20 44 49 56 20 63 6f 6c 32 20 41 53 20 63  l2 DIV col2 AS c
1d1e0 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d  ol0 FROM tab1..-
1d1f0 2d 2d 2d 0d 0a 33 31 0d 0a 33 34 0d 0a 37 33 0d  ---..31..34..73.
1d200 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
1d210 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
1d220 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1d230 74 20 6c 61 62 65 6c 2d 38 30 38 0d 0a 53 45 4c  t label-808..SEL
1d240 45 43 54 20 41 4c 4c 20 74 61 62 31 2e 63 6f 6c  ECT ALL tab1.col
1d250 32 20 2b 20 2d 20 32 32 20 2d 20 63 6f 6c 32 20  2 + - 22 - col2 
1d260 2f 20 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46  / col2 AS col0 F
1d270 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab1..----..
1d280 33 31 0d 0a 33 34 0d 0a 37 33 0d 0a 0d 0a 71 75  31..34..73....qu
1d290 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
1d2a0 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 30 20 2d  ELECT ALL col0 -
1d2b0 20 2d 20 36 31 20 41 53 20 63 6f 6c 31 20 46 52   - 61 AS col1 FR
1d2c0 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31  OM tab0..----..1
1d2d0 35 30 0d 0a 38 35 0d 0a 39 36 0d 0a 0d 0a 71 75  50..85..96....qu
1d2e0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
1d2f0 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b  ELECT DISTINCT +
1d300 20 2d 20 39 32 20 2d 20 63 6f 72 30 2e 63 6f 6c   - 92 - cor0.col
1d310 32 20 2a 20 2d 20 63 6f 6c 31 20 41 53 20 63 6f  2 * - col1 AS co
1d320 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l2 FROM tab1 AS 
1d330 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 35 36  cor0..----..1156
1d340 0d 0a 31 33 31 32 0d 0a 34 37 38 0d 0a 0d 0a 71  ..1312..478....q
1d350 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
1d360 53 45 4c 45 43 54 20 28 20 38 36 20 29 20 41 53  SELECT ( 86 ) AS
1d370 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 2c   col2 FROM tab0,
1d380 20 74 61 62 31 20 63 6f 72 30 2c 20 74 61 62 31   tab1 cor0, tab1
1d390 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a   AS cor1..----..
1d3a0 32 37 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e  27 values hashin
1d3b0 67 20 74 6f 20 65 64 31 61 33 39 63 32 37 35 32  g to ed1a39c2752
1d3c0 63 61 33 37 32 33 36 30 32 65 34 61 39 32 63 35  ca3723602e4a92c5
1d3d0 34 62 62 63 34 0d 0a 0d 0a 71 75 65 72 79 20 49  4bbc4....query I
1d3e0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
1d3f0 20 44 49 53 54 49 4e 43 54 20 2b 20 39 35 20 2a   DISTINCT + 95 *
1d400 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20   + col1 AS col1 
1d410 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d  FROM tab2..----.
1d420 0a 31 36 31 35 0d 0a 32 39 34 35 0d 0a 35 36 30  .1615..2945..560
1d430 35 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74  5....skipif post
1d440 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65  gresql # Postgre
1d450 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20  SQL requires AS 
1d460 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75  when renaming ou
1d470 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75  tput columns..qu
1d480 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
1d490 45 4c 45 43 54 20 2d 20 2d 20 39 31 20 63 6f 6c  ELECT - - 91 col
1d4a0 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  2 FROM tab1 AS c
1d4b0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 31 0d 0a 39  or0..----..91..9
1d4c0 31 0d 0a 39 31 0d 0a 0d 0a 71 75 65 72 79 20 49  1..91....query I
1d4d0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
1d4e0 20 41 4c 4c 20 2d 20 37 30 20 41 53 20 63 6f 6c   ALL - 70 AS col
1d4f0 30 20 46 52 4f 4d 20 74 61 62 31 2c 20 74 61 62  0 FROM tab1, tab
1d500 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20  2 cor0..----..9 
1d510 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74  values hashing t
1d520 6f 20 33 35 37 30 37 61 35 64 39 39 63 39 38 62  o 35707a5d99c98b
1d530 32 36 35 37 63 30 38 34 61 35 30 66 66 31 62 30  2657c084a50ff1b0
1d540 37 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  73....query I ro
1d550 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f  wsort..SELECT co
1d560 72 30 2e 63 6f 6c 31 20 2b 20 2b 20 39 31 20 46  r0.col1 + + 91 F
1d570 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
1d580 0d 0a 2d 2d 2d 2d 0d 0a 31 37 37 0d 0a 31 38 32  ..----..177..182
1d590 0d 0a 31 38 38 0d 0a 0d 0a 73 6b 69 70 69 66 20  ..188....skipif 
1d5a0 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73  postgresql # Pos
1d5b0 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73  tgreSQL requires
1d5c0 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e   AS when renamin
1d5d0 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73  g output columns
1d5e0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1d5f0 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2b 20 63 6f  t..SELECT - + co
1d600 6c 30 20 2b 20 63 6f 6c 30 20 63 6f 6c 32 20 46  l0 + col0 col2 F
1d610 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
1d620 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d  ..----..0..0..0.
1d630 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
1d640 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2d 20 63  rt..SELECT + - c
1d650 6f 72 30 2e 63 6f 6c 30 20 2b 20 32 35 20 41 53  or0.col0 + 25 AS
1d660 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20   col1 FROM tab1 
1d670 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
1d680 33 39 0d 0a 2d 35 35 0d 0a 32 32 0d 0a 0d 0a 71  39..-55..22....q
1d690 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
1d6a0 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
1d6b0 63 6f 6c 30 20 2b 20 35 31 20 46 52 4f 4d 20 74  col0 + 51 FROM t
1d6c0 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
1d6d0 2d 0d 0a 31 31 35 0d 0a 31 33 31 0d 0a 35 34 0d  -..115..131..54.
1d6e0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
1d6f0 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 72  rt..SELECT + cor
1d700 30 2e 63 6f 6c 30 20 2a 20 35 30 20 46 52 4f 4d  0.col0 * 50 FROM
1d710 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
1d720 2d 2d 2d 0d 0a 31 35 30 0d 0a 33 32 30 30 0d 0a  ---..150..3200..
1d730 34 30 30 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20  4000....query I 
1d740 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
1d750 37 32 20 2a 20 63 6f 6c 31 20 46 52 4f 4d 20 74  72 * col1 FROM t
1d760 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 32 32 34 0d  ab2..----..1224.
1d770 0a 32 32 33 32 0d 0a 34 32 34 38 0d 0a 0d 0a 71  .2232..4248....q
1d780 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
1d790 53 45 4c 45 43 54 20 2d 20 63 6f 6c 30 20 2b 20  SELECT - col0 + 
1d7a0 2d 20 63 6f 6c 32 20 2b 20 31 31 20 41 53 20 63  - col2 + 11 AS c
1d7b0 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d  ol0 FROM tab2..-
1d7c0 2d 2d 2d 0d 0a 2d 31 30 36 0d 0a 2d 32 33 0d 0a  ---..-106..-23..
1d7d0 2d 39 33 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  -93....onlyif my
1d7e0 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70  sql # use DIV op
1d7f0 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67  erator for integ
1d800 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65  er division..que
1d810 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
1d820 65 6c 2d 38 32 32 0d 0a 53 45 4c 45 43 54 20 2b  el-822..SELECT +
1d830 20 28 20 63 6f 6c 30 20 29 20 44 49 56 20 2b 20   ( col0 ) DIV + 
1d840 63 6f 6c 31 20 2d 20 63 6f 6c 30 20 46 52 4f 4d  col1 - col0 FROM
1d850 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 34   tab0..----..-24
1d860 0d 0a 2d 33 35 0d 0a 2d 38 39 0d 0a 0d 0a 73 6b  ..-35..-89....sk
1d870 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
1d880 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
1d890 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
1d8a0 65 6c 2d 38 32 32 0d 0a 53 45 4c 45 43 54 20 2b  el-822..SELECT +
1d8b0 20 28 20 63 6f 6c 30 20 29 20 2f 20 2b 20 63 6f   ( col0 ) / + co
1d8c0 6c 31 20 2d 20 63 6f 6c 30 20 46 52 4f 4d 20 74  l1 - col0 FROM t
1d8d0 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 34 0d 0a  ab0..----..-24..
1d8e0 2d 33 35 0d 0a 2d 38 39 0d 0a 0d 0a 71 75 65 72  -35..-89....quer
1d8f0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
1d900 45 43 54 20 2b 20 31 39 20 2b 20 2b 20 63 6f 6c  ECT + 19 + + col
1d910 32 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d  2 FROM tab0..---
1d920 2d 0d 0a 31 30 31 0d 0a 32 30 0d 0a 35 32 0d 0a  -..101..20..52..
1d930 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1d940 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 28 20  t..SELECT ALL ( 
1d950 74 61 62 31 2e 63 6f 6c 32 20 29 20 2b 20 2b 20  tab1.col2 ) + + 
1d960 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46 52 4f  col0 AS col2 FRO
1d970 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 32  M tab1..----..12
1d980 31 0d 0a 31 37 36 0d 0a 35 37 0d 0a 0d 0a 73 6b  1..176..57....sk
1d990 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20  ipif postgresql 
1d9a0 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71  # PostgreSQL req
1d9b0 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65  uires AS when re
1d9c0 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f  naming output co
1d9d0 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72  lumns..query I r
1d9e0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
1d9f0 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c 30 20 2b  ISTINCT - col0 +
1da00 20 2d 20 74 61 62 30 2e 63 6f 6c 30 20 2a 20 2d   - tab0.col0 * -
1da10 20 63 6f 6c 30 20 63 6f 6c 30 20 46 52 4f 4d 20   col0 col0 FROM 
1da20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 39 30  tab0..----..1190
1da30 0d 0a 35 35 32 0d 0a 37 38 33 32 0d 0a 0d 0a 71  ..552..7832....q
1da40 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
1da50 53 45 4c 45 43 54 20 2d 20 2d 20 36 32 20 2b 20  SELECT - - 62 + 
1da60 63 6f 6c 30 20 2a 20 63 6f 72 30 2e 63 6f 6c 32  col0 * cor0.col2
1da70 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
1da80 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
1da90 0d 0a 37 33 36 30 0d 0a 38 35 34 0d 0a 39 37 0d  ..7360..854..97.
1daa0 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72  ...skipif postgr
1dab0 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51  esql # PostgreSQ
1dac0 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68  L requires AS wh
1dad0 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70  en renaming outp
1dae0 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72  ut columns..quer
1daf0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
1db00 45 43 54 20 63 6f 6c 32 20 2b 20 63 6f 6c 31 20  ECT col2 + col1 
1db10 2a 20 63 6f 6c 30 20 63 6f 6c 32 20 46 52 4f 4d  * col0 col2 FROM
1db20 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab0 cor0..----
1db30 0d 0a 32 30 39 37 0d 0a 33 33 39 36 0d 0a 38 31  ..2097..3396..81
1db40 38 31 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  81....onlyif mys
1db50 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65  ql # use DIV ope
1db60 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65  rator for intege
1db70 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72  r division..quer
1db80 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
1db90 6c 2d 38 32 38 0d 0a 53 45 4c 45 43 54 20 2d 20  l-828..SELECT - 
1dba0 35 35 20 44 49 56 20 2d 20 63 6f 6c 30 20 2d 20  55 DIV - col0 - 
1dbb0 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46  + col1 AS col0 F
1dbc0 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
1dbd0 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 37 0d 0a 2d 32 34  ..----..-17..-24
1dbe0 0d 0a 2d 35 39 0d 0a 0d 0a 73 6b 69 70 69 66 20  ..-59....skipif 
1dbf0 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
1dc00 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
1dc10 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 38 32  rowsort label-82
1dc20 38 0d 0a 53 45 4c 45 43 54 20 2d 20 35 35 20 2f  8..SELECT - 55 /
1dc30 20 2d 20 63 6f 6c 30 20 2d 20 2b 20 63 6f 6c 31   - col0 - + col1
1dc40 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
1dc50 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
1dc60 0d 0a 2d 31 37 0d 0a 2d 32 34 0d 0a 2d 35 39 0d  ..-17..-24..-59.
1dc70 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
1dc80 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
1dc90 4e 43 54 20 63 6f 6c 32 20 2b 20 2b 20 63 6f 6c  NCT col2 + + col
1dca0 30 20 2a 20 2d 20 63 6f 6c 32 20 2b 20 63 6f 6c  0 * - col2 + col
1dcb0 30 20 2a 20 63 6f 6c 30 20 41 53 20 63 6f 6c 31  0 * col0 AS col1
1dcc0 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
1dcd0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 33 0d 0a  r0..----..-113..
1dce0 33 32 37 37 0d 0a 34 30 38 32 0d 0a 0d 0a 71 75  3277..4082....qu
1dcf0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
1dd00 45 4c 45 43 54 20 41 4c 4c 20 2d 20 2b 20 63 6f  ELECT ALL - + co
1dd10 6c 30 20 2a 20 2b 20 28 20 63 6f 6c 31 20 29 20  l0 * + ( col1 ) 
1dd20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
1dd30 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 34 33 0d 0a  0..----..-1343..
1dd40 2d 32 31 37 0d 0a 2d 34 36 30 32 0d 0a 0d 0a 71  -217..-4602....q
1dd50 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
1dd60 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 32 20  SELECT ALL col2 
1dd70 2d 20 2b 20 63 6f 6c 30 20 2a 20 63 6f 72 30 2e  - + col0 * cor0.
1dd80 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46 52 4f  col0 AS col0 FRO
1dd90 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
1dda0 2d 2d 2d 2d 0d 0a 2d 31 32 32 34 0d 0a 2d 35 34  ----..-1224..-54
1ddb0 33 0d 0a 2d 37 38 33 39 0d 0a 0d 0a 71 75 65 72  3..-7839....quer
1ddc0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
1ddd0 45 43 54 20 2b 20 2d 20 63 6f 72 30 2e 63 6f 6c  ECT + - cor0.col
1dde0 32 20 2a 20 28 20 2d 20 63 6f 6c 32 20 29 20 2b  2 * ( - col2 ) +
1ddf0 20 63 6f 6c 32 20 2a 20 2b 20 28 20 2b 20 63 6f   col2 * + ( + co
1de00 6c 32 20 29 20 41 53 20 63 6f 6c 32 20 46 52 4f  l2 ) AS col2 FRO
1de10 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
1de20 2d 2d 2d 2d 0d 0a 31 33 34 34 38 0d 0a 32 0d 0a  ----..13448..2..
1de30 32 31 37 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20  2178....query I 
1de40 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
1de50 2b 20 63 6f 6c 31 20 2a 20 63 6f 6c 30 20 2b 20  + col1 * col0 + 
1de60 2d 20 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46  - col1 AS col1 F
1de70 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
1de80 0d 0a 2d 2d 2d 2d 0d 0a 31 39 37 38 0d 0a 33 32  ..----..1978..32
1de90 39 38 0d 0a 38 30 30 38 0d 0a 0d 0a 71 75 65 72  98..8008....quer
1dea0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
1deb0 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 30 20 2a  ECT ALL - col0 *
1dec0 20 2b 20 63 6f 6c 31 20 2b 20 2d 20 63 6f 6c 31   + col1 + - col1
1ded0 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
1dee0 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
1def0 0d 0a 2d 31 30 34 0d 0a 2d 31 30 35 33 0d 0a 2d  ..-104..-1053..-
1df00 36 35 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  650....query I r
1df10 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
1df20 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c 31 20 2b  ISTINCT - col1 +
1df30 20 63 6f 72 30 2e 63 6f 6c 30 20 2a 20 2b 20 63   cor0.col0 * + c
1df40 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol0 FROM tab2 AS
1df50 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 38 0d   cor0..----..18.
1df60 0a 36 30 32 35 0d 0a 36 32 32 34 0d 0a 0d 0a 71  .6025..6224....q
1df70 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
1df80 53 45 4c 45 43 54 20 2d 20 2d 20 63 6f 6c 30 20  SELECT - - col0 
1df90 2a 20 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c 32 20  * col0 * - col2 
1dfa0 2b 20 2d 20 63 6f 6c 31 20 2a 20 63 6f 6c 30 20  + - col1 * col0 
1dfb0 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
1dfc0 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 33 34 31 31 32  0..----..-234112
1dfd0 0d 0a 2d 35 36 34 0d 0a 2d 36 31 35 34 34 30 0d  ..-564..-615440.
1dfe0 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
1dff0 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74  # use DIV operat
1e000 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64  or for integer d
1e010 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49  ivision..query I
1e020 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 38   rowsort label-8
1e030 33 37 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  37..SELECT DISTI
1e040 4e 43 54 20 2d 20 63 6f 72 30 2e 63 6f 6c 31 20  NCT - cor0.col1 
1e050 2a 20 2b 20 63 6f 6c 31 20 2b 20 63 6f 6c 31 20  * + col1 + col1 
1e060 44 49 56 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20  DIV + col1 FROM 
1e070 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab0 cor0..----.
1e080 0a 2d 37 33 39 35 0d 0a 2d 38 32 38 30 0d 0a 2d  .-7395..-8280..-
1e090 39 34 30 38 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  9408....skipif m
1e0a0 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
1e0b0 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
1e0c0 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 38 33 37  owsort label-837
1e0d0 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
1e0e0 54 20 2d 20 63 6f 72 30 2e 63 6f 6c 31 20 2a 20  T - cor0.col1 * 
1e0f0 2b 20 63 6f 6c 31 20 2b 20 63 6f 6c 31 20 2f 20  + col1 + col1 / 
1e100 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30  + col1 FROM tab0
1e110 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 37 33   cor0..----..-73
1e120 39 35 0d 0a 2d 38 32 38 30 0d 0a 2d 39 34 30 38  95..-8280..-9408
1e130 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
1e140 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61   # use DIV opera
1e150 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20  tor for integer 
1e160 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20  division..query 
1e170 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
1e180 38 33 38 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  838..SELECT ALL 
1e190 63 6f 6c 30 20 2d 20 2b 20 63 6f 72 30 2e 63 6f  col0 - + cor0.co
1e1a0 6c 32 20 44 49 56 20 2b 20 63 6f 6c 31 20 63 6f  l2 DIV + col1 co
1e1b0 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l2 FROM tab0 AS 
1e1c0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 34 0d 0a  cor0..----..24..
1e1d0 33 35 0d 0a 38 39 0d 0a 0d 0a 73 6b 69 70 69 66  35..89....skipif
1e1e0 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f   postgresql # Po
1e1f0 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65  stgreSQL require
1e200 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69  s AS when renami
1e210 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e  ng output column
1e220 73 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  s..skipif mysql 
1e230 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
1e240 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1e250 74 20 6c 61 62 65 6c 2d 38 33 38 0d 0a 53 45 4c  t label-838..SEL
1e260 45 43 54 20 41 4c 4c 20 63 6f 6c 30 20 2d 20 2b  ECT ALL col0 - +
1e270 20 63 6f 72 30 2e 63 6f 6c 32 20 2f 20 2b 20 63   cor0.col2 / + c
1e280 6f 6c 31 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61  ol1 col2 FROM ta
1e290 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
1e2a0 0d 0a 32 34 0d 0a 33 35 0d 0a 38 39 0d 0a 0d 0a  ..24..35..89....
1e2b0 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75  onlyif mysql # u
1e2c0 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20  se DIV operator 
1e2d0 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69  for integer divi
1e2e0 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f  sion..query I ro
1e2f0 77 73 6f 72 74 20 6c 61 62 65 6c 2d 38 33 39 0d  wsort label-839.
1e300 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
1e310 20 2b 20 74 61 62 30 2e 63 6f 6c 32 20 2b 20 63   + tab0.col2 + c
1e320 6f 6c 30 20 44 49 56 20 63 6f 6c 30 20 46 52 4f  ol0 DIV col0 FRO
1e330 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 32 0d  M tab0..----..2.
1e340 0a 33 34 0d 0a 38 33 0d 0a 0d 0a 73 6b 69 70 69  .34..83....skipi
1e350 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
1e360 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
1e370 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
1e380 38 33 39 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  839..SELECT DIST
1e390 49 4e 43 54 20 2b 20 74 61 62 30 2e 63 6f 6c 32  INCT + tab0.col2
1e3a0 20 2b 20 63 6f 6c 30 20 2f 20 63 6f 6c 30 20 46   + col0 / col0 F
1e3b0 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab0..----..
1e3c0 32 0d 0a 33 34 0d 0a 38 33 0d 0a 0d 0a 71 75 65  2..34..83....que
1e3d0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
1e3e0 4c 45 43 54 20 63 6f 72 30 2e 63 6f 6c 32 20 2b  LECT cor0.col2 +
1e3f0 20 28 20 63 6f 6c 30 20 29 20 46 52 4f 4d 20 74   ( col0 ) FROM t
1e400 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
1e410 2d 0d 0a 31 30 34 0d 0a 31 31 37 0d 0a 33 34 0d  -..104..117..34.
1e420 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
1e430 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b  rt..SELECT ALL +
1e440 20 63 6f 6c 31 20 2a 20 2d 20 28 20 2d 20 28 20   col1 * - ( - ( 
1e450 2d 20 63 6f 72 30 2e 63 6f 6c 30 20 29 20 29 20  - cor0.col0 ) ) 
1e460 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
1e470 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 34 30 0d 0a  0..----..-1040..
1e480 2d 36 34 30 0d 0a 2d 37 38 0d 0a 0d 0a 71 75 65  -640..-78....que
1e490 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
1e4a0 4c 45 43 54 20 2b 20 2d 20 63 6f 6c 31 20 2b 20  LECT + - col1 + 
1e4b0 2d 20 31 30 20 2a 20 2b 20 63 6f 6c 32 20 46 52  - 10 * + col2 FR
1e4c0 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
1e4d0 0a 2d 2d 2d 2d 0d 0a 2d 33 30 31 0d 0a 2d 33 31  .----..-301..-31
1e4e0 39 0d 0a 2d 33 39 37 0d 0a 0d 0a 6f 6e 6c 79 69  9..-397....onlyi
1e4f0 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49  f mysql # use DI
1e500 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69  V operator for i
1e510 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d  nteger division.
1e520 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1e530 20 6c 61 62 65 6c 2d 38 34 33 0d 0a 53 45 4c 45   label-843..SELE
1e540 43 54 20 2b 20 43 41 53 54 28 20 2d 20 63 6f 6c  CT + CAST( - col
1e550 31 20 41 53 20 53 49 47 4e 45 44 20 29 20 44 49  1 AS SIGNED ) DI
1e560 56 20 2b 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61  V + col2 FROM ta
1e570 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
1e580 0d 0a 2d 31 0d 0a 2d 32 0d 0a 2d 39 37 0d 0a 0d  ..-1..-2..-97...
1e590 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
1e5a0 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
1e5b0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
1e5c0 6c 61 62 65 6c 2d 38 34 33 0d 0a 53 45 4c 45 43  label-843..SELEC
1e5d0 54 20 2b 20 43 41 53 54 20 28 20 2d 20 63 6f 6c  T + CAST ( - col
1e5e0 31 20 41 53 20 49 4e 54 45 47 45 52 20 29 20 2f  1 AS INTEGER ) /
1e5f0 20 2b 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62   + col2 FROM tab
1e600 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
1e610 0a 2d 31 0d 0a 2d 32 0d 0a 2d 39 37 0d 0a 0d 0a  .-1..-2..-97....
1e620 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71  skipif postgresq
1e630 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72  l # PostgreSQL r
1e640 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20  equires AS when 
1e650 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20  renaming output 
1e660 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49  columns..query I
1e670 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
1e680 20 2d 20 34 34 20 2a 20 2b 20 33 36 20 2b 20 63   - 44 * + 36 + c
1e690 6f 6c 30 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61  ol0 col1 FROM ta
1e6a0 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
1e6b0 0d 0a 2d 31 35 30 35 0d 0a 2d 31 35 30 36 0d 0a  ..-1505..-1506..
1e6c0 2d 31 35 37 37 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  -1577....onlyif 
1e6d0 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20  mysql # use DIV 
1e6e0 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74  operator for int
1e6f0 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71  eger division..q
1e700 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
1e710 61 62 65 6c 2d 38 34 35 0d 0a 53 45 4c 45 43 54  abel-845..SELECT
1e720 20 44 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c 30   DISTINCT + col0
1e730 20 2b 20 63 6f 6c 32 20 44 49 56 20 63 6f 6c 30   + col2 DIV col0
1e740 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
1e750 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 31 0d 0a 36 34  r0..----..21..64
1e760 0d 0a 38 31 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  ..81....skipif m
1e770 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
1e780 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
1e790 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 38 34 35  owsort label-845
1e7a0 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
1e7b0 54 20 2b 20 63 6f 6c 30 20 2b 20 63 6f 6c 32 20  T + col0 + col2 
1e7c0 2f 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31  / col0 FROM tab1
1e7d0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
1e7e0 32 31 0d 0a 36 34 0d 0a 38 31 0d 0a 0d 0a 6f 6e  21..64..81....on
1e7f0 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70  lyif mysql # sup
1e800 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73  port for MySQL s
1e810 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20 74  pecific system t
1e820 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d  ypes and syntax.
1e830 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1e840 20 6c 61 62 65 6c 2d 38 34 36 0d 0a 53 45 4c 45   label-846..SELE
1e850 43 54 20 41 4c 4c 20 2b 20 43 41 53 54 28 20 4e  CT ALL + CAST( N
1e860 55 4c 4c 20 41 53 20 53 49 47 4e 45 44 20 29 20  ULL AS SIGNED ) 
1e870 2a 20 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46  * col1 AS col1 F
1e880 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
1e890 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55  ..----..NULL..NU
1e8a0 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70  LL..NULL....skip
1e8b0 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
1e8c0 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
1e8d0 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
1e8e0 2d 38 34 36 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  -846..SELECT ALL
1e8f0 20 2b 20 43 41 53 54 20 28 20 4e 55 4c 4c 20 41   + CAST ( NULL A
1e900 53 20 49 4e 54 45 47 45 52 20 29 20 2a 20 63 6f  S INTEGER ) * co
1e910 6c 31 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  l1 AS col1 FROM 
1e920 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
1e930 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a  --..NULL..NULL..
1e940 4e 55 4c 4c 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  NULL....onlyif m
1e950 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f  ysql # use DIV o
1e960 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65  perator for inte
1e970 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75  ger division..qu
1e980 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
1e990 62 65 6c 2d 38 34 37 0d 0a 53 45 4c 45 43 54 20  bel-847..SELECT 
1e9a0 2b 20 39 31 20 2b 20 28 20 63 6f 6c 32 20 29 20  + 91 + ( col2 ) 
1e9b0 44 49 56 20 63 6f 72 30 2e 63 6f 6c 30 20 41 53  DIV cor0.col0 AS
1e9c0 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20   col2 FROM tab0 
1e9d0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39  AS cor0..----..9
1e9e0 31 0d 0a 39 31 0d 0a 39 32 0d 0a 0d 0a 73 6b 69  1..91..92....ski
1e9f0 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
1ea00 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
1ea10 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
1ea20 6c 2d 38 34 37 0d 0a 53 45 4c 45 43 54 20 2b 20  l-847..SELECT + 
1ea30 39 31 20 2b 20 28 20 63 6f 6c 32 20 29 20 2f 20  91 + ( col2 ) / 
1ea40 63 6f 72 30 2e 63 6f 6c 30 20 41 53 20 63 6f 6c  cor0.col0 AS col
1ea50 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  2 FROM tab0 AS c
1ea60 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 31 0d 0a 39  or0..----..91..9
1ea70 31 0d 0a 39 32 0d 0a 0d 0a 73 6b 69 70 69 66 20  1..92....skipif 
1ea80 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73  postgresql # Pos
1ea90 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73  tgreSQL requires
1eaa0 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e   AS when renamin
1eab0 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73  g output columns
1eac0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1ead0 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20  t..SELECT ALL + 
1eae0 39 39 20 2b 20 2d 20 63 6f 72 30 2e 63 6f 6c 31  99 + - cor0.col1
1eaf0 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20   col1 FROM tab2 
1eb00 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 34  AS cor0..----..4
1eb10 30 0d 0a 36 38 0d 0a 38 32 0d 0a 0d 0a 6f 6e 6c  0..68..82....onl
1eb20 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70  yif mysql # supp
1eb30 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70  ort for MySQL sp
1eb40 65 63 69 66 69 63 20 73 79 73 74 65 6d 20 74 79  ecific system ty
1eb50 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a  pes and syntax..
1eb60 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
1eb70 6c 61 62 65 6c 2d 38 34 39 0d 0a 53 45 4c 45 43  label-849..SELEC
1eb80 54 20 44 49 53 54 49 4e 43 54 20 2b 20 43 41 53  T DISTINCT + CAS
1eb90 54 28 20 4e 55 4c 4c 20 41 53 20 44 45 43 49 4d  T( NULL AS DECIM
1eba0 41 4c 20 29 20 2b 20 2b 20 28 20 2b 20 63 6f 6c  AL ) + + ( + col
1ebb0 32 20 29 20 46 52 4f 4d 20 74 61 62 32 20 41 53  2 ) FROM tab2 AS
1ebc0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c   cor0..----..NUL
1ebd0 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  L....skipif mysq
1ebe0 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
1ebf0 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
1ec00 6f 72 74 20 6c 61 62 65 6c 2d 38 34 39 0d 0a 53  ort label-849..S
1ec10 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b  ELECT DISTINCT +
1ec20 20 43 41 53 54 20 28 20 4e 55 4c 4c 20 41 53 20   CAST ( NULL AS 
1ec30 52 45 41 4c 20 29 20 2b 20 2b 20 28 20 2b 20 63  REAL ) + + ( + c
1ec40 6f 6c 32 20 29 20 46 52 4f 4d 20 74 61 62 32 20  ol2 ) FROM tab2 
1ec50 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e  AS cor0..----..N
1ec60 55 4c 4c 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  ULL....query I r
1ec70 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
1ec80 49 53 54 49 4e 43 54 20 2d 20 63 6f 72 30 2e 63  ISTINCT - cor0.c
1ec90 6f 6c 31 20 2b 20 2d 20 63 6f 6c 32 20 2b 20 63  ol1 + - col2 + c
1eca0 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol2 FROM tab2 AS
1ecb0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 37   cor0..----..-17
1ecc0 0d 0a 2d 33 31 0d 0a 2d 35 39 0d 0a 0d 0a 71 75  ..-31..-59....qu
1ecd0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
1ece0 45 4c 45 43 54 20 37 36 20 2d 20 2b 20 63 6f 72  ELECT 76 - + cor
1ecf0 30 2e 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46  0.col1 AS col2 F
1ed00 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
1ed10 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 0d 0a 2d 31 35  ..----..-10..-15
1ed20 0d 0a 2d 32 31 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  ..-21....onlyif 
1ed30 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20  mysql # use DIV 
1ed40 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74  operator for int
1ed50 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71  eger division..q
1ed60 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
1ed70 61 62 65 6c 2d 38 35 32 0d 0a 53 45 4c 45 43 54  abel-852..SELECT
1ed80 20 41 4c 4c 20 2b 20 63 6f 6c 31 20 44 49 56 20   ALL + col1 DIV 
1ed90 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46  + col0 AS col0 F
1eda0 52 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d  ROM tab2 cor0..-
1edb0 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 34 0d 0a 0d 0a  ---..0..0..4....
1edc0 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
1edd0 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
1ede0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
1edf0 61 62 65 6c 2d 38 35 32 0d 0a 53 45 4c 45 43 54  abel-852..SELECT
1ee00 20 41 4c 4c 20 2b 20 63 6f 6c 31 20 2f 20 2b 20   ALL + col1 / + 
1ee10 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46 52 4f  col0 AS col0 FRO
1ee20 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab2 cor0..---
1ee30 2d 0d 0a 30 0d 0a 30 0d 0a 34 0d 0a 0d 0a 71 75  -..0..0..4....qu
1ee40 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
1ee50 45 4c 45 43 54 20 63 6f 6c 30 20 2b 20 2d 20 63  ELECT col0 + - c
1ee60 6f 6c 31 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f  ol1 + col1 AS co
1ee70 6c 31 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d  l1 FROM tab2..--
1ee80 2d 2d 0d 0a 37 0d 0a 37 38 0d 0a 37 39 0d 0a 0d  --..7..78..79...
1ee90 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
1eea0 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51  support for MySQ
1eeb0 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65  L specific syste
1eec0 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74  m types and synt
1eed0 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ax..query I rows
1eee0 6f 72 74 20 6c 61 62 65 6c 2d 38 35 34 0d 0a 53  ort label-854..S
1eef0 45 4c 45 43 54 20 43 41 53 54 28 20 4e 55 4c 4c  ELECT CAST( NULL
1ef00 20 41 53 20 53 49 47 4e 45 44 20 29 20 2b 20 2d   AS SIGNED ) + -
1ef10 20 37 33 20 2d 20 63 6f 6c 30 20 46 52 4f 4d 20   73 - col0 FROM 
1ef20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c  tab2..----..NULL
1ef30 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a  ..NULL..NULL....
1ef40 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
1ef50 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
1ef60 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
1ef70 61 62 65 6c 2d 38 35 34 0d 0a 53 45 4c 45 43 54  abel-854..SELECT
1ef80 20 43 41 53 54 20 28 20 4e 55 4c 4c 20 41 53 20   CAST ( NULL AS 
1ef90 49 4e 54 45 47 45 52 20 29 20 2b 20 2d 20 37 33  INTEGER ) + - 73
1efa0 20 2d 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62   - col0 FROM tab
1efb0 32 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e  2..----..NULL..N
1efc0 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69  ULL..NULL....ski
1efd0 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23  pif postgresql #
1efe0 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75   PostgreSQL requ
1eff0 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e  ires AS when ren
1f000 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c  aming output col
1f010 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f  umns..query I ro
1f020 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
1f030 53 54 49 4e 43 54 20 31 31 20 2a 20 74 61 62 30  STINCT 11 * tab0
1f040 2e 63 6f 6c 31 20 63 6f 6c 30 20 46 52 4f 4d 20  .col1 col0 FROM 
1f050 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 30 31  tab0..----..1001
1f060 0d 0a 31 30 36 37 0d 0a 39 34 36 0d 0a 0d 0a 71  ..1067..946....q
1f070 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
1f080 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 2b 20 38  SELECT ALL + + 8
1f090 31 20 2a 20 2b 20 63 6f 6c 30 20 2b 20 63 6f 6c  1 * + col0 + col
1f0a0 31 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  1 AS col2 FROM t
1f0b0 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
1f0c0 2d 0d 0a 35 39 38 0d 0a 36 33 37 37 0d 0a 36 34  -..598..6377..64
1f0d0 31 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  16....query I ro
1f0e0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
1f0f0 63 6f 6c 32 20 2a 20 63 6f 72 30 2e 63 6f 6c 31  col2 * cor0.col1
1f100 20 2b 20 2b 20 39 38 20 2a 20 35 37 20 41 53 20   + + 98 * 57 AS 
1f110 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41  col0 FROM tab1 A
1f120 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 34 31  S cor0..----..41
1f130 38 32 0d 0a 34 33 33 38 0d 0a 35 30 31 36 0d 0a  82..4338..5016..
1f140 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1f150 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
1f160 43 54 20 39 33 20 2a 20 2b 20 63 6f 72 30 2e 63  CT 93 * + cor0.c
1f170 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol2 FROM tab1 AS
1f180 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 35 30 32   cor0..----..502
1f190 32 0d 0a 35 33 30 31 0d 0a 38 39 32 38 0d 0a 0d  2..5301..8928...
1f1a0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1f1b0 0d 0a 53 45 4c 45 43 54 20 2d 20 38 32 20 2a 20  ..SELECT - 82 * 
1f1c0 2b 20 63 6f 6c 32 20 2a 20 38 35 20 2b 20 2b 20  + col2 * 85 + + 
1f1d0 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c 30 20 46 52  col2 * + col0 FR
1f1e0 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
1f1f0 0a 2d 2d 2d 2d 0d 0a 2d 31 37 39 31 39 32 0d 0a  .----..-179192..
1f200 2d 31 38 38 30 30 31 0d 0a 2d 32 36 31 38 35 38  -188001..-261858
1f210 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
1f220 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d   # support for M
1f230 79 53 51 4c 20 73 70 65 63 69 66 69 63 20 73 79  ySQL specific sy
1f240 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73  stem types and s
1f250 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72  yntax..query I r
1f260 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 38 36 30  owsort label-860
1f270 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 32 20 2a 20  ..SELECT col2 * 
1f280 63 6f 6c 31 20 2d 20 43 41 53 54 28 20 2b 20 63  col1 - CAST( + c
1f290 6f 6c 32 20 41 53 20 53 49 47 4e 45 44 20 29 20  ol2 AS SIGNED ) 
1f2a0 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
1f2b0 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
1f2c0 0a 31 35 30 38 0d 0a 36 30 38 0d 0a 38 31 30 0d  .1508..608..810.
1f2d0 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
1f2e0 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
1f2f0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1f300 74 20 6c 61 62 65 6c 2d 38 36 30 0d 0a 53 45 4c  t label-860..SEL
1f310 45 43 54 20 63 6f 6c 32 20 2a 20 63 6f 6c 31 20  ECT col2 * col1 
1f320 2d 20 43 41 53 54 20 28 20 2b 20 63 6f 6c 32 20  - CAST ( + col2 
1f330 41 53 20 49 4e 54 45 47 45 52 20 29 20 41 53 20  AS INTEGER ) AS 
1f340 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41  col0 FROM tab2 A
1f350 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 35  S cor0..----..15
1f360 30 38 0d 0a 36 30 38 0d 0a 38 31 30 0d 0a 0d 0a  08..608..810....
1f370 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
1f380 0a 53 45 4c 45 43 54 20 2b 20 37 38 20 2b 20 63  .SELECT + 78 + c
1f390 6f 72 30 2e 63 6f 6c 30 20 46 52 4f 4d 20 74 61  or0.col0 FROM ta
1f3a0 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
1f3b0 0d 0a 31 34 32 0d 0a 31 35 38 0d 0a 38 31 0d 0a  ..142..158..81..
1f3c0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1f3d0 74 0d 0a 53 45 4c 45 43 54 20 34 36 20 2d 20 63  t..SELECT 46 - c
1f3e0 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol1 FROM tab2 AS
1f3f0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33   cor0..----..-13
1f400 0d 0a 31 35 0d 0a 32 39 0d 0a 0d 0a 71 75 65 72  ..15..29....quer
1f410 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
1f420 45 43 54 20 2b 20 63 6f 6c 32 20 2a 20 63 6f 72  ECT + col2 * cor
1f430 30 2e 63 6f 6c 31 20 2d 20 2d 20 37 32 20 41 53  0.col1 - - 72 AS
1f440 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20   col0 FROM tab1 
1f450 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
1f460 33 32 30 0d 0a 31 34 37 36 0d 0a 36 34 32 0d 0a  320..1476..642..
1f470 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1f480 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 33 36  t..SELECT ALL 36
1f490 20 2b 20 2d 20 63 6f 6c 32 20 2a 20 2b 20 28 20   + - col2 * + ( 
1f4a0 63 6f 6c 31 20 29 20 46 52 4f 4d 20 74 61 62 32  col1 ) FROM tab2
1f4b0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 34   cor0..----..-14
1f4c0 39 38 0d 0a 2d 36 31 30 0d 0a 2d 38 30 31 0d 0a  98..-610..-801..
1f4d0 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65  ..skipif postgre
1f4e0 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c  sql # PostgreSQL
1f4f0 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65   requires AS whe
1f500 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75  n renaming outpu
1f510 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79  t columns..query
1f520 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
1f530 43 54 20 2d 20 34 37 20 2a 20 63 6f 6c 32 20 63  CT - 47 * col2 c
1f540 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 63 6f  ol1 FROM tab1 co
1f550 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 35 33 38 0d  r0..----..-2538.
1f560 0a 2d 32 36 37 39 0d 0a 2d 34 35 31 32 0d 0a 0d  .-2679..-4512...
1f570 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1f580 0d 0a 53 45 4c 45 43 54 20 2b 20 2d 20 28 20 63  ..SELECT + - ( c
1f590 6f 6c 31 20 29 20 2d 20 31 30 20 41 53 20 63 6f  ol1 ) - 10 AS co
1f5a0 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l0 FROM tab2 AS 
1f5b0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 37 0d  cor0..----..-27.
1f5c0 0a 2d 34 31 0d 0a 2d 36 39 0d 0a 0d 0a 6f 6e 6c  .-41..-69....onl
1f5d0 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20  yif mysql # use 
1f5e0 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72  DIV operator for
1f5f0 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f   integer divisio
1f600 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  n..query I rowso
1f610 72 74 20 6c 61 62 65 6c 2d 38 36 37 0d 0a 53 45  rt label-867..SE
1f620 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20  LECT DISTINCT - 
1f630 2d 20 32 20 44 49 56 20 2d 20 63 6f 6c 30 20 46  - 2 DIV - col0 F
1f640 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
1f650 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 0d 0a 73 6b 69  ..----..0....ski
1f660 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
1f670 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
1f680 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
1f690 6c 2d 38 36 37 0d 0a 53 45 4c 45 43 54 20 44 49  l-867..SELECT DI
1f6a0 53 54 49 4e 43 54 20 2d 20 2d 20 32 20 2f 20 2d  STINCT - - 2 / -
1f6b0 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20   col0 FROM tab1 
1f6c0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30  AS cor0..----..0
1f6d0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
1f6e0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 32 31  ort..SELECT + 21
1f6f0 20 2d 20 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20   - col1 AS col2 
1f700 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d  FROM tab1..----.
1f710 0a 2d 35 0d 0a 31 31 0d 0a 38 0d 0a 0d 0a 71 75  .-5..11..8....qu
1f720 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
1f730 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d  ELECT DISTINCT -
1f740 20 63 6f 6c 31 20 2a 20 63 6f 6c 30 20 2b 20 63   col1 * col0 + c
1f750 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d  ol1 FROM tab0..-
1f760 2d 2d 2d 0d 0a 2d 31 39 37 38 0d 0a 2d 33 32 39  ---..-1978..-329
1f770 38 0d 0a 2d 38 30 30 38 0d 0a 0d 0a 71 75 65 72  8..-8008....quer
1f780 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
1f790 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63  ECT DISTINCT + c
1f7a0 6f 6c 30 20 2a 20 2b 20 63 6f 6c 32 20 2b 20 2d  ol0 * + col2 + -
1f7b0 20 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46 52   col0 AS col2 FR
1f7c0 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
1f7d0 0a 2d 2d 2d 2d 0d 0a 31 38 32 0d 0a 31 39 35 30  .----..182..1950
1f7e0 0d 0a 32 39 32 33 0d 0a 0d 0a 71 75 65 72 79 20  ..2923....query 
1f7f0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
1f800 54 20 63 6f 6c 31 20 2b 20 63 6f 72 30 2e 63 6f  T col1 + cor0.co
1f810 6c 31 20 2a 20 2d 20 35 36 20 41 53 20 63 6f 6c  l1 * - 56 AS col
1f820 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  2 FROM tab2 AS c
1f830 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 37 30 35  or0..----..-1705
1f840 0d 0a 2d 33 32 34 35 0d 0a 2d 39 33 35 0d 0a 0d  ..-3245..-935...
1f850 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1f860 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
1f870 54 20 2d 20 31 34 20 2d 20 2b 20 63 6f 72 30 2e  T - 14 - + cor0.
1f880 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41  col0 FROM tab1 A
1f890 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
1f8a0 37 0d 0a 2d 37 38 0d 0a 2d 39 34 0d 0a 0d 0a 71  7..-78..-94....q
1f8b0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
1f8c0 53 45 4c 45 43 54 20 2b 20 31 32 20 46 52 4f 4d  SELECT + 12 FROM
1f8d0 20 74 61 62 30 20 41 53 20 63 6f 72 30 20 43 52   tab0 AS cor0 CR
1f8e0 4f 53 53 20 4a 4f 49 4e 20 74 61 62 32 20 41 53  OSS JOIN tab2 AS
1f8f0 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76   cor1..----..9 v
1f900 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f  alues hashing to
1f910 20 64 34 66 35 61 38 65 30 33 32 32 39 34 63 33   d4f5a8e032294c3
1f920 62 39 33 34 32 38 32 31 36 31 37 38 30 30 39 37  b934282161780097
1f930 32 0d 0a 0d 0a 71 75 65 72 79 20 49 49 49 49 49  2....query IIIII
1f940 49 49 49 49 49 49 49 49 49 49 20 72 6f 77 73 6f  IIIIIIIIII rowso
1f950 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2a  rt..SELECT ALL *
1f960 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
1f970 72 30 20 43 52 4f 53 53 20 4a 4f 49 4e 20 74 61  r0 CROSS JOIN ta
1f980 62 32 2c 20 74 61 62 32 20 41 53 20 63 6f 72 31  b2, tab2 AS cor1
1f990 2c 20 74 61 62 30 20 41 53 20 63 6f 72 32 2c 20  , tab0 AS cor2, 
1f9a0 74 61 62 32 20 41 53 20 63 6f 72 33 0d 0a 2d 2d  tab2 AS cor3..--
1f9b0 2d 2d 0d 0a 33 36 34 35 20 76 61 6c 75 65 73 20  --..3645 values 
1f9c0 68 61 73 68 69 6e 67 20 74 6f 20 66 63 61 65 36  hashing to fcae6
1f9d0 65 34 34 36 37 66 37 39 38 61 63 38 38 63 38 36  e4467f798ac88c86
1f9e0 39 62 38 65 33 38 63 36 62 32 33 0d 0a 0d 0a 71  9b8e38c6b23....q
1f9f0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
1fa00 53 45 4c 45 43 54 20 2b 20 28 20 2b 20 63 6f 72  SELECT + ( + cor
1fa10 30 2e 63 6f 6c 32 20 29 20 2a 20 63 6f 72 30 2e  0.col2 ) * cor0.
1fa20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 63  col0 FROM tab1 c
1fa30 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 36 32 0d 0a  or0..----..162..
1fa40 33 36 34 38 0d 0a 37 36 38 30 0d 0a 0d 0a 71 75  3648..7680....qu
1fa50 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
1fa60 45 4c 45 43 54 20 41 4c 4c 20 37 32 20 46 52 4f  ELECT ALL 72 FRO
1fa70 4d 20 74 61 62 32 2c 20 74 61 62 30 20 41 53 20  M tab2, tab0 AS 
1fa80 63 6f 72 30 2c 20 74 61 62 31 20 63 6f 72 31 2c  cor0, tab1 cor1,
1fa90 20 74 61 62 32 20 41 53 20 63 6f 72 32 0d 0a 2d   tab2 AS cor2..-
1faa0 2d 2d 2d 0d 0a 38 31 20 76 61 6c 75 65 73 20 68  ---..81 values h
1fab0 61 73 68 69 6e 67 20 74 6f 20 65 31 36 31 38 61  ashing to e1618a
1fac0 62 66 65 31 32 62 65 36 61 39 35 30 63 63 35 37  bfe12be6a950cc57
1fad0 35 64 36 39 35 36 33 39 62 37 0d 0a 0d 0a 71 75  5d695639b7....qu
1fae0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
1faf0 45 4c 45 43 54 20 41 4c 4c 20 2b 20 2d 20 63 6f  ELECT ALL + - co
1fb00 6c 32 20 2a 20 38 30 20 2b 20 2d 20 63 6f 6c 32  l2 * 80 + - col2
1fb10 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
1fb20 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 36 37 33 0d  r0..----..-2673.
1fb30 0a 2d 36 36 34 32 0d 0a 2d 38 31 0d 0a 0d 0a 6f  .-6642..-81....o
1fb40 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73  nlyif mysql # us
1fb50 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66  e DIV operator f
1fb60 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73  or integer divis
1fb70 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ion..query I row
1fb80 73 6f 72 74 20 6c 61 62 65 6c 2d 38 37 38 0d 0a  sort label-878..
1fb90 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
1fba0 43 41 53 54 28 20 2d 20 63 6f 6c 30 20 41 53 20  CAST( - col0 AS 
1fbb0 53 49 47 4e 45 44 20 29 20 44 49 56 20 2d 20 63  SIGNED ) DIV - c
1fbc0 6f 6c 31 20 2b 20 32 32 20 2b 20 63 6f 72 30 2e  ol1 + 22 + cor0.
1fbd0 63 6f 6c 32 20 44 49 56 20 63 6f 6c 31 20 41 53  col2 DIV col1 AS
1fbe0 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20   col2 FROM tab0 
1fbf0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 32 0d 0a  cor0..----..22..
1fc00 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
1fc10 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
1fc20 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1fc30 20 6c 61 62 65 6c 2d 38 37 38 0d 0a 53 45 4c 45   label-878..SELE
1fc40 43 54 20 44 49 53 54 49 4e 43 54 20 43 41 53 54  CT DISTINCT CAST
1fc50 20 28 20 2d 20 63 6f 6c 30 20 41 53 20 49 4e 54   ( - col0 AS INT
1fc60 45 47 45 52 20 29 20 2f 20 2d 20 63 6f 6c 31 20  EGER ) / - col1 
1fc70 2b 20 32 32 20 2b 20 63 6f 72 30 2e 63 6f 6c 32  + 22 + cor0.col2
1fc80 20 2f 20 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20   / col1 AS col2 
1fc90 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a  FROM tab0 cor0..
1fca0 2d 2d 2d 2d 0d 0a 32 32 0d 0a 0d 0a 6f 6e 6c 79  ----..22....only
1fcb0 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f  if mysql # suppo
1fcc0 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65  rt for MySQL spe
1fcd0 63 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70  cific system typ
1fce0 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71  es and syntax..q
1fcf0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
1fd00 61 62 65 6c 2d 38 37 39 0d 0a 53 45 4c 45 43 54  abel-879..SELECT
1fd10 20 44 49 53 54 49 4e 43 54 20 2d 20 28 20 2b 20   DISTINCT - ( + 
1fd20 31 31 20 29 20 2a 20 63 6f 72 30 2e 63 6f 6c 32  11 ) * cor0.col2
1fd30 20 2b 20 43 41 53 54 28 20 4e 55 4c 4c 20 41 53   + CAST( NULL AS
1fd40 20 53 49 47 4e 45 44 20 29 20 2a 20 2d 20 63 6f   SIGNED ) * - co
1fd50 6c 31 20 2b 20 2d 20 63 6f 72 30 2e 63 6f 6c 30  l1 + - cor0.col0
1fd60 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
1fd70 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a  r0..----..NULL..
1fd80 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
1fd90 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
1fda0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1fdb0 20 6c 61 62 65 6c 2d 38 37 39 0d 0a 53 45 4c 45   label-879..SELE
1fdc0 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 28 20  CT DISTINCT - ( 
1fdd0 2b 20 31 31 20 29 20 2a 20 63 6f 72 30 2e 63 6f  + 11 ) * cor0.co
1fde0 6c 32 20 2b 20 43 41 53 54 20 28 20 4e 55 4c 4c  l2 + CAST ( NULL
1fdf0 20 41 53 20 49 4e 54 45 47 45 52 20 29 20 2a 20   AS INTEGER ) * 
1fe00 2d 20 63 6f 6c 31 20 2b 20 2d 20 63 6f 72 30 2e  - col1 + - cor0.
1fe10 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41  col0 FROM tab1 A
1fe20 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55  S cor0..----..NU
1fe30 4c 4c 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  LL....query I ro
1fe40 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
1fe50 63 6f 6c 31 20 2b 20 31 32 20 41 53 20 63 6f 6c  col1 + 12 AS col
1fe60 32 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d  2 FROM tab1..---
1fe70 2d 0d 0a 32 32 0d 0a 32 35 0d 0a 33 38 0d 0a 0d  -..22..25..38...
1fe80 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1fe90 0d 0a 53 45 4c 45 43 54 20 74 61 62 30 2e 63 6f  ..SELECT tab0.co
1fea0 6c 30 20 2b 20 2d 20 63 6f 6c 32 20 2a 20 2d 20  l0 + - col2 * - 
1feb0 74 61 62 30 2e 63 6f 6c 30 20 2a 20 63 6f 6c 30  tab0.col0 * col0
1fec0 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
1fed0 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 36 30 0d 0a  b0..----..1260..
1fee0 31 39 30 33 32 0d 0a 36 34 39 36 31 31 0d 0a 0d  19032..649611...
1fef0 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
1ff00 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51  support for MySQ
1ff10 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65  L specific syste
1ff20 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74  m types and synt
1ff30 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ax..query I rows
1ff40 6f 72 74 20 6c 61 62 65 6c 2d 38 38 32 0d 0a 53  ort label-882..S
1ff50 45 4c 45 43 54 20 2b 20 43 41 53 54 28 20 4e 55  ELECT + CAST( NU
1ff60 4c 4c 20 41 53 20 53 49 47 4e 45 44 20 29 20 2b  LL AS SIGNED ) +
1ff70 20 2b 20 63 6f 6c 30 20 2a 20 63 6f 6c 31 20 46   + col0 * col1 F
1ff80 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab1..----..
1ff90 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c  NULL..NULL..NULL
1ffa0 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
1ffb0 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
1ffc0 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
1ffd0 72 74 20 6c 61 62 65 6c 2d 38 38 32 0d 0a 53 45  rt label-882..SE
1ffe0 4c 45 43 54 20 2b 20 43 41 53 54 20 28 20 4e 55  LECT + CAST ( NU
1fff0 4c 4c 20 41 53 20 49 4e 54 45 47 45 52 20 29 20  LL AS INTEGER ) 
20000 2b 20 2b 20 63 6f 6c 30 20 2a 20 63 6f 6c 31 20  + + col0 * col1 
20010 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d  FROM tab1..----.
20020 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c  .NULL..NULL..NUL
20030 4c 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  L....query I row
20040 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
20050 54 49 4e 43 54 20 63 6f 72 31 2e 63 6f 6c 30 20  TINCT cor1.col0 
20060 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
20070 32 2c 20 74 61 62 31 20 63 6f 72 30 2c 20 74 61  2, tab1 cor0, ta
20080 62 32 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d  b2 AS cor1..----
20090 0d 0a 37 0d 0a 37 38 0d 0a 37 39 0d 0a 0d 0a 71  ..7..78..79....q
200a0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
200b0 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
200c0 2d 20 2b 20 28 20 2b 20 63 6f 6c 30 20 29 20 2a  - + ( + col0 ) *
200d0 20 2d 20 63 6f 6c 31 20 2b 20 2b 20 39 31 20 41   - col1 + + 91 A
200e0 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30  S col0 FROM tab0
200f0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 31 35   cor0..----..215
20100 35 0d 0a 33 34 38 36 0d 0a 38 31 39 30 0d 0a 0d  5..3486..8190...
20110 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
20120 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 2d  ..SELECT ALL - -
20130 20 63 6f 72 30 2e 63 6f 6c 30 20 2b 20 2d 20 36   cor0.col0 + - 6
20140 31 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  1 AS col0 FROM t
20150 61 62 31 2c 20 74 61 62 32 2c 20 74 61 62 30 20  ab1, tab2, tab0 
20160 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32  AS cor0..----..2
20170 37 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67  7 values hashing
20180 20 74 6f 20 36 39 31 62 34 31 62 38 64 62 32 65   to 691b41b8db2e
20190 32 64 65 33 35 66 66 39 63 38 36 62 35 63 32 37  2de35ff9c86b5c27
201a0 65 63 32 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ec25....query I 
201b0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
201c0 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 72 30 2e  DISTINCT - cor0.
201d0 63 6f 6c 30 20 2d 20 2d 20 63 6f 6c 32 20 46 52  col0 - - col2 FR
201e0 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
201f0 0a 2d 2d 2d 2d 0d 0a 2d 33 34 0d 0a 2d 37 0d 0a  .----..-34..-7..
20200 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  9....query I row
20210 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2b  sort..SELECT + +
20220 20 28 20 2d 20 63 6f 6c 30 20 29 20 2b 20 63 6f   ( - col0 ) + co
20230 6c 30 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  l0 AS col0 FROM 
20240 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
20250 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a 71  --..0..0..0....q
20260 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
20270 53 45 4c 45 43 54 20 2d 20 39 38 20 2a 20 35 38  SELECT - 98 * 58
20280 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
20290 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
202a0 0d 0a 2d 35 36 38 34 0d 0a 2d 35 36 38 34 0d 0a  ..-5684..-5684..
202b0 2d 35 36 38 34 0d 0a 0d 0a 71 75 65 72 79 20 49  -5684....query I
202c0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
202d0 20 41 4c 4c 20 39 35 20 41 53 20 63 6f 6c 31 20   ALL 95 AS col1 
202e0 46 52 4f 4d 20 74 61 62 30 2c 20 74 61 62 30 20  FROM tab0, tab0 
202f0 41 53 20 63 6f 72 30 2c 20 74 61 62 30 20 41 53  AS cor0, tab0 AS
20300 20 63 6f 72 31 2c 20 74 61 62 31 20 41 53 20 63   cor1, tab1 AS c
20310 6f 72 32 0d 0a 2d 2d 2d 2d 0d 0a 38 31 20 76 61  or2..----..81 va
20320 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20  lues hashing to 
20330 39 38 39 36 66 62 63 37 63 39 38 61 62 65 38 34  9896fbc7c98abe84
20340 63 62 35 38 35 65 36 66 35 66 32 35 62 35 38 61  cb585e6f5f25b58a
20350 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
20360 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
20370 2d 20 2d 20 33 39 20 2b 20 28 20 63 6f 6c 32 20  - - 39 + ( col2 
20380 2a 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 29 20  * + cor0.col0 ) 
20390 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
203a0 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
203b0 0a 32 30 36 37 0d 0a 32 32 38 0d 0a 33 30 34 31  .2067..228..3041
203c0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
203d0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
203e0 2d 20 2d 20 28 20 2d 20 35 33 20 29 20 2a 20 2d  - - ( - 53 ) * -
203f0 20 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c 32 20 2b   col0 * + col2 +
20400 20 2d 20 63 6f 6c 31 20 2a 20 63 6f 6c 30 20 46   - col1 * col0 F
20410 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
20420 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 35 34 30 0d 0a 33  ..----..-1540..3
20430 37 38 36 39 35 0d 0a 33 39 39 31 32 0d 0a 0d 0a  78695..39912....
20440 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
20450 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 28 20  .SELECT ALL + ( 
20460 2d 20 63 6f 6c 30 20 29 20 2b 20 2d 20 63 6f 6c  - col0 ) + - col
20470 32 20 2a 20 2b 20 63 6f 6c 30 20 2a 20 63 6f 72  2 * + col0 * cor
20480 30 2e 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46  0.col0 AS col0 F
20490 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d  ROM tab1 cor0..-
204a0 2d 2d 2d 0d 0a 2d 32 33 33 35 33 36 0d 0a 2d 34  ---..-233536..-4
204b0 38 39 0d 0a 2d 36 31 34 34 38 30 0d 0a 0d 0a 71  89..-614480....q
204c0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
204d0 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
204e0 2d 20 63 6f 6c 30 20 2d 20 63 6f 72 30 2e 63 6f  - col0 - cor0.co
204f0 6c 31 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  l1 AS col1 FROM 
20500 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
20510 2d 2d 0d 0a 2d 32 39 0d 0a 2d 37 34 0d 0a 2d 39  --..-29..-74..-9
20520 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  3....query I row
20530 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2b  sort..SELECT + +
20540 20 63 6f 6c 30 20 2a 20 39 38 20 46 52 4f 4d 20   col0 * 98 FROM 
20550 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
20560 2d 2d 0d 0a 32 33 35 32 0d 0a 33 34 33 30 0d 0a  --..2352..3430..
20570 38 37 32 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20  8722....query I 
20580 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
20590 44 49 53 54 49 4e 43 54 20 63 6f 72 31 2e 63 6f  DISTINCT cor1.co
205a0 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l2 FROM tab1 AS 
205b0 63 6f 72 30 20 43 52 4f 53 53 20 4a 4f 49 4e 20  cor0 CROSS JOIN 
205c0 74 61 62 31 2c 20 74 61 62 32 20 41 53 20 63 6f  tab1, tab2 AS co
205d0 72 31 2c 20 74 61 62 31 20 41 53 20 63 6f 72 32  r1, tab1 AS cor2
205e0 2c 20 74 61 62 32 20 41 53 20 63 6f 72 33 0d 0a  , tab2 AS cor3..
205f0 2d 2d 2d 2d 0d 0a 32 36 0d 0a 32 37 0d 0a 33 38  ----..26..27..38
20600 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
20610 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d   # support for M
20620 79 53 51 4c 20 73 70 65 63 69 66 69 63 20 73 79  ySQL specific sy
20630 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73  stem types and s
20640 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72  yntax..query I r
20650 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 38 39 36  owsort label-896
20660 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 32 20  ..SELECT + col2 
20670 2f 20 2b 20 43 41 53 54 28 20 4e 55 4c 4c 20 41  / + CAST( NULL A
20680 53 20 53 49 47 4e 45 44 20 29 20 46 52 4f 4d 20  S SIGNED ) FROM 
20690 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab0 cor0..----.
206a0 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c  .NULL..NULL..NUL
206b0 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  L....skipif mysq
206c0 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
206d0 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
206e0 6f 72 74 20 6c 61 62 65 6c 2d 38 39 36 0d 0a 53  ort label-896..S
206f0 45 4c 45 43 54 20 2b 20 63 6f 6c 32 20 2f 20 2b  ELECT + col2 / +
20700 20 43 41 53 54 20 28 20 4e 55 4c 4c 20 41 53 20   CAST ( NULL AS 
20710 49 4e 54 45 47 45 52 20 29 20 46 52 4f 4d 20 74  INTEGER ) FROM t
20720 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab0 cor0..----..
20730 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c  NULL..NULL..NULL
20740 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
20750 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f  ort..SELECT + co
20760 72 30 2e 63 6f 6c 30 20 2a 20 38 36 20 46 52 4f  r0.col0 * 86 FRO
20770 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
20780 2d 2d 2d 2d 0d 0a 36 30 32 0d 0a 36 37 30 38 0d  ----..602..6708.
20790 0a 36 37 39 34 0d 0a 0d 0a 71 75 65 72 79 20 49  .6794....query I
207a0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
207b0 20 74 61 62 30 2e 63 6f 6c 30 20 2a 20 28 20 2d   tab0.col0 * ( -
207c0 20 63 6f 6c 30 20 2b 20 63 6f 6c 32 20 29 20 41   col0 + col2 ) A
207d0 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30  S col1 FROM tab0
207e0 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 39 30 0d 0a 2d  ..----..-1190..-
207f0 36 32 33 0d 0a 32 31 36 0d 0a 0d 0a 73 6b 69 70  623..216....skip
20800 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20  if postgresql # 
20810 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69  PostgreSQL requi
20820 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61  res AS when rena
20830 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75  ming output colu
20840 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  mns..query I row
20850 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 39  sort..SELECT + 9
20860 32 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30  2 col1 FROM tab0
20870 20 63 6f 72 30 20 43 52 4f 53 53 20 4a 4f 49 4e   cor0 CROSS JOIN
20880 20 74 61 62 31 2c 20 74 61 62 31 20 41 53 20 63   tab1, tab1 AS c
20890 6f 72 31 2c 20 74 61 62 31 20 41 53 20 63 6f 72  or1, tab1 AS cor
208a0 32 0d 0a 2d 2d 2d 2d 0d 0a 38 31 20 76 61 6c 75  2..----..81 valu
208b0 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 63 66  es hashing to cf
208c0 63 66 30 31 32 63 65 31 61 38 64 64 36 30 61 37  cf012ce1a8dd60a7
208d0 34 32 38 62 34 65 66 36 62 39 35 38 34 33 0d 0a  428b4ef6b95843..
208e0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
208f0 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2b 20 63 6f  t..SELECT - + co
20900 6c 30 20 2b 20 2b 20 63 6f 6c 31 20 2a 20 28 20  l0 + + col1 * ( 
20910 2b 20 63 6f 6c 31 20 29 20 41 53 20 63 6f 6c 30  + col1 ) AS col0
20920 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
20930 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 31 30 0d 0a 33  r0..----..210..3
20940 34 30 33 0d 0a 39 35 34 0d 0a 0d 0a 73 6b 69 70  403..954....skip
20950 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20  if postgresql # 
20960 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69  PostgreSQL requi
20970 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61  res AS when rena
20980 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75  ming output colu
20990 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  mns..query I row
209a0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
209b0 54 49 4e 43 54 20 2d 20 2b 20 63 6f 6c 32 20 2b  TINCT - + col2 +
209c0 20 63 6f 6c 32 20 2a 20 39 36 20 2a 20 38 31 20   col2 * 96 * 81 
209d0 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41  col1 FROM tab2 A
209e0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 30  S cor0..----..20
209f0 32 31 35 30 0d 0a 32 30 39 39 32 35 0d 0a 32 39  2150..209925..29
20a00 35 34 35 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20  5450....query I 
20a10 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
20a20 44 49 53 54 49 4e 43 54 20 2d 20 74 61 62 30 2e  DISTINCT - tab0.
20a30 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46 52 4f  col0 AS col2 FRO
20a40 4d 20 74 61 62 30 20 57 48 45 52 45 20 4e 55 4c  M tab0 WHERE NUL
20a50 4c 20 49 4e 20 28 20 74 61 62 30 2e 63 6f 6c 30  L IN ( tab0.col0
20a60 20 2a 20 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c 31   * col1 * + col1
20a70 20 29 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a 71 75 65 72   )..----....quer
20a80 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
20a90 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 30 20 2d  ECT ALL - col0 -
20aa0 20 2b 20 63 6f 6c 32 20 2a 20 2b 20 74 61 62 30   + col2 * + tab0
20ab0 2e 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c 31 20 41  .col1 * + col1 A
20ac0 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30  S col1 FROM tab0
20ad0 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 34 34 30 39 32 0d  ..----..-244092.
20ae0 0a 2d 36 37 39 31 33 31 0d 0a 2d 39 34 34 34 0d  .-679131..-9444.
20af0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
20b00 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
20b10 4e 43 54 20 2d 20 35 31 20 41 53 20 63 6f 6c 31  NCT - 51 AS col1
20b20 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
20b30 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 31 0d 0a 0d  r0..----..-51...
20b40 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73  .skipif postgres
20b50 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20  ql # PostgreSQL 
20b60 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e  requires AS when
20b70 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74   renaming output
20b80 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20   columns..query 
20b90 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
20ba0 54 20 41 4c 4c 20 2b 20 2d 20 63 6f 72 30 2e 63  T ALL + - cor0.c
20bb0 6f 6c 32 20 2b 20 63 6f 6c 30 20 63 6f 6c 32 20  ol2 + col0 col2 
20bc0 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
20bd0 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 36 0d 0a 2d 35  0..----..-16..-5
20be0 31 0d 0a 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20  1..7....query I 
20bf0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
20c00 41 4c 4c 20 63 6f 6c 30 20 2b 20 2b 20 28 20 2d  ALL col0 + + ( -
20c10 20 63 6f 72 30 2e 63 6f 6c 30 20 29 20 2b 20 63   cor0.col0 ) + c
20c20 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol0 FROM tab2 AS
20c30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 37 0d 0a   cor0..----..7..
20c40 37 38 0d 0a 37 39 0d 0a 0d 0a 71 75 65 72 79 20  78..79....query 
20c50 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
20c60 54 20 35 38 20 41 53 20 63 6f 6c 32 20 46 52 4f  T 58 AS col2 FRO
20c70 4d 20 74 61 62 32 2c 20 74 61 62 31 20 41 53 20  M tab2, tab1 AS 
20c80 63 6f 72 30 2c 20 74 61 62 32 20 41 53 20 63 6f  cor0, tab2 AS co
20c90 72 31 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c  r1..----..27 val
20ca0 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 39  ues hashing to 9
20cb0 65 65 33 36 33 63 36 61 63 31 39 63 66 64 62 38  ee363c6ac19cfdb8
20cc0 61 35 30 63 37 64 66 64 35 63 63 32 62 38 61 0d  a50c7dfd5cc2b8a.
20cd0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
20ce0 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d  rt..SELECT ALL -
20cf0 20 2b 20 63 6f 6c 32 20 2a 20 63 6f 6c 31 20 2b   + col2 * col1 +
20d00 20 28 20 63 6f 6c 31 20 29 20 46 52 4f 4d 20 74   ( col1 ) FROM t
20d10 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
20d20 2d 0d 0a 2d 31 32 33 35 0d 0a 2d 31 33 37 38 0d  -..-1235..-1378.
20d30 0a 2d 35 36 30 0d 0a 0d 0a 71 75 65 72 79 20 49  .-560....query I
20d40 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
20d50 20 2d 20 63 6f 6c 30 20 2b 20 28 20 63 6f 6c 30   - col0 + ( col0
20d60 20 29 20 2a 20 2d 20 63 6f 6c 32 20 41 53 20 63   ) * - col2 AS c
20d70 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 63 6f  ol1 FROM tab1 co
20d80 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 36 35 0d 0a  r0..----..-165..
20d90 2d 33 37 31 32 0d 0a 2d 37 37 36 30 0d 0a 0d 0a  -3712..-7760....
20da0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
20db0 0a 53 45 4c 45 43 54 20 2b 20 36 34 20 41 53 20  .SELECT + 64 AS 
20dc0 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 63  col1 FROM tab0 c
20dd0 6f 72 30 20 43 52 4f 53 53 20 4a 4f 49 4e 20 74  or0 CROSS JOIN t
20de0 61 62 31 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d  ab1 AS cor1..---
20df0 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68  -..9 values hash
20e00 69 6e 67 20 74 6f 20 36 30 61 62 30 34 30 65 39  ing to 60ab040e9
20e10 33 31 63 35 63 38 35 64 62 37 62 61 31 39 33 36  31c5c85db7ba1936
20e20 34 65 61 63 63 38 65 0d 0a 0d 0a 6f 6e 6c 79 69  4eacc8e....onlyi
20e30 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72  f mysql # suppor
20e40 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63  t for MySQL spec
20e50 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65  ific system type
20e60 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75  s and syntax..qu
20e70 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
20e80 62 65 6c 2d 39 31 31 0d 0a 53 45 4c 45 43 54 20  bel-911..SELECT 
20e90 2d 20 2b 20 63 6f 6c 30 20 2b 20 43 41 53 54 28  - + col0 + CAST(
20ea0 20 2b 20 63 6f 6c 32 20 41 53 20 53 49 47 4e 45   + col2 AS SIGNE
20eb0 44 20 29 20 46 52 4f 4d 20 74 61 62 31 20 41 53  D ) FROM tab1 AS
20ec0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 37 0d   cor0..----..-7.
20ed0 0a 31 36 0d 0a 35 31 0d 0a 0d 0a 73 6b 69 70 69  .16..51....skipi
20ee0 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
20ef0 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
20f00 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
20f10 39 31 31 0d 0a 53 45 4c 45 43 54 20 2d 20 2b 20  911..SELECT - + 
20f20 63 6f 6c 30 20 2b 20 43 41 53 54 20 28 20 2b 20  col0 + CAST ( + 
20f30 63 6f 6c 32 20 41 53 20 49 4e 54 45 47 45 52 20  col2 AS INTEGER 
20f40 29 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  ) FROM tab1 AS c
20f50 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 37 0d 0a 31  or0..----..-7..1
20f60 36 0d 0a 35 31 0d 0a 0d 0a 71 75 65 72 79 20 49  6..51....query I
20f70 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
20f80 20 28 20 2d 20 63 6f 72 30 2e 63 6f 6c 30 20 29   ( - cor0.col0 )
20f90 20 2a 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20   * col0 AS col0 
20fa0 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a  FROM tab0 cor0..
20fb0 2d 2d 2d 2d 0d 0a 2d 31 32 32 35 0d 0a 2d 35 37  ----..-1225..-57
20fc0 36 0d 0a 2d 37 39 32 31 0d 0a 0d 0a 71 75 65 72  6..-7921....quer
20fd0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
20fe0 45 43 54 20 2d 20 33 34 20 2b 20 2b 20 37 38 20  ECT - 34 + + 78 
20ff0 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
21000 30 2c 20 74 61 62 32 2c 20 74 61 62 32 20 41 53  0, tab2, tab2 AS
21010 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20   cor0..----..27 
21020 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74  values hashing t
21030 6f 20 30 63 63 33 65 35 32 65 37 38 31 65 34 36  o 0cc3e52e781e46
21040 39 36 32 32 39 31 63 33 30 36 30 63 36 61 65 37  962291c3060c6ae7
21050 33 62 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  3b....query I ro
21060 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
21070 4c 20 35 32 20 2a 20 2b 20 63 6f 6c 32 20 46 52  L 52 * + col2 FR
21080 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31  OM tab2..----..1
21090 33 35 32 0d 0a 31 34 30 34 0d 0a 31 39 37 36 0d  352..1404..1976.
210a0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
210b0 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c  rt..SELECT - col
210c0 31 20 2b 20 63 6f 6c 31 20 2a 20 2b 20 28 20 2d  1 + col1 * + ( -
210d0 20 36 38 20 29 20 46 52 4f 4d 20 74 61 62 31 20   68 ) FROM tab1 
210e0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
210f0 31 37 39 34 0d 0a 2d 36 39 30 0d 0a 2d 38 39 37  1794..-690..-897
21100 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
21110 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 39 37  ort..SELECT + 97
21120 20 2b 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c   + + col0 AS col
21130 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  0 FROM tab1 AS c
21140 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 30 0d 0a  or0..----..100..
21150 31 36 31 0d 0a 31 37 37 0d 0a 0d 0a 71 75 65 72  161..177....quer
21160 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
21170 45 43 54 20 2d 20 63 6f 6c 32 20 2a 20 2d 20 63  ECT - col2 * - c
21180 6f 6c 31 20 2a 20 36 33 20 46 52 4f 4d 20 74 61  ol1 * 63 FROM ta
21190 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  b0 cor0..----..1
211a0 37 38 37 39 34 0d 0a 34 37 30 31 30 36 0d 0a 36  78794..470106..6
211b0 31 31 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  111....query I r
211c0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
211d0 20 63 6f 6c 32 20 2a 20 2d 20 63 6f 72 30 2e 63   col2 * - cor0.c
211e0 6f 6c 30 20 2a 20 63 6f 6c 30 20 2b 20 2b 20 63  ol0 * col0 + + c
211f0 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol1 FROM tab1 AS
21200 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 33 33   cor0..----..233
21210 34 38 32 0d 0a 35 31 32 0d 0a 36 31 34 34 31 33  482..512..614413
21220 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
21230 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 31  ort..SELECT col1
21240 20 2a 20 2b 20 63 6f 6c 32 20 2b 20 2b 20 33 33   * + col2 + + 33
21250 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
21260 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
21270 0d 0a 31 33 30 0d 0a 32 38 37 31 0d 0a 37 34 39  ..130..2871..749
21280 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  5....query I row
21290 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
212a0 20 2b 20 2b 20 36 20 2a 20 63 6f 72 30 2e 63 6f   + + 6 * cor0.co
212b0 6c 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  l0 AS col2 FROM 
212c0 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
212d0 2d 2d 0d 0a 31 38 0d 0a 33 38 34 0d 0a 34 38 30  --..18..384..480
212e0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
212f0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 74 61  ort..SELECT - ta
21300 62 31 2e 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c 32  b1.col1 * - col2
21310 20 2d 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62   - col1 FROM tab
21320 31 0d 0a 2d 2d 2d 2d 0d 0a 31 32 33 35 0d 0a 31  1..----..1235..1
21330 33 37 38 0d 0a 35 36 30 0d 0a 0d 0a 71 75 65 72  378..560....quer
21340 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
21350 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 32 20 2a  ECT ALL - col2 *
21360 20 39 37 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d   97 AS col0 FROM
21370 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
21380 2d 2d 2d 0d 0a 2d 32 35 32 32 0d 0a 2d 32 36 31  ---..-2522..-261
21390 39 0d 0a 2d 33 36 38 36 0d 0a 0d 0a 71 75 65 72  9..-3686....quer
213a0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
213b0 45 43 54 20 2d 20 63 6f 72 30 2e 63 6f 6c 30 20  ECT - cor0.col0 
213c0 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 20 43  FROM tab1 cor0 C
213d0 52 4f 53 53 20 4a 4f 49 4e 20 74 61 62 30 2c 20  ROSS JOIN tab0, 
213e0 74 61 62 32 20 41 53 20 63 6f 72 31 0d 0a 2d 2d  tab2 AS cor1..--
213f0 2d 2d 0d 0a 32 37 20 76 61 6c 75 65 73 20 68 61  --..27 values ha
21400 73 68 69 6e 67 20 74 6f 20 37 32 39 63 31 65 64  shing to 729c1ed
21410 64 61 39 33 33 32 33 39 38 32 39 39 66 33 39 63  da9332398299f39c
21420 64 31 37 34 65 64 38 34 30 0d 0a 0d 0a 71 75 65  d174ed840....que
21430 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
21440 4c 45 43 54 20 2d 20 2b 20 36 38 20 41 53 20 63  LECT - + 68 AS c
21450 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol2 FROM tab1 AS
21460 20 63 6f 72 30 20 43 52 4f 53 53 20 4a 4f 49 4e   cor0 CROSS JOIN
21470 20 74 61 62 32 20 41 53 20 63 6f 72 31 0d 0a 2d   tab2 AS cor1..-
21480 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61  ---..9 values ha
21490 73 68 69 6e 67 20 74 6f 20 35 66 65 62 66 33 38  shing to 5febf38
214a0 32 64 33 36 64 36 65 30 31 39 31 38 38 39 63 34  2d36d6e0191889c4
214b0 31 62 39 32 38 37 38 36 66 0d 0a 0d 0a 71 75 65  1b928786f....que
214c0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
214d0 4c 45 43 54 20 2d 20 63 6f 6c 30 20 2a 20 2d 20  LECT - col0 * - 
214e0 32 33 20 2b 20 2d 20 32 36 20 2b 20 74 61 62 31  23 + - 26 + tab1
214f0 2e 63 6f 6c 30 20 2a 20 33 33 20 41 53 20 63 6f  .col0 * 33 AS co
21500 6c 30 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d  l0 FROM tab1..--
21510 2d 2d 0d 0a 31 34 32 0d 0a 33 35 35 38 0d 0a 34  --..142..3558..4
21520 34 35 34 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  454....onlyif my
21530 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f  sql # support fo
21540 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63  r MySQL specific
21550 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e   system types an
21560 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20  d syntax..query 
21570 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
21580 39 32 36 0d 0a 53 45 4c 45 43 54 20 43 41 53 54  926..SELECT CAST
21590 28 20 4e 55 4c 4c 20 41 53 20 44 45 43 49 4d 41  ( NULL AS DECIMA
215a0 4c 20 29 20 2a 20 2d 20 63 6f 6c 32 20 2b 20 63  L ) * - col2 + c
215b0 6f 6c 32 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61  ol2 col1 FROM ta
215c0 62 32 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a  b2..----..NULL..
215d0 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b  NULL..NULL....sk
215e0 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20  ipif postgresql 
215f0 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71  # PostgreSQL req
21600 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65  uires AS when re
21610 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f  naming output co
21620 6c 75 6d 6e 73 0d 0a 73 6b 69 70 69 66 20 6d 79  lumns..skipif my
21630 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
21640 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
21650 77 73 6f 72 74 20 6c 61 62 65 6c 2d 39 32 36 0d  wsort label-926.
21660 0a 53 45 4c 45 43 54 20 43 41 53 54 20 28 20 4e  .SELECT CAST ( N
21670 55 4c 4c 20 41 53 20 52 45 41 4c 20 29 20 2a 20  ULL AS REAL ) * 
21680 2d 20 63 6f 6c 32 20 2b 20 63 6f 6c 32 20 63 6f  - col2 + col2 co
21690 6c 31 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d  l1 FROM tab2..--
216a0 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a  --..NULL..NULL..
216b0 4e 55 4c 4c 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  NULL....onlyif m
216c0 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f  ysql # use DIV o
216d0 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65  perator for inte
216e0 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75  ger division..qu
216f0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
21700 62 65 6c 2d 39 32 37 0d 0a 53 45 4c 45 43 54 20  bel-927..SELECT 
21710 44 49 53 54 49 4e 43 54 20 2b 20 35 20 44 49 56  DISTINCT + 5 DIV
21720 20 2d 20 63 6f 6c 31 20 2b 20 2b 20 63 6f 6c 31   - col1 + + col1
21730 20 2a 20 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c 30   * col0 * + col0
21740 20 2b 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62   + col2 FROM tab
21750 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 38 38 32 36 0d  0..----..118826.
21760 0a 34 39 35 36 39 0d 0a 37 32 30 38 39 33 0d 0a  .49569..720893..
21770 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
21780 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
21790 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
217a0 20 6c 61 62 65 6c 2d 39 32 37 0d 0a 53 45 4c 45   label-927..SELE
217b0 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 35 20  CT DISTINCT + 5 
217c0 2f 20 2d 20 63 6f 6c 31 20 2b 20 2b 20 63 6f 6c  / - col1 + + col
217d0 31 20 2a 20 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c  1 * col0 * + col
217e0 30 20 2b 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61  0 + col2 FROM ta
217f0 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 38 38 32 36  b0..----..118826
21800 0d 0a 34 39 35 36 39 0d 0a 37 32 30 38 39 33 0d  ..49569..720893.
21810 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
21820 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74  # use DIV operat
21830 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64  or for integer d
21840 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49  ivision..query I
21850 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 39   rowsort label-9
21860 32 38 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c  28..SELECT + col
21870 30 20 2b 20 2b 20 34 38 20 44 49 56 20 63 6f 6c  0 + + 48 DIV col
21880 32 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d  2 FROM tab1..---
21890 2d 0d 0a 33 0d 0a 36 34 0d 0a 38 30 0d 0a 0d 0a  -..3..64..80....
218a0 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
218b0 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
218c0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
218d0 61 62 65 6c 2d 39 32 38 0d 0a 53 45 4c 45 43 54  abel-928..SELECT
218e0 20 2b 20 63 6f 6c 30 20 2b 20 2b 20 34 38 20 2f   + col0 + + 48 /
218f0 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 0d   col2 FROM tab1.
21900 0a 2d 2d 2d 2d 0d 0a 33 0d 0a 36 34 0d 0a 38 30  .----..3..64..80
21910 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
21920 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
21930 49 4e 43 54 20 2b 20 28 20 2b 20 63 6f 6c 31 20  INCT + ( + col1 
21940 2a 20 63 6f 6c 32 20 29 20 2b 20 2d 20 63 6f 6c  * col2 ) + - col
21950 31 20 2b 20 2b 20 36 30 20 46 52 4f 4d 20 74 61  1 + + 60 FROM ta
21960 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 32 39 35 0d 0a  b1..----..1295..
21970 31 34 33 38 0d 0a 36 32 30 0d 0a 0d 0a 71 75 65  1438..620....que
21980 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
21990 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 31 35  LECT DISTINCT 15
219a0 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62   + col0 FROM tab
219b0 31 0d 0a 2d 2d 2d 2d 0d 0a 31 38 0d 0a 37 39 0d  1..----..18..79.
219c0 0a 39 35 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  .95....onlyif my
219d0 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70  sql # use DIV op
219e0 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67  erator for integ
219f0 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65  er division..que
21a00 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
21a10 65 6c 2d 39 33 31 0d 0a 53 45 4c 45 43 54 20 63  el-931..SELECT c
21a20 6f 6c 30 20 44 49 56 20 2d 20 38 30 20 41 53 20  ol0 DIV - 80 AS 
21a30 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a  col0 FROM tab0..
21a40 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 30 0d 0a 30 0d 0a  ----..-1..0..0..
21a50 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
21a60 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
21a70 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
21a80 20 6c 61 62 65 6c 2d 39 33 31 0d 0a 53 45 4c 45   label-931..SELE
21a90 43 54 20 63 6f 6c 30 20 2f 20 2d 20 38 30 20 41  CT col0 / - 80 A
21aa0 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30  S col0 FROM tab0
21ab0 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 30 0d 0a 30  ..----..-1..0..0
21ac0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
21ad0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 74 61 62 30  ort..SELECT tab0
21ae0 2e 63 6f 6c 30 20 2b 20 32 20 2b 20 2d 20 63 6f  .col0 + 2 + - co
21af0 6c 32 20 2a 20 2b 20 63 6f 6c 32 20 41 53 20 63  l2 * + col2 AS c
21b00 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d  ol2 FROM tab0..-
21b10 2d 2d 2d 0d 0a 2d 31 30 36 33 0d 0a 2d 36 36 33  ---..-1063..-663
21b20 33 0d 0a 33 36 0d 0a 0d 0a 71 75 65 72 79 20 49  3..36....query I
21b30 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
21b40 20 2b 20 38 31 20 2d 20 2b 20 63 6f 6c 31 20 46   + 81 - + col1 F
21b50 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
21b60 0d 0a 2d 2d 2d 2d 0d 0a 32 32 0d 0a 35 30 0d 0a  ..----..22..50..
21b70 36 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  64....query I ro
21b80 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 28 20  wsort..SELECT ( 
21b90 37 31 20 29 20 46 52 4f 4d 20 74 61 62 30 20 41  71 ) FROM tab0 A
21ba0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 37 31  S cor0..----..71
21bb0 0d 0a 37 31 0d 0a 37 31 0d 0a 0d 0a 71 75 65 72  ..71..71....quer
21bc0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
21bd0 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 32 20 2a  ECT ALL + col2 *
21be0 20 63 6f 6c 31 20 2b 20 63 6f 72 30 2e 63 6f 6c   col1 + cor0.col
21bf0 31 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  1 AS col2 FROM t
21c00 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
21c10 2d 0d 0a 31 35 39 33 0d 0a 36 36 33 0d 0a 38 36  -..1593..663..86
21c20 38 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  8....onlyif mysq
21c30 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20  l # support for 
21c40 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63 20 73  MySQL specific s
21c50 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20  ystem types and 
21c60 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20  syntax..query I 
21c70 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 39 33  rowsort label-93
21c80 36 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20  6..SELECT ALL + 
21c90 43 41 53 54 28 20 4e 55 4c 4c 20 41 53 20 53 49  CAST( NULL AS SI
21ca0 47 4e 45 44 20 29 20 2a 20 2d 20 39 39 20 2b 20  GNED ) * - 99 + 
21cb0 2d 20 63 6f 6c 32 20 2b 20 28 20 63 6f 6c 30 20  - col2 + ( col0 
21cc0 29 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  ) FROM tab0 AS c
21cd0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d  or0..----..NULL.
21ce0 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73  .NULL..NULL....s
21cf0 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
21d00 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
21d10 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
21d20 62 65 6c 2d 39 33 36 0d 0a 53 45 4c 45 43 54 20  bel-936..SELECT 
21d30 41 4c 4c 20 2b 20 43 41 53 54 20 28 20 4e 55 4c  ALL + CAST ( NUL
21d40 4c 20 41 53 20 49 4e 54 45 47 45 52 20 29 20 2a  L AS INTEGER ) *
21d50 20 2d 20 39 39 20 2b 20 2d 20 63 6f 6c 32 20 2b   - 99 + - col2 +
21d60 20 28 20 63 6f 6c 30 20 29 20 46 52 4f 4d 20 74   ( col0 ) FROM t
21d70 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
21d80 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e  -..NULL..NULL..N
21d90 55 4c 4c 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  ULL....onlyif my
21da0 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f  sql # support fo
21db0 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63  r MySQL specific
21dc0 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e   system types an
21dd0 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20  d syntax..query 
21de0 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
21df0 39 33 37 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  937..SELECT DIST
21e00 49 4e 43 54 20 43 41 53 54 28 20 34 39 20 41 53  INCT CAST( 49 AS
21e10 20 53 49 47 4e 45 44 20 29 20 2a 20 63 6f 72 30   SIGNED ) * cor0
21e20 2e 63 6f 6c 31 20 2b 20 2b 20 63 6f 72 30 2e 63  .col1 + + cor0.c
21e30 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  ol2 AS col1 FROM
21e40 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
21e50 2d 2d 2d 0d 0a 31 35 34 36 0d 0a 32 39 31 37 0d  ---..1546..2917.
21e60 0a 38 37 31 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  .871....skipif m
21e70 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
21e80 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
21e90 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 39 33 37  owsort label-937
21ea0 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
21eb0 54 20 43 41 53 54 20 28 20 34 39 20 41 53 20 49  T CAST ( 49 AS I
21ec0 4e 54 45 47 45 52 20 29 20 2a 20 63 6f 72 30 2e  NTEGER ) * cor0.
21ed0 63 6f 6c 31 20 2b 20 2b 20 63 6f 72 30 2e 63 6f  col1 + + cor0.co
21ee0 6c 32 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  l2 AS col1 FROM 
21ef0 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
21f00 2d 2d 0d 0a 31 35 34 36 0d 0a 32 39 31 37 0d 0a  --..1546..2917..
21f10 38 37 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  871....query I r
21f20 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
21f30 49 53 54 49 4e 43 54 20 2d 20 36 38 20 2b 20 2b  ISTINCT - 68 + +
21f40 20 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46 52   col1 AS col1 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 2d 34 32 0d 0a 2d 35 35 0d  .----..-42..-55.
21f70 0a 2d 35 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .-58....query I 
21f80 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
21f90 63 6f 6c 30 20 2d 20 74 61 62 30 2e 63 6f 6c 30  col0 - tab0.col0
21fa0 20 2a 20 2b 20 63 6f 6c 30 20 2a 20 2d 20 63 6f   * + col0 * - co
21fb0 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d  l0 FROM tab0..--
21fc0 2d 2d 0d 0a 31 33 38 34 38 0d 0a 34 32 39 31 30  --..13848..42910
21fd0 0d 0a 37 30 35 30 35 38 0d 0a 0d 0a 71 75 65 72  ..705058....quer
21fe0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
21ff0 45 43 54 20 32 30 20 2a 20 2d 20 63 6f 6c 30 20  ECT 20 * - col0 
22000 2b 20 2d 20 63 6f 6c 30 20 2a 20 38 31 20 41 53  + - col0 * 81 AS
22010 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 0d   col1 FROM tab1.
22020 0a 2d 2d 2d 2d 0d 0a 2d 33 30 33 0d 0a 2d 36 34  .----..-303..-64
22030 36 34 0d 0a 2d 38 30 38 30 0d 0a 0d 0a 71 75 65  64..-8080....que
22040 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
22050 4c 45 43 54 20 2d 20 36 37 20 41 53 20 63 6f 6c  LECT - 67 AS col
22060 32 20 46 52 4f 4d 20 74 61 62 32 2c 20 74 61 62  2 FROM tab2, tab
22070 31 2c 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  1, tab2 AS cor0.
22080 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75 65 73  .----..27 values
22090 20 68 61 73 68 69 6e 67 20 74 6f 20 39 35 63 39   hashing to 95c9
220a0 65 62 61 36 34 33 66 36 34 38 39 65 30 33 62 65  eba643f6489e03be
220b0 34 64 35 65 38 33 66 31 65 66 39 39 0d 0a 0d 0a  4d5e83f1ef99....
220c0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
220d0 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
220e0 20 2d 20 63 6f 6c 31 20 2b 20 2b 20 31 36 20 46   - col1 + + 16 F
220f0 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
22100 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 2d 31 35 0d  ..----..-1..-15.
22110 0a 2d 34 33 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  .-43....onlyif m
22120 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66  ysql # support f
22130 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69  or MySQL specifi
22140 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61  c system types a
22150 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79  nd syntax..query
22160 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
22170 2d 39 34 33 0d 0a 53 45 4c 45 43 54 20 2b 20 63  -943..SELECT + c
22180 6f 72 30 2e 63 6f 6c 31 20 2a 20 43 41 53 54 28  or0.col1 * CAST(
22190 20 2d 20 63 6f 6c 31 20 41 53 20 53 49 47 4e 45   - col1 AS SIGNE
221a0 44 20 29 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  D ) AS col0 FROM
221b0 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
221c0 2d 2d 2d 0d 0a 2d 31 30 30 0d 0a 2d 31 36 39 0d  ---..-100..-169.
221d0 0a 2d 36 37 36 0d 0a 0d 0a 73 6b 69 70 69 66 20  .-676....skipif 
221e0 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
221f0 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
22200 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 39 34  rowsort label-94
22210 33 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 72 30  3..SELECT + cor0
22220 2e 63 6f 6c 31 20 2a 20 43 41 53 54 20 28 20 2d  .col1 * CAST ( -
22230 20 63 6f 6c 31 20 41 53 20 49 4e 54 45 47 45 52   col1 AS INTEGER
22240 20 29 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20   ) AS col0 FROM 
22250 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
22260 2d 2d 0d 0a 2d 31 30 30 0d 0a 2d 31 36 39 0d 0a  --..-100..-169..
22270 2d 36 37 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20  -676....query I 
22280 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
22290 44 49 53 54 49 4e 43 54 20 63 6f 6c 30 20 2a 20  DISTINCT col0 * 
222a0 2b 20 63 6f 6c 30 20 2b 20 63 6f 6c 30 20 46 52  + col0 + col0 FR
222b0 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
222c0 0a 2d 2d 2d 2d 0d 0a 31 32 36 30 0d 0a 36 30 30  .----..1260..600
222d0 0d 0a 38 30 31 30 0d 0a 0d 0a 71 75 65 72 79 20  ..8010....query 
222e0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
222f0 54 20 41 4c 4c 20 2b 20 63 6f 6c 30 20 2b 20 2b  T ALL + col0 + +
22300 20 34 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20   4 FROM tab1 AS 
22310 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 36 38 0d 0a  cor0..----..68..
22320 37 0d 0a 38 34 0d 0a 0d 0a 71 75 65 72 79 20 49  7..84....query I
22330 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
22340 20 44 49 53 54 49 4e 43 54 20 2d 20 2d 20 63 6f   DISTINCT - - co
22350 6c 32 20 2b 20 2b 20 63 6f 6c 32 20 2a 20 2b 20  l2 + + col2 * + 
22360 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46 52 4f  col1 AS col1 FRO
22370 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
22380 2d 2d 2d 2d 0d 0a 31 35 36 30 0d 0a 36 38 34 0d  ----..1560..684.
22390 0a 38 36 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .864....query I 
223a0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
223b0 2d 20 31 30 20 41 53 20 63 6f 6c 31 20 46 52 4f  - 10 AS col1 FRO
223c0 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 20 43  M tab0 AS cor0 C
223d0 52 4f 53 53 20 4a 4f 49 4e 20 74 61 62 31 2c 20  ROSS JOIN tab1, 
223e0 74 61 62 30 20 63 6f 72 31 2c 20 74 61 62 32 20  tab0 cor1, tab2 
223f0 41 53 20 63 6f 72 32 0d 0a 2d 2d 2d 2d 0d 0a 38  AS cor2..----..8
22400 31 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67  1 values hashing
22410 20 74 6f 20 64 30 32 64 64 33 38 36 30 62 61 64   to d02dd3860bad
22420 38 32 35 37 62 38 64 63 34 38 33 65 66 65 33 37  8257b8dc483efe37
22430 30 61 66 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20  0af0....query I 
22440 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
22450 2b 20 63 6f 6c 32 20 2b 20 2b 20 63 6f 6c 31 20  + col2 + + col1 
22460 2a 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32  * col0 FROM tab2
22470 0d 0a 2d 2d 2d 2d 0d 0a 31 33 38 31 0d 0a 32 34  ..----..1381..24
22480 34 0d 0a 34 36 32 38 0d 0a 0d 0a 71 75 65 72 79  4..4628....query
22490 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
224a0 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 2d 20  CT DISTINCT + - 
224b0 63 6f 6c 30 20 2b 20 63 6f 6c 32 20 2a 20 39 20  col0 + col2 * 9 
224c0 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
224d0 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 34 34  1 cor0..----..44
224e0 39 0d 0a 34 38 33 0d 0a 37 38 34 0d 0a 0d 0a 71  9..483..784....q
224f0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
22500 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c  SELECT ALL - col
22510 32 20 2a 20 63 6f 6c 31 20 2a 20 63 6f 6c 31 20  2 * col1 * col1 
22520 2b 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c 32  + + col1 AS col2
22530 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
22540 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 39 36 35  r0..----..-10965
22550 0d 0a 2d 32 35 39 31 36 0d 0a 2d 39 30 34 34 37  ..-25916..-90447
22560 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
22570 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
22580 2d 20 63 6f 6c 31 20 2b 20 35 38 20 41 53 20 63  - col1 + 58 AS c
22590 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 63 6f  ol1 FROM tab0 co
225a0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 38 0d 0a 2d  r0..----..-28..-
225b0 33 33 0d 0a 2d 33 39 0d 0a 0d 0a 71 75 65 72 79  33..-39....query
225c0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
225d0 43 54 20 2d 20 32 20 41 53 20 63 6f 6c 32 20 46  CT - 2 AS col2 F
225e0 52 4f 4d 20 74 61 62 30 2c 20 74 61 62 30 20 41  ROM tab0, tab0 A
225f0 53 20 63 6f 72 30 2c 20 74 61 62 32 20 41 53 20  S cor0, tab2 AS 
22600 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76  cor1..----..27 v
22610 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f  alues hashing to
22620 20 32 30 63 39 32 31 33 33 31 36 35 32 37 64 35   20c9213316527d5
22630 30 37 65 32 36 34 32 35 30 34 31 65 30 38 33 38  07e26425041e0838
22640 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  7....query I row
22650 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c  sort..SELECT col
22660 31 20 2a 20 2b 20 32 30 20 41 53 20 63 6f 6c 31  1 * + 20 AS col1
22670 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
22680 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 30 30 0d 0a 32  r0..----..200..2
22690 36 30 0d 0a 35 32 30 0d 0a 0d 0a 71 75 65 72 79  60..520....query
226a0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
226b0 43 54 20 41 4c 4c 20 2d 20 2d 20 63 6f 6c 31 20  CT ALL - - col1 
226c0 2b 20 2d 20 39 30 20 41 53 20 63 6f 6c 31 20 46  + - 90 AS col1 F
226d0 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
226e0 0d 0a 2d 2d 2d 2d 0d 0a 2d 36 34 0d 0a 2d 37 37  ..----..-64..-77
226f0 0d 0a 2d 38 30 0d 0a 0d 0a 71 75 65 72 79 20 49  ..-80....query I
22700 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
22710 20 41 4c 4c 20 2d 20 63 6f 6c 30 20 2a 20 2d 20   ALL - col0 * - 
22720 38 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d  81 FROM tab0..--
22730 2d 2d 0d 0a 31 39 34 34 0d 0a 32 38 33 35 0d 0a  --..1944..2835..
22740 37 32 30 39 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  7209....skipif m
22750 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
22760 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
22770 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
22780 20 2d 20 43 41 53 54 20 28 20 63 6f 6c 32 20 41   - CAST ( col2 A
22790 53 20 52 45 41 4c 20 29 20 2a 20 2d 20 63 6f 6c  S REAL ) * - col
227a0 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  0 FROM tab1 AS c
227b0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 36 32 0d 0a  or0..----..162..
227c0 33 36 34 38 0d 0a 37 36 38 30 0d 0a 0d 0a 71 75  3648..7680....qu
227d0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
227e0 45 4c 45 43 54 20 2d 20 2b 20 63 6f 6c 32 20 2b  ELECT - + col2 +
227f0 20 2d 20 63 6f 6c 30 20 2b 20 2d 20 33 35 20 46   - col0 + - 35 F
22800 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
22810 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 35 36 0d 0a 2d 32  ..----..-156..-2
22820 31 31 0d 0a 2d 39 32 0d 0a 0d 0a 73 6b 69 70 69  11..-92....skipi
22830 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50  f postgresql # P
22840 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72  ostgreSQL requir
22850 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d  es AS when renam
22860 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d  ing output colum
22870 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ns..query I rows
22880 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
22890 36 38 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  68 col1 FROM tab
228a0 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 36 38  1 cor0..----..68
228b0 0d 0a 36 38 0d 0a 36 38 0d 0a 0d 0a 6f 6e 6c 79  ..68..68....only
228c0 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44  if mysql # use D
228d0 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20  IV operator for 
228e0 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e  integer division
228f0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
22900 74 20 6c 61 62 65 6c 2d 39 35 39 0d 0a 53 45 4c  t label-959..SEL
22910 45 43 54 20 41 4c 4c 20 2b 20 63 6f 72 30 2e 63  ECT ALL + cor0.c
22920 6f 6c 31 20 44 49 56 20 63 6f 6c 30 20 41 53 20  ol1 DIV col0 AS 
22930 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41  col2 FROM tab2 A
22940 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d  S cor0..----..0.
22950 0a 30 0d 0a 34 0d 0a 0d 0a 73 6b 69 70 69 66 20  .0..4....skipif 
22960 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
22970 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
22980 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 39 35  rowsort label-95
22990 39 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20  9..SELECT ALL + 
229a0 63 6f 72 30 2e 63 6f 6c 31 20 2f 20 63 6f 6c 30  cor0.col1 / col0
229b0 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
229c0 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
229d0 0d 0a 30 0d 0a 30 0d 0a 34 0d 0a 0d 0a 71 75 65  ..0..0..4....que
229e0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
229f0 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20  LECT DISTINCT - 
22a00 63 6f 6c 31 20 2a 20 63 6f 6c 32 20 2b 20 2d 20  col1 * col2 + - 
22a10 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46 52 4f  col1 AS col2 FRO
22a20 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
22a30 2d 2d 2d 2d 0d 0a 2d 31 39 34 0d 0a 2d 32 39 32  ----..-194..-292
22a40 34 0d 0a 2d 37 35 35 33 0d 0a 0d 0a 71 75 65 72  4..-7553....quer
22a50 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
22a60 45 43 54 20 41 4c 4c 20 2b 20 28 20 63 6f 6c 32  ECT ALL + ( col2
22a70 20 29 20 2a 20 34 20 46 52 4f 4d 20 74 61 62 30   ) * 4 FROM tab0
22a80 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
22a90 31 33 32 0d 0a 33 32 38 0d 0a 34 0d 0a 0d 0a 6f  132..328..4....o
22aa0 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73  nlyif mysql # us
22ab0 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66  e DIV operator f
22ac0 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73  or integer divis
22ad0 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ion..query I row
22ae0 73 6f 72 74 20 6c 61 62 65 6c 2d 39 36 32 0d 0a  sort label-962..
22af0 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
22b00 2d 20 63 6f 6c 31 20 2b 20 63 6f 6c 30 20 44 49  - col1 + col0 DI
22b10 56 20 2d 20 63 6f 6c 31 20 41 53 20 63 6f 6c 32  V - col1 AS col2
22b20 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
22b30 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 38 36 0d 0a 2d  r0..----..-86..-
22b40 39 31 0d 0a 2d 39 37 0d 0a 0d 0a 73 6b 69 70 69  91..-97....skipi
22b50 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
22b60 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
22b70 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
22b80 39 36 32 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  962..SELECT DIST
22b90 49 4e 43 54 20 2d 20 63 6f 6c 31 20 2b 20 63 6f  INCT - col1 + co
22ba0 6c 30 20 2f 20 2d 20 63 6f 6c 31 20 41 53 20 63  l0 / - col1 AS c
22bb0 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol2 FROM tab0 AS
22bc0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 38 36   cor0..----..-86
22bd0 0d 0a 2d 39 31 0d 0a 2d 39 37 0d 0a 0d 0a 71 75  ..-91..-97....qu
22be0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
22bf0 45 4c 45 43 54 20 2b 20 39 30 20 2b 20 2b 20 63  ELECT + 90 + + c
22c00 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol2 FROM tab2 AS
22c10 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 36   cor0..----..116
22c20 0d 0a 31 31 37 0d 0a 31 32 38 0d 0a 0d 0a 6f 6e  ..117..128....on
22c30 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
22c40 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
22c50 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
22c60 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
22c70 6f 72 74 20 6c 61 62 65 6c 2d 39 36 34 0d 0a 53  ort label-964..S
22c80 45 4c 45 43 54 20 41 4c 4c 20 2b 20 74 61 62 32  ELECT ALL + tab2
22c90 2e 63 6f 6c 32 20 44 49 56 20 2d 20 34 34 20 2b  .col2 DIV - 44 +
22ca0 20 74 61 62 32 2e 63 6f 6c 30 20 2a 20 2b 20 63   tab2.col0 * + c
22cb0 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d  ol0 FROM tab2..-
22cc0 2d 2d 2d 0d 0a 34 39 0d 0a 36 30 38 34 0d 0a 36  ---..49..6084..6
22cd0 32 34 31 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  241....skipif my
22ce0 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
22cf0 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
22d00 77 73 6f 72 74 20 6c 61 62 65 6c 2d 39 36 34 0d  wsort label-964.
22d10 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 74 61  .SELECT ALL + ta
22d20 62 32 2e 63 6f 6c 32 20 2f 20 2d 20 34 34 20 2b  b2.col2 / - 44 +
22d30 20 74 61 62 32 2e 63 6f 6c 30 20 2a 20 2b 20 63   tab2.col0 * + c
22d40 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d  ol0 FROM tab2..-
22d50 2d 2d 2d 0d 0a 34 39 0d 0a 36 30 38 34 0d 0a 36  ---..49..6084..6
22d60 32 34 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  241....query I r
22d70 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63  owsort..SELECT c
22d80 6f 6c 30 20 2b 20 2d 20 34 31 20 46 52 4f 4d 20  ol0 + - 41 FROM 
22d90 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 37 0d  tab0..----..-17.
22da0 0a 2d 36 0d 0a 34 38 0d 0a 0d 0a 73 6b 69 70 69  .-6..48....skipi
22db0 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50  f postgresql # P
22dc0 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72  ostgreSQL requir
22dd0 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d  es AS when renam
22de0 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d  ing output colum
22df0 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ns..query I rows
22e00 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
22e10 2d 20 32 39 20 63 6f 6c 32 20 46 52 4f 4d 20 74  - 29 col2 FROM t
22e20 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
22e30 2d 0d 0a 2d 32 39 0d 0a 2d 32 39 0d 0a 2d 32 39  -..-29..-29..-29
22e40 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
22e50 6f 72 74 0d 0a 53 45 4c 45 43 54 20 28 20 2b 20  ort..SELECT ( + 
22e60 63 6f 6c 31 20 29 20 2a 20 2d 20 63 6f 6c 31 20  col1 ) * - col1 
22e70 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
22e80 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 37  0 cor0..----..-7
22e90 33 39 36 0d 0a 2d 38 32 38 31 0d 0a 2d 39 34 30  396..-8281..-940
22ea0 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  9....query I row
22eb0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
22ec0 54 49 4e 43 54 20 36 20 2b 20 2d 20 63 6f 6c 32  TINCT 6 + - col2
22ed0 20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d   FROM tab1 cor0.
22ee0 0a 2d 2d 2d 2d 0d 0a 2d 34 38 0d 0a 2d 35 31 0d  .----..-48..-51.
22ef0 0a 2d 39 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .-90....query I 
22f00 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
22f10 41 4c 4c 20 32 33 20 2a 20 2d 20 63 6f 6c 31 20  ALL 23 * - col1 
22f20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d  FROM tab0..----.
22f30 0a 2d 31 39 37 38 0d 0a 2d 32 30 39 33 0d 0a 2d  .-1978..-2093..-
22f40 32 32 33 31 0d 0a 0d 0a 73 6b 69 70 69 66 20 70  2231....skipif p
22f50 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74  ostgresql # Post
22f60 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20  greSQL requires 
22f70 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67  AS when renaming
22f80 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d   output columns.
22f90 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
22fa0 0d 0a 53 45 4c 45 43 54 20 2b 20 2b 20 63 6f 6c  ..SELECT + + col
22fb0 32 20 2a 20 39 20 63 6f 6c 30 20 46 52 4f 4d 20  2 * 9 col0 FROM 
22fc0 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
22fd0 2d 2d 0d 0a 32 39 37 0d 0a 37 33 38 0d 0a 39 0d  --..297..738..9.
22fe0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
22ff0 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 32 20 2a  rt..SELECT + 2 *
23000 20 63 6f 72 30 2e 63 6f 6c 32 20 2b 20 63 6f 6c   cor0.col2 + col
23010 31 20 2a 20 63 6f 72 30 2e 63 6f 6c 30 20 41 53  1 * cor0.col0 AS
23020 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20   col1 FROM tab0 
23030 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 31 33 30  cor0..----..2130
23040 0d 0a 33 33 39 37 0d 0a 38 32 36 33 0d 0a 0d 0a  ..3397..8263....
23050 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
23060 0a 53 45 4c 45 43 54 20 2b 20 2d 20 63 6f 72 30  .SELECT + - cor0
23070 2e 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c 31 20 2b  .col2 * + col1 +
23080 20 2b 20 28 20 2d 20 63 6f 6c 32 20 29 20 41 53   + ( - col2 ) AS
23090 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20   col1 FROM tab2 
230a0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 35 36  cor0..----..-156
230b0 30 0d 0a 2d 36 38 34 0d 0a 2d 38 36 34 0d 0a 0d  0..-684..-864...
230c0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
230d0 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
230e0 54 20 74 61 62 32 2e 63 6f 6c 32 20 2b 20 2d 20  T tab2.col2 + - 
230f0 31 32 20 46 52 4f 4d 20 74 61 62 32 2c 20 74 61  12 FROM tab2, ta
23100 62 32 20 41 53 20 63 6f 72 30 2c 20 74 61 62 31  b2 AS cor0, tab1
23110 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a   AS cor1..----..
23120 31 34 0d 0a 31 35 0d 0a 32 36 0d 0a 0d 0a 71 75  14..15..26....qu
23130 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
23140 45 4c 45 43 54 20 2d 20 28 20 63 6f 6c 32 20 29  ELECT - ( col2 )
23150 20 2a 20 63 6f 6c 32 20 2b 20 2b 20 28 20 63 6f   * col2 + + ( co
23160 6c 30 20 29 20 46 52 4f 4d 20 74 61 62 30 20 63  l0 ) FROM tab0 c
23170 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 36 35  or0..----..-1065
23180 0d 0a 2d 36 36 33 35 0d 0a 33 34 0d 0a 0d 0a 71  ..-6635..34....q
23190 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
231a0 53 45 4c 45 43 54 20 32 30 20 2b 20 2b 20 63 6f  SELECT 20 + + co
231b0 72 31 2e 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20  r1.col0 AS col0 
231c0 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
231d0 30 20 43 52 4f 53 53 20 4a 4f 49 4e 20 74 61 62  0 CROSS JOIN tab
231e0 31 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d  1 AS cor1..----.
231f0 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e  .9 values hashin
23200 67 20 74 6f 20 31 35 31 33 31 62 32 66 38 61 38  g to 15131b2f8a8
23210 66 62 62 33 34 39 38 66 65 61 30 32 31 64 31 63  fbb3498fea021d1c
23220 66 63 39 31 37 0d 0a 0d 0a 71 75 65 72 79 20 49  fc917....query I
23230 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
23240 20 41 4c 4c 20 2b 20 74 61 62 31 2e 63 6f 6c 31   ALL + tab1.col1
23250 20 2a 20 74 61 62 31 2e 63 6f 6c 31 20 46 52 4f   * tab1.col1 FRO
23260 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 30  M tab1..----..10
23270 30 0d 0a 31 36 39 0d 0a 36 37 36 0d 0a 0d 0a 6f  0..169..676....o
23280 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73  nlyif mysql # us
23290 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66  e DIV operator f
232a0 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73  or integer divis
232b0 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ion..query I row
232c0 73 6f 72 74 20 6c 61 62 65 6c 2d 39 37 37 0d 0a  sort label-977..
232d0 53 45 4c 45 43 54 20 2d 20 63 6f 6c 30 20 2b 20  SELECT - col0 + 
232e0 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 2a 20 63 6f  - cor0.col2 * co
232f0 6c 31 20 2b 20 63 6f 6c 31 20 44 49 56 20 2b 20  l1 + col1 DIV + 
23300 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41  col2 FROM tab1 A
23310 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
23320 33 32 38 0d 0a 2d 31 34 30 37 0d 0a 2d 36 33 34  328..-1407..-634
23330 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
23340 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
23350 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
23360 72 74 20 6c 61 62 65 6c 2d 39 37 37 0d 0a 53 45  rt label-977..SE
23370 4c 45 43 54 20 2d 20 63 6f 6c 30 20 2b 20 2d 20  LECT - col0 + - 
23380 63 6f 72 30 2e 63 6f 6c 32 20 2a 20 63 6f 6c 31  cor0.col2 * col1
23390 20 2b 20 63 6f 6c 31 20 2f 20 2b 20 63 6f 6c 32   + col1 / + col2
233a0 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
233b0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 32 38 0d  r0..----..-1328.
233c0 0a 2d 31 34 30 37 0d 0a 2d 36 33 34 0d 0a 0d 0a  .-1407..-634....
233d0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
233e0 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 30 20 2a  .SELECT - col0 *
233f0 20 63 6f 6c 32 20 2b 20 39 31 20 41 53 20 63 6f   col2 + 91 AS co
23400 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l2 FROM tab0 AS 
23410 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 37 30 31  cor0..----..-701
23420 0d 0a 2d 37 32 30 37 0d 0a 35 36 0d 0a 0d 0a 6f  ..-7207..56....o
23430 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73  nlyif mysql # us
23440 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66  e DIV operator f
23450 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73  or integer divis
23460 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ion..query I row
23470 73 6f 72 74 20 6c 61 62 65 6c 2d 39 37 39 0d 0a  sort label-979..
23480 53 45 4c 45 43 54 20 2d 20 2d 20 63 6f 6c 30 20  SELECT - - col0 
23490 44 49 56 20 31 38 20 63 6f 6c 31 20 46 52 4f 4d  DIV 18 col1 FROM
234a0 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
234b0 2d 2d 2d 0d 0a 30 0d 0a 33 0d 0a 34 0d 0a 0d 0a  ---..0..3..4....
234c0 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71  skipif postgresq
234d0 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72  l # PostgreSQL r
234e0 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20  equires AS when 
234f0 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20  renaming output 
23500 63 6f 6c 75 6d 6e 73 0d 0a 73 6b 69 70 69 66 20  columns..skipif 
23510 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
23520 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
23530 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 39 37  rowsort label-97
23540 39 0d 0a 53 45 4c 45 43 54 20 2d 20 2d 20 63 6f  9..SELECT - - co
23550 6c 30 20 2f 20 31 38 20 63 6f 6c 31 20 46 52 4f  l0 / 18 col1 FRO
23560 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
23570 2d 2d 2d 2d 0d 0a 30 0d 0a 33 0d 0a 34 0d 0a 0d  ----..0..3..4...
23580 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
23590 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 31 20  ..SELECT - col1 
235a0 2a 20 2b 20 28 20 63 6f 6c 32 20 29 20 2b 20 63  * + ( col2 ) + c
235b0 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol2 FROM tab1 AS
235c0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31   cor0..----..-11
235d0 35 32 0d 0a 2d 31 33 35 30 0d 0a 2d 35 31 33 0d  52..-1350..-513.
235e0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
235f0 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d  rt..SELECT ALL -
23600 20 2d 20 63 6f 6c 30 20 2b 20 28 20 2b 20 63 6f   - col0 + ( + co
23610 6c 31 20 29 20 46 52 4f 4d 20 74 61 62 30 20 41  l1 ) FROM tab0 A
23620 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31  S cor0..----..11
23630 30 0d 0a 31 33 32 0d 0a 31 38 30 0d 0a 0d 0a 6f  0..132..180....o
23640 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73  nlyif mysql # us
23650 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66  e DIV operator f
23660 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73  or integer divis
23670 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ion..query I row
23680 73 6f 72 74 20 6c 61 62 65 6c 2d 39 38 32 0d 0a  sort label-982..
23690 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
236a0 2b 20 2d 20 63 6f 6c 32 20 44 49 56 20 2b 20 39  + - col2 DIV + 9
236b0 38 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  8 FROM tab2 AS c
236c0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 0d 0a  or0..----..0....
236d0 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
236e0 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
236f0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
23700 61 62 65 6c 2d 39 38 32 0d 0a 53 45 4c 45 43 54  abel-982..SELECT
23710 20 44 49 53 54 49 4e 43 54 20 2b 20 2d 20 63 6f   DISTINCT + - co
23720 6c 32 20 2f 20 2b 20 39 38 20 46 52 4f 4d 20 74  l2 / + 98 FROM t
23730 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
23740 2d 0d 0a 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20  -..0....query I 
23750 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
23760 2b 20 2d 20 36 33 20 2b 20 2d 20 31 39 20 46 52  + - 63 + - 19 FR
23770 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
23780 0a 2d 2d 2d 2d 0d 0a 2d 38 32 0d 0a 2d 38 32 0d  .----..-82..-82.
23790 0a 2d 38 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .-82....query I 
237a0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
237b0 41 4c 4c 20 2b 20 35 30 20 41 53 20 63 6f 6c 30  ALL + 50 AS col0
237c0 20 46 52 4f 4d 20 74 61 62 32 2c 20 74 61 62 32   FROM tab2, tab2
237d0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
237e0 39 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67  9 values hashing
237f0 20 74 6f 20 64 65 61 32 64 31 62 37 34 65 30 63   to dea2d1b74e0c
23800 64 66 36 37 38 30 36 61 66 38 63 34 31 37 33 32  df67806af8c41732
23810 34 66 35 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20  4f52....query I 
23820 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
23830 2b 20 28 20 36 20 29 20 46 52 4f 4d 20 74 61 62  + ( 6 ) FROM tab
23840 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
23850 0a 36 0d 0a 36 0d 0a 36 0d 0a 0d 0a 71 75 65 72  .6..6..6....quer
23860 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
23870 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 2d  ECT DISTINCT + -
23880 20 31 20 2a 20 2d 20 63 6f 6c 32 20 46 52 4f 4d   1 * - col2 FROM
23890 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
238a0 2d 2d 2d 0d 0a 32 36 0d 0a 32 37 0d 0a 33 38 0d  ---..26..27..38.
238b0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
238c0 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 33 38 20  rt..SELECT - 38 
238d0 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
238e0 30 2c 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  0, tab0 AS cor0.
238f0 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20  .----..9 values 
23900 68 61 73 68 69 6e 67 20 74 6f 20 65 35 37 31 35  hashing to e5715
23910 34 31 61 65 34 30 63 62 30 64 64 61 63 61 31 36  41ae40cb0ddaca16
23920 65 31 31 66 34 33 35 39 35 30 37 0d 0a 0d 0a 71  e11f4359507....q
23930 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
23940 53 45 4c 45 43 54 20 28 20 2b 20 63 6f 6c 32 20  SELECT ( + col2 
23950 29 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c 32  ) + col0 AS col2
23960 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d   FROM tab0 cor0.
23970 0a 2d 2d 2d 2d 0d 0a 31 37 31 0d 0a 33 36 0d 0a  .----..171..36..
23980 35 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  57....query I ro
23990 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
239a0 63 6f 6c 32 20 2a 20 63 6f 6c 30 20 2b 20 2d 20  col2 * col0 + - 
239b0 63 6f 6c 30 20 2a 20 2d 20 63 6f 72 30 2e 63 6f  col0 * - cor0.co
239c0 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l2 FROM tab0 AS 
239d0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 34 35 39  cor0..----..1459
239e0 36 0d 0a 31 35 38 34 0d 0a 37 30 0d 0a 0d 0a 71  6..1584..70....q
239f0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
23a00 53 45 4c 45 43 54 20 63 6f 6c 31 20 2a 20 35 32  SELECT col1 * 52
23a10 20 2a 20 2b 20 63 6f 6c 31 20 2b 20 33 20 2a 20   * + col1 + 3 * 
23a20 2b 20 38 31 20 41 53 20 63 6f 6c 32 20 46 52 4f  + 81 AS col2 FRO
23a30 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
23a40 2d 2d 2d 2d 0d 0a 33 38 34 38 33 35 0d 0a 34 33  ----..384835..43
23a50 30 38 35 35 0d 0a 34 38 39 35 31 31 0d 0a 0d 0a  0855..489511....
23a60 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
23a70 0a 53 45 4c 45 43 54 20 2d 20 28 20 34 33 20 2a  .SELECT - ( 43 *
23a80 20 2b 20 63 6f 6c 32 20 29 20 2b 20 2b 20 28 20   + col2 ) + + ( 
23a90 2d 20 28 20 2d 20 63 6f 6c 32 20 29 20 29 20 46  - ( - col2 ) ) F
23aa0 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab2..----..
23ab0 2d 31 30 39 32 0d 0a 2d 31 31 33 34 0d 0a 2d 31  -1092..-1134..-1
23ac0 35 39 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  596....query I r
23ad0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
23ae0 20 2d 20 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c 30   - col2 * + col0
23af0 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 2a 20 28   + cor0.col0 * (
23b00 20 2b 20 63 6f 6c 32 20 29 20 2b 20 63 6f 6c 30   + col2 ) + col0
23b10 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
23b20 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 34 0d 0a 33 35  r0..----..24..35
23b30 0d 0a 38 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..89....query I 
23b40 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
23b50 41 4c 4c 20 2b 20 63 6f 6c 32 20 2a 20 2d 20 63  ALL + col2 * - c
23b60 6f 72 30 2e 63 6f 6c 32 20 2b 20 63 6f 6c 30 20  or0.col2 + col0 
23b70 2a 20 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c 30 20  * col1 * + col0 
23b80 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
23b90 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 36 38 32 0d 0a  0..----..-2682..
23ba0 33 37 37 31 31 0d 0a 37 33 39 38 34 0d 0a 0d 0a  37711..73984....
23bb0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
23bc0 0a 53 45 4c 45 43 54 20 2d 20 39 36 20 2b 20 63  .SELECT - 96 + c
23bd0 6f 72 30 2e 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c  or0.col0 + - col
23be0 31 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  1 AS col0 FROM t
23bf0 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
23c00 2d 0d 0a 2d 31 35 38 0d 0a 2d 31 35 38 0d 0a 2d  -..-158..-158..-
23c10 39 38 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73  98....skipif pos
23c20 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72  tgresql # Postgr
23c30 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53  eSQL requires AS
23c40 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f   when renaming o
23c50 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71  utput columns..q
23c60 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
23c70 53 45 4c 45 43 54 20 63 6f 72 30 2e 63 6f 6c 30  SELECT cor0.col0
23c80 20 2b 20 2b 20 36 20 63 6f 6c 30 20 46 52 4f 4d   + + 6 col0 FROM
23c90 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
23ca0 2d 2d 2d 0d 0a 37 30 0d 0a 38 36 0d 0a 39 0d 0a  ---..70..86..9..
23cb0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
23cc0 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20  t..SELECT ALL - 
23cd0 2b 20 28 20 2b 20 63 6f 6c 31 20 29 20 2a 20 63  + ( + col1 ) * c
23ce0 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  ol2 AS col2 FROM
23cf0 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
23d00 2d 2d 2d 0d 0a 2d 32 38 33 38 0d 0a 2d 37 34 36  ---..-2838..-746
23d10 32 0d 0a 2d 39 37 0d 0a 0d 0a 71 75 65 72 79 20  2..-97....query 
23d20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
23d30 54 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 2a 20  T + cor0.col0 * 
23d40 63 6f 6c 30 20 2a 20 63 6f 6c 31 20 46 52 4f 4d  col0 * col1 FROM
23d50 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
23d60 2d 2d 2d 0d 0a 32 33 34 0d 0a 34 30 39 36 30 0d  ---..234..40960.
23d70 0a 38 33 32 30 30 0d 0a 0d 0a 73 6b 69 70 69 66  .83200....skipif
23d80 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f   postgresql # Po
23d90 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65  stgreSQL require
23da0 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69  s AS when renami
23db0 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e  ng output column
23dc0 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  s..query I rowso
23dd0 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
23de0 4e 43 54 20 2b 20 2b 20 63 6f 72 30 2e 63 6f 6c  NCT + + cor0.col
23df0 32 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 63 6f  2 + cor0.col2 co
23e00 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72  l0 FROM tab1 cor
23e10 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 38 0d 0a 31 31  0..----..108..11
23e20 34 0d 0a 31 39 32 0d 0a 0d 0a 71 75 65 72 79 20  4..192....query 
23e30 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
23e40 54 20 44 49 53 54 49 4e 43 54 20 28 20 63 6f 6c  T DISTINCT ( col
23e50 32 20 29 20 2a 20 63 6f 6c 31 20 2d 20 2d 20 63  2 ) * col1 - - c
23e60 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  ol0 AS col0 FROM
23e70 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab1 cor0..----
23e80 0d 0a 31 33 32 38 0d 0a 31 34 30 37 0d 0a 36 33  ..1328..1407..63
23e90 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  4....query I row
23ea0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
23eb0 20 2b 20 28 20 2d 20 63 6f 6c 32 20 29 20 2b 20   + ( - col2 ) + 
23ec0 2b 20 63 6f 6c 30 20 2b 20 63 6f 6c 30 20 41 53  + col0 + col0 AS
23ed0 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 0d   col2 FROM tab0.
23ee0 0a 2d 2d 2d 2d 0d 0a 31 35 0d 0a 36 39 0d 0a 39  .----..15..69..9
23ef0 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  6....query I row
23f00 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
23f10 20 63 6f 72 30 2e 63 6f 6c 32 20 2a 20 2b 20 63   cor0.col2 * + c
23f20 6f 72 32 2e 63 6f 6c 32 20 41 53 20 63 6f 6c 32  or2.col2 AS col2
23f30 20 46 52 4f 4d 20 74 61 62 32 2c 20 74 61 62 31   FROM tab2, tab1
23f40 20 41 53 20 63 6f 72 30 2c 20 74 61 62 30 20 41   AS cor0, tab0 A
23f50 53 20 63 6f 72 31 2c 20 74 61 62 30 20 41 53 20  S cor1, tab0 AS 
23f60 63 6f 72 32 0d 0a 2d 2d 2d 2d 0d 0a 38 31 20 76  cor2..----..81 v
23f70 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f  alues hashing to
23f80 20 61 35 61 30 37 32 65 61 65 62 33 34 33 36 36   a5a072eaeb34366
23f90 39 63 63 36 37 32 31 64 63 32 66 37 31 37 63 62  9cc6721dc2f717cb
23fa0 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  2....query I row
23fb0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c  sort..SELECT col
23fc0 30 20 2a 20 2d 20 38 33 20 46 52 4f 4d 20 74 61  0 * - 83 FROM ta
23fd0 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
23fe0 0d 0a 2d 31 39 39 32 0d 0a 2d 32 39 30 35 0d 0a  ..-1992..-2905..
23ff0 2d 37 33 38 37 0d 0a 0d 0a 71 75 65 72 79 20 49  -7387....query I
24000 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
24010 20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c 30   DISTINCT - col0
24020 20 2b 20 2b 20 33 38 20 46 52 4f 4d 20 74 61 62   + + 38 FROM tab
24030 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 34  2 cor0..----..-4
24040 30 0d 0a 2d 34 31 0d 0a 33 31 0d 0a 0d 0a 71 75  0..-41..31....qu
24050 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
24060 45 4c 45 43 54 20 2b 20 2d 20 63 6f 6c 32 20 2a  ELECT + - col2 *
24070 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 41 53 20   + cor0.col1 AS 
24080 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41  col1 FROM tab0 A
24090 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32  S cor0..----..-2
240a0 38 33 38 0d 0a 2d 37 34 36 32 0d 0a 2d 39 37 0d  838..-7462..-97.
240b0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
240c0 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 28 20 2b  rt..SELECT + ( +
240d0 20 74 61 62 32 2e 63 6f 6c 30 20 2a 20 74 61 62   tab2.col0 * tab
240e0 32 2e 63 6f 6c 31 20 29 20 46 52 4f 4d 20 74 61  2.col1 ) FROM ta
240f0 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 33 34 33 0d 0a  b2..----..1343..
24100 32 31 37 0d 0a 34 36 30 32 0d 0a 0d 0a 71 75 65  217..4602....que
24110 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
24120 4c 45 43 54 20 41 4c 4c 20 2d 20 31 36 20 41 53  LECT ALL - 16 AS
24130 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 2c   col2 FROM tab1,
24140 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
24150 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61  ---..9 values ha
24160 73 68 69 6e 67 20 74 6f 20 62 65 32 32 61 63 37  shing to be22ac7
24170 36 62 34 32 63 36 66 37 32 31 32 65 63 63 30 62  6b42c6f7212ecc0b
24180 61 37 63 38 39 65 62 33 34 0d 0a 0d 0a 71 75 65  a7c89eb34....que
24190 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
241a0 4c 45 43 54 20 2d 20 63 6f 6c 31 20 2a 20 39 35  LECT - col1 * 95
241b0 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d   FROM tab0..----
241c0 0d 0a 2d 38 31 37 30 0d 0a 2d 38 36 34 35 0d 0a  ..-8170..-8645..
241d0 2d 39 32 31 35 0d 0a 0d 0a 71 75 65 72 79 20 49  -9215....query I
241e0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
241f0 20 2d 20 63 6f 6c 31 20 2a 20 32 34 20 2a 20 2b   - col1 * 24 * +
24200 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 0d   col2 FROM tab1.
24210 0a 2d 2d 2d 2d 0d 0a 2d 31 33 36 38 30 0d 0a 2d  .----..-13680..-
24220 32 39 39 35 32 0d 0a 2d 33 33 36 39 36 0d 0a 0d  29952..-33696...
24230 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
24240 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
24250 54 20 63 6f 6c 31 20 2a 20 63 6f 6c 32 20 2a 20  T col1 * col2 * 
24260 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41  col0 FROM tab2 A
24270 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31  S cor0..----..11
24280 39 36 35 32 0d 0a 35 31 30 33 34 0d 0a 35 38 35  9652..51034..585
24290 39 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  9....onlyif mysq
242a0 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72  l # use DIV oper
242b0 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72  ator for integer
242c0 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79   division..query
242d0 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
242e0 2d 31 30 31 30 0d 0a 53 45 4c 45 43 54 20 41 4c  -1010..SELECT AL
242f0 4c 20 43 41 53 54 28 20 31 35 20 41 53 20 53 49  L CAST( 15 AS SI
24300 47 4e 45 44 20 29 20 44 49 56 20 63 6f 72 30 2e  GNED ) DIV cor0.
24310 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 2c 20  col2 FROM tab0, 
24320 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
24330 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73  --..9 values has
24340 68 69 6e 67 20 74 6f 20 36 61 65 37 39 34 35 61  hing to 6ae7945a
24350 31 38 34 65 38 32 64 32 31 38 63 63 63 30 31 38  184e82d218ccc018
24360 62 36 30 64 34 37 66 30 0d 0a 0d 0a 73 6b 69 70  b60d47f0....skip
24370 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
24380 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
24390 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
243a0 2d 31 30 31 30 0d 0a 53 45 4c 45 43 54 20 41 4c  -1010..SELECT AL
243b0 4c 20 43 41 53 54 20 28 20 31 35 20 41 53 20 49  L CAST ( 15 AS I
243c0 4e 54 45 47 45 52 20 29 20 2f 20 63 6f 72 30 2e  NTEGER ) / cor0.
243d0 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 2c 20  col2 FROM tab0, 
243e0 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
243f0 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73  --..9 values has
24400 68 69 6e 67 20 74 6f 20 36 61 65 37 39 34 35 61  hing to 6ae7945a
24410 31 38 34 65 38 32 64 32 31 38 63 63 63 30 31 38  184e82d218ccc018
24420 62 36 30 64 34 37 66 30 0d 0a 0d 0a 71 75 65 72  b60d47f0....quer
24430 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
24440 45 43 54 20 41 4c 4c 20 74 61 62 30 2e 63 6f 6c  ECT ALL tab0.col
24450 31 20 2d 20 63 6f 6c 31 20 2a 20 2d 20 28 20 63  1 - col1 * - ( c
24460 6f 6c 30 20 29 20 46 52 4f 4d 20 74 61 62 30 0d  ol0 ) FROM tab0.
24470 0a 2d 2d 2d 2d 0d 0a 32 31 35 30 0d 0a 33 34 39  .----..2150..349
24480 32 0d 0a 38 31 39 30 0d 0a 0d 0a 71 75 65 72 79  2..8190....query
24490 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
244a0 43 54 20 63 6f 72 30 2e 63 6f 6c 31 20 2b 20 2d  CT cor0.col1 + -
244b0 20 35 38 20 2a 20 37 31 20 46 52 4f 4d 20 74 61   58 * 71 FROM ta
244c0 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
244d0 0d 0a 2d 34 30 32 31 0d 0a 2d 34 30 32 37 0d 0a  ..-4021..-4027..
244e0 2d 34 30 33 32 0d 0a 0d 0a 71 75 65 72 79 20 49  -4032....query I
244f0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
24500 20 41 4c 4c 20 63 6f 6c 32 20 2a 20 2b 20 63 6f   ALL col2 * + co
24510 6c 31 20 2d 20 2b 20 63 6f 6c 30 20 2a 20 63 6f  l1 - + col0 * co
24520 6c 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  l0 AS col2 FROM 
24530 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 32  tab0..----..-112
24540 38 0d 0a 2d 34 35 39 0d 0a 32 32 36 32 0d 0a 0d  8..-459..2262...
24550 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
24560 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63  ..SELECT ALL + c
24570 6f 6c 30 20 2a 20 37 31 20 2d 20 2b 20 63 6f 6c  ol0 * 71 - + col
24580 30 20 2a 20 63 6f 6c 31 20 41 53 20 63 6f 6c 32  0 * col1 AS col2
24590 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d   FROM tab2..----
245a0 0d 0a 32 38 30 0d 0a 34 32 36 36 0d 0a 39 33 36  ..280..4266..936
245b0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
245c0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
245d0 2d 20 36 38 20 2a 20 63 6f 6c 32 20 41 53 20 63  - 68 * col2 AS c
245e0 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol1 FROM tab1 AS
245f0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 36   cor0..----..-36
24600 37 32 0d 0a 2d 33 38 37 36 0d 0a 2d 36 35 32 38  72..-3876..-6528
24610 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
24620 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
24630 2d 20 2b 20 28 20 2b 20 63 6f 6c 31 20 29 20 2a  - + ( + col1 ) *
24640 20 2d 20 63 6f 6c 30 20 2b 20 2b 20 34 38 20 2a   - col0 + + 48 *
24650 20 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46 52   col2 AS col2 FR
24660 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
24670 0a 2d 2d 2d 2d 0d 0a 31 32 30 33 35 0d 0a 33 34  .----..12035..34
24680 34 33 0d 0a 33 36 34 38 0d 0a 0d 0a 71 75 65 72  43..3648....quer
24690 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
246a0 45 43 54 20 41 4c 4c 20 2d 20 37 30 20 2a 20 2d  ECT ALL - 70 * -
246b0 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20   col2 FROM tab1 
246c0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 37 38 30  cor0..----..3780
246d0 0d 0a 33 39 39 30 0d 0a 36 37 32 30 0d 0a 0d 0a  ..3990..6720....
246e0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
246f0 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
24700 20 2d 20 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c 30   - col0 * + col0
24710 20 2b 20 2d 20 34 37 20 2d 20 35 30 20 46 52 4f   + - 47 - 50 FRO
24720 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab0 cor0..---
24730 2d 0d 0a 2d 31 33 32 32 0d 0a 2d 36 37 33 0d 0a  -..-1322..-673..
24740 2d 38 30 31 38 0d 0a 0d 0a 73 6b 69 70 69 66 20  -8018....skipif 
24750 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
24760 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
24770 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
24780 41 4c 4c 20 2d 20 36 36 20 2b 20 63 6f 6c 32 20  ALL - 66 + col2 
24790 2b 20 2b 20 43 41 53 54 20 28 20 36 34 20 41 53  + + CAST ( 64 AS
247a0 20 52 45 41 4c 20 29 20 46 52 4f 4d 20 74 61 62   REAL ) FROM tab
247b0 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
247c0 0a 2d 31 0d 0a 33 31 0d 0a 38 30 0d 0a 0d 0a 71  .-1..31..80....q
247d0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
247e0 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
247f0 32 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  2 AS col0 FROM t
24800 61 62 31 2c 20 74 61 62 31 20 41 53 20 63 6f 72  ab1, tab1 AS cor
24810 30 2c 20 74 61 62 31 20 41 53 20 63 6f 72 31 0d  0, tab1 AS cor1.
24820 0a 2d 2d 2d 2d 0d 0a 32 0d 0a 0d 0a 71 75 65 72  .----..2....quer
24830 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
24840 45 43 54 20 41 4c 4c 20 2b 20 28 20 63 6f 72 30  ECT ALL + ( cor0
24850 2e 63 6f 6c 32 20 29 20 41 53 20 63 6f 6c 31 20  .col2 ) AS col1 
24860 46 52 4f 4d 20 74 61 62 31 2c 20 74 61 62 30 20  FROM tab1, tab0 
24870 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39  AS cor0..----..9
24880 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20   values hashing 
24890 74 6f 20 63 38 66 39 66 61 39 65 66 30 66 38 37  to c8f9fa9ef0f87
248a0 30 32 62 64 33 38 32 65 38 32 31 33 37 38 61 39  02bd382e821378a9
248b0 36 64 38 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  6d8....onlyif my
248c0 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f  sql # support fo
248d0 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63  r MySQL specific
248e0 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e   system types an
248f0 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20  d syntax..query 
24900 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
24910 31 30 32 32 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  1022..SELECT ALL
24920 20 74 61 62 31 2e 63 6f 6c 31 20 2a 20 63 6f 6c   tab1.col1 * col
24930 31 20 2a 20 2d 20 43 41 53 54 28 20 4e 55 4c 4c  1 * - CAST( NULL
24940 20 41 53 20 53 49 47 4e 45 44 20 29 20 2d 20 74   AS SIGNED ) - t
24950 61 62 31 2e 63 6f 6c 30 20 46 52 4f 4d 20 74 61  ab1.col0 FROM ta
24960 62 31 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a  b1..----..NULL..
24970 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b  NULL..NULL....sk
24980 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
24990 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
249a0 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
249b0 65 6c 2d 31 30 32 32 0d 0a 53 45 4c 45 43 54 20  el-1022..SELECT 
249c0 41 4c 4c 20 74 61 62 31 2e 63 6f 6c 31 20 2a 20  ALL tab1.col1 * 
249d0 63 6f 6c 31 20 2a 20 2d 20 43 41 53 54 20 28 20  col1 * - CAST ( 
249e0 4e 55 4c 4c 20 41 53 20 49 4e 54 45 47 45 52 20  NULL AS INTEGER 
249f0 29 20 2d 20 74 61 62 31 2e 63 6f 6c 30 20 46 52  ) - tab1.col0 FR
24a00 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 4e  OM tab1..----..N
24a10 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d  ULL..NULL..NULL.
24a20 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
24a30 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b  rt..SELECT ALL +
24a40 20 2d 20 63 6f 6c 32 20 2b 20 35 35 20 46 52 4f   - col2 + 55 FRO
24a50 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
24a60 2d 2d 2d 2d 0d 0a 31 37 0d 0a 32 38 0d 0a 32 39  ----..17..28..29
24a70 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
24a80 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
24a90 49 4e 43 54 20 2d 20 2d 20 63 6f 72 30 2e 63 6f  INCT - - cor0.co
24aa0 6c 32 20 2a 20 2b 20 63 6f 6c 30 20 41 53 20 63  l2 * + col0 AS c
24ab0 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol0 FROM tab2 AS
24ac0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 38 39   cor0..----..189
24ad0 0d 0a 32 30 32 38 0d 0a 33 30 30 32 0d 0a 0d 0a  ..2028..3002....
24ae0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
24af0 0a 53 45 4c 45 43 54 20 2b 20 32 31 20 2a 20 35  .SELECT + 21 * 5
24b00 36 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  6 AS col1 FROM t
24b10 61 62 31 2c 20 74 61 62 32 20 41 53 20 63 6f 72  ab1, tab2 AS cor
24b20 30 2c 20 74 61 62 32 20 41 53 20 63 6f 72 31 0d  0, tab2 AS cor1.
24b30 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75 65 73  .----..27 values
24b40 20 68 61 73 68 69 6e 67 20 74 6f 20 38 66 30 33   hashing to 8f03
24b50 65 63 32 66 32 65 36 39 61 62 65 63 33 34 65 34  ec2f2e69abec34e4
24b60 36 38 62 62 34 30 66 39 30 36 31 31 0d 0a 0d 0a  68bb40f90611....
24b70 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
24b80 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 28 20  .SELECT ALL - ( 
24b90 63 6f 6c 32 20 29 20 2b 20 2d 20 63 6f 6c 31 20  col2 ) + - col1 
24ba0 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
24bb0 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 35 0d 0a 2d 35  0..----..-55..-5
24bc0 38 0d 0a 2d 38 35 0d 0a 0d 0a 71 75 65 72 79 20  8..-85....query 
24bd0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
24be0 54 20 41 4c 4c 20 39 36 20 2a 20 2d 20 63 6f 6c  T ALL 96 * - col
24bf0 32 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d  2 FROM tab0..---
24c00 2d 0d 0a 2d 33 31 36 38 0d 0a 2d 37 38 37 32 0d  -..-3168..-7872.
24c10 0a 2d 39 36 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  .-96....skipif m
24c20 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
24c30 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
24c40 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
24c50 49 53 54 49 4e 43 54 20 2d 20 43 41 53 54 20 28  ISTINCT - CAST (
24c60 20 28 20 2d 20 63 6f 6c 32 20 29 20 41 53 20 52   ( - col2 ) AS R
24c70 45 41 4c 20 29 20 2b 20 2d 20 32 36 20 46 52 4f  EAL ) + - 26 FRO
24c80 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
24c90 2d 2d 2d 2d 0d 0a 32 38 0d 0a 33 31 0d 0a 37 30  ----..28..31..70
24ca0 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67  ....skipif postg
24cb0 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53  resql # PostgreS
24cc0 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77  QL requires AS w
24cd0 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74  hen renaming out
24ce0 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65  put columns..que
24cf0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
24d00 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 32 20  LECT ALL + col2 
24d10 2b 20 2b 20 32 37 20 63 6f 6c 31 20 46 52 4f 4d  + + 27 col1 FROM
24d20 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
24d30 2d 2d 2d 0d 0a 31 32 33 0d 0a 38 31 0d 0a 38 34  ---..123..81..84
24d40 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
24d50 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d   # support for M
24d60 79 53 51 4c 20 73 70 65 63 69 66 69 63 20 73 79  ySQL specific sy
24d70 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73  stem types and s
24d80 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72  yntax..query I r
24d90 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 30 33  owsort label-103
24da0 30 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20  0..SELECT ALL + 
24db0 43 41 53 54 28 20 2b 20 63 6f 6c 31 20 41 53 20  CAST( + col1 AS 
24dc0 53 49 47 4e 45 44 20 29 20 2a 20 63 6f 6c 30 20  SIGNED ) * col0 
24dd0 2b 20 2b 20 33 38 20 41 53 20 63 6f 6c 32 20 46  + + 38 AS col2 F
24de0 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
24df0 0d 0a 2d 2d 2d 2d 0d 0a 31 33 38 31 0d 0a 32 35  ..----..1381..25
24e00 35 0d 0a 34 36 34 30 0d 0a 0d 0a 73 6b 69 70 69  5..4640....skipi
24e10 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
24e20 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
24e30 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
24e40 31 30 33 30 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  1030..SELECT ALL
24e50 20 2b 20 43 41 53 54 20 28 20 2b 20 63 6f 6c 31   + CAST ( + col1
24e60 20 41 53 20 49 4e 54 45 47 45 52 20 29 20 2a 20   AS INTEGER ) * 
24e70 63 6f 6c 30 20 2b 20 2b 20 33 38 20 41 53 20 63  col0 + + 38 AS c
24e80 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol2 FROM tab2 AS
24e90 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33 38   cor0..----..138
24ea0 31 0d 0a 32 35 35 0d 0a 34 36 34 30 0d 0a 0d 0a  1..255..4640....
24eb0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
24ec0 0a 53 45 4c 45 43 54 20 2b 20 2d 20 63 6f 6c 30  .SELECT + - col0
24ed0 20 2a 20 2b 20 37 38 20 41 53 20 63 6f 6c 30 20   * + 78 AS col0 
24ee0 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
24ef0 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 38 37 32 0d 0a  0..----..-1872..
24f00 2d 32 37 33 30 0d 0a 2d 36 39 34 32 0d 0a 0d 0a  -2730..-6942....
24f10 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
24f20 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
24f30 20 2b 20 63 6f 6c 32 20 2d 20 63 6f 6c 32 20 2a   + col2 - col2 *
24f40 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20   + col1 AS col0 
24f50 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
24f60 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 35 30 38 0d 0a  0..----..-1508..
24f70 2d 36 30 38 0d 0a 2d 38 31 30 0d 0a 0d 0a 71 75  -608..-810....qu
24f80 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
24f90 45 4c 45 43 54 20 41 4c 4c 20 2b 20 28 20 2d 20  ELECT ALL + ( - 
24fa0 38 39 20 29 20 2b 20 63 6f 6c 32 20 46 52 4f 4d  89 ) + col2 FROM
24fb0 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
24fc0 2d 2d 2d 0d 0a 2d 35 31 0d 0a 2d 36 32 0d 0a 2d  ---..-51..-62..-
24fd0 36 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  63....query I ro
24fe0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
24ff0 2d 20 63 6f 72 30 2e 63 6f 6c 30 20 2a 20 2d 20  - cor0.col0 * - 
25000 63 6f 72 30 2e 63 6f 6c 31 20 41 53 20 63 6f 6c  cor0.col1 AS col
25010 31 20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30  1 FROM tab1 cor0
25020 0d 0a 2d 2d 2d 2d 0d 0a 31 30 34 30 0d 0a 36 34  ..----..1040..64
25030 30 0d 0a 37 38 0d 0a 0d 0a 71 75 65 72 79 20 49  0..78....query I
25040 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
25050 20 44 49 53 54 49 4e 43 54 20 74 61 62 31 2e 63   DISTINCT tab1.c
25060 6f 6c 31 20 2b 20 74 61 62 31 2e 63 6f 6c 30 20  ol1 + tab1.col0 
25070 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d  FROM tab1..----.
25080 0a 32 39 0d 0a 37 34 0d 0a 39 33 0d 0a 0d 0a 6f  .29..74..93....o
25090 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75  nlyif mysql # su
250a0 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20  pport for MySQL 
250b0 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20  specific system 
250c0 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78  types and syntax
250d0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
250e0 74 20 6c 61 62 65 6c 2d 31 30 33 36 0d 0a 53 45  t label-1036..SE
250f0 4c 45 43 54 20 2d 20 63 6f 6c 30 20 2a 20 31 37  LECT - col0 * 17
25100 20 2a 20 2b 20 63 6f 6c 31 20 2b 20 2b 20 63 6f   * + col1 + + co
25110 6c 30 20 2b 20 43 41 53 54 28 20 63 6f 6c 32 20  l0 + CAST( col2 
25120 41 53 20 53 49 47 4e 45 44 20 29 20 46 52 4f 4d  AS SIGNED ) FROM
25130 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33   tab0..----..-13
25140 37 35 31 32 0d 0a 2d 33 35 30 33 31 0d 0a 2d 35  7512..-35031..-5
25150 37 36 37 39 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  7679....skipif m
25160 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
25170 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
25180 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 30 33  owsort label-103
25190 36 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 30  6..SELECT - col0
251a0 20 2a 20 31 37 20 2a 20 2b 20 63 6f 6c 31 20 2b   * 17 * + col1 +
251b0 20 2b 20 63 6f 6c 30 20 2b 20 43 41 53 54 20 28   + col0 + CAST (
251c0 20 63 6f 6c 32 20 41 53 20 49 4e 54 45 47 45 52   col2 AS INTEGER
251d0 20 29 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d   ) FROM tab0..--
251e0 2d 2d 0d 0a 2d 31 33 37 35 31 32 0d 0a 2d 33 35  --..-137512..-35
251f0 30 33 31 0d 0a 2d 35 37 36 37 39 0d 0a 0d 0a 71  031..-57679....q
25200 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
25210 53 45 4c 45 43 54 20 74 61 62 30 2e 63 6f 6c 31  SELECT tab0.col1
25220 20 2b 20 2b 20 28 20 63 6f 6c 32 20 2a 20 2b 20   + + ( col2 * + 
25230 63 6f 6c 32 20 29 20 46 52 4f 4d 20 74 61 62 30  col2 ) FROM tab0
25240 0d 0a 2d 2d 2d 2d 0d 0a 31 31 37 35 0d 0a 36 38  ..----..1175..68
25250 31 35 0d 0a 39 38 0d 0a 0d 0a 71 75 65 72 79 20  15..98....query 
25260 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
25270 54 20 2b 20 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c  T + col2 * - col
25280 32 20 2b 20 2b 20 63 6f 6c 30 20 2a 20 63 6f 6c  2 + + col0 * col
25290 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  2 FROM tab1 AS c
252a0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 35 33 36  or0..----..-1536
252b0 0d 0a 2d 32 37 35 34 0d 0a 33 39 39 0d 0a 0d 0a  ..-2754..399....
252c0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
252d0 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 2b 20  .SELECT ALL - + 
252e0 63 6f 6c 32 20 2d 20 63 6f 6c 32 20 2a 20 2b 20  col2 - col2 * + 
252f0 63 6f 72 30 2e 63 6f 6c 31 20 2a 20 2b 20 28 20  cor0.col1 * + ( 
25300 2d 20 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c 30 20  - col0 * - col0 
25310 29 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  ) FROM tab1 AS c
25320 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32 36 39  or0..----..-1269
25330 30 0d 0a 2d 32 33 33 34 37 37 37 0d 0a 2d 37 39  0..-2334777..-79
25340 38 37 32 39 36 0d 0a 0d 0a 71 75 65 72 79 20 49  87296....query I
25350 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
25360 20 44 49 53 54 49 4e 43 54 20 34 35 20 2a 20 2b   DISTINCT 45 * +
25370 20 63 6f 72 30 2e 63 6f 6c 30 20 41 53 20 63 6f   cor0.col0 AS co
25380 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l2 FROM tab1 AS 
25390 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33 35 0d  cor0..----..135.
253a0 0a 32 38 38 30 0d 0a 33 36 30 30 0d 0a 0d 0a 71  .2880..3600....q
253b0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
253c0 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
253d0 2b 20 28 20 2d 20 63 6f 6c 30 20 29 20 2a 20 63  + ( - col0 ) * c
253e0 6f 72 30 2e 63 6f 6c 32 20 2b 20 63 6f 6c 31 20  or0.col2 + col1 
253f0 2b 20 2b 20 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c  + + col2 * + col
25400 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  2 FROM tab2 AS c
25410 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32 39 33  or0..----..-1293
25420 0d 0a 2d 31 35 34 31 0d 0a 35 37 31 0d 0a 0d 0a  ..-1541..571....
25430 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
25440 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 2b 20  .SELECT ALL + + 
25450 63 6f 6c 30 20 2b 20 34 20 2b 20 63 6f 6c 30 20  col0 + 4 + col0 
25460 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
25470 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 36  2 cor0..----..16
25480 30 0d 0a 31 36 32 0d 0a 31 38 0d 0a 0d 0a 6f 6e  0..162..18....on
25490 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70  lyif mysql # sup
254a0 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73  port for MySQL s
254b0 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20 74  pecific system t
254c0 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d  ypes and syntax.
254d0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
254e0 20 6c 61 62 65 6c 2d 31 30 34 33 0d 0a 53 45 4c   label-1043..SEL
254f0 45 43 54 20 41 4c 4c 20 2d 20 43 41 53 54 28 20  ECT ALL - CAST( 
25500 4e 55 4c 4c 20 41 53 20 44 45 43 49 4d 41 4c 20  NULL AS DECIMAL 
25510 29 20 2a 20 28 20 63 6f 6c 30 20 29 20 2d 20 2d  ) * ( col0 ) - -
25520 20 33 39 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d   39 AS col1 FROM
25530 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab0 cor0..----
25540 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55  ..NULL..NULL..NU
25550 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  LL....skipif mys
25560 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
25570 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
25580 73 6f 72 74 20 6c 61 62 65 6c 2d 31 30 34 33 0d  sort label-1043.
25590 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 43 41  .SELECT ALL - CA
255a0 53 54 20 28 20 4e 55 4c 4c 20 41 53 20 52 45 41  ST ( NULL AS REA
255b0 4c 20 29 20 2a 20 28 20 63 6f 6c 30 20 29 20 2d  L ) * ( col0 ) -
255c0 20 2d 20 33 39 20 41 53 20 63 6f 6c 31 20 46 52   - 39 AS col1 FR
255d0 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d  OM tab0 cor0..--
255e0 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a  --..NULL..NULL..
255f0 4e 55 4c 4c 0d 0a 0d 0a 71 75 65 72 79 20 49 20  NULL....query I 
25600 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
25610 63 6f 6c 30 20 2b 20 63 6f 6c 32 20 2a 20 63 6f  col0 + col2 * co
25620 6c 30 20 2a 20 2d 20 63 6f 6c 31 20 41 53 20 63  l0 * - col1 AS c
25630 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol0 FROM tab1 AS
25640 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 36   cor0..----..-36
25650 34 31 36 0d 0a 2d 34 32 30 39 0d 0a 2d 39 39 37  416..-4209..-997
25660 36 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  60....query I ro
25670 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
25680 53 54 49 4e 43 54 20 2d 20 2d 20 28 20 63 6f 72  STINCT - - ( cor
25690 30 2e 63 6f 6c 31 20 29 20 2a 20 63 6f 6c 32 20  0.col1 ) * col2 
256a0 2a 20 2d 20 31 32 20 2b 20 2b 20 63 6f 6c 30 20  * - 12 + + col0 
256b0 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
256c0 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 30 33 37 0d  0..----..-10037.
256d0 0a 2d 31 38 33 33 30 0d 0a 2d 37 36 37 33 0d 0a  .-18330..-7673..
256e0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
256f0 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 31 20 2a  t..SELECT col1 *
25700 20 2b 20 32 33 20 2b 20 63 6f 6c 31 20 41 53 20   + 23 + col1 AS 
25710 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 0d 0a  col0 FROM tab2..
25720 2d 2d 2d 2d 0d 0a 31 34 31 36 0d 0a 34 30 38 0d  ----..1416..408.
25730 0a 37 34 34 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  .744....skipif m
25740 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
25750 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
25760 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 43  owsort..SELECT C
25770 41 53 54 20 28 20 63 6f 6c 30 20 41 53 20 52 45  AST ( col0 AS RE
25780 41 4c 20 29 20 2a 20 63 6f 6c 32 20 2a 20 36 32  AL ) * col2 * 62
25790 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20   + col1 AS col0 
257a0 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d  FROM tab1..----.
257b0 0a 31 30 30 37 30 0d 0a 32 32 36 31 38 36 0d 0a  .10070..226186..
257c0 34 37 36 31 37 33 0d 0a 0d 0a 71 75 65 72 79 20  476173....query 
257d0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
257e0 54 20 2d 20 28 20 2d 20 63 6f 6c 32 20 29 20 2a  T - ( - col2 ) *
257f0 20 2d 20 63 6f 6c 32 20 2d 20 2d 20 63 6f 6c 31   - col2 - - col1
25800 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d   FROM tab1..----
25810 0d 0a 2d 32 38 39 30 0d 0a 2d 33 32 33 39 0d 0a  ..-2890..-3239..
25820 2d 39 32 30 33 0d 0a 0d 0a 71 75 65 72 79 20 49  -9203....query I
25830 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
25840 20 44 49 53 54 49 4e 43 54 20 2b 20 35 32 20 2a   DISTINCT + 52 *
25850 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 0d   col2 FROM tab0.
25860 0a 2d 2d 2d 2d 0d 0a 31 37 31 36 0d 0a 34 32 36  .----..1716..426
25870 34 0d 0a 35 32 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  4..52....onlyif 
25880 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20  mysql # use DIV 
25890 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74  operator for int
258a0 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71  eger division..q
258b0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
258c0 61 62 65 6c 2d 31 30 35 30 0d 0a 53 45 4c 45 43  abel-1050..SELEC
258d0 54 20 74 61 62 31 2e 63 6f 6c 30 20 2b 20 2b 20  T tab1.col0 + + 
258e0 63 6f 6c 31 20 44 49 56 20 63 6f 6c 32 20 41 53  col1 DIV col2 AS
258f0 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 0d   col2 FROM tab1.
25900 0a 2d 2d 2d 2d 0d 0a 33 0d 0a 36 34 0d 0a 38 30  .----..3..64..80
25910 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
25920 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
25930 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
25940 72 74 20 6c 61 62 65 6c 2d 31 30 35 30 0d 0a 53  rt label-1050..S
25950 45 4c 45 43 54 20 74 61 62 31 2e 63 6f 6c 30 20  ELECT tab1.col0 
25960 2b 20 2b 20 63 6f 6c 31 20 2f 20 63 6f 6c 32 20  + + col1 / col2 
25970 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
25980 31 0d 0a 2d 2d 2d 2d 0d 0a 33 0d 0a 36 34 0d 0a  1..----..3..64..
25990 38 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  80....query I ro
259a0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
259b0 35 35 20 2a 20 63 6f 6c 30 20 2b 20 74 61 62 32  55 * col0 + tab2
259c0 2e 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46 52  .col1 AS col2 FR
259d0 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 34  OM tab2..----..4
259e0 31 36 0d 0a 34 33 34 39 0d 0a 34 33 36 32 0d 0a  16..4349..4362..
259f0 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65  ..skipif postgre
25a00 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c  sql # PostgreSQL
25a10 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65   requires AS whe
25a20 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75  n renaming outpu
25a30 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79  t columns..query
25a40 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
25a50 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 28 20  CT DISTINCT - ( 
25a60 2d 20 33 20 29 20 2b 20 63 6f 6c 30 20 2a 20 2d  - 3 ) + col0 * -
25a70 20 63 6f 6c 31 20 63 6f 6c 31 20 46 52 4f 4d 20   col1 col1 FROM 
25a80 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
25a90 2d 2d 0d 0a 2d 31 30 33 37 0d 0a 2d 36 33 37 0d  --..-1037..-637.
25aa0 0a 2d 37 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .-75....query I 
25ab0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
25ac0 2b 20 28 20 2d 20 63 6f 6c 32 20 29 20 2a 20 2b  + ( - col2 ) * +
25ad0 20 63 6f 6c 31 20 2b 20 2b 20 63 6f 6c 32 20 41   col1 + + col2 A
25ae0 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30  S col2 FROM tab0
25af0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
25b00 2d 32 38 30 35 0d 0a 2d 37 33 38 30 0d 0a 2d 39  -2805..-7380..-9
25b10 36 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74  6....skipif post
25b20 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65  gresql # Postgre
25b30 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20  SQL requires AS 
25b40 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75  when renaming ou
25b50 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75  tput columns..qu
25b60 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
25b70 45 4c 45 43 54 20 41 4c 4c 20 2d 20 28 20 2d 20  ELECT ALL - ( - 
25b80 63 6f 6c 32 20 29 20 63 6f 6c 31 20 46 52 4f 4d  col2 ) col1 FROM
25b90 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
25ba0 2d 2d 2d 0d 0a 32 36 0d 0a 32 37 0d 0a 33 38 0d  ---..26..27..38.
25bb0 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
25bc0 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79  # support for My
25bd0 53 51 4c 20 73 70 65 63 69 66 69 63 20 73 79 73  SQL specific sys
25be0 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79  tem types and sy
25bf0 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f  ntax..query I ro
25c00 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 30 35 35  wsort label-1055
25c10 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 39 35 20  ..SELECT ALL 95 
25c20 2b 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 2d 20  + + cor0.col2 - 
25c30 43 41 53 54 28 20 63 6f 6c 32 20 41 53 20 53 49  CAST( col2 AS SI
25c40 47 4e 45 44 20 29 20 46 52 4f 4d 20 74 61 62 31  GNED ) FROM tab1
25c50 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 35 0d   cor0..----..95.
25c60 0a 39 35 0d 0a 39 35 0d 0a 0d 0a 73 6b 69 70 69  .95..95....skipi
25c70 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
25c80 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
25c90 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
25ca0 31 30 35 35 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  1055..SELECT ALL
25cb0 20 39 35 20 2b 20 2b 20 63 6f 72 30 2e 63 6f 6c   95 + + cor0.col
25cc0 32 20 2d 20 43 41 53 54 20 28 20 63 6f 6c 32 20  2 - CAST ( col2 
25cd0 41 53 20 49 4e 54 45 47 45 52 20 29 20 46 52 4f  AS INTEGER ) FRO
25ce0 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab1 cor0..---
25cf0 2d 0d 0a 39 35 0d 0a 39 35 0d 0a 39 35 0d 0a 0d  -..95..95..95...
25d00 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
25d10 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
25d20 54 20 2d 20 63 6f 6c 31 20 2a 20 63 6f 6c 31 20  T - col1 * col1 
25d30 2b 20 36 20 46 52 4f 4d 20 74 61 62 32 20 41 53  + 6 FROM tab2 AS
25d40 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 38   cor0..----..-28
25d50 33 0d 0a 2d 33 34 37 35 0d 0a 2d 39 35 35 0d 0a  3..-3475..-955..
25d60 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
25d70 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53   support for MyS
25d80 51 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74  QL specific syst
25d90 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e  em types and syn
25da0 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  tax..query I row
25db0 73 6f 72 74 20 6c 61 62 65 6c 2d 31 30 35 37 0d  sort label-1057.
25dc0 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 32 20 2a  .SELECT + col2 *
25dd0 20 2d 20 63 6f 6c 32 20 2a 20 43 41 53 54 28 20   - col2 * CAST( 
25de0 63 6f 6c 30 20 41 53 20 53 49 47 4e 45 44 20 29  col0 AS SIGNED )
25df0 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20   col2 FROM tab1 
25e00 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
25e10 32 30 37 39 33 36 0d 0a 2d 37 33 37 32 38 30 0d  207936..-737280.
25e20 0a 2d 38 37 34 38 0d 0a 0d 0a 73 6b 69 70 69 66  .-8748....skipif
25e30 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f   postgresql # Po
25e40 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65  stgreSQL require
25e50 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69  s AS when renami
25e60 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e  ng output column
25e70 73 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  s..skipif mysql 
25e80 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
25e90 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
25ea0 74 20 6c 61 62 65 6c 2d 31 30 35 37 0d 0a 53 45  t label-1057..SE
25eb0 4c 45 43 54 20 2b 20 63 6f 6c 32 20 2a 20 2d 20  LECT + col2 * - 
25ec0 63 6f 6c 32 20 2a 20 43 41 53 54 20 28 20 63 6f  col2 * CAST ( co
25ed0 6c 30 20 41 53 20 49 4e 54 45 47 45 52 20 29 20  l0 AS INTEGER ) 
25ee0 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41  col2 FROM tab1 A
25ef0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32  S cor0..----..-2
25f00 30 37 39 33 36 0d 0a 2d 37 33 37 32 38 30 0d 0a  07936..-737280..
25f10 2d 38 37 34 38 0d 0a 0d 0a 71 75 65 72 79 20 49  -8748....query I
25f20 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
25f30 20 74 61 62 30 2e 63 6f 6c 30 20 2b 20 2b 20 63   tab0.col0 + + c
25f40 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  ol0 AS col2 FROM
25f50 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 37 38   tab0..----..178
25f60 0d 0a 34 38 0d 0a 37 30 0d 0a 0d 0a 6f 6e 6c 79  ..48..70....only
25f70 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44  if mysql # use D
25f80 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20  IV operator for 
25f90 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e  integer division
25fa0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
25fb0 74 20 6c 61 62 65 6c 2d 31 30 35 39 0d 0a 53 45  t label-1059..SE
25fc0 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20  LECT DISTINCT + 
25fd0 63 6f 6c 32 20 44 49 56 20 2b 20 63 6f 6c 30 20  col2 DIV + col0 
25fe0 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
25ff0 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d  2 cor0..----..0.
26000 0a 33 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  .3....skipif mys
26010 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
26020 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
26030 73 6f 72 74 20 6c 61 62 65 6c 2d 31 30 35 39 0d  sort label-1059.
26040 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
26050 20 2b 20 63 6f 6c 32 20 2f 20 2b 20 63 6f 6c 30   + col2 / + col0
26060 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
26070 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30  b2 cor0..----..0
26080 0d 0a 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  ..3....query I r
26090 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
260a0 4c 4c 20 2d 20 2d 20 63 6f 72 30 2e 63 6f 6c 31  LL - - cor0.col1
260b0 20 2a 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 41   * + cor0.col1 A
260c0 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31  S col0 FROM tab1
260d0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
260e0 31 30 30 0d 0a 31 36 39 0d 0a 36 37 36 0d 0a 0d  100..169..676...
260f0 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
26100 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51  support for MySQ
26110 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65  L specific syste
26120 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74  m types and synt
26130 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ax..query I rows
26140 6f 72 74 20 6c 61 62 65 6c 2d 31 30 36 31 0d 0a  ort label-1061..
26150 53 45 4c 45 43 54 20 2b 20 63 6f 6c 30 20 2a 20  SELECT + col0 * 
26160 2b 20 43 41 53 54 28 20 4e 55 4c 4c 20 41 53 20  + CAST( NULL AS 
26170 53 49 47 4e 45 44 20 29 20 46 52 4f 4d 20 74 61  SIGNED ) FROM ta
26180 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e  b0 cor0..----..N
26190 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d  ULL..NULL..NULL.
261a0 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
261b0 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
261c0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
261d0 74 20 6c 61 62 65 6c 2d 31 30 36 31 0d 0a 53 45  t label-1061..SE
261e0 4c 45 43 54 20 2b 20 63 6f 6c 30 20 2a 20 2b 20  LECT + col0 * + 
261f0 43 41 53 54 20 28 20 4e 55 4c 4c 20 41 53 20 49  CAST ( NULL AS I
26200 4e 54 45 47 45 52 20 29 20 46 52 4f 4d 20 74 61  NTEGER ) FROM ta
26210 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e  b0 cor0..----..N
26220 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d  ULL..NULL..NULL.
26230 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
26240 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b  rt..SELECT ALL +
26250 20 63 6f 6c 32 20 2a 20 32 35 20 46 52 4f 4d 20   col2 * 25 FROM 
26260 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
26270 2d 2d 0d 0a 32 30 35 30 0d 0a 32 35 0d 0a 38 32  --..2050..25..82
26280 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  5....query I row
26290 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
262a0 20 2b 20 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c 32   + col0 * - col2
262b0 20 2b 20 28 20 63 6f 6c 32 20 29 20 41 53 20 63   + ( col2 ) AS c
262c0 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol1 FROM tab2 AS
262d0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 36   cor0..----..-16
262e0 32 0d 0a 2d 32 30 30 32 0d 0a 2d 32 39 36 34 0d  2..-2002..-2964.
262f0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
26300 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2d 20 63  rt..SELECT - - c
26310 6f 72 30 2e 63 6f 6c 30 20 2b 20 2d 20 63 6f 72  or0.col0 + - cor
26320 30 2e 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46  0.col0 AS col1 F
26330 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d  ROM tab0 cor0..-
26340 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a  ---..0..0..0....
26350 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75  onlyif mysql # u
26360 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20  se DIV operator 
26370 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69  for integer divi
26380 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f  sion..query I ro
26390 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 30 36 35  wsort label-1065
263a0 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63  ..SELECT ALL + c
263b0 6f 6c 30 20 44 49 56 20 36 36 20 41 53 20 63 6f  ol0 DIV 66 AS co
263c0 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l0 FROM tab2 AS 
263d0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 31  cor0..----..0..1
263e0 0d 0a 31 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  ..1....skipif my
263f0 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
26400 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
26410 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 30 36 35  wsort label-1065
26420 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63  ..SELECT ALL + c
26430 6f 6c 30 20 2f 20 36 36 20 41 53 20 63 6f 6c 30  ol0 / 66 AS col0
26440 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
26450 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 31 0d 0a  r0..----..0..1..
26460 31 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74  1....skipif post
26470 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65  gresql # Postgre
26480 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20  SQL requires AS 
26490 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75  when renaming ou
264a0 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75  tput columns..qu
264b0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
264c0 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b  ELECT DISTINCT +
264d0 20 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c 31 20 63   col1 * + col1 c
264e0 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 63 6f  ol0 FROM tab2 co
264f0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 38 39 0d 0a 33  r0..----..289..3
26500 34 38 31 0d 0a 39 36 31 0d 0a 0d 0a 71 75 65 72  481..961....quer
26510 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
26520 45 43 54 20 63 6f 6c 31 20 2d 20 33 34 20 41 53  ECT col1 - 34 AS
26530 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20   col0 FROM tab0 
26540 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 35  AS cor0..----..5
26550 32 0d 0a 35 37 0d 0a 36 33 0d 0a 0d 0a 6f 6e 6c  2..57..63....onl
26560 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20  yif mysql # use 
26570 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72  DIV operator for
26580 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f   integer divisio
26590 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  n..query I rowso
265a0 72 74 20 6c 61 62 65 6c 2d 31 30 36 38 0d 0a 53  rt label-1068..S
265b0 45 4c 45 43 54 20 41 4c 4c 20 2d 20 2d 20 63 6f  ELECT ALL - - co
265c0 6c 30 20 2b 20 63 6f 6c 32 20 44 49 56 20 2b 20  l0 + col2 DIV + 
265d0 36 34 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  64 AS col0 FROM 
265e0 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
265f0 2d 2d 0d 0a 32 34 0d 0a 33 35 0d 0a 39 30 0d 0a  --..24..35..90..
26600 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
26610 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
26620 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
26630 20 6c 61 62 65 6c 2d 31 30 36 38 0d 0a 53 45 4c   label-1068..SEL
26640 45 43 54 20 41 4c 4c 20 2d 20 2d 20 63 6f 6c 30  ECT ALL - - col0
26650 20 2b 20 63 6f 6c 32 20 2f 20 2b 20 36 34 20 41   + col2 / + 64 A
26660 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30  S col0 FROM tab0
26670 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
26680 32 34 0d 0a 33 35 0d 0a 39 30 0d 0a 0d 0a 71 75  24..35..90....qu
26690 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
266a0 45 4c 45 43 54 20 2b 20 63 6f 6c 32 20 2a 20 63  ELECT + col2 * c
266b0 6f 6c 31 20 2d 20 63 6f 6c 31 20 46 52 4f 4d 20  ol1 - col1 FROM 
266c0 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab0 cor0..----.
266d0 0a 30 0d 0a 32 37 35 32 0d 0a 37 33 37 31 0d 0a  .0..2752..7371..
266e0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
266f0 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 30  t..SELECT - col0
26700 20 2b 20 2b 20 34 20 41 53 20 63 6f 6c 30 20 46   + + 4 AS col0 F
26710 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d  ROM tab0 cor0..-
26720 2d 2d 2d 0d 0a 2d 32 30 0d 0a 2d 33 31 0d 0a 2d  ---..-20..-31..-
26730 38 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  85....query I ro
26740 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f  wsort..SELECT co
26750 6c 32 20 2b 20 2b 20 63 6f 6c 30 20 2a 20 2b 20  l2 + + col0 * + 
26760 63 6f 72 30 2e 63 6f 6c 31 20 46 52 4f 4d 20 74  cor0.col1 FROM t
26770 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab0 cor0..----..
26780 32 30 39 37 0d 0a 33 33 39 36 0d 0a 38 31 38 31  2097..3396..8181
26790 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
267a0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
267b0 2b 20 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c 31 20  + col1 * - col1 
267c0 2a 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61  * + col1 FROM ta
267d0 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
267e0 0d 0a 2d 36 33 36 30 35 36 0d 0a 2d 37 35 33 35  ..-636056..-7535
267f0 37 31 0d 0a 2d 39 31 32 36 37 33 0d 0a 0d 0a 71  71..-912673....q
26800 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
26810 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
26820 63 6f 6c 30 20 2b 20 2b 20 38 38 20 2b 20 63 6f  col0 + + 88 + co
26830 6c 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  l0 AS col1 FROM 
26840 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 30 32 0d  tab2..----..102.
26850 0a 32 34 34 0d 0a 32 34 36 0d 0a 0d 0a 6f 6e 6c  .244..246....onl
26860 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20  yif mysql # use 
26870 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72  DIV operator for
26880 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f   integer divisio
26890 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  n..query I rowso
268a0 72 74 20 6c 61 62 65 6c 2d 31 30 37 34 0d 0a 53  rt label-1074..S
268b0 45 4c 45 43 54 20 2d 20 2d 20 63 6f 6c 30 20 2b  ELECT - - col0 +
268c0 20 63 6f 6c 30 20 44 49 56 20 63 6f 6c 32 20 46   col0 DIV col2 F
268d0 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d  ROM tab0 cor0..-
268e0 2d 2d 2d 0d 0a 32 34 0d 0a 37 30 0d 0a 39 30 0d  ---..24..70..90.
268f0 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
26900 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
26910 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
26920 74 20 6c 61 62 65 6c 2d 31 30 37 34 0d 0a 53 45  t label-1074..SE
26930 4c 45 43 54 20 2d 20 2d 20 63 6f 6c 30 20 2b 20  LECT - - col0 + 
26940 63 6f 6c 30 20 2f 20 63 6f 6c 32 20 46 52 4f 4d  col0 / col2 FROM
26950 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab0 cor0..----
26960 0d 0a 32 34 0d 0a 37 30 0d 0a 39 30 0d 0a 0d 0a  ..24..70..90....
26970 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
26980 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 32 20 2a  .SELECT + col2 *
26990 20 35 37 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d   57 AS col0 FROM
269a0 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
269b0 2d 2d 2d 0d 0a 31 34 38 32 0d 0a 31 35 33 39 0d  ---..1482..1539.
269c0 0a 32 31 36 36 0d 0a 0d 0a 71 75 65 72 79 20 49  .2166....query I
269d0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
269e0 20 63 6f 6c 31 20 2b 20 63 6f 6c 31 20 2a 20 63   col1 + col1 * c
269f0 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  ol2 AS col0 FROM
26a00 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
26a10 2d 2d 2d 0d 0a 31 39 34 0d 0a 32 39 32 34 0d 0a  ---..194..2924..
26a20 37 35 35 33 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  7553....onlyif m
26a30 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f  ysql # use DIV o
26a40 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65  perator for inte
26a50 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75  ger division..qu
26a60 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
26a70 62 65 6c 2d 31 30 37 37 0d 0a 53 45 4c 45 43 54  bel-1077..SELECT
26a80 20 2d 20 63 6f 6c 30 20 2b 20 28 20 2d 20 63 6f   - col0 + ( - co
26a90 6c 31 20 29 20 44 49 56 20 63 6f 72 30 2e 63 6f  l1 ) DIV cor0.co
26aa0 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72  l1 FROM tab1 cor
26ab0 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 0d 0a 2d 36 35  0..----..-4..-65
26ac0 0d 0a 2d 38 31 0d 0a 0d 0a 73 6b 69 70 69 66 20  ..-81....skipif 
26ad0 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
26ae0 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
26af0 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 30  rowsort label-10
26b00 37 37 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c  77..SELECT - col
26b10 30 20 2b 20 28 20 2d 20 63 6f 6c 31 20 29 20 2f  0 + ( - col1 ) /
26b20 20 63 6f 72 30 2e 63 6f 6c 31 20 46 52 4f 4d 20   cor0.col1 FROM 
26b30 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab1 cor0..----.
26b40 0a 2d 34 0d 0a 2d 36 35 0d 0a 2d 38 31 0d 0a 0d  .-4..-65..-81...
26b50 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
26b60 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51  support for MySQ
26b70 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65  L specific syste
26b80 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74  m types and synt
26b90 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ax..query I rows
26ba0 6f 72 74 20 6c 61 62 65 6c 2d 31 30 37 38 0d 0a  ort label-1078..
26bb0 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
26bc0 43 41 53 54 28 20 4e 55 4c 4c 20 41 53 20 53 49  CAST( NULL AS SI
26bd0 47 4e 45 44 20 29 20 41 53 20 63 6f 6c 30 20 46  GNED ) AS col0 F
26be0 52 4f 4d 20 74 61 62 30 2c 20 74 61 62 31 20 41  ROM tab0, tab1 A
26bf0 53 20 63 6f 72 30 2c 20 74 61 62 32 20 41 53 20  S cor0, tab2 AS 
26c00 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c  cor1..----..NULL
26c10 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
26c20 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
26c30 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
26c40 72 74 20 6c 61 62 65 6c 2d 31 30 37 38 0d 0a 53  rt label-1078..S
26c50 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 43  ELECT DISTINCT C
26c60 41 53 54 20 28 20 4e 55 4c 4c 20 41 53 20 49 4e  AST ( NULL AS IN
26c70 54 45 47 45 52 20 29 20 41 53 20 63 6f 6c 30 20  TEGER ) AS col0 
26c80 46 52 4f 4d 20 74 61 62 30 2c 20 74 61 62 31 20  FROM tab0, tab1 
26c90 41 53 20 63 6f 72 30 2c 20 74 61 62 32 20 41 53  AS cor0, tab2 AS
26ca0 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c   cor1..----..NUL
26cb0 4c 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  L....query I row
26cc0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63  sort..SELECT - c
26cd0 6f 6c 32 20 2b 20 63 6f 6c 32 20 2a 20 2b 20 63  ol2 + col2 * + c
26ce0 6f 6c 32 20 2a 20 2b 20 63 6f 72 30 2e 63 6f 6c  ol2 * + cor0.col
26cf0 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  2 AS col2 FROM t
26d00 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
26d10 2d 0d 0a 30 0d 0a 33 35 39 30 34 0d 0a 35 35 31  -..0..35904..551
26d20 32 38 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  286....query I r
26d30 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
26d40 20 36 32 20 2a 20 63 6f 72 30 2e 63 6f 6c 32 20   62 * cor0.col2 
26d50 2b 20 35 30 20 46 52 4f 4d 20 74 61 62 32 2c 20  + 50 FROM tab2, 
26d60 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
26d70 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73  --..9 values has
26d80 68 69 6e 67 20 74 6f 20 39 39 65 31 32 31 33 33  hing to 99e12133
26d90 34 34 64 66 33 38 34 66 64 38 64 31 65 61 31 63  44df384fd8d1ea1c
26da0 35 30 36 32 38 30 62 35 0d 0a 0d 0a 71 75 65 72  506280b5....quer
26db0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
26dc0 45 43 54 20 44 49 53 54 49 4e 43 54 20 38 31 20  ECT DISTINCT 81 
26dd0 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
26de0 31 2c 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  1, tab1 AS cor0.
26df0 0a 2d 2d 2d 2d 0d 0a 38 31 0d 0a 0d 0a 6f 6e 6c  .----..81....onl
26e00 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20  yif mysql # use 
26e10 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72  DIV operator for
26e20 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f   integer divisio
26e30 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  n..query I rowso
26e40 72 74 20 6c 61 62 65 6c 2d 31 30 38 32 0d 0a 53  rt label-1082..S
26e50 45 4c 45 43 54 20 63 6f 6c 32 20 2d 20 31 35 20  ELECT col2 - 15 
26e60 44 49 56 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61  DIV col1 FROM ta
26e70 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
26e80 0d 0a 35 34 0d 0a 35 36 0d 0a 39 35 0d 0a 0d 0a  ..54..56..95....
26e90 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
26ea0 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
26eb0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
26ec0 61 62 65 6c 2d 31 30 38 32 0d 0a 53 45 4c 45 43  abel-1082..SELEC
26ed0 54 20 63 6f 6c 32 20 2d 20 31 35 20 2f 20 63 6f  T col2 - 15 / co
26ee0 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l1 FROM tab1 AS 
26ef0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 35 34 0d 0a  cor0..----..54..
26f00 35 36 0d 0a 39 35 0d 0a 0d 0a 71 75 65 72 79 20  56..95....query 
26f10 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
26f20 54 20 41 4c 4c 20 2d 20 2b 20 63 6f 6c 31 20 2a  T ALL - + col1 *
26f30 20 33 36 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d   36 AS col2 FROM
26f40 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
26f50 2d 2d 2d 0d 0a 2d 33 36 30 0d 0a 2d 34 36 38 0d  ---..-360..-468.
26f60 0a 2d 39 33 36 0d 0a 0d 0a 71 75 65 72 79 20 49  .-936....query I
26f70 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
26f80 20 2d 20 36 37 20 2b 20 63 6f 6c 31 20 2a 20 63   - 67 + col1 * c
26f90 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol0 FROM tab1 AS
26fa0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 0d   cor0..----..11.
26fb0 0a 35 37 33 0d 0a 39 37 33 0d 0a 0d 0a 6f 6e 6c  .573..973....onl
26fc0 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20  yif mysql # use 
26fd0 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72  DIV operator for
26fe0 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f   integer divisio
26ff0 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  n..query I rowso
27000 72 74 20 6c 61 62 65 6c 2d 31 30 38 35 0d 0a 53  rt label-1085..S
27010 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d  ELECT DISTINCT -
27020 20 39 37 20 2a 20 2d 20 63 6f 6c 32 20 2b 20 2d   97 * - col2 + -
27030 20 33 39 20 44 49 56 20 63 6f 6c 30 20 2b 20 2b   39 DIV col0 + +
27040 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20   col2 FROM tab0 
27050 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33  AS cor0..----..3
27060 32 33 33 0d 0a 38 30 33 36 0d 0a 39 37 0d 0a 0d  233..8036..97...
27070 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
27080 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
27090 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
270a0 6c 61 62 65 6c 2d 31 30 38 35 0d 0a 53 45 4c 45  label-1085..SELE
270b0 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 39 37  CT DISTINCT - 97
270c0 20 2a 20 2d 20 63 6f 6c 32 20 2b 20 2d 20 33 39   * - col2 + - 39
270d0 20 2f 20 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c 32   / col0 + + col2
270e0 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
270f0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 32 33 33 0d 0a  r0..----..3233..
27100 38 30 33 36 0d 0a 39 37 0d 0a 0d 0a 71 75 65 72  8036..97....quer
27110 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
27120 45 43 54 20 2b 20 63 6f 6c 32 20 2a 20 63 6f 6c  ECT + col2 * col
27130 30 20 2b 20 2d 20 63 6f 6c 32 20 46 52 4f 4d 20  0 + - col2 FROM 
27140 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
27150 2d 2d 0d 0a 33 34 0d 0a 37 32 31 36 0d 0a 37 35  --..34..7216..75
27160 39 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  9....onlyif mysq
27170 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20  l # support for 
27180 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63 20 73  MySQL specific s
27190 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20  ystem types and 
271a0 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20  syntax..query I 
271b0 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 30  rowsort label-10
271c0 38 37 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c  87..SELECT + col
271d0 30 20 2a 20 2b 20 63 6f 6c 31 20 2b 20 2d 20 43  0 * + col1 + - C
271e0 41 53 54 28 20 2d 20 63 6f 6c 31 20 41 53 20 53  AST( - col1 AS S
271f0 49 47 4e 45 44 20 29 20 2b 20 63 6f 6c 31 20 2a  IGNED ) + col1 *
27200 20 28 20 63 6f 6c 30 20 29 20 46 52 4f 4d 20 74   ( col0 ) FROM t
27210 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 32 37 30 33 0d  ab2..----..2703.
27220 0a 34 36 35 0d 0a 39 32 36 33 0d 0a 0d 0a 73 6b  .465..9263....sk
27230 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
27240 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
27250 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
27260 65 6c 2d 31 30 38 37 0d 0a 53 45 4c 45 43 54 20  el-1087..SELECT 
27270 2b 20 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c 31 20  + col0 * + col1 
27280 2b 20 2d 20 43 41 53 54 20 28 20 2d 20 63 6f 6c  + - CAST ( - col
27290 31 20 41 53 20 49 4e 54 45 47 45 52 20 29 20 2b  1 AS INTEGER ) +
272a0 20 63 6f 6c 31 20 2a 20 28 20 63 6f 6c 30 20 29   col1 * ( col0 )
272b0 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d   FROM tab2..----
272c0 0d 0a 32 37 30 33 0d 0a 34 36 35 0d 0a 39 32 36  ..2703..465..926
272d0 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  3....query I row
272e0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 31  sort..SELECT - 1
272f0 33 20 2a 20 63 6f 6c 32 20 2b 20 63 6f 6c 32 20  3 * col2 + col2 
27300 46 52 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a  FROM tab2 cor0..
27310 2d 2d 2d 2d 0d 0a 2d 33 31 32 0d 0a 2d 33 32 34  ----..-312..-324
27320 0d 0a 2d 34 35 36 0d 0a 0d 0a 71 75 65 72 79 20  ..-456....query 
27330 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
27340 54 20 38 39 20 2b 20 63 6f 6c 30 20 41 53 20 63  T 89 + col0 AS c
27350 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol2 FROM tab2 AS
27360 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 36 37   cor0..----..167
27370 0d 0a 31 36 38 0d 0a 39 36 0d 0a 0d 0a 6f 6e 6c  ..168..96....onl
27380 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70  yif mysql # supp
27390 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70  ort for MySQL sp
273a0 65 63 69 66 69 63 20 73 79 73 74 65 6d 20 74 79  ecific system ty
273b0 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a  pes and syntax..
273c0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
273d0 6c 61 62 65 6c 2d 31 30 39 30 0d 0a 53 45 4c 45  label-1090..SELE
273e0 43 54 20 37 30 20 2a 20 63 6f 6c 31 20 2d 20 43  CT 70 * col1 - C
273f0 41 53 54 28 20 4e 55 4c 4c 20 41 53 20 53 49 47  AST( NULL AS SIG
27400 4e 45 44 20 29 20 63 6f 6c 30 20 46 52 4f 4d 20  NED ) col0 FROM 
27410 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
27420 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a  --..NULL..NULL..
27430 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 70  NULL....skipif p
27440 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74  ostgresql # Post
27450 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20  greSQL requires 
27460 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67  AS when renaming
27470 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d   output columns.
27480 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
27490 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
274a0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
274b0 6c 61 62 65 6c 2d 31 30 39 30 0d 0a 53 45 4c 45  label-1090..SELE
274c0 43 54 20 37 30 20 2a 20 63 6f 6c 31 20 2d 20 43  CT 70 * col1 - C
274d0 41 53 54 20 28 20 4e 55 4c 4c 20 41 53 20 49 4e  AST ( NULL AS IN
274e0 54 45 47 45 52 20 29 20 63 6f 6c 30 20 46 52 4f  TEGER ) col0 FRO
274f0 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
27500 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c  ----..NULL..NULL
27510 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75 65 72 79 20  ..NULL....query 
27520 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
27530 54 20 36 20 2b 20 63 6f 6c 30 20 2a 20 63 6f 6c  T 6 + col0 * col
27540 30 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  0 AS col0 FROM t
27550 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab2 cor0..----..
27560 35 35 0d 0a 36 30 39 30 0d 0a 36 32 34 37 0d 0a  55..6090..6247..
27570 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
27580 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 30  t..SELECT - col0
27590 20 2a 20 2d 20 63 6f 6c 30 20 2b 20 2b 20 37 36   * - col0 + + 76
275a0 20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d   FROM tab1 cor0.
275b0 0a 2d 2d 2d 2d 0d 0a 34 31 37 32 0d 0a 36 34 37  .----..4172..647
275c0 36 0d 0a 38 35 0d 0a 0d 0a 71 75 65 72 79 20 49  6..85....query I
275d0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
275e0 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 32 20 2a   DISTINCT col2 *
275f0 20 2d 20 28 20 63 6f 72 30 2e 63 6f 6c 32 20 29   - ( cor0.col2 )
27600 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
27610 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
27620 0d 0a 2d 31 34 34 34 0d 0a 2d 36 37 36 0d 0a 2d  ..-1444..-676..-
27630 37 32 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  729....query I r
27640 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
27650 4c 4c 20 2d 20 63 6f 6c 32 20 2a 20 2b 20 63 6f  LL - col2 * + co
27660 6c 31 20 2b 20 2d 20 63 6f 6c 30 20 41 53 20 63  l1 + - col0 AS c
27670 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol0 FROM tab0 AS
27680 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33   cor0..----..-13
27690 32 0d 0a 2d 32 38 36 32 0d 0a 2d 37 35 35 31 0d  2..-2862..-7551.
276a0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
276b0 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b  rt..SELECT ALL +
276c0 20 28 20 2d 20 63 6f 6c 31 20 29 20 2a 20 34 39   ( - col1 ) * 49
276d0 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d   FROM tab1..----
276e0 0d 0a 2d 31 32 37 34 0d 0a 2d 34 39 30 0d 0a 2d  ..-1274..-490..-
276f0 36 33 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  637....query I r
27700 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
27710 4c 4c 20 28 20 2b 20 35 37 20 2a 20 63 6f 6c 31  LL ( + 57 * col1
27720 20 29 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d   ) FROM tab0..--
27730 2d 2d 0d 0a 34 39 30 32 0d 0a 35 31 38 37 0d 0a  --..4902..5187..
27740 35 35 32 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20  5529....query I 
27750 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
27760 2d 20 74 61 62 31 2e 63 6f 6c 30 20 2b 20 2d 20  - tab1.col0 + - 
27770 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c 32 20 41 53  col2 * + col2 AS
27780 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 0d   col1 FROM tab1.
27790 0a 2d 2d 2d 2d 0d 0a 2d 32 39 31 39 0d 0a 2d 33  .----..-2919..-3
277a0 33 31 33 0d 0a 2d 39 32 39 36 0d 0a 0d 0a 71 75  313..-9296....qu
277b0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
277c0 45 4c 45 43 54 20 63 6f 6c 32 20 2b 20 63 6f 6c  ELECT col2 + col
277d0 32 20 2a 20 2d 20 63 6f 6c 31 20 2a 20 2d 20 63  2 * - col1 * - c
277e0 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  ol0 AS col0 FROM
277f0 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 33 33 39   tab0..----..339
27800 36 0d 0a 36 36 34 32 30 30 0d 0a 36 38 31 34 35  6..664200..68145
27810 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
27820 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
27830 2b 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 2b 20  + + cor0.col1 + 
27840 32 37 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  27 AS col1 FROM 
27850 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
27860 2d 2d 0d 0a 31 31 33 0d 0a 31 31 38 0d 0a 31 32  --..113..118..12
27870 34 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  4....onlyif mysq
27880 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72  l # use DIV oper
27890 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72  ator for integer
278a0 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79   division..query
278b0 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
278c0 2d 31 31 30 30 0d 0a 53 45 4c 45 43 54 20 28 20  -1100..SELECT ( 
278d0 63 6f 72 30 2e 63 6f 6c 30 20 29 20 44 49 56 20  cor0.col0 ) DIV 
278e0 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46 52 4f  col1 AS col1 FRO
278f0 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
27900 2d 2d 2d 2d 0d 0a 30 0d 0a 31 0d 0a 34 0d 0a 0d  ----..0..1..4...
27910 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
27920 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
27930 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
27940 6c 61 62 65 6c 2d 31 31 30 30 0d 0a 53 45 4c 45  label-1100..SELE
27950 43 54 20 28 20 63 6f 72 30 2e 63 6f 6c 30 20 29  CT ( cor0.col0 )
27960 20 2f 20 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20   / col1 AS col1 
27970 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
27980 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 31 0d 0a 34  0..----..0..1..4
27990 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
279a0 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61   # use DIV opera
279b0 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20  tor for integer 
279c0 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20  division..query 
279d0 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
279e0 31 31 30 31 0d 0a 53 45 4c 45 43 54 20 2b 20 2b  1101..SELECT + +
279f0 20 28 20 2d 20 34 37 20 29 20 44 49 56 20 2b 20   ( - 47 ) DIV + 
27a00 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41  col0 FROM tab2 A
27a10 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 36  S cor0..----..-6
27a20 0d 0a 30 0d 0a 30 0d 0a 0d 0a 73 6b 69 70 69 66  ..0..0....skipif
27a30 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
27a40 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
27a50 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
27a60 31 30 31 0d 0a 53 45 4c 45 43 54 20 2b 20 2b 20  101..SELECT + + 
27a70 28 20 2d 20 34 37 20 29 20 2f 20 2b 20 63 6f 6c  ( - 47 ) / + col
27a80 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  0 FROM tab2 AS c
27a90 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 36 0d 0a 30  or0..----..-6..0
27aa0 0d 0a 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  ..0....query I r
27ab0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
27ac0 20 28 20 63 6f 72 30 2e 63 6f 6c 30 20 29 20 2a   ( cor0.col0 ) *
27ad0 20 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46 52   col2 AS col2 FR
27ae0 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
27af0 0a 2d 2d 2d 2d 0d 0a 33 35 0d 0a 37 32 39 38 0d  .----..35..7298.
27b00 0a 37 39 32 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  .792....onlyif m
27b10 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66  ysql # support f
27b20 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69  or MySQL specifi
27b30 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61  c system types a
27b40 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79  nd syntax..query
27b50 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
27b60 2d 31 31 30 33 0d 0a 53 45 4c 45 43 54 20 44 49  -1103..SELECT DI
27b70 53 54 49 4e 43 54 20 2d 20 2b 20 63 6f 72 30 2e  STINCT - + cor0.
27b80 63 6f 6c 32 20 2b 20 63 6f 6c 31 20 2a 20 43 41  col2 + col1 * CA
27b90 53 54 28 20 4e 55 4c 4c 20 41 53 20 53 49 47 4e  ST( NULL AS SIGN
27ba0 45 44 20 29 20 41 53 20 63 6f 6c 31 20 46 52 4f  ED ) AS col1 FRO
27bb0 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
27bc0 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b  ----..NULL....sk
27bd0 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
27be0 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
27bf0 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
27c00 65 6c 2d 31 31 30 33 0d 0a 53 45 4c 45 43 54 20  el-1103..SELECT 
27c10 44 49 53 54 49 4e 43 54 20 2d 20 2b 20 63 6f 72  DISTINCT - + cor
27c20 30 2e 63 6f 6c 32 20 2b 20 63 6f 6c 31 20 2a 20  0.col2 + col1 * 
27c30 43 41 53 54 20 28 20 4e 55 4c 4c 20 41 53 20 49  CAST ( NULL AS I
27c40 4e 54 45 47 45 52 20 29 20 41 53 20 63 6f 6c 31  NTEGER ) AS col1
27c50 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
27c60 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a  r0..----..NULL..
27c70 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
27c80 74 0d 0a 53 45 4c 45 43 54 20 2b 20 36 20 2b 20  t..SELECT + 6 + 
27c90 63 6f 6c 32 20 2a 20 63 6f 6c 30 20 2d 20 2b 20  col2 * col0 - + 
27ca0 63 6f 6c 30 20 2a 20 63 6f 6c 30 20 46 52 4f 4d  col0 * col0 FROM
27cb0 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
27cc0 2d 2d 2d 0d 0a 2d 31 31 38 34 0d 0a 2d 36 31 37  ---..-1184..-617
27cd0 0d 0a 32 32 32 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  ..222....onlyif 
27ce0 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20  mysql # use DIV 
27cf0 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74  operator for int
27d00 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71  eger division..q
27d10 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
27d20 61 62 65 6c 2d 31 31 30 35 0d 0a 53 45 4c 45 43  abel-1105..SELEC
27d30 54 20 41 4c 4c 20 39 37 20 2d 20 63 6f 6c 31 20  T ALL 97 - col1 
27d40 44 49 56 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61  DIV col0 FROM ta
27d50 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
27d60 0d 0a 39 34 0d 0a 39 35 0d 0a 39 36 0d 0a 0d 0a  ..94..95..96....
27d70 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
27d80 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
27d90 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
27da0 61 62 65 6c 2d 31 31 30 35 0d 0a 53 45 4c 45 43  abel-1105..SELEC
27db0 54 20 41 4c 4c 20 39 37 20 2d 20 63 6f 6c 31 20  T ALL 97 - col1 
27dc0 2f 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30  / col0 FROM tab0
27dd0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
27de0 39 34 0d 0a 39 35 0d 0a 39 36 0d 0a 0d 0a 71 75  94..95..96....qu
27df0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
27e00 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 34  ELECT DISTINCT 4
27e10 31 20 46 52 4f 4d 20 74 61 62 31 2c 20 74 61 62  1 FROM tab1, tab
27e20 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 34 31  2 cor0..----..41
27e30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
27e40 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 28 20  ort..SELECT + ( 
27e50 2b 20 34 34 20 2b 20 2b 20 63 6f 6c 32 20 29 20  + 44 + + col2 ) 
27e60 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
27e70 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 36 0d 0a 34 35  0..----..126..45
27e80 0d 0a 37 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..77....query I 
27e90 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
27ea0 44 49 53 54 49 4e 43 54 20 63 6f 6c 30 20 2a 20  DISTINCT col0 * 
27eb0 35 34 20 2a 20 63 6f 6c 31 20 46 52 4f 4d 20 74  54 * col1 FROM t
27ec0 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 33 34 35 36 30  ab1..----..34560
27ed0 0d 0a 34 32 31 32 0d 0a 35 36 31 36 30 0d 0a 0d  ..4212..56160...
27ee0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
27ef0 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
27f00 54 20 2b 20 35 30 20 46 52 4f 4d 20 74 61 62 31  T + 50 FROM tab1
27f10 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 35 30 0d   cor0..----..50.
27f20 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
27f30 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 28 20 2d  rt..SELECT + ( -
27f40 20 36 38 20 29 20 2a 20 63 6f 6c 30 20 2b 20 2b   68 ) * col0 + +
27f50 20 63 6f 6c 31 20 2a 20 63 6f 6c 30 20 2b 20 2d   col1 * col0 + -
27f60 20 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c 32 20 46   col0 * - col2 F
27f70 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
27f80 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 32 37 0d 0a 2d  ..----..-1027..-
27f90 37 30 0d 0a 31 33 32 36 0d 0a 0d 0a 71 75 65 72  70..1326....quer
27fa0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
27fb0 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 31 20 2b  ECT ALL - col1 +
27fc0 20 63 6f 6c 32 20 2a 20 63 6f 72 30 2e 63 6f 6c   col2 * cor0.col
27fd0 32 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  2 AS col1 FROM t
27fe0 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
27ff0 2d 0d 0a 32 38 39 30 0d 0a 33 32 33 39 0d 0a 39  -..2890..3239..9
28000 32 30 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  203....query I r
28010 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
28020 49 53 54 49 4e 43 54 20 2b 20 28 20 2d 20 36 38  ISTINCT + ( - 68
28030 20 29 20 2a 20 63 6f 6c 31 20 46 52 4f 4d 20 74   ) * col1 FROM t
28040 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
28050 2d 0d 0a 2d 31 31 35 36 0d 0a 2d 32 31 30 38 0d  -..-1156..-2108.
28060 0a 2d 34 30 31 32 0d 0a 0d 0a 71 75 65 72 79 20  .-4012....query 
28070 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
28080 54 20 2d 20 63 6f 6c 30 20 2b 20 63 6f 72 30 2e  T - col0 + cor0.
28090 63 6f 6c 31 20 2a 20 63 6f 6c 30 20 41 53 20 63  col1 * col0 AS c
280a0 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol0 FROM tab1 AS
280b0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 35 37 36   cor0..----..576
280c0 0d 0a 37 35 0d 0a 39 36 30 0d 0a 0d 0a 71 75 65  ..75..960....que
280d0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
280e0 4c 45 43 54 20 2b 20 2d 20 63 6f 6c 31 20 2b 20  LECT + - col1 + 
280f0 2b 20 31 32 20 2a 20 2b 20 63 6f 6c 30 20 2b 20  + 12 * + col0 + 
28100 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41  col0 FROM tab1 A
28110 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30  S cor0..----..10
28120 32 37 0d 0a 31 33 0d 0a 38 32 32 0d 0a 0d 0a 71  27..13..822....q
28130 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
28140 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 39 20 2b  SELECT ALL + 9 +
28150 20 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46 52   col2 AS col0 FR
28160 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
28170 0a 2d 2d 2d 2d 0d 0a 31 30 35 0d 0a 36 33 0d 0a  .----..105..63..
28180 36 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  66....query I ro
28190 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
281a0 53 54 49 4e 43 54 20 2d 20 39 20 2a 20 63 6f 6c  STINCT - 9 * col
281b0 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  2 FROM tab1 AS c
281c0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 38 36 0d  or0..----..-486.
281d0 0a 2d 35 31 33 0d 0a 2d 38 36 34 0d 0a 0d 0a 71  .-513..-864....q
281e0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
281f0 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
28200 2b 20 28 20 63 6f 6c 31 20 29 20 2a 20 63 6f 6c  + ( col1 ) * col
28210 30 20 2b 20 36 32 20 41 53 20 63 6f 6c 31 20 46  0 + 62 AS col1 F
28220 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
28230 0d 0a 2d 2d 2d 2d 0d 0a 31 34 30 35 0d 0a 32 37  ..----..1405..27
28240 39 0d 0a 34 36 36 34 0d 0a 0d 0a 71 75 65 72 79  9..4664....query
28250 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
28260 43 54 20 41 4c 4c 20 2d 20 2d 20 28 20 28 20 2b  CT ALL - - ( ( +
28270 20 63 6f 6c 30 20 29 20 29 20 41 53 20 63 6f 6c   col0 ) ) AS col
28280 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  2 FROM tab1 AS c
28290 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 0d 0a 36 34  or0..----..3..64
282a0 0d 0a 38 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  ..80....onlyif m
282b0 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f  ysql # use DIV o
282c0 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65  perator for inte
282d0 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75  ger division..qu
282e0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
282f0 62 65 6c 2d 31 31 31 39 0d 0a 53 45 4c 45 43 54  bel-1119..SELECT
28300 20 44 49 53 54 49 4e 43 54 20 2d 20 37 33 20 2a   DISTINCT - 73 *
28310 20 63 6f 6c 32 20 2a 20 28 20 35 39 20 2a 20 63   col2 * ( 59 * c
28320 6f 6c 30 20 29 20 2b 20 63 6f 6c 30 20 44 49 56  ol0 ) + col0 DIV
28330 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 2b 20 2b   + cor0.col1 + +
28340 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46 52   col0 AS col0 FR
28350 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
28360 0a 2d 2d 2d 2d 0d 0a 2d 31 35 37 31 31 38 36 36  .----..-15711866
28370 0d 0a 2d 33 33 30 37 37 36 37 34 0d 0a 2d 36 39  ..-33077674..-69
28380 37 37 33 31 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  7731....skipif m
28390 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
283a0 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
283b0 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 31 31  owsort label-111
283c0 39 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  9..SELECT DISTIN
283d0 43 54 20 2d 20 37 33 20 2a 20 63 6f 6c 32 20 2a  CT - 73 * col2 *
283e0 20 28 20 35 39 20 2a 20 63 6f 6c 30 20 29 20 2b   ( 59 * col0 ) +
283f0 20 63 6f 6c 30 20 2f 20 2b 20 63 6f 72 30 2e 63   col0 / + cor0.c
28400 6f 6c 31 20 2b 20 2b 20 63 6f 6c 30 20 41 53 20  ol1 + + col0 AS 
28410 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41  col0 FROM tab1 A
28420 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
28430 35 37 31 31 38 36 36 0d 0a 2d 33 33 30 37 37 36  5711866..-330776
28440 37 34 0d 0a 2d 36 39 37 37 33 31 0d 0a 0d 0a 6f  74..-697731....o
28450 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75  nlyif mysql # su
28460 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20  pport for MySQL 
28470 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20  specific system 
28480 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78  types and syntax
28490 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
284a0 74 20 6c 61 62 65 6c 2d 31 31 32 30 0d 0a 53 45  t label-1120..SE
284b0 4c 45 43 54 20 41 4c 4c 20 43 41 53 54 28 20 4e  LECT ALL CAST( N
284c0 55 4c 4c 20 41 53 20 53 49 47 4e 45 44 20 29 20  ULL AS SIGNED ) 
284d0 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
284e0 32 2c 20 74 61 62 30 20 63 6f 72 30 2c 20 74 61  2, tab0 cor0, ta
284f0 62 32 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d  b2 AS cor1..----
28500 0d 0a 32 37 20 76 61 6c 75 65 73 20 68 61 73 68  ..27 values hash
28510 69 6e 67 20 74 6f 20 31 36 62 65 38 38 36 38 61  ing to 16be8868a
28520 31 65 36 66 34 65 38 38 35 30 35 30 39 66 39 33  1e6f4e8850509f93
28530 32 37 61 66 65 39 30 0d 0a 0d 0a 73 6b 69 70 69  27afe90....skipi
28540 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
28550 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
28560 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
28570 31 31 32 30 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  1120..SELECT ALL
28580 20 43 41 53 54 20 28 20 4e 55 4c 4c 20 41 53 20   CAST ( NULL AS 
28590 49 4e 54 45 47 45 52 20 29 20 41 53 20 63 6f 6c  INTEGER ) AS col
285a0 31 20 46 52 4f 4d 20 74 61 62 32 2c 20 74 61 62  1 FROM tab2, tab
285b0 30 20 63 6f 72 30 2c 20 74 61 62 32 20 41 53 20  0 cor0, tab2 AS 
285c0 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76  cor1..----..27 v
285d0 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f  alues hashing to
285e0 20 31 36 62 65 38 38 36 38 61 31 65 36 66 34 65   16be8868a1e6f4e
285f0 38 38 35 30 35 30 39 66 39 33 32 37 61 66 65 39  8850509f9327afe9
28600 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74  0....skipif post
28610 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65  gresql # Postgre
28620 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20  SQL requires AS 
28630 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75  when renaming ou
28640 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75  tput columns..qu
28650 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
28660 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b  ELECT DISTINCT +
28670 20 2b 20 63 6f 6c 32 20 2b 20 2b 20 63 6f 6c 31   + col2 + + col1
28680 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20   col2 FROM tab2 
28690 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 35  AS cor0..----..5
286a0 35 0d 0a 35 38 0d 0a 38 35 0d 0a 0d 0a 71 75 65  5..58..85....que
286b0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
286c0 4c 45 43 54 20 2d 20 37 36 20 2b 20 2b 20 63 6f  LECT - 76 + + co
286d0 6c 32 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  l2 AS col0 FROM 
286e0 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
286f0 2d 2d 0d 0a 2d 33 38 0d 0a 2d 34 39 0d 0a 2d 35  --..-38..-49..-5
28700 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  0....query I row
28710 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
28720 20 63 6f 72 31 2e 63 6f 6c 31 20 46 52 4f 4d 20   cor1.col1 FROM 
28730 74 61 62 32 2c 20 74 61 62 30 20 63 6f 72 30 2c  tab2, tab0 cor0,
28740 20 74 61 62 31 20 41 53 20 63 6f 72 31 0d 0a 2d   tab1 AS cor1..-
28750 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75 65 73 20 68  ---..27 values h
28760 61 73 68 69 6e 67 20 74 6f 20 64 36 37 31 61 30  ashing to d671a0
28770 36 34 65 32 64 61 37 30 39 63 61 34 63 64 66 65  64e2da709ca4cdfe
28780 61 33 31 37 62 38 65 38 39 32 0d 0a 0d 0a 71 75  a317b8e892....qu
28790 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
287a0 45 4c 45 43 54 20 41 4c 4c 20 28 20 2d 20 63 6f  ELECT ALL ( - co
287b0 6c 30 20 29 20 2b 20 2b 20 31 32 20 2a 20 2d 20  l0 ) + + 12 * - 
287c0 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c 30 20 46 52  col1 * - col0 FR
287d0 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
287e0 0a 2d 2d 2d 2d 0d 0a 31 32 34 30 30 0d 0a 37 36  .----..12400..76
287f0 31 36 0d 0a 39 33 33 0d 0a 0d 0a 73 6b 69 70 69  16..933....skipi
28800 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50  f postgresql # P
28810 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72  ostgreSQL requir
28820 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d  es AS when renam
28830 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d  ing output colum
28840 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ns..query I rows
28850 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
28860 2d 20 63 6f 6c 30 20 2d 20 2b 20 63 6f 6c 30 20  - col0 - + col0 
28870 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 63  col1 FROM tab0 c
28880 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 37 38 0d  or0..----..-178.
28890 0a 2d 34 38 0d 0a 2d 37 30 0d 0a 0d 0a 71 75 65  .-48..-70....que
288a0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
288b0 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f  LECT DISTINCT co
288c0 6c 30 20 2a 20 2d 20 63 6f 6c 32 20 2a 20 63 6f  l0 * - col2 * co
288d0 6c 31 20 2d 20 2d 20 28 20 2d 20 63 6f 6c 32 20  l1 - - ( - col2 
288e0 29 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  ) FROM tab0 AS c
288f0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 33 39 36  or0..----..-3396
28900 0d 0a 2d 36 36 34 32 30 30 0d 0a 2d 36 38 31 34  ..-664200..-6814
28910 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  5....query I row
28920 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
28930 54 49 4e 43 54 20 2d 20 63 6f 6c 30 20 2a 20 38  TINCT - col0 * 8
28940 34 20 2a 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20  4 * + col1 FROM 
28950 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab1 cor0..----.
28960 0a 2d 35 33 37 36 30 0d 0a 2d 36 35 35 32 0d 0a  .-53760..-6552..
28970 2d 38 37 33 36 30 0d 0a 0d 0a 71 75 65 72 79 20  -87360....query 
28980 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
28990 54 20 2b 20 2b 20 63 6f 6c 31 20 2a 20 2b 20 28  T + + col1 * + (
289a0 20 63 6f 6c 32 20 2b 20 63 6f 6c 31 20 29 20 46   col2 + col1 ) F
289b0 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d  ROM tab0 cor0..-
289c0 2d 2d 2d 0d 0a 31 30 32 33 34 0d 0a 31 35 37 34  ---..10234..1574
289d0 33 0d 0a 39 35 30 36 0d 0a 0d 0a 73 6b 69 70 69  3..9506....skipi
289e0 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50  f postgresql # P
289f0 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72  ostgreSQL requir
28a00 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d  es AS when renam
28a10 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d  ing output colum
28a20 6e 73 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ns..skipif mysql
28a30 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
28a40 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
28a50 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 30 20  rt..SELECT col0 
28a60 2a 20 2d 20 43 41 53 54 20 28 20 63 6f 6c 30 20  * - CAST ( col0 
28a70 2a 20 2b 20 63 6f 6c 31 20 41 53 20 52 45 41 4c  * + col1 AS REAL
28a80 20 29 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62   ) col1 FROM tab
28a90 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
28aa0 0a 2d 32 33 34 0d 0a 2d 34 30 39 36 30 0d 0a 2d  .-234..-40960..-
28ab0 38 33 32 30 30 0d 0a 0d 0a 71 75 65 72 79 20 49  83200....query I
28ac0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
28ad0 20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 72 30   DISTINCT - cor0
28ae0 2e 63 6f 6c 32 20 2a 20 28 20 63 6f 6c 31 20 29  .col2 * ( col1 )
28af0 20 2a 20 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20   * col1 AS col2 
28b00 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
28b10 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 39 38 32 0d  0..----..-10982.
28b20 0a 2d 32 35 39 34 37 0d 0a 2d 39 30 35 30 36 0d  .-25947..-90506.
28b30 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
28b40 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c  rt..SELECT + col
28b50 32 20 2b 20 2b 20 31 32 20 2a 20 2b 20 63 6f 6c  2 + + 12 * + col
28b60 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  0 FROM tab1 AS c
28b70 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 35 36 0d  or0..----..1056.
28b80 0a 38 32 35 0d 0a 39 30 0d 0a 0d 0a 71 75 65 72  .825..90....quer
28b90 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
28ba0 45 43 54 20 41 4c 4c 20 74 61 62 31 2e 63 6f 6c  ECT ALL tab1.col
28bb0 32 20 2a 20 74 61 62 31 2e 63 6f 6c 30 20 2b 20  2 * tab1.col0 + 
28bc0 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46 52 4f  col2 AS col2 FRO
28bd0 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 32 31  M tab1..----..21
28be0 36 0d 0a 33 37 30 35 0d 0a 37 37 37 36 0d 0a 0d  6..3705..7776...
28bf0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
28c00 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
28c10 54 20 63 6f 6c 32 20 2b 20 63 6f 6c 30 20 2a 20  T col2 + col0 * 
28c20 2d 20 38 32 20 41 53 20 63 6f 6c 31 20 46 52 4f  - 82 AS col1 FRO
28c30 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 35  M tab2..----..-5
28c40 34 37 0d 0a 2d 36 33 37 30 0d 0a 2d 36 34 34 30  47..-6370..-6440
28c50 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
28c60 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
28c70 49 4e 43 54 20 34 32 20 2a 20 63 6f 6c 32 20 41  INCT 42 * col2 A
28c80 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32  S col0 FROM tab2
28c90 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
28ca0 31 30 39 32 0d 0a 31 31 33 34 0d 0a 31 35 39 36  1092..1134..1596
28cb0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
28cc0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 33 30  ort..SELECT + 30
28cd0 20 2a 20 2b 20 63 6f 6c 31 20 2b 20 63 6f 72 30   * + col1 + cor0
28ce0 2e 63 6f 6c 31 20 2a 20 28 20 2b 20 63 6f 6c 30  .col1 * ( + col0
28cf0 20 29 20 2a 20 2d 20 63 6f 6c 32 20 46 52 4f 4d   ) * - col2 FROM
28d00 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
28d10 2d 2d 2d 0d 0a 2d 33 34 33 32 0d 0a 2d 33 36 31  ---..-3432..-361
28d20 38 30 0d 0a 2d 39 39 34 35 30 0d 0a 0d 0a 71 75  80..-99450....qu
28d30 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
28d40 45 4c 45 43 54 20 2d 20 63 6f 72 30 2e 63 6f 6c  ELECT - cor0.col
28d50 31 20 2a 20 36 38 20 46 52 4f 4d 20 74 61 62 31  1 * 68 FROM tab1
28d60 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
28d70 2d 31 37 36 38 0d 0a 2d 36 38 30 0d 0a 2d 38 38  -1768..-680..-88
28d80 34 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  4....onlyif mysq
28d90 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72  l # use DIV oper
28da0 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72  ator for integer
28db0 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79   division..query
28dc0 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
28dd0 2d 31 31 33 37 0d 0a 53 45 4c 45 43 54 20 2d 20  -1137..SELECT - 
28de0 63 6f 6c 32 20 2a 20 2b 20 33 20 2d 20 35 38 20  col2 * + 3 - 58 
28df0 44 49 56 20 2d 20 63 6f 6c 32 20 41 53 20 63 6f  DIV - col2 AS co
28e00 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d  l0 FROM tab0..--
28e10 2d 2d 0d 0a 2d 32 34 36 0d 0a 2d 39 38 0d 0a 35  --..-246..-98..5
28e20 35 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  5....skipif mysq
28e30 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
28e40 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
28e50 6f 72 74 20 6c 61 62 65 6c 2d 31 31 33 37 0d 0a  ort label-1137..
28e60 53 45 4c 45 43 54 20 2d 20 63 6f 6c 32 20 2a 20  SELECT - col2 * 
28e70 2b 20 33 20 2d 20 35 38 20 2f 20 2d 20 63 6f 6c  + 3 - 58 / - col
28e80 32 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  2 AS col0 FROM t
28e90 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 34 36 0d  ab0..----..-246.
28ea0 0a 2d 39 38 0d 0a 35 35 0d 0a 0d 0a 71 75 65 72  .-98..55....quer
28eb0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
28ec0 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 31 20 2b  ECT ALL - col1 +
28ed0 20 28 20 63 6f 6c 31 20 29 20 2b 20 2d 20 63 6f   ( col1 ) + - co
28ee0 6c 31 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  l1 AS col0 FROM 
28ef0 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 0d  tab1..----..-10.
28f00 0a 2d 31 33 0d 0a 2d 32 36 0d 0a 0d 0a 71 75 65  .-13..-26....que
28f10 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
28f20 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20  LECT DISTINCT - 
28f30 63 6f 72 31 2e 63 6f 6c 31 20 2d 20 63 6f 72 30  cor1.col1 - cor0
28f40 2e 63 6f 6c 32 20 2a 20 39 30 20 41 53 20 63 6f  .col2 * 90 AS co
28f50 6c 30 20 46 52 4f 4d 20 74 61 62 32 2c 20 74 61  l0 FROM tab2, ta
28f60 62 31 20 41 53 20 63 6f 72 30 2c 20 74 61 62 32  b1 AS cor0, tab2
28f70 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a   AS cor1..----..
28f80 39 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67  9 values hashing
28f90 20 74 6f 20 34 33 61 62 63 66 33 31 32 36 34 39   to 43abcf312649
28fa0 63 63 38 32 61 39 32 38 35 34 38 61 30 35 35 33  cc82a928548a0553
28fb0 37 65 38 65 0d 0a 0d 0a 71 75 65 72 79 20 49 20  7e8e....query I 
28fc0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
28fd0 44 49 53 54 49 4e 43 54 20 74 61 62 32 2e 63 6f  DISTINCT tab2.co
28fe0 6c 32 20 2b 20 74 61 62 32 2e 63 6f 6c 31 20 46  l2 + tab2.col1 F
28ff0 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab2..----..
29000 35 35 0d 0a 35 38 0d 0a 38 35 0d 0a 0d 0a 73 6b  55..58..85....sk
29010 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20  ipif postgresql 
29020 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71  # PostgreSQL req
29030 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65  uires AS when re
29040 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f  naming output co
29050 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72  lumns..query I r
29060 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
29070 20 35 30 20 2a 20 2b 20 34 37 20 63 6f 6c 31 20   50 * + 47 col1 
29080 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
29090 30 0d 0a 2d 2d 2d 2d 0d 0a 32 33 35 30 0d 0a 32  0..----..2350..2
290a0 33 35 30 0d 0a 32 33 35 30 0d 0a 0d 0a 71 75 65  350..2350....que
290b0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
290c0 4c 45 43 54 20 41 4c 4c 20 2d 20 2d 20 28 20 2d  LECT ALL - - ( -
290d0 20 63 6f 6c 32 20 29 20 2a 20 2b 20 63 6f 6c 31   col2 ) * + col1
290e0 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
290f0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32 34 38 0d  r0..----..-1248.
29100 0a 2d 31 34 30 34 0d 0a 2d 35 37 30 0d 0a 0d 0a  .-1404..-570....
29110 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
29120 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 34 32  .SELECT ALL + 42
29130 20 46 52 4f 4d 20 74 61 62 32 2c 20 74 61 62 31   FROM tab2, tab1
29140 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
29150 39 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67  9 values hashing
29160 20 74 6f 20 36 34 63 32 39 64 62 39 66 31 63 64   to 64c29db9f1cd
29170 37 65 64 34 64 64 65 62 31 37 33 35 65 33 65 30  7ed4ddeb1735e3e0
29180 64 34 34 32 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  d442....onlyif m
29190 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f  ysql # use DIV o
291a0 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65  perator for inte
291b0 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75  ger division..qu
291c0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
291d0 62 65 6c 2d 31 31 34 34 0d 0a 53 45 4c 45 43 54  bel-1144..SELECT
291e0 20 2b 20 63 6f 6c 31 20 2a 20 31 39 20 44 49 56   + col1 * 19 DIV
291f0 20 2d 20 63 6f 6c 30 20 2b 20 63 6f 6c 30 20 2b   - col0 + col0 +
29200 20 2d 20 63 6f 6c 31 20 63 6f 6c 31 20 46 52 4f   - col1 col1 FRO
29210 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
29220 2d 2d 2d 2d 0d 0a 2d 31 31 34 0d 0a 2d 31 33 30  ----..-114..-130
29230 0d 0a 2d 32 31 0d 0a 0d 0a 73 6b 69 70 69 66 20  ..-21....skipif 
29240 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73  postgresql # Pos
29250 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73  tgreSQL requires
29260 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e   AS when renamin
29270 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73  g output columns
29280 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
29290 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
292a0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
292b0 20 6c 61 62 65 6c 2d 31 31 34 34 0d 0a 53 45 4c   label-1144..SEL
292c0 45 43 54 20 2b 20 63 6f 6c 31 20 2a 20 31 39 20  ECT + col1 * 19 
292d0 2f 20 2d 20 63 6f 6c 30 20 2b 20 63 6f 6c 30 20  / - col0 + col0 
292e0 2b 20 2d 20 63 6f 6c 31 20 63 6f 6c 31 20 46 52  + - col1 col1 FR
292f0 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
29300 0a 2d 2d 2d 2d 0d 0a 2d 31 31 34 0d 0a 2d 31 33  .----..-114..-13
29310 30 0d 0a 2d 32 31 0d 0a 0d 0a 71 75 65 72 79 20  0..-21....query 
29320 49 49 49 49 49 49 49 49 49 49 49 49 20 72 6f 77  IIIIIIIIIIII row
29330 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
29340 20 2a 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72   * FROM tab0 cor
29350 30 20 43 52 4f 53 53 20 4a 4f 49 4e 20 74 61 62  0 CROSS JOIN tab
29360 30 2c 20 74 61 62 32 20 41 53 20 63 6f 72 31 2c  0, tab2 AS cor1,
29370 20 74 61 62 30 20 41 53 20 63 6f 72 32 0d 0a 2d   tab0 AS cor2..-
29380 2d 2d 2d 0d 0a 39 37 32 20 76 61 6c 75 65 73 20  ---..972 values 
29390 68 61 73 68 69 6e 67 20 74 6f 20 33 38 30 32 34  hashing to 38024
293a0 31 62 62 63 35 30 33 61 33 31 65 37 30 34 39 34  1bbc503a31e70494
293b0 36 31 31 61 38 37 66 66 64 39 39 0d 0a 0d 0a 71  611a87ffd99....q
293c0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
293d0 53 45 4c 45 43 54 20 74 61 62 31 2e 63 6f 6c 30  SELECT tab1.col0
293e0 20 2b 20 2d 20 63 6f 6c 31 20 41 53 20 63 6f 6c   + - col1 AS col
293f0 31 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d  1 FROM tab1..---
29400 2d 0d 0a 2d 32 33 0d 0a 35 34 0d 0a 36 37 0d 0a  -..-23..54..67..
29410 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
29420 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 32  t..SELECT - col2
29430 20 2b 20 2b 20 63 6f 6c 31 20 2a 20 74 61 62 30   + + col1 * tab0
29440 2e 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d  .col0 FROM tab0.
29450 0a 2d 2d 2d 2d 0d 0a 32 30 33 31 0d 0a 33 33 39  .----..2031..339
29460 34 0d 0a 38 30 31 37 0d 0a 0d 0a 71 75 65 72 79  4..8017....query
29470 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
29480 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 39 37  CT DISTINCT + 97
29490 20 2a 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62   * col0 FROM tab
294a0 32 0d 0a 2d 2d 2d 2d 0d 0a 36 37 39 0d 0a 37 35  2..----..679..75
294b0 36 36 0d 0a 37 36 36 33 0d 0a 0d 0a 6f 6e 6c 79  66..7663....only
294c0 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f  if mysql # suppo
294d0 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65  rt for MySQL spe
294e0 63 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70  cific system typ
294f0 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71  es and syntax..q
29500 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
29510 61 62 65 6c 2d 31 31 34 39 0d 0a 53 45 4c 45 43  abel-1149..SELEC
29520 54 20 41 4c 4c 20 2d 20 43 41 53 54 28 20 4e 55  T ALL - CAST( NU
29530 4c 4c 20 41 53 20 44 45 43 49 4d 41 4c 20 29 20  LL AS DECIMAL ) 
29540 2a 20 63 6f 6c 30 20 63 6f 6c 30 20 46 52 4f 4d  * col0 col0 FROM
29550 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c   tab0..----..NUL
29560 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d  L..NULL..NULL...
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 73 6b 69 70 69 66   columns..skipif
295c0 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
295d0 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
295e0 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
295f0 31 34 39 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  149..SELECT ALL 
29600 2d 20 43 41 53 54 20 28 20 4e 55 4c 4c 20 41 53  - CAST ( NULL AS
29610 20 52 45 41 4c 20 29 20 2a 20 63 6f 6c 30 20 63   REAL ) * col0 c
29620 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d  ol0 FROM tab0..-
29630 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d  ---..NULL..NULL.
29640 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75 65 72 79 20 49  .NULL....query I
29650 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
29660 20 41 4c 4c 20 39 38 20 41 53 20 63 6f 6c 31 20   ALL 98 AS col1 
29670 46 52 4f 4d 20 74 61 62 32 2c 20 74 61 62 32 20  FROM tab2, tab2 
29680 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61  cor0..----..9 va
29690 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20  lues hashing to 
296a0 66 39 64 65 65 38 63 32 31 31 31 36 66 31 61 65  f9dee8c21116f1ae
296b0 64 36 34 61 63 35 31 36 30 65 31 39 30 38 30 39  d64ac5160e190809
296c0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
296d0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 32  ort..SELECT col2
296e0 20 2b 20 2d 20 74 61 62 30 2e 63 6f 6c 32 20 2a   + - tab0.col2 *
296f0 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20   + col0 AS col0 
29700 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d  FROM tab0..----.
29710 0a 2d 33 34 0d 0a 2d 37 32 31 36 0d 0a 2d 37 35  .-34..-7216..-75
29720 39 0d 0a 0d 0a 71 75 65 72 79 20 49 49 49 49 49  9....query IIIII
29730 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
29740 54 20 2a 20 46 52 4f 4d 20 74 61 62 32 2c 20 74  T * FROM tab2, t
29750 61 62 30 20 63 6f 72 30 20 57 48 45 52 45 20 4e  ab0 cor0 WHERE N
29760 55 4c 4c 20 3c 3d 20 4e 55 4c 4c 0d 0a 2d 2d 2d  ULL <= NULL..---
29770 2d 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  -....onlyif mysq
29780 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72  l # use DIV oper
29790 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72  ator for integer
297a0 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79   division..query
297b0 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
297c0 2d 31 31 35 33 0d 0a 53 45 4c 45 43 54 20 33 30  -1153..SELECT 30
297d0 20 44 49 56 20 63 6f 6c 30 20 2b 20 63 6f 6c 32   DIV col0 + col2
297e0 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
297f0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 35 37 0d 0a 36 34  r0..----..57..64
29800 0d 0a 39 36 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  ..96....skipif m
29810 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
29820 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
29830 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 31 35  owsort label-115
29840 33 0d 0a 53 45 4c 45 43 54 20 33 30 20 2f 20 63  3..SELECT 30 / c
29850 6f 6c 30 20 2b 20 63 6f 6c 32 20 46 52 4f 4d 20  ol0 + col2 FROM 
29860 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
29870 2d 2d 0d 0a 35 37 0d 0a 36 34 0d 0a 39 36 0d 0a  --..57..64..96..
29880 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
29890 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
298a0 43 54 20 33 39 20 2b 20 2d 20 33 37 20 41 53 20  CT 39 + - 37 AS 
298b0 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41  col0 FROM tab0 A
298c0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 0d  S cor0..----..2.
298d0 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
298e0 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74  # use DIV operat
298f0 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64  or for integer d
29900 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49  ivision..query I
29910 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
29920 31 35 35 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  155..SELECT ALL 
29930 63 6f 6c 32 20 44 49 56 20 2d 20 63 6f 6c 30 20  col2 DIV - col0 
29940 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 0d 0a  col0 FROM tab2..
29950 2d 2d 2d 2d 0d 0a 2d 33 0d 0a 30 0d 0a 30 0d 0a  ----..-3..0..0..
29960 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65  ..skipif postgre
29970 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c  sql # PostgreSQL
29980 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65   requires AS whe
29990 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75  n renaming outpu
299a0 74 20 63 6f 6c 75 6d 6e 73 0d 0a 73 6b 69 70 69  t columns..skipi
299b0 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
299c0 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
299d0 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
299e0 31 31 35 35 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  1155..SELECT ALL
299f0 20 63 6f 6c 32 20 2f 20 2d 20 63 6f 6c 30 20 63   col2 / - col0 c
29a00 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d  ol0 FROM tab2..-
29a10 2d 2d 2d 0d 0a 2d 33 0d 0a 30 0d 0a 30 0d 0a 0d  ---..-3..0..0...
29a20 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
29a30 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63  ..SELECT ALL - c
29a40 6f 6c 32 20 2b 20 2d 20 63 6f 6c 30 20 2a 20 63  ol2 + - col0 * c
29a50 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol2 FROM tab2 AS
29a60 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 30   cor0..----..-20
29a70 35 34 0d 0a 2d 32 31 36 0d 0a 2d 33 30 34 30 0d  54..-216..-3040.
29a80 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
29a90 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b  rt..SELECT ALL +
29aa0 20 2d 20 63 6f 6c 30 20 2b 20 2b 20 37 31 20 41   - col0 + + 71 A
29ab0 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30  S col1 FROM tab0
29ac0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
29ad0 2d 31 38 0d 0a 33 36 0d 0a 34 37 0d 0a 0d 0a 71  -18..36..47....q
29ae0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
29af0 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c  SELECT ALL + col
29b00 32 20 2b 20 63 6f 6c 30 20 2a 20 2b 20 35 32 20  2 + col0 * + 52 
29b10 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
29b20 31 0d 0a 2d 2d 2d 2d 0d 0a 32 31 30 0d 0a 33 33  1..----..210..33
29b30 38 35 0d 0a 34 32 35 36 0d 0a 0d 0a 71 75 65 72  85..4256....quer
29b40 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
29b50 45 43 54 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20  ECT + cor0.col2 
29b60 2a 20 28 20 38 32 20 29 20 2d 20 63 6f 6c 32 20  * ( 82 ) - col2 
29b70 46 52 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a  FROM tab2 cor0..
29b80 2d 2d 2d 2d 0d 0a 32 31 30 36 0d 0a 32 31 38 37  ----..2106..2187
29b90 0d 0a 33 30 37 38 0d 0a 0d 0a 6f 6e 6c 79 69 66  ..3078....onlyif
29ba0 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56   mysql # use DIV
29bb0 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e   operator for in
29bc0 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a  teger division..
29bd0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
29be0 6c 61 62 65 6c 2d 31 31 36 30 0d 0a 53 45 4c 45  label-1160..SELE
29bf0 43 54 20 63 6f 6c 30 20 44 49 56 20 2d 20 28 20  CT col0 DIV - ( 
29c00 63 6f 6c 31 20 29 20 2d 20 63 6f 6c 32 20 46 52  col1 ) - col2 FR
29c10 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
29c20 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 2d 33 33 0d 0a  .----..-1..-33..
29c30 2d 38 32 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  -82....skipif my
29c40 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
29c50 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
29c60 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 31 36 30  wsort label-1160
29c70 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 30 20 2f 20  ..SELECT col0 / 
29c80 2d 20 28 20 63 6f 6c 31 20 29 20 2d 20 63 6f 6c  - ( col1 ) - col
29c90 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  2 FROM tab0 AS c
29ca0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 2d  or0..----..-1..-
29cb0 33 33 0d 0a 2d 38 32 0d 0a 0d 0a 6f 6e 6c 79 69  33..-82....onlyi
29cc0 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72  f mysql # suppor
29cd0 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63  t for MySQL spec
29ce0 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65  ific system type
29cf0 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75  s and syntax..qu
29d00 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
29d10 62 65 6c 2d 31 31 36 31 0d 0a 53 45 4c 45 43 54  bel-1161..SELECT
29d20 20 63 6f 6c 30 20 2a 20 2b 20 43 41 53 54 28 20   col0 * + CAST( 
29d30 31 32 20 41 53 20 53 49 47 4e 45 44 20 29 20 46  12 AS SIGNED ) F
29d40 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
29d50 0d 0a 2d 2d 2d 2d 0d 0a 38 34 0d 0a 39 33 36 0d  ..----..84..936.
29d60 0a 39 34 38 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  .948....skipif m
29d70 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
29d80 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
29d90 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 31 36  owsort label-116
29da0 31 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 30 20 2a  1..SELECT col0 *
29db0 20 2b 20 43 41 53 54 20 28 20 31 32 20 41 53 20   + CAST ( 12 AS 
29dc0 49 4e 54 45 47 45 52 20 29 20 46 52 4f 4d 20 74  INTEGER ) FROM t
29dd0 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
29de0 2d 0d 0a 38 34 0d 0a 39 33 36 0d 0a 39 34 38 0d  -..84..936..948.
29df0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
29e00 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b  rt..SELECT ALL +
29e10 20 63 6f 6c 30 20 2b 20 2b 20 28 20 2d 20 63 6f   col0 + + ( - co
29e20 6c 31 20 2b 20 2b 20 63 6f 6c 30 20 29 20 41 53  l1 + + col0 ) AS
29e30 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20   col1 FROM tab0 
29e40 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
29e50 32 37 0d 0a 2d 33 38 0d 0a 38 37 0d 0a 0d 0a 71  27..-38..87....q
29e60 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
29e70 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
29e80 2b 20 63 6f 6c 32 20 2b 20 2b 20 63 6f 6c 32 20  + col2 + + col2 
29e90 2a 20 2b 20 63 6f 6c 32 20 41 53 20 63 6f 6c 32  * + col2 AS col2
29ea0 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d   FROM tab0 cor0.
29eb0 0a 2d 2d 2d 2d 0d 0a 31 31 32 32 0d 0a 32 0d 0a  .----..1122..2..
29ec0 36 38 30 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20  6806....query I 
29ed0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
29ee0 2b 20 63 6f 6c 30 20 2a 20 2d 20 34 31 20 41 53  + col0 * - 41 AS
29ef0 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20   col1 FROM tab0 
29f00 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
29f10 31 34 33 35 0d 0a 2d 33 36 34 39 0d 0a 2d 39 38  1435..-3649..-98
29f20 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  4....query I row
29f30 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
29f40 20 2d 20 2b 20 63 6f 6c 30 20 2b 20 63 6f 72 30   - + col0 + cor0
29f50 2e 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52  .col1 AS col0 FR
29f60 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
29f70 0a 2d 2d 2d 2d 0d 0a 2d 35 34 0d 0a 2d 36 37 0d  .----..-54..-67.
29f80 0a 32 33 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  .23....onlyif my
29f90 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f  sql # support fo
29fa0 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63  r MySQL specific
29fb0 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e   system types an
29fc0 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20  d syntax..query 
29fd0 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
29fe0 31 31 36 36 0d 0a 53 45 4c 45 43 54 20 44 49 53  1166..SELECT DIS
29ff0 54 49 4e 43 54 20 63 6f 6c 31 20 2a 20 43 41 53  TINCT col1 * CAS
2a000 54 28 20 4e 55 4c 4c 20 41 53 20 53 49 47 4e 45  T( NULL AS SIGNE
2a010 44 20 29 20 2a 20 2b 20 33 20 41 53 20 63 6f 6c  D ) * + 3 AS col
2a020 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  1 FROM tab2 AS c
2a030 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d  or0..----..NULL.
2a040 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
2a050 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
2a060 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2a070 74 20 6c 61 62 65 6c 2d 31 31 36 36 0d 0a 53 45  t label-1166..SE
2a080 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f  LECT DISTINCT co
2a090 6c 31 20 2a 20 43 41 53 54 20 28 20 4e 55 4c 4c  l1 * CAST ( NULL
2a0a0 20 41 53 20 49 4e 54 45 47 45 52 20 29 20 2a 20   AS INTEGER ) * 
2a0b0 2b 20 33 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  + 3 AS col1 FROM
2a0c0 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
2a0d0 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75 65  ---..NULL....que
2a0e0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
2a0f0 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20  LECT DISTINCT + 
2a100 63 6f 6c 30 20 2b 20 28 20 35 32 20 2a 20 2b 20  col0 + ( 52 * + 
2a110 63 6f 72 30 2e 63 6f 6c 32 20 29 20 46 52 4f 4d  cor0.col2 ) FROM
2a120 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab0 cor0..----
2a130 0d 0a 31 37 34 30 0d 0a 34 33 35 33 0d 0a 38 37  ..1740..4353..87
2a140 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
2a150 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61   # use DIV opera
2a160 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20  tor for integer 
2a170 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20  division..query 
2a180 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
2a190 31 31 36 38 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  1168..SELECT ALL
2a1a0 20 2b 20 74 61 62 30 2e 63 6f 6c 30 20 2d 20 74   + tab0.col0 - t
2a1b0 61 62 30 2e 63 6f 6c 30 20 44 49 56 20 63 6f 6c  ab0.col0 DIV col
2a1c0 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  0 AS col1 FROM t
2a1d0 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 32 33 0d 0a 33  ab0..----..23..3
2a1e0 34 0d 0a 38 38 0d 0a 0d 0a 73 6b 69 70 69 66 20  4..88....skipif 
2a1f0 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
2a200 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
2a210 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 31  rowsort label-11
2a220 36 38 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b  68..SELECT ALL +
2a230 20 74 61 62 30 2e 63 6f 6c 30 20 2d 20 74 61 62   tab0.col0 - tab
2a240 30 2e 63 6f 6c 30 20 2f 20 63 6f 6c 30 20 41 53  0.col0 / col0 AS
2a250 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 0d   col1 FROM tab0.
2a260 0a 2d 2d 2d 2d 0d 0a 32 33 0d 0a 33 34 0d 0a 38  .----..23..34..8
2a270 38 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  8....onlyif mysq
2a280 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72  l # use DIV oper
2a290 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72  ator for integer
2a2a0 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79   division..query
2a2b0 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
2a2c0 2d 31 31 36 39 0d 0a 53 45 4c 45 43 54 20 41 4c  -1169..SELECT AL
2a2d0 4c 20 2d 20 74 61 62 30 2e 63 6f 6c 31 20 44 49  L - tab0.col1 DI
2a2e0 56 20 63 6f 6c 31 20 63 6f 6c 31 20 46 52 4f 4d  V col1 col1 FROM
2a2f0 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d   tab0..----..-1.
2a300 0a 2d 31 0d 0a 2d 31 0d 0a 0d 0a 73 6b 69 70 69  .-1..-1....skipi
2a310 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50  f postgresql # P
2a320 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72  ostgreSQL requir
2a330 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d  es AS when renam
2a340 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d  ing output colum
2a350 6e 73 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ns..skipif mysql
2a360 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
2a370 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
2a380 72 74 20 6c 61 62 65 6c 2d 31 31 36 39 0d 0a 53  rt label-1169..S
2a390 45 4c 45 43 54 20 41 4c 4c 20 2d 20 74 61 62 30  ELECT ALL - tab0
2a3a0 2e 63 6f 6c 31 20 2f 20 63 6f 6c 31 20 63 6f 6c  .col1 / col1 col
2a3b0 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d  1 FROM tab0..---
2a3c0 2d 0d 0a 2d 31 0d 0a 2d 31 0d 0a 2d 31 0d 0a 0d  -..-1..-1..-1...
2a3d0 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
2a3e0 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72  use DIV operator
2a3f0 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76   for integer div
2a400 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72  ision..query I r
2a410 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 31 37  owsort label-117
2a420 30 0d 0a 53 45 4c 45 43 54 20 32 30 20 44 49 56  0..SELECT 20 DIV
2a430 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20   col2 FROM tab1 
2a440 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30  AS cor0..----..0
2a450 0d 0a 30 0d 0a 30 0d 0a 0d 0a 73 6b 69 70 69 66  ..0..0....skipif
2a460 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
2a470 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
2a480 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
2a490 31 37 30 0d 0a 53 45 4c 45 43 54 20 32 30 20 2f  170..SELECT 20 /
2a4a0 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20   col2 FROM tab1 
2a4b0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30  AS cor0..----..0
2a4c0 0d 0a 30 0d 0a 30 0d 0a 0d 0a 71 75 65 72 79 20  ..0..0....query 
2a4d0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
2a4e0 54 20 2d 20 36 35 20 2a 20 63 6f 6c 30 20 41 53  T - 65 * col0 AS
2a4f0 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20   col2 FROM tab2 
2a500 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
2a510 34 35 35 0d 0a 2d 35 30 37 30 0d 0a 2d 35 31 33  455..-5070..-513
2a520 35 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  5....onlyif mysq
2a530 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72  l # use DIV oper
2a540 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72  ator for integer
2a550 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79   division..query
2a560 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
2a570 2d 31 31 37 32 0d 0a 53 45 4c 45 43 54 20 2d 20  -1172..SELECT - 
2a580 63 6f 72 30 2e 63 6f 6c 31 20 2a 20 63 6f 6c 31  cor0.col1 * col1
2a590 20 44 49 56 20 2b 20 28 20 2d 20 63 6f 6c 30 20   DIV + ( - col0 
2a5a0 2a 20 63 6f 6c 32 20 29 20 2d 20 28 20 63 6f 6c  * col2 ) - ( col
2a5b0 31 20 29 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  1 ) AS col0 FROM
2a5c0 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
2a5d0 2d 2d 2d 0d 0a 2d 31 30 0d 0a 2d 31 33 0d 0a 2d  ---..-10..-13..-
2a5e0 32 32 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  22....skipif mys
2a5f0 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
2a600 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
2a610 73 6f 72 74 20 6c 61 62 65 6c 2d 31 31 37 32 0d  sort label-1172.
2a620 0a 53 45 4c 45 43 54 20 2d 20 63 6f 72 30 2e 63  .SELECT - cor0.c
2a630 6f 6c 31 20 2a 20 63 6f 6c 31 20 2f 20 2b 20 28  ol1 * col1 / + (
2a640 20 2d 20 63 6f 6c 30 20 2a 20 63 6f 6c 32 20 29   - col0 * col2 )
2a650 20 2d 20 28 20 63 6f 6c 31 20 29 20 41 53 20 63   - ( col1 ) AS c
2a660 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol0 FROM tab1 AS
2a670 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30   cor0..----..-10
2a680 0d 0a 2d 31 33 0d 0a 2d 32 32 0d 0a 0d 0a 71 75  ..-13..-22....qu
2a690 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
2a6a0 45 4c 45 43 54 20 63 6f 6c 31 20 2a 20 37 33 20  ELECT col1 * 73 
2a6b0 46 52 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a  FROM tab2 cor0..
2a6c0 2d 2d 2d 2d 0d 0a 31 32 34 31 0d 0a 32 32 36 33  ----..1241..2263
2a6d0 0d 0a 34 33 30 37 0d 0a 0d 0a 6f 6e 6c 79 69 66  ..4307....onlyif
2a6e0 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56   mysql # use DIV
2a6f0 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e   operator for in
2a700 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a  teger division..
2a710 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
2a720 6c 61 62 65 6c 2d 31 31 37 34 0d 0a 53 45 4c 45  label-1174..SELE
2a730 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f 72 30  CT DISTINCT cor0
2a740 2e 63 6f 6c 31 20 44 49 56 20 28 20 63 6f 6c 31  .col1 DIV ( col1
2a750 20 29 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20   ) FROM tab2 AS 
2a760 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 0d 0a 0d  cor0..----..1...
2a770 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
2a780 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
2a790 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
2a7a0 6c 61 62 65 6c 2d 31 31 37 34 0d 0a 53 45 4c 45  label-1174..SELE
2a7b0 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f 72 30  CT DISTINCT cor0
2a7c0 2e 63 6f 6c 31 20 2f 20 28 20 63 6f 6c 31 20 29  .col1 / ( col1 )
2a7d0 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
2a7e0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 0d 0a 0d 0a 71  r0..----..1....q
2a7f0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
2a800 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
2a810 2b 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 2b 20  + + cor0.col2 + 
2a820 2b 20 35 35 20 41 53 20 63 6f 6c 32 20 46 52 4f  + 55 AS col2 FRO
2a830 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab0 cor0..---
2a840 2d 0d 0a 31 33 37 0d 0a 35 36 0d 0a 38 38 0d 0a  -..137..56..88..
2a850 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
2a860 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f   use DIV operato
2a870 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69  r for integer di
2a880 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20  vision..query I 
2a890 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 31  rowsort label-11
2a8a0 37 36 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c  76..SELECT + col
2a8b0 32 20 44 49 56 20 39 32 20 2b 20 63 6f 6c 31 20  2 DIV 92 + col1 
2a8c0 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
2a8d0 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
2a8e0 0a 38 36 0d 0a 39 31 0d 0a 39 37 0d 0a 0d 0a 73  .86..91..97....s
2a8f0 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
2a900 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
2a910 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
2a920 62 65 6c 2d 31 31 37 36 0d 0a 53 45 4c 45 43 54  bel-1176..SELECT
2a930 20 2b 20 63 6f 6c 32 20 2f 20 39 32 20 2b 20 63   + col2 / 92 + c
2a940 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  ol1 AS col1 FROM
2a950 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
2a960 2d 2d 2d 0d 0a 38 36 0d 0a 39 31 0d 0a 39 37 0d  ---..86..91..97.
2a970 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72  ...skipif postgr
2a980 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51  esql # PostgreSQ
2a990 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68  L requires AS wh
2a9a0 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70  en renaming outp
2a9b0 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72  ut columns..quer
2a9c0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
2a9d0 45 43 54 20 63 6f 6c 32 20 2a 20 2b 20 28 20 63  ECT col2 * + ( c
2a9e0 6f 6c 31 20 29 20 2b 20 63 6f 6c 31 20 2a 20 28  ol1 ) + col1 * (
2a9f0 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 29 20 63   - cor0.col2 ) c
2aa00 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol1 FROM tab0 AS
2aa10 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a   cor0..----..0..
2aa20 30 0d 0a 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20  0..0....query I 
2aa30 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
2aa40 2d 20 63 6f 72 30 2e 63 6f 6c 30 20 2b 20 28 20  - cor0.col0 + ( 
2aa50 63 6f 6c 30 20 2b 20 63 6f 6c 30 20 29 20 46 52  col0 + col0 ) FR
2aa60 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
2aa70 0a 2d 2d 2d 2d 0d 0a 37 0d 0a 37 38 0d 0a 37 39  .----..7..78..79
2aa80 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
2aa90 6f 72 74 0d 0a 53 45 4c 45 43 54 20 32 37 20 2a  ort..SELECT 27 *
2aaa0 20 74 61 62 32 2e 63 6f 6c 31 20 2a 20 2b 20 63   tab2.col1 * + c
2aab0 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  ol0 AS col2 FROM
2aac0 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 32 34   tab2..----..124
2aad0 32 35 34 0d 0a 33 36 32 36 31 0d 0a 35 38 35 39  254..36261..5859
2aae0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
2aaf0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
2ab00 49 4e 43 54 20 63 6f 72 30 2e 63 6f 6c 31 20 2a  INCT cor0.col1 *
2ab10 20 63 6f 6c 31 20 2d 20 2d 20 63 6f 6c 31 20 2a   col1 - - col1 *
2ab20 20 2d 20 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20   - col1 AS col2 
2ab30 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
2ab40 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 0d 0a 71 75  0..----..0....qu
2ab50 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
2ab60 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d  ELECT DISTINCT -
2ab70 20 63 6f 6c 30 20 2a 20 38 36 20 46 52 4f 4d 20   col0 * 86 FROM 
2ab80 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
2ab90 2d 2d 0d 0a 2d 36 30 32 0d 0a 2d 36 37 30 38 0d  --..-602..-6708.
2aba0 0a 2d 36 37 39 34 0d 0a 0d 0a 71 75 65 72 79 20  .-6794....query 
2abb0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
2abc0 54 20 44 49 53 54 49 4e 43 54 20 32 34 20 2a 20  T DISTINCT 24 * 
2abd0 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46 52 4f  col0 AS col1 FRO
2abe0 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 35  M tab1..----..15
2abf0 33 36 0d 0a 31 39 32 30 0d 0a 37 32 0d 0a 0d 0a  36..1920..72....
2ac00 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
2ac10 0a 53 45 4c 45 43 54 20 2d 20 37 32 20 2a 20 2d  .SELECT - 72 * -
2ac20 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46 52   col0 AS col0 FR
2ac30 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 32  OM tab1..----..2
2ac40 31 36 0d 0a 34 36 30 38 0d 0a 35 37 36 30 0d 0a  16..4608..5760..
2ac50 0d 0a 71 75 65 72 79 20 49 49 49 20 72 6f 77 73  ..query III rows
2ac60 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2a 20 46 52  ort..SELECT * FR
2ac70 4f 4d 20 74 61 62 30 20 57 48 45 52 45 20 63 6f  OM tab0 WHERE co
2ac80 6c 31 20 49 4e 20 28 20 2d 20 63 6f 6c 31 20 29  l1 IN ( - col1 )
2ac90 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a 6f 6e 6c 79 69 66  ..----....onlyif
2aca0 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56   mysql # use DIV
2acb0 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e   operator for in
2acc0 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a  teger division..
2acd0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
2ace0 6c 61 62 65 6c 2d 31 31 38 35 0d 0a 53 45 4c 45  label-1185..SELE
2acf0 43 54 20 63 6f 6c 31 20 2b 20 63 6f 6c 30 20 44  CT col1 + col0 D
2ad00 49 56 20 74 61 62 30 2e 63 6f 6c 32 20 41 53 20  IV tab0.col2 AS 
2ad10 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 0d 0a  col2 FROM tab0..
2ad20 2d 2d 2d 2d 0d 0a 31 33 32 0d 0a 38 36 0d 0a 39  ----..132..86..9
2ad30 32 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  2....skipif mysq
2ad40 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
2ad50 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
2ad60 6f 72 74 20 6c 61 62 65 6c 2d 31 31 38 35 0d 0a  ort label-1185..
2ad70 53 45 4c 45 43 54 20 63 6f 6c 31 20 2b 20 63 6f  SELECT col1 + co
2ad80 6c 30 20 2f 20 74 61 62 30 2e 63 6f 6c 32 20 41  l0 / tab0.col2 A
2ad90 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30  S col2 FROM tab0
2ada0 0d 0a 2d 2d 2d 2d 0d 0a 31 33 32 0d 0a 38 36 0d  ..----..132..86.
2adb0 0a 39 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .92....query I r
2adc0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
2add0 4c 4c 20 74 61 62 31 2e 63 6f 6c 31 20 2d 20 63  LL tab1.col1 - c
2ade0 6f 6c 32 20 2a 20 2d 20 74 61 62 31 2e 63 6f 6c  ol2 * - tab1.col
2adf0 31 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d  1 FROM tab1..---
2ae00 2d 0d 0a 31 32 36 31 0d 0a 31 34 33 30 0d 0a 35  -..1261..1430..5
2ae10 38 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  80....query I ro
2ae20 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
2ae30 4c 20 63 6f 6c 31 20 2d 20 2d 20 63 6f 6c 31 20  L col1 - - col1 
2ae40 2a 20 2d 20 63 6f 6c 30 20 41 53 20 63 6f 6c 31  * - col0 AS col1
2ae50 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d   FROM tab0..----
2ae60 0d 0a 2d 31 39 37 38 0d 0a 2d 33 32 39 38 0d 0a  ..-1978..-3298..
2ae70 2d 38 30 30 38 0d 0a 0d 0a 71 75 65 72 79 20 49  -8008....query I
2ae80 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
2ae90 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 30 20 2d   DISTINCT col0 -
2aea0 20 2d 20 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c 31   - col1 * - col1
2aeb0 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
2aec0 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 37 33 37 32 0d  b0..----..-7372.
2aed0 0a 2d 38 31 39 32 0d 0a 2d 39 33 37 34 0d 0a 0d  .-8192..-9374...
2aee0 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73  .skipif postgres
2aef0 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20  ql # PostgreSQL 
2af00 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e  requires AS when
2af10 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74   renaming output
2af20 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20   columns..query 
2af30 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
2af40 54 20 2d 20 63 6f 6c 32 20 2d 20 2b 20 63 6f 6c  T - col2 - + col
2af50 31 20 2a 20 63 6f 6c 32 20 63 6f 6c 31 20 46 52  1 * col2 col1 FR
2af60 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  OM tab0..----..-
2af70 32 38 37 31 0d 0a 2d 37 35 34 34 0d 0a 2d 39 38  2871..-7544..-98
2af80 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
2af90 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 32  ort..SELECT col2
2afa0 20 2a 20 2b 20 74 61 62 30 2e 63 6f 6c 32 20 41   * + tab0.col2 A
2afb0 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30  S col1 FROM tab0
2afc0 20 57 48 45 52 45 20 4e 55 4c 4c 20 42 45 54 57   WHERE NULL BETW
2afd0 45 45 4e 20 4e 55 4c 4c 20 41 4e 44 20 4e 55 4c  EEN NULL AND NUL
2afe0 4c 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a 71 75 65 72 79  L..----....query
2aff0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
2b000 43 54 20 2b 20 74 61 62 32 2e 63 6f 6c 32 20 2b  CT + tab2.col2 +
2b010 20 2b 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62   + col2 FROM tab
2b020 32 20 57 48 45 52 45 20 63 6f 6c 32 20 3c 20 28  2 WHERE col2 < (
2b030 20 4e 55 4c 4c 20 29 0d 0a 2d 2d 2d 2d 0d 0a 0d   NULL )..----...
2b040 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
2b050 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72  use DIV operator
2b060 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76   for integer div
2b070 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72  ision..query I r
2b080 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 31 39  owsort label-119
2b090 32 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  2..SELECT DISTIN
2b0a0 43 54 20 2b 20 74 61 62 32 2e 63 6f 6c 30 20 2a  CT + tab2.col0 *
2b0b0 20 63 6f 6c 32 20 2b 20 2d 20 63 6f 6c 30 20 44   col2 + - col0 D
2b0c0 49 56 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74  IV + col1 FROM t
2b0d0 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 38 39 0d 0a  ab2..----..189..
2b0e0 32 30 32 37 0d 0a 32 39 39 38 0d 0a 0d 0a 73 6b  2027..2998....sk
2b0f0 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
2b100 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
2b110 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
2b120 65 6c 2d 31 31 39 32 0d 0a 53 45 4c 45 43 54 20  el-1192..SELECT 
2b130 44 49 53 54 49 4e 43 54 20 2b 20 74 61 62 32 2e  DISTINCT + tab2.
2b140 63 6f 6c 30 20 2a 20 63 6f 6c 32 20 2b 20 2d 20  col0 * col2 + - 
2b150 63 6f 6c 30 20 2f 20 2b 20 63 6f 6c 31 20 46 52  col0 / + col1 FR
2b160 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31  OM tab2..----..1
2b170 38 39 0d 0a 32 30 32 37 0d 0a 32 39 39 38 0d 0a  89..2027..2998..
2b180 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2b190 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20  t..SELECT ALL - 
2b1a0 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c 32 20 2d 20  col1 * + col2 - 
2b1b0 2d 20 63 6f 6c 32 20 2a 20 63 6f 6c 32 20 41 53  - col2 * col2 AS
2b1c0 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 0d   col0 FROM tab1.
2b1d0 0a 2d 2d 2d 2d 0d 0a 31 35 31 32 0d 0a 32 36 37  .----..1512..267
2b1e0 39 0d 0a 37 39 36 38 0d 0a 0d 0a 71 75 65 72 79  9..7968....query
2b1f0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
2b200 43 54 20 2d 20 63 6f 6c 30 20 41 53 20 63 6f 6c  CT - col0 AS col
2b210 31 20 46 52 4f 4d 20 74 61 62 32 20 57 48 45 52  1 FROM tab2 WHER
2b220 45 20 4e 4f 54 20 4e 55 4c 4c 20 3e 20 63 6f 6c  E NOT NULL > col
2b230 32 20 2a 20 63 6f 6c 31 0d 0a 2d 2d 2d 2d 0d 0a  2 * col1..----..
2b240 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2b250 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 31 20 2b  t..SELECT col1 +
2b260 20 63 6f 6c 30 20 2a 20 2b 20 74 61 62 30 2e 63   col0 * + tab0.c
2b270 6f 6c 30 20 2a 20 74 61 62 30 2e 63 6f 6c 32 20  ol0 * tab0.col2 
2b280 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d  FROM tab0..----.
2b290 0a 31 33 32 32 0d 0a 31 39 30 39 34 0d 0a 36 34  .1322..19094..64
2b2a0 39 36 31 33 0d 0a 0d 0a 73 6b 69 70 69 66 20 70  9613....skipif p
2b2b0 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74  ostgresql # Post
2b2c0 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20  greSQL requires 
2b2d0 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67  AS when renaming
2b2e0 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d   output columns.
2b2f0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2b300 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
2b310 54 20 2d 20 74 61 62 32 2e 63 6f 6c 30 20 63 6f  T - tab2.col0 co
2b320 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 57 48 45  l0 FROM tab2 WHE
2b330 52 45 20 2b 20 63 6f 6c 30 20 2a 20 2b 20 63 6f  RE + col0 * + co
2b340 6c 30 20 49 4e 20 28 20 63 6f 6c 31 20 2f 20 63  l0 IN ( col1 / c
2b350 6f 6c 31 20 29 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a 71  ol1 )..----....q
2b360 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
2b370 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c  SELECT ALL + col
2b380 32 20 2a 20 2b 20 63 6f 6c 31 20 2a 20 2b 20 63  2 * + col1 * + c
2b390 6f 6c 30 20 2d 20 63 6f 6c 32 20 41 53 20 63 6f  ol0 - col2 AS co
2b3a0 6c 30 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d  l0 FROM tab1..--
2b3b0 2d 2d 0d 0a 33 36 34 32 33 0d 0a 34 31 35 38 0d  --..36423..4158.
2b3c0 0a 39 39 37 34 34 0d 0a 0d 0a 71 75 65 72 79 20  .99744....query 
2b3d0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
2b3e0 54 20 63 6f 6c 31 20 2a 20 63 6f 6c 30 20 2b 20  T col1 * col0 + 
2b3f0 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46 52 4f  col1 AS col1 FRO
2b400 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 33  M tab2..----..13
2b410 36 30 0d 0a 32 34 38 0d 0a 34 36 36 31 0d 0a 0d  60..248..4661...
2b420 0a 71 75 65 72 79 20 49 49 49 20 72 6f 77 73 6f  .query III rowso
2b430 72 74 0d 0a 53 45 4c 45 43 54 20 2a 20 46 52 4f  rt..SELECT * FRO
2b440 4d 20 74 61 62 32 20 57 48 45 52 45 20 4e 4f 54  M tab2 WHERE NOT
2b450 20 2b 20 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c 31   + col0 * - col1
2b460 20 4e 4f 54 20 49 4e 20 28 20 74 61 62 32 2e 63   NOT IN ( tab2.c
2b470 6f 6c 31 20 29 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a 71  ol1 )..----....q
2b480 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
2b490 53 45 4c 45 43 54 20 63 6f 6c 31 20 2a 20 63 6f  SELECT col1 * co
2b4a0 6c 31 20 2a 20 2d 20 63 6f 6c 31 20 46 52 4f 4d  l1 * - col1 FROM
2b4b0 20 74 61 62 30 20 57 48 45 52 45 20 4e 4f 54 20   tab0 WHERE NOT 
2b4c0 63 6f 6c 30 20 49 4e 20 28 20 63 6f 6c 31 20 2b  col0 IN ( col1 +
2b4d0 20 2d 20 63 6f 6c 31 20 29 0d 0a 2d 2d 2d 2d 0d   - col1 )..----.
2b4e0 0a 2d 36 33 36 30 35 36 0d 0a 2d 37 35 33 35 37  .-636056..-75357
2b4f0 31 0d 0a 2d 39 31 32 36 37 33 0d 0a 0d 0a 71 75  1..-912673....qu
2b500 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
2b510 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b  ELECT DISTINCT +
2b520 20 63 6f 6c 30 20 2b 20 63 6f 6c 31 20 2a 20 2d   col0 + col1 * -
2b530 20 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46 52   col1 AS col1 FR
2b540 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  OM tab0..----..-
2b550 37 33 37 32 0d 0a 2d 38 31 39 32 0d 0a 2d 39 33  7372..-8192..-93
2b560 37 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  74....query I ro
2b570 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f  wsort..SELECT co
2b580 6c 30 20 2b 20 2b 20 63 6f 6c 32 20 2a 20 2d 20  l0 + + col2 * - 
2b590 63 6f 6c 32 20 2a 20 63 6f 6c 32 20 46 52 4f 4d  col2 * col2 FROM
2b5a0 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 35   tab0..----..-35
2b5b0 39 31 33 0d 0a 2d 35 35 31 32 37 39 0d 0a 33 34  913..-551279..34
2b5c0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
2b5d0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
2b5e0 2b 20 36 38 20 2a 20 63 6f 6c 32 20 41 53 20 63  + 68 * col2 AS c
2b5f0 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol1 FROM tab1 AS
2b600 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 36 37   cor0..----..367
2b610 32 0d 0a 33 38 37 36 0d 0a 36 35 32 38 0d 0a 0d  2..3876..6528...
2b620 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2b630 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
2b640 54 20 2b 20 36 38 20 2a 20 2d 20 63 6f 6c 32 20  T + 68 * - col2 
2b650 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
2b660 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 36 37 32 0d 0a  0..----..-3672..
2b670 2d 33 38 37 36 0d 0a 2d 36 35 32 38 0d 0a 0d 0a  -3876..-6528....
2b680 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
2b690 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 37 32  .SELECT ALL + 72
2b6a0 20 2b 20 2b 20 63 6f 6c 30 20 2a 20 28 20 38 35   + + col0 * ( 85
2b6b0 20 29 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20   ) AS col2 FROM 
2b6c0 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
2b6d0 2d 2d 0d 0a 32 31 31 32 0d 0a 33 30 34 37 0d 0a  --..2112..3047..
2b6e0 37 36 33 37 0d 0a 0d 0a 73 6b 69 70 69 66 20 70  7637....skipif p
2b6f0 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74  ostgresql # Post
2b700 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20  greSQL requires 
2b710 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67  AS when renaming
2b720 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d   output columns.
2b730 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2b740 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 2b  ..SELECT ALL + +
2b750 20 63 6f 6c 32 20 2b 20 2b 20 63 6f 6c 32 20 2d   col2 + + col2 -
2b760 20 63 6f 6c 32 20 63 6f 6c 31 20 46 52 4f 4d 20   col2 col1 FROM 
2b770 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
2b780 2d 2d 0d 0a 31 0d 0a 33 33 0d 0a 38 32 0d 0a 0d  --..1..33..82...
2b790 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2b7a0 0d 0a 53 45 4c 45 43 54 20 2d 20 28 20 63 6f 6c  ..SELECT - ( col
2b7b0 30 20 29 20 2b 20 2b 20 63 6f 6c 30 20 2a 20 2d  0 ) + + col0 * -
2b7c0 20 35 32 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d   52 AS col1 FROM
2b7d0 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 35   tab1..----..-15
2b7e0 39 0d 0a 2d 33 33 39 32 0d 0a 2d 34 32 34 30 0d  9..-3392..-4240.
2b7f0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
2b800 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 34 35 20  rt..SELECT + 45 
2b810 2d 20 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46  - col1 AS col2 F
2b820 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab1..----..
2b830 31 39 0d 0a 33 32 0d 0a 33 35 0d 0a 0d 0a 71 75  19..32..35....qu
2b840 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
2b850 45 4c 45 43 54 20 2d 20 28 20 2b 20 34 35 20 29  ELECT - ( + 45 )
2b860 20 2a 20 63 6f 6c 32 20 2b 20 2d 20 63 6f 6c 30   * col2 + - col0
2b870 20 2a 20 2d 20 74 61 62 31 2e 63 6f 6c 30 20 2a   * - tab1.col0 *
2b880 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 0d   col0 FROM tab1.
2b890 0a 2d 2d 2d 2d 0d 0a 2d 32 34 30 33 0d 0a 32 35  .----..-2403..25
2b8a0 39 35 37 39 0d 0a 35 30 37 36 38 30 0d 0a 0d 0a  9579..507680....
2b8b0 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75  onlyif mysql # u
2b8c0 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20  se DIV operator 
2b8d0 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69  for integer divi
2b8e0 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f  sion..query I ro
2b8f0 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 32 31 30  wsort label-1210
2b900 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 31 20  ..SELECT + col1 
2b910 2b 20 63 6f 6c 31 20 2d 20 63 6f 6c 32 20 2a 20  + col1 - col2 * 
2b920 63 6f 6c 31 20 44 49 56 20 2d 20 74 61 62 30 2e  col1 DIV - tab0.
2b930 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46 52 4f  col2 AS col1 FRO
2b940 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 32 35  M tab0..----..25
2b950 38 0d 0a 32 37 33 0d 0a 32 39 31 0d 0a 0d 0a 73  8..273..291....s
2b960 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
2b970 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
2b980 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
2b990 62 65 6c 2d 31 32 31 30 0d 0a 53 45 4c 45 43 54  bel-1210..SELECT
2b9a0 20 2b 20 63 6f 6c 31 20 2b 20 63 6f 6c 31 20 2d   + col1 + col1 -
2b9b0 20 63 6f 6c 32 20 2a 20 63 6f 6c 31 20 2f 20 2d   col2 * col1 / -
2b9c0 20 74 61 62 30 2e 63 6f 6c 32 20 41 53 20 63 6f   tab0.col2 AS co
2b9d0 6c 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d  l1 FROM tab0..--
2b9e0 2d 2d 0d 0a 32 35 38 0d 0a 32 37 33 0d 0a 32 39  --..258..273..29
2b9f0 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  1....query I row
2ba00 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
2ba10 20 2b 20 32 30 20 41 53 20 63 6f 6c 30 20 46 52   + 20 AS col0 FR
2ba20 4f 4d 20 74 61 62 31 2c 20 74 61 62 30 20 41 53  OM tab1, tab0 AS
2ba30 20 63 6f 72 30 2c 20 74 61 62 30 20 41 53 20 63   cor0, tab0 AS c
2ba40 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61  or1..----..27 va
2ba50 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20  lues hashing to 
2ba60 30 61 33 35 66 65 39 38 66 33 65 37 64 35 66 63  0a35fe98f3e7d5fc
2ba70 38 66 66 32 61 65 38 31 35 62 64 32 30 65 66 34  8ff2ae815bd20ef4
2ba80 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
2ba90 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
2baa0 49 4e 43 54 20 2b 20 35 38 20 41 53 20 63 6f 6c  INCT + 58 AS col
2bab0 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  2 FROM tab2 AS c
2bac0 6f 72 30 20 43 52 4f 53 53 20 4a 4f 49 4e 20 74  or0 CROSS JOIN t
2bad0 61 62 32 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d  ab2 AS cor1..---
2bae0 2d 0d 0a 35 38 0d 0a 0d 0a 73 6b 69 70 69 66 20  -..58....skipif 
2baf0 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
2bb00 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
2bb10 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
2bb20 41 4c 4c 20 74 61 62 31 2e 63 6f 6c 32 20 2d 20  ALL tab1.col2 - 
2bb30 63 6f 6c 31 20 2a 20 2d 20 43 41 53 54 20 28 20  col1 * - CAST ( 
2bb40 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c 31 20 41 53  col2 * - col1 AS
2bb50 20 52 45 41 4c 20 29 20 41 53 20 63 6f 6c 32 20   REAL ) AS col2 
2bb60 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d  FROM tab1..----.
2bb70 0a 2d 31 36 31 32 38 0d 0a 2d 33 36 34 35 30 0d  .-16128..-36450.
2bb80 0a 2d 35 36 34 33 0d 0a 0d 0a 71 75 65 72 79 20  .-5643....query 
2bb90 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
2bba0 54 20 63 6f 6c 30 20 2b 20 74 61 62 32 2e 63 6f  T col0 + tab2.co
2bbb0 6c 32 20 2d 20 2d 20 28 20 36 37 20 29 20 41 53  l2 - - ( 67 ) AS
2bbc0 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 0d   col1 FROM tab2.
2bbd0 0a 2d 2d 2d 2d 0d 0a 31 30 31 0d 0a 31 37 31 0d  .----..101..171.
2bbe0 0a 31 38 34 0d 0a 0d 0a 73 6b 69 70 69 66 20 70  .184....skipif p
2bbf0 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74  ostgresql # Post
2bc00 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20  greSQL requires 
2bc10 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67  AS when renaming
2bc20 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d   output columns.
2bc30 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2bc40 0d 0a 53 45 4c 45 43 54 20 2b 20 31 32 20 2a 20  ..SELECT + 12 * 
2bc50 63 6f 6c 32 20 63 6f 6c 32 20 46 52 4f 4d 20 74  col2 col2 FROM t
2bc60 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
2bc70 2d 0d 0a 31 31 35 32 0d 0a 36 34 38 0d 0a 36 38  -..1152..648..68
2bc80 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  4....query I row
2bc90 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
2bca0 20 2d 20 2b 20 28 20 2b 20 63 6f 6c 31 20 29 20   - + ( + col1 ) 
2bcb0 2b 20 2b 20 63 6f 6c 31 20 2b 20 63 6f 6c 32 20  + + col1 + col2 
2bcc0 2a 20 2d 20 63 6f 6c 30 20 41 53 20 63 6f 6c 32  * - col0 AS col2
2bcd0 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
2bce0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 38 39 0d 0a  r0..----..-189..
2bcf0 2d 32 30 32 38 0d 0a 2d 33 30 30 32 0d 0a 0d 0a  -2028..-3002....
2bd00 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
2bd10 0a 53 45 4c 45 43 54 20 63 6f 6c 30 20 2d 20 2d  .SELECT col0 - -
2bd20 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46 52   col0 AS col0 FR
2bd30 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
2bd40 0a 2d 2d 2d 2d 0d 0a 31 34 0d 0a 31 35 36 0d 0a  .----..14..156..
2bd50 31 35 38 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  158....onlyif my
2bd60 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70  sql # use DIV op
2bd70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67  erator for integ
2bd80 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65  er division..que
2bd90 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
2bda0 65 6c 2d 31 32 31 38 0d 0a 53 45 4c 45 43 54 20  el-1218..SELECT 
2bdb0 63 6f 6c 31 20 2a 20 63 6f 72 30 2e 63 6f 6c 30  col1 * cor0.col0
2bdc0 20 44 49 56 20 2d 20 63 6f 6c 32 20 63 6f 6c 30   DIV - col2 col0
2bdd0 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
2bde0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 33 39 35 0d  r0..----..-3395.
2bdf0 0a 2d 36 32 0d 0a 2d 39 38 0d 0a 0d 0a 73 6b 69  .-62..-98....ski
2be00 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23  pif postgresql #
2be10 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75   PostgreSQL requ
2be20 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e  ires AS when ren
2be30 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c  aming output col
2be40 75 6d 6e 73 0d 0a 73 6b 69 70 69 66 20 6d 79 73  umns..skipif mys
2be50 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
2be60 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
2be70 73 6f 72 74 20 6c 61 62 65 6c 2d 31 32 31 38 0d  sort label-1218.
2be80 0a 53 45 4c 45 43 54 20 63 6f 6c 31 20 2a 20 63  .SELECT col1 * c
2be90 6f 72 30 2e 63 6f 6c 30 20 2f 20 2d 20 63 6f 6c  or0.col0 / - col
2bea0 32 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30  2 col0 FROM tab0
2beb0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
2bec0 2d 33 33 39 35 0d 0a 2d 36 32 0d 0a 2d 39 38 0d  -3395..-62..-98.
2bed0 0a 0d 0a 71 75 65 72 79 20 49 49 49 49 49 49 49  ...query IIIIIII
2bee0 49 49 49 49 49 20 72 6f 77 73 6f 72 74 0d 0a 53  IIIII rowsort..S
2bef0 45 4c 45 43 54 20 2a 20 46 52 4f 4d 20 74 61 62  ELECT * FROM tab
2bf00 31 20 41 53 20 63 6f 72 30 20 43 52 4f 53 53 20  1 AS cor0 CROSS 
2bf10 4a 4f 49 4e 20 74 61 62 30 2c 20 74 61 62 31 20  JOIN tab0, tab1 
2bf20 41 53 20 63 6f 72 31 2c 20 74 61 62 30 20 63 6f  AS cor1, tab0 co
2bf30 72 32 0d 0a 2d 2d 2d 2d 0d 0a 39 37 32 20 76 61  r2..----..972 va
2bf40 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20  lues hashing to 
2bf50 39 35 39 32 30 34 30 33 64 66 32 36 38 61 32 37  95920403df268a27
2bf60 32 63 34 65 39 33 33 63 64 30 62 62 65 30 62 65  2c4e933cd0bbe0be
2bf70 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
2bf80 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d   # support for M
2bf90 79 53 51 4c 20 73 70 65 63 69 66 69 63 20 73 79  ySQL specific sy
2bfa0 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73  stem types and s
2bfb0 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72  yntax..query I r
2bfc0 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 32 32  owsort label-122
2bfd0 30 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  0..SELECT DISTIN
2bfe0 43 54 20 63 6f 6c 31 20 2b 20 2d 20 43 41 53 54  CT col1 + - CAST
2bff0 28 20 2d 20 63 6f 6c 31 20 41 53 20 53 49 47 4e  ( - col1 AS SIGN
2c000 45 44 20 29 20 63 6f 6c 30 20 46 52 4f 4d 20 74  ED ) col0 FROM t
2c010 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 31 38 0d 0a  ab2..----..118..
2c020 33 34 0d 0a 36 32 0d 0a 0d 0a 73 6b 69 70 69 66  34..62....skipif
2c030 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f   postgresql # Po
2c040 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65  stgreSQL require
2c050 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69  s AS when renami
2c060 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e  ng output column
2c070 73 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  s..skipif mysql 
2c080 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
2c090 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2c0a0 74 20 6c 61 62 65 6c 2d 31 32 32 30 0d 0a 53 45  t label-1220..SE
2c0b0 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f  LECT DISTINCT co
2c0c0 6c 31 20 2b 20 2d 20 43 41 53 54 20 28 20 2d 20  l1 + - CAST ( - 
2c0d0 63 6f 6c 31 20 41 53 20 49 4e 54 45 47 45 52 20  col1 AS INTEGER 
2c0e0 29 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32  ) col0 FROM tab2
2c0f0 0d 0a 2d 2d 2d 2d 0d 0a 31 31 38 0d 0a 33 34 0d  ..----..118..34.
2c100 0a 36 32 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f  .62....skipif po
2c110 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67  stgresql # Postg
2c120 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41  reSQL requires A
2c130 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20  S when renaming 
2c140 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a  output columns..
2c150 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
2c160 0a 53 45 4c 45 43 54 20 28 20 32 31 20 29 20 63  .SELECT ( 21 ) c
2c170 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 63 6f  ol2 FROM tab0 co
2c180 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 31 0d 0a 32 31  r0..----..21..21
2c190 0d 0a 32 31 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  ..21....onlyif m
2c1a0 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f  ysql # use DIV o
2c1b0 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65  perator for inte
2c1c0 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75  ger division..qu
2c1d0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
2c1e0 62 65 6c 2d 31 32 32 32 0d 0a 53 45 4c 45 43 54  bel-1222..SELECT
2c1f0 20 43 41 53 54 28 20 63 6f 6c 31 20 41 53 20 53   CAST( col1 AS S
2c200 49 47 4e 45 44 20 29 20 2d 20 63 6f 6c 32 20 44  IGNED ) - col2 D
2c210 49 56 20 38 30 20 41 53 20 63 6f 6c 30 20 46 52  IV 80 AS col0 FR
2c220 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31  OM tab1..----..1
2c230 30 0d 0a 31 32 0d 0a 32 36 0d 0a 0d 0a 73 6b 69  0..12..26....ski
2c240 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
2c250 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
2c260 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
2c270 6c 2d 31 32 32 32 0d 0a 53 45 4c 45 43 54 20 43  l-1222..SELECT C
2c280 41 53 54 20 28 20 63 6f 6c 31 20 41 53 20 49 4e  AST ( col1 AS IN
2c290 54 45 47 45 52 20 29 20 2d 20 63 6f 6c 32 20 2f  TEGER ) - col2 /
2c2a0 20 38 30 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d   80 AS col0 FROM
2c2b0 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 30 0d   tab1..----..10.
2c2c0 0a 31 32 0d 0a 32 36 0d 0a 0d 0a 6f 6e 6c 79 69  .12..26....onlyi
2c2d0 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49  f mysql # use DI
2c2e0 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69  V operator for i
2c2f0 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d  nteger division.
2c300 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2c310 20 6c 61 62 65 6c 2d 31 32 32 33 0d 0a 53 45 4c   label-1223..SEL
2c320 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 2b  ECT DISTINCT + +
2c330 20 28 20 33 32 20 29 20 44 49 56 20 63 6f 6c 31   ( 32 ) DIV col1
2c340 20 2b 20 28 20 2d 20 63 6f 6c 31 20 29 20 2b 20   + ( - col1 ) + 
2c350 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 44 49 56 20  + cor0.col2 DIV 
2c360 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41  col0 FROM tab1 A
2c370 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
2c380 30 0d 0a 2d 37 0d 0a 0d 0a 73 6b 69 70 69 66 20  0..-7....skipif 
2c390 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
2c3a0 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
2c3b0 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 32  rowsort label-12
2c3c0 32 33 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  23..SELECT DISTI
2c3d0 4e 43 54 20 2b 20 2b 20 28 20 33 32 20 29 20 2f  NCT + + ( 32 ) /
2c3e0 20 63 6f 6c 31 20 2b 20 28 20 2d 20 63 6f 6c 31   col1 + ( - col1
2c3f0 20 29 20 2b 20 2b 20 63 6f 72 30 2e 63 6f 6c 32   ) + + cor0.col2
2c400 20 2f 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62   / col0 FROM tab
2c410 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
2c420 0a 2d 31 30 0d 0a 2d 37 0d 0a 0d 0a 6f 6e 6c 79  .-10..-7....only
2c430 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f  if mysql # suppo
2c440 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65  rt for MySQL spe
2c450 63 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70  cific system typ
2c460 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71  es and syntax..q
2c470 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
2c480 61 62 65 6c 2d 31 32 32 34 0d 0a 53 45 4c 45 43  abel-1224..SELEC
2c490 54 20 41 4c 4c 20 2d 20 32 35 20 2a 20 2b 20 63  T ALL - 25 * + c
2c4a0 6f 6c 32 20 2d 20 63 6f 6c 32 20 2a 20 2d 20 43  ol2 - col2 * - C
2c4b0 41 53 54 28 20 2d 20 31 33 20 2b 20 63 6f 6c 31  AST( - 13 + col1
2c4c0 20 41 53 20 53 49 47 4e 45 44 20 29 20 2a 20 63   AS SIGNED ) * c
2c4d0 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 63 6f  ol0 FROM tab0 co
2c4e0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 39 31 35 0d 0a  r0..----..2915..
2c4f0 35 36 37 31 39 34 0d 0a 35 36 39 39 31 0d 0a 0d  567194..56991...
2c500 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
2c510 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
2c520 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
2c530 6c 61 62 65 6c 2d 31 32 32 34 0d 0a 53 45 4c 45  label-1224..SELE
2c540 43 54 20 41 4c 4c 20 2d 20 32 35 20 2a 20 2b 20  CT ALL - 25 * + 
2c550 63 6f 6c 32 20 2d 20 63 6f 6c 32 20 2a 20 2d 20  col2 - col2 * - 
2c560 43 41 53 54 20 28 20 2d 20 31 33 20 2b 20 63 6f  CAST ( - 13 + co
2c570 6c 31 20 41 53 20 49 4e 54 45 47 45 52 20 29 20  l1 AS INTEGER ) 
2c580 2a 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30  * col0 FROM tab0
2c590 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 39 31   cor0..----..291
2c5a0 35 0d 0a 35 36 37 31 39 34 0d 0a 35 36 39 39 31  5..567194..56991
2c5b0 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67  ....skipif postg
2c5c0 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53  resql # PostgreS
2c5d0 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77  QL requires AS w
2c5e0 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74  hen renaming out
2c5f0 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65  put columns..que
2c600 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
2c610 4c 45 43 54 20 2b 20 63 6f 6c 30 20 2b 20 63 6f  LECT + col0 + co
2c620 6c 32 20 2a 20 63 6f 6c 32 20 63 6f 6c 31 20 46  l2 * col2 col1 F
2c630 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
2c640 0d 0a 2d 2d 2d 2d 0d 0a 31 35 32 33 0d 0a 37 33  ..----..1523..73
2c650 36 0d 0a 37 35 34 0d 0a 0d 0a 71 75 65 72 79 20  6..754....query 
2c660 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
2c670 54 20 41 4c 4c 20 2b 20 34 37 20 2b 20 63 6f 6c  T ALL + 47 + col
2c680 30 20 2b 20 2b 20 63 6f 6c 32 20 46 52 4f 4d 20  0 + + col2 FROM 
2c690 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
2c6a0 2d 2d 0d 0a 31 35 31 0d 0a 31 36 34 0d 0a 38 31  --..151..164..81
2c6b0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
2c6c0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 38 35  ort..SELECT - 85
2c6d0 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 2a 20 2b   + cor0.col2 * +
2c6e0 20 33 37 20 46 52 4f 4d 20 74 61 62 32 2c 20 74   37 FROM tab2, t
2c6f0 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
2c700 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68  -..9 values hash
2c710 69 6e 67 20 74 6f 20 35 64 30 65 62 66 30 62 39  ing to 5d0ebf0b9
2c720 37 64 35 61 34 33 31 32 31 66 32 36 64 33 62 35  7d5a43121f26d3b5
2c730 38 31 39 30 34 32 38 0d 0a 0d 0a 71 75 65 72 79  8190428....query
2c740 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
2c750 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 2d 20  CT DISTINCT - - 
2c760 63 6f 6c 32 20 2b 20 2d 20 63 6f 6c 31 20 2a 20  col2 + - col1 * 
2c770 63 6f 72 30 2e 63 6f 6c 30 20 2b 20 2d 20 28 20  cor0.col0 + - ( 
2c780 2d 20 63 6f 6c 31 20 29 20 41 53 20 63 6f 6c 31  - col1 ) AS col1
2c790 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
2c7a0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 39 34 35 0d  r0..----..-1945.
2c7b0 0a 2d 33 32 39 37 0d 0a 2d 37 39 32 36 0d 0a 0d  .-3297..-7926...
2c7c0 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73  .skipif postgres
2c7d0 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20  ql # PostgreSQL 
2c7e0 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e  requires AS when
2c7f0 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74   renaming output
2c800 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20   columns..query 
2c810 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
2c820 54 20 2b 20 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c  T + col2 * + col
2c830 31 20 2b 20 63 6f 6c 30 20 63 6f 6c 32 20 46 52  1 + col0 col2 FR
2c840 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
2c850 0a 2d 2d 2d 2d 0d 0a 31 33 32 38 0d 0a 31 34 30  .----..1328..140
2c860 37 0d 0a 36 33 34 0d 0a 0d 0a 71 75 65 72 79 20  7..634....query 
2c870 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
2c880 54 20 2d 20 2b 20 63 6f 6c 32 20 2b 20 63 6f 72  T - + col2 + cor
2c890 30 2e 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c 31 20  0.col0 * + col1 
2c8a0 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
2c8b0 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
2c8c0 0a 31 33 30 35 0d 0a 31 39 30 0d 0a 34 35 37 36  .1305..190..4576
2c8d0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
2c8e0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 37 32 20 2a  ort..SELECT 72 *
2c8f0 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62   + col0 FROM tab
2c900 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
2c910 0a 35 30 34 0d 0a 35 36 31 36 0d 0a 35 36 38 38  .504..5616..5688
2c920 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
2c930 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
2c940 49 4e 43 54 20 2d 20 37 36 20 41 53 20 63 6f 6c  INCT - 76 AS col
2c950 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  2 FROM tab2 AS c
2c960 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 37 36 0d 0a  or0..----..-76..
2c970 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2c980 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 32  t..SELECT + col2
2c990 20 2a 20 2d 20 63 6f 6c 32 20 2d 20 34 38 20 2a   * - col2 - 48 *
2c9a0 20 2b 20 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c 31   + col0 * - col1
2c9b0 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
2c9c0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 37 34 37 31 0d  r0..----..27471.
2c9d0 0a 34 30 37 30 34 0d 0a 38 32 38 0d 0a 0d 0a 73  .40704..828....s
2c9e0 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c  kipif postgresql
2c9f0 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65   # PostgreSQL re
2ca00 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72  quires AS when r
2ca10 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63  enaming output c
2ca20 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20  olumns..query I 
2ca30 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
2ca40 44 49 53 54 49 4e 43 54 20 63 6f 6c 32 20 2a 20  DISTINCT col2 * 
2ca50 2b 20 63 6f 6c 32 20 2b 20 28 20 2b 20 63 6f 6c  + col2 + ( + col
2ca60 31 20 29 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61  1 ) col1 FROM ta
2ca70 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 37 35 0d 0a  b0..----..1175..
2ca80 36 38 31 35 0d 0a 39 38 0d 0a 0d 0a 73 6b 69 70  6815..98....skip
2ca90 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20  if postgresql # 
2caa0 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69  PostgreSQL requi
2cab0 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61  res AS when rena
2cac0 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75  ming output colu
2cad0 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  mns..query I row
2cae0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
2caf0 54 49 4e 43 54 20 2d 20 63 6f 72 31 2e 63 6f 6c  TINCT - cor1.col
2cb00 32 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32  2 col2 FROM tab2
2cb10 20 41 53 20 63 6f 72 30 20 43 52 4f 53 53 20 4a   AS cor0 CROSS J
2cb20 4f 49 4e 20 74 61 62 31 20 41 53 20 63 6f 72 31  OIN tab1 AS cor1
2cb30 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 34 0d 0a 2d 35 37  ..----..-54..-57
2cb40 0d 0a 2d 39 36 0d 0a 0d 0a 71 75 65 72 79 20 49  ..-96....query I
2cb50 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
2cb60 20 41 4c 4c 20 2b 20 63 6f 6c 32 20 2a 20 35 37   ALL + col2 * 57
2cb70 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
2cb80 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 38 38 31 0d 0a  r0..----..1881..
2cb90 34 36 37 34 0d 0a 35 37 0d 0a 0d 0a 71 75 65 72  4674..57....quer
2cba0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
2cbb0 45 43 54 20 41 4c 4c 20 2d 20 63 6f 72 30 2e 63  ECT ALL - cor0.c
2cbc0 6f 6c 32 20 2b 20 2b 20 36 33 20 2a 20 2d 20 34  ol2 + + 63 * - 4
2cbd0 39 20 2a 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20  9 * - cor0.col2 
2cbe0 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
2cbf0 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
2cc00 0a 31 31 37 32 36 38 0d 0a 38 30 32 33 36 0d 0a  .117268..80236..
2cc10 38 33 33 32 32 0d 0a 0d 0a 71 75 65 72 79 20 49  83322....query I
2cc20 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
2cc30 20 41 4c 4c 20 36 39 20 41 53 20 63 6f 6c 30 20   ALL 69 AS col0 
2cc40 46 52 4f 4d 20 74 61 62 32 2c 20 74 61 62 31 20  FROM tab2, tab1 
2cc50 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61  cor0..----..9 va
2cc60 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20  lues hashing to 
2cc70 38 35 64 39 62 39 30 61 30 33 62 39 64 65 66 31  85d9b90a03b9def1
2cc80 36 31 38 39 31 62 31 33 30 38 35 32 37 31 66 37  61891b13085271f7
2cc90 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
2cca0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
2ccb0 49 4e 43 54 20 63 6f 6c 30 20 2a 20 28 20 63 6f  INCT col0 * ( co
2ccc0 6c 30 20 29 20 2a 20 63 6f 6c 30 20 2b 20 63 6f  l0 ) * col0 + co
2ccd0 72 30 2e 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c 32  r0.col0 + - col2
2cce0 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
2ccf0 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
2cd00 0d 0a 2d 32 34 0d 0a 32 36 32 31 35 31 0d 0a 35  ..-24..262151..5
2cd10 31 31 39 38 34 0d 0a 0d 0a 71 75 65 72 79 20 49  11984....query I
2cd20 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
2cd30 20 44 49 53 54 49 4e 43 54 20 34 30 20 2a 20 2b   DISTINCT 40 * +
2cd40 20 63 6f 72 30 2e 63 6f 6c 30 20 41 53 20 63 6f   cor0.col0 AS co
2cd50 6c 30 20 46 52 4f 4d 20 74 61 62 30 2c 20 74 61  l0 FROM tab0, ta
2cd60 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
2cd70 0d 0a 32 38 30 0d 0a 33 31 32 30 0d 0a 33 31 36  ..280..3120..316
2cd80 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  0....query I row
2cd90 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
2cda0 54 49 4e 43 54 20 63 6f 72 30 2e 63 6f 6c 31 20  TINCT cor0.col1 
2cdb0 2b 20 2b 20 31 38 20 2b 20 63 6f 6c 31 20 46 52  + + 18 + col1 FR
2cdc0 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
2cdd0 0a 2d 2d 2d 2d 0d 0a 31 33 36 0d 0a 35 32 0d 0a  .----..136..52..
2cde0 38 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  80....query I ro
2cdf0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
2ce00 4c 20 63 6f 6c 31 20 2a 20 32 39 20 46 52 4f 4d  L col1 * 29 FROM
2ce10 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab0 cor0..----
2ce20 0d 0a 32 34 39 34 0d 0a 32 36 33 39 0d 0a 32 38  ..2494..2639..28
2ce30 31 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  13....query I ro
2ce40 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
2ce50 53 54 49 4e 43 54 20 33 31 20 2a 20 2b 20 63 6f  STINCT 31 * + co
2ce60 6c 31 20 2a 20 2b 20 63 6f 6c 31 20 46 52 4f 4d  l1 * + col1 FROM
2ce70 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 32 30 39   tab1..----..209
2ce80 35 36 0d 0a 33 31 30 30 0d 0a 35 32 33 39 0d 0a  56..3100..5239..
2ce90 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2cea0 74 0d 0a 53 45 4c 45 43 54 20 2b 20 28 20 2d 20  t..SELECT + ( - 
2ceb0 31 20 29 20 2a 20 63 6f 6c 30 20 46 52 4f 4d 20  1 ) * col0 FROM 
2cec0 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab0 cor0..----.
2ced0 0a 2d 32 34 0d 0a 2d 33 35 0d 0a 2d 38 39 0d 0a  .-24..-35..-89..
2cee0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2cef0 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20  t..SELECT ALL - 
2cf00 63 6f 6c 31 20 2d 20 2d 20 38 20 2a 20 74 61 62  col1 - - 8 * tab
2cf10 31 2e 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46  1.col1 AS col1 F
2cf20 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab1..----..
2cf30 31 38 32 0d 0a 37 30 0d 0a 39 31 0d 0a 0d 0a 71  182..70..91....q
2cf40 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
2cf50 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 31 20  SELECT ALL col1 
2cf60 2d 20 31 37 20 2a 20 63 6f 6c 31 20 41 53 20 63  - 17 * col1 AS c
2cf70 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d  ol2 FROM tab2..-
2cf80 2d 2d 2d 0d 0a 2d 32 37 32 0d 0a 2d 34 39 36 0d  ---..-272..-496.
2cf90 0a 2d 39 34 34 0d 0a 0d 0a 71 75 65 72 79 20 49  .-944....query I
2cfa0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
2cfb0 20 74 61 62 30 2e 63 6f 6c 32 20 2a 20 2b 20 63   tab0.col2 * + c
2cfc0 6f 6c 30 20 2a 20 2b 20 63 6f 6c 31 20 2b 20 2d  ol0 * + col1 + -
2cfd0 20 74 61 62 30 2e 63 6f 6c 30 20 41 53 20 63 6f   tab0.col0 AS co
2cfe0 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d  l0 FROM tab0..--
2cff0 2d 2d 0d 0a 33 33 36 30 0d 0a 36 36 34 30 32 39  --..3360..664029
2d000 0d 0a 36 38 30 38 38 0d 0a 0d 0a 6f 6e 6c 79 69  ..68088....onlyi
2d010 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49  f mysql # use DI
2d020 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69  V operator for i
2d030 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d  nteger division.
2d040 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2d050 20 6c 61 62 65 6c 2d 31 32 34 38 0d 0a 53 45 4c   label-1248..SEL
2d060 45 43 54 20 41 4c 4c 20 30 20 44 49 56 20 63 6f  ECT ALL 0 DIV co
2d070 6c 31 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  l1 AS col2 FROM 
2d080 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
2d090 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a 73  --..0..0..0....s
2d0a0 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
2d0b0 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
2d0c0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
2d0d0 62 65 6c 2d 31 32 34 38 0d 0a 53 45 4c 45 43 54  bel-1248..SELECT
2d0e0 20 41 4c 4c 20 30 20 2f 20 63 6f 6c 31 20 41 53   ALL 0 / col1 AS
2d0f0 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20   col2 FROM tab1 
2d100 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30  AS cor0..----..0
2d110 0d 0a 30 0d 0a 30 0d 0a 0d 0a 71 75 65 72 79 20  ..0..0....query 
2d120 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
2d130 54 20 41 4c 4c 20 2b 20 35 20 2a 20 63 6f 6c 32  T ALL + 5 * col2
2d140 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
2d150 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 36 35 0d 0a 34  r0..----..165..4
2d160 31 30 0d 0a 35 0d 0a 0d 0a 71 75 65 72 79 20 49  10..5....query I
2d170 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
2d180 20 44 49 53 54 49 4e 43 54 20 2b 20 2b 20 63 6f   DISTINCT + + co
2d190 6c 31 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 2a  l1 + cor0.col2 *
2d1a0 20 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46 52   col1 AS col2 FR
2d1b0 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
2d1c0 0a 2d 2d 2d 2d 0d 0a 31 32 36 31 0d 0a 31 34 33  .----..1261..143
2d1d0 30 0d 0a 35 38 30 0d 0a 0d 0a 71 75 65 72 79 20  0..580....query 
2d1e0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
2d1f0 54 20 2b 20 2b 20 31 34 20 2b 20 2b 20 63 6f 6c  T + + 14 + + col
2d200 30 20 2a 20 63 6f 72 30 2e 63 6f 6c 31 20 46 52  0 * cor0.col1 FR
2d210 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d  OM tab2 cor0..--
2d220 2d 2d 0d 0a 31 33 35 37 0d 0a 32 33 31 0d 0a 34  --..1357..231..4
2d230 36 31 36 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  616....onlyif my
2d240 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f  sql # support fo
2d250 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63  r MySQL specific
2d260 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e   system types an
2d270 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20  d syntax..query 
2d280 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
2d290 31 32 35 32 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  1252..SELECT ALL
2d2a0 20 2d 20 43 41 53 54 28 20 63 6f 6c 31 20 41 53   - CAST( col1 AS
2d2b0 20 53 49 47 4e 45 44 20 29 20 2a 20 2d 20 63 6f   SIGNED ) * - co
2d2c0 72 30 2e 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  r0.col2 FROM tab
2d2d0 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
2d2e0 0a 31 32 34 38 0d 0a 31 34 30 34 0d 0a 35 37 30  .1248..1404..570
2d2f0 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
2d300 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
2d310 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
2d320 72 74 20 6c 61 62 65 6c 2d 31 32 35 32 0d 0a 53  rt label-1252..S
2d330 45 4c 45 43 54 20 41 4c 4c 20 2d 20 43 41 53 54  ELECT ALL - CAST
2d340 20 28 20 63 6f 6c 31 20 41 53 20 49 4e 54 45 47   ( col1 AS INTEG
2d350 45 52 20 29 20 2a 20 2d 20 63 6f 72 30 2e 63 6f  ER ) * - cor0.co
2d360 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l2 FROM tab1 AS 
2d370 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 34 38  cor0..----..1248
2d380 0d 0a 31 34 30 34 0d 0a 35 37 30 0d 0a 0d 0a 71  ..1404..570....q
2d390 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
2d3a0 53 45 4c 45 43 54 20 2d 20 63 6f 6c 30 20 2a 20  SELECT - col0 * 
2d3b0 2d 20 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c 30 20  - col0 * + col0 
2d3c0 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a  FROM tab0 cor0..
2d3d0 2d 2d 2d 2d 0d 0a 31 33 38 32 34 0d 0a 34 32 38  ----..13824..428
2d3e0 37 35 0d 0a 37 30 34 39 36 39 0d 0a 0d 0a 73 6b  75..704969....sk
2d3f0 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20  ipif postgresql 
2d400 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71  # PostgreSQL req
2d410 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65  uires AS when re
2d420 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f  naming output co
2d430 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72  lumns..query I r
2d440 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
2d450 20 31 35 20 2a 20 63 6f 6c 31 20 63 6f 6c 30 20   15 * col1 col0 
2d460 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
2d470 30 0d 0a 2d 2d 2d 2d 0d 0a 31 35 30 0d 0a 31 39  0..----..150..19
2d480 35 0d 0a 33 39 30 0d 0a 0d 0a 71 75 65 72 79 20  5..390....query 
2d490 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
2d4a0 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63 6f 72  T DISTINCT + cor
2d4b0 30 2e 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c 32 20  0.col0 * - col2 
2d4c0 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
2d4d0 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
2d4e0 0a 2d 31 38 39 0d 0a 2d 32 30 32 38 0d 0a 2d 33  .-189..-2028..-3
2d4f0 30 30 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  002....query I r
2d500 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
2d510 4c 4c 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 2a  LL + cor0.col0 *
2d520 20 2d 20 63 6f 6c 32 20 2b 20 2d 20 63 6f 6c 30   - col2 + - col0
2d530 20 2a 20 34 31 20 41 53 20 63 6f 6c 32 20 46 52   * 41 AS col2 FR
2d540 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
2d550 0a 2d 2d 2d 2d 0d 0a 2d 31 30 39 36 30 0d 0a 2d  .----..-10960..-
2d560 32 38 35 0d 0a 2d 36 32 37 32 0d 0a 0d 0a 6f 6e  285..-6272....on
2d570 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
2d580 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
2d590 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
2d5a0 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
2d5b0 6f 72 74 20 6c 61 62 65 6c 2d 31 32 35 37 0d 0a  ort label-1257..
2d5c0 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
2d5d0 2b 20 28 20 2b 20 63 6f 6c 31 20 29 20 2b 20 63  + ( + col1 ) + c
2d5e0 6f 6c 31 20 44 49 56 20 63 6f 72 30 2e 63 6f 6c  ol1 DIV cor0.col
2d5f0 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  2 FROM tab1 AS c
2d600 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 0d 0a 31  or0..----..10..1
2d610 33 0d 0a 32 36 0d 0a 0d 0a 73 6b 69 70 69 66 20  3..26....skipif 
2d620 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
2d630 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
2d640 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 32  rowsort label-12
2d650 35 37 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  57..SELECT DISTI
2d660 4e 43 54 20 2b 20 28 20 2b 20 63 6f 6c 31 20 29  NCT + ( + col1 )
2d670 20 2b 20 63 6f 6c 31 20 2f 20 63 6f 72 30 2e 63   + col1 / cor0.c
2d680 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol2 FROM tab1 AS
2d690 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 0d   cor0..----..10.
2d6a0 0a 31 33 0d 0a 32 36 0d 0a 0d 0a 73 6b 69 70 69  .13..26....skipi
2d6b0 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50  f postgresql # P
2d6c0 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72  ostgreSQL requir
2d6d0 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d  es AS when renam
2d6e0 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d  ing output colum
2d6f0 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ns..query I rows
2d700 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
2d710 2d 20 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c 31 20  - col0 + + col1 
2d720 2a 20 2d 20 63 6f 6c 32 20 63 6f 6c 32 20 46 52  * - col2 col2 FR
2d730 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
2d740 0a 2d 2d 2d 2d 0d 0a 2d 31 36 31 32 0d 0a 2d 37  .----..-1612..-7
2d750 32 35 0d 0a 2d 38 34 34 0d 0a 0d 0a 71 75 65 72  25..-844....quer
2d760 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
2d770 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 31  ECT DISTINCT - 1
2d780 20 2d 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74   - + col1 FROM t
2d790 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
2d7a0 2d 0d 0a 2d 31 38 0d 0a 2d 33 32 0d 0a 2d 36 30  -..-18..-32..-60
2d7b0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
2d7c0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f  ort..SELECT + co
2d7d0 6c 31 20 2d 20 63 6f 6c 32 20 2a 20 63 6f 6c 31  l1 - col2 * col1
2d7e0 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
2d7f0 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
2d800 0d 0a 2d 31 34 37 35 0d 0a 2d 36 32 39 0d 0a 2d  ..-1475..-629..-
2d810 38 30 36 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  806....onlyif my
2d820 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70  sql # use DIV op
2d830 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67  erator for integ
2d840 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65  er division..que
2d850 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
2d860 65 6c 2d 31 32 36 31 0d 0a 53 45 4c 45 43 54 20  el-1261..SELECT 
2d870 41 4c 4c 20 2d 20 63 6f 6c 31 20 44 49 56 20 2b  ALL - col1 DIV +
2d880 20 63 6f 6c 32 20 2b 20 2d 20 63 6f 6c 31 20 46   col2 + - col1 F
2d890 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
2d8a0 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 0d 0a 2d 31 33  ..----..-10..-13
2d8b0 0d 0a 2d 32 36 0d 0a 0d 0a 73 6b 69 70 69 66 20  ..-26....skipif 
2d8c0 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
2d8d0 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
2d8e0 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 32  rowsort label-12
2d8f0 36 31 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d  61..SELECT ALL -
2d900 20 63 6f 6c 31 20 2f 20 2b 20 63 6f 6c 32 20 2b   col1 / + col2 +
2d910 20 2d 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62   - col1 FROM tab
2d920 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
2d930 0a 2d 31 30 0d 0a 2d 31 33 0d 0a 2d 32 36 0d 0a  .-10..-13..-26..
2d940 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2d950 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
2d960 43 54 20 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c 30  CT col2 * - col0
2d970 20 2d 20 2b 20 33 31 20 46 52 4f 4d 20 74 61 62   - + 31 FROM tab
2d980 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  1 cor0..----..-1
2d990 39 33 0d 0a 2d 33 36 37 39 0d 0a 2d 37 37 31 31  93..-3679..-7711
2d9a0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
2d9b0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 38 32  ort..SELECT + 82
2d9c0 20 2b 20 2d 20 63 6f 6c 32 20 2a 20 63 6f 6c 31   + - col2 * col1
2d9d0 20 2a 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c   * + col1 AS col
2d9e0 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  0 FROM tab2 AS c
2d9f0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 39 30  or0..----..-1090
2da00 30 0d 0a 2d 32 35 38 36 35 0d 0a 2d 39 30 34 32  0..-25865..-9042
2da10 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  4....query I row
2da20 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 34  sort..SELECT + 4
2da30 39 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 2a 20  9 - cor0.col2 * 
2da40 2b 20 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46  + col2 AS col1 F
2da50 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
2da60 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 38 36 37 0d 0a 2d  ..----..-2867..-
2da70 33 32 30 30 0d 0a 2d 39 31 36 37 0d 0a 0d 0a 71  3200..-9167....q
2da80 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
2da90 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f 72  SELECT ALL - cor
2daa0 30 2e 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c 32 20  0.col2 * - col2 
2dab0 2d 20 2b 20 63 6f 6c 31 20 2a 20 2d 20 32 32 20  - + col1 * - 22 
2dac0 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
2dad0 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
2dae0 0a 31 34 31 31 0d 0a 31 38 31 38 0d 0a 31 39 37  .1411..1818..197
2daf0 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  4....query I row
2db00 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
2db10 20 2d 20 28 20 63 6f 6c 30 20 29 20 2b 20 2d 20   - ( col0 ) + - 
2db20 63 6f 72 30 2e 63 6f 6c 31 20 41 53 20 63 6f 6c  cor0.col1 AS col
2db30 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  2 FROM tab2 AS c
2db40 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 37 0d  or0..----..-137.
2db50 0a 2d 33 38 0d 0a 2d 39 36 0d 0a 0d 0a 71 75 65  .-38..-96....que
2db60 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
2db70 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 30 20 2d 20  LECT ALL col0 - 
2db80 2d 20 38 39 20 46 52 4f 4d 20 74 61 62 31 0d 0a  - 89 FROM tab1..
2db90 2d 2d 2d 2d 0d 0a 31 35 33 0d 0a 31 36 39 0d 0a  ----..153..169..
2dba0 39 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  92....query I ro
2dbb0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
2dbc0 53 54 49 4e 43 54 20 2b 20 2d 20 63 6f 6c 32 20  STINCT + - col2 
2dbd0 2a 20 2b 20 63 6f 6c 30 20 2a 20 63 6f 6c 32 20  * + col0 * col2 
2dbe0 2b 20 2b 20 28 20 63 6f 6c 30 20 29 20 2a 20 2b  + + ( col0 ) * +
2dbf0 20 38 38 20 46 52 4f 4d 20 74 61 62 32 20 41 53   88 FROM tab2 AS
2dc00 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30   cor0..----..-10
2dc10 37 31 32 34 0d 0a 2d 34 34 38 37 0d 0a 2d 34 35  7124..-4487..-45
2dc20 38 36 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  864....query I r
2dc30 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
2dc40 49 53 54 49 4e 43 54 20 2d 20 37 20 2a 20 35 34  ISTINCT - 7 * 54
2dc50 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d   FROM tab0..----
2dc60 0d 0a 2d 33 37 38 0d 0a 0d 0a 73 6b 69 70 69 66  ..-378....skipif
2dc70 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f   postgresql # Po
2dc80 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65  stgreSQL require
2dc90 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69  s AS when renami
2dca0 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e  ng output column
2dcb0 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  s..query I rowso
2dcc0 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 38  rt..SELECT ALL 8
2dcd0 37 20 2a 20 2b 20 63 6f 6c 30 20 63 6f 6c 32 20  7 * + col0 col2 
2dce0 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
2dcf0 30 0d 0a 2d 2d 2d 2d 0d 0a 32 30 38 38 0d 0a 33  0..----..2088..3
2dd00 30 34 35 0d 0a 37 37 34 33 0d 0a 0d 0a 6f 6e 6c  045..7743....onl
2dd10 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20  yif mysql # use 
2dd20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72  DIV operator for
2dd30 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f   integer divisio
2dd40 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  n..query I rowso
2dd50 72 74 20 6c 61 62 65 6c 2d 31 32 37 31 0d 0a 53  rt label-1271..S
2dd60 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b  ELECT DISTINCT +
2dd70 20 28 20 63 6f 6c 32 20 29 20 2a 20 28 20 32 32   ( col2 ) * ( 22
2dd80 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 29 20 44   + cor0.col1 ) D
2dd90 49 56 20 28 20 63 6f 6c 30 20 29 20 46 52 4f 4d  IV ( col0 ) FROM
2dda0 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
2ddb0 2d 2d 2d 0d 0a 32 38 0d 0a 34 32 0d 0a 38 36 34  ---..28..42..864
2ddc0 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
2ddd0 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
2dde0 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
2ddf0 72 74 20 6c 61 62 65 6c 2d 31 32 37 31 0d 0a 53  rt label-1271..S
2de00 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b  ELECT DISTINCT +
2de10 20 28 20 63 6f 6c 32 20 29 20 2a 20 28 20 32 32   ( col2 ) * ( 22
2de20 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 29 20 2f   + cor0.col1 ) /
2de30 20 28 20 63 6f 6c 30 20 29 20 46 52 4f 4d 20 74   ( col0 ) FROM t
2de40 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
2de50 2d 0d 0a 32 38 0d 0a 34 32 0d 0a 38 36 34 0d 0a  -..28..42..864..
2de60 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2de70 74 0d 0a 53 45 4c 45 43 54 20 31 37 20 2a 20 63  t..SELECT 17 * c
2de80 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d  ol0 FROM tab0..-
2de90 2d 2d 2d 0d 0a 31 35 31 33 0d 0a 34 30 38 0d 0a  ---..1513..408..
2dea0 35 39 35 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  595....onlyif my
2deb0 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70  sql # use DIV op
2dec0 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67  erator for integ
2ded0 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65  er division..que
2dee0 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
2def0 65 6c 2d 31 32 37 33 0d 0a 53 45 4c 45 43 54 20  el-1273..SELECT 
2df00 44 49 53 54 49 4e 43 54 20 39 39 20 44 49 56 20  DISTINCT 99 DIV 
2df10 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 0d 0a  col2 FROM tab0..
2df20 2d 2d 2d 2d 0d 0a 31 0d 0a 33 0d 0a 39 39 0d 0a  ----..1..3..99..
2df30 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
2df40 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
2df50 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2df60 20 6c 61 62 65 6c 2d 31 32 37 33 0d 0a 53 45 4c   label-1273..SEL
2df70 45 43 54 20 44 49 53 54 49 4e 43 54 20 39 39 20  ECT DISTINCT 99 
2df80 2f 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30  / col2 FROM tab0
2df90 0d 0a 2d 2d 2d 2d 0d 0a 31 0d 0a 33 0d 0a 39 39  ..----..1..3..99
2dfa0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
2dfb0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f  ort..SELECT - co
2dfc0 72 30 2e 63 6f 6c 32 20 2b 20 34 39 20 46 52 4f  r0.col2 + 49 FRO
2dfd0 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
2dfe0 2d 2d 2d 2d 0d 0a 2d 33 33 0d 0a 31 36 0d 0a 34  ----..-33..16..4
2dff0 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  8....query I row
2e000 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63  sort..SELECT + c
2e010 6f 6c 32 20 2b 20 63 6f 6c 30 20 2a 20 2d 20 39  ol2 + col0 * - 9
2e020 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  2 AS col2 FROM t
2e030 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
2e040 2d 0d 0a 2d 36 31 37 0d 0a 2d 37 31 35 30 0d 0a  -..-617..-7150..
2e050 2d 37 32 33 30 0d 0a 0d 0a 71 75 65 72 79 20 49  -7230....query I
2e060 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
2e070 20 34 38 20 2b 20 74 61 62 30 2e 63 6f 6c 32 20   48 + tab0.col2 
2e080 2a 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30  * col2 FROM tab0
2e090 0d 0a 2d 2d 2d 2d 0d 0a 31 31 33 37 0d 0a 34 39  ..----..1137..49
2e0a0 0d 0a 36 37 37 32 0d 0a 0d 0a 71 75 65 72 79 20  ..6772....query 
2e0b0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
2e0c0 54 20 41 4c 4c 20 31 30 20 2b 20 74 61 62 32 2e  T ALL 10 + tab2.
2e0d0 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 0d 0a  col2 FROM tab2..
2e0e0 2d 2d 2d 2d 0d 0a 33 36 0d 0a 33 37 0d 0a 34 38  ----..36..37..48
2e0f0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
2e100 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 31 30  ort..SELECT + 10
2e110 20 2b 20 2d 20 63 6f 6c 31 20 2b 20 28 20 34 38   + - col1 + ( 48
2e120 20 29 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d   ) FROM tab2..--
2e130 2d 2d 0d 0a 2d 31 0d 0a 32 37 0d 0a 34 31 0d 0a  --..-1..27..41..
2e140 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2e150 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
2e160 43 54 20 2d 20 63 6f 6c 30 20 2b 20 63 6f 6c 31  CT - col0 + col1
2e170 20 2b 20 28 20 2d 20 63 6f 6c 32 20 29 20 41 53   + ( - col2 ) AS
2e180 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 0d   col0 FROM tab1.
2e190 0a 2d 2d 2d 2d 0d 0a 2d 31 31 31 0d 0a 2d 31 36  .----..-111..-16
2e1a0 33 0d 0a 2d 33 31 0d 0a 0d 0a 71 75 65 72 79 20  3..-31....query 
2e1b0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
2e1c0 54 20 41 4c 4c 20 2d 20 63 6f 6c 30 20 2a 20 33  T ALL - col0 * 3
2e1d0 38 20 2b 20 63 6f 6c 30 20 2b 20 2d 20 28 20 63  8 + col0 + - ( c
2e1e0 6f 6c 30 20 29 20 41 53 20 63 6f 6c 30 20 46 52  ol0 ) AS col0 FR
2e1f0 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
2e200 0a 2d 2d 2d 2d 0d 0a 2d 31 31 34 0d 0a 2d 32 34  .----..-114..-24
2e210 33 32 0d 0a 2d 33 30 34 30 0d 0a 0d 0a 71 75 65  32..-3040....que
2e220 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
2e230 4c 45 43 54 20 41 4c 4c 20 33 38 20 2b 20 31 34  LECT ALL 38 + 14
2e240 20 2a 20 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20   * col0 AS col2 
2e250 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
2e260 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 38 34 0d 0a 33  0..----..1284..3
2e270 37 34 0d 0a 35 32 38 0d 0a 0d 0a 71 75 65 72 79  74..528....query
2e280 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
2e290 43 54 20 41 4c 4c 20 2b 20 28 20 2b 20 63 6f 6c  CT ALL + ( + col
2e2a0 30 20 29 20 2a 20 2d 20 63 6f 6c 30 20 2a 20 63  0 ) * - col0 * c
2e2b0 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol1 FROM tab2 AS
2e2c0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30   cor0..----..-10
2e2d0 36 30 39 37 0d 0a 2d 31 35 31 39 0d 0a 2d 33 35  6097..-1519..-35
2e2e0 38 39 35 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20  8956....query I 
2e2f0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
2e300 2b 20 2d 20 28 20 39 31 20 29 20 41 53 20 63 6f  + - ( 91 ) AS co
2e310 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l1 FROM tab2 AS 
2e320 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 39 31 0d  cor0..----..-91.
2e330 0a 2d 39 31 0d 0a 2d 39 31 0d 0a 0d 0a 71 75 65  .-91..-91....que
2e340 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
2e350 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 30 20  LECT ALL + col0 
2e360 2a 20 63 6f 6c 30 20 2b 20 63 6f 72 30 2e 63 6f  * col0 + cor0.co
2e370 6c 31 20 2a 20 2b 20 38 32 20 2a 20 2b 20 63 6f  l1 * + 82 * + co
2e380 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l2 FROM tab0 AS 
2e390 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 33 33 32  cor0..----..2332
2e3a0 39 32 0d 0a 36 31 39 38 30 35 0d 0a 39 31 37 39  92..619805..9179
2e3b0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
2e3c0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
2e3d0 49 4e 43 54 20 2b 20 28 20 63 6f 6c 32 20 29 20  INCT + ( col2 ) 
2e3e0 2a 20 2d 20 63 6f 6c 31 20 2b 20 63 6f 6c 32 20  * - col1 + col2 
2e3f0 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30  + col0 FROM tab0
2e400 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
2e410 2d 32 37 38 31 0d 0a 2d 36 31 0d 0a 2d 37 32 39  -2781..-61..-729
2e420 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  1....query I row
2e430 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 74 61 62  sort..SELECT tab
2e440 30 2e 63 6f 6c 32 20 2a 20 36 38 20 41 53 20 63  0.col2 * 68 AS c
2e450 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d  ol1 FROM tab0..-
2e460 2d 2d 2d 0d 0a 32 32 34 34 0d 0a 35 35 37 36 0d  ---..2244..5576.
2e470 0a 36 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .68....query I r
2e480 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 74  owsort..SELECT t
2e490 61 62 30 2e 63 6f 6c 31 20 2a 20 2b 20 39 37 20  ab0.col1 * + 97 
2e4a0 2d 20 2b 20 28 20 63 6f 6c 31 20 29 20 41 53 20  - + ( col1 ) AS 
2e4b0 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a  col1 FROM tab0..
2e4c0 2d 2d 2d 2d 0d 0a 38 32 35 36 0d 0a 38 37 33 36  ----..8256..8736
2e4d0 0d 0a 39 33 31 32 0d 0a 0d 0a 71 75 65 72 79 20  ..9312....query 
2e4e0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
2e4f0 54 20 44 49 53 54 49 4e 43 54 20 2d 20 35 33 20  T DISTINCT - 53 
2e500 2b 20 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c 32 20  + col2 * - col2 
2e510 2a 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c 30  * + col1 AS col0
2e520 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
2e530 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 35 30 0d 0a  r0..----..-150..
2e540 2d 36 31 31 39 33 37 0d 0a 2d 39 33 37 30 37 0d  -611937..-93707.
2e550 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
2e560 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
2e570 4e 43 54 20 2d 20 37 36 20 2a 20 2b 20 63 6f 6c  NCT - 76 * + col
2e580 31 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  1 AS col0 FROM t
2e590 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
2e5a0 2d 0d 0a 2d 31 32 39 32 0d 0a 2d 32 33 35 36 0d  -..-1292..-2356.
2e5b0 0a 2d 34 34 38 34 0d 0a 0d 0a 6f 6e 6c 79 69 66  .-4484....onlyif
2e5c0 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74   mysql # support
2e5d0 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69   for MySQL speci
2e5e0 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73  fic system types
2e5f0 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65   and syntax..que
2e600 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
2e610 65 6c 2d 31 32 39 30 0d 0a 53 45 4c 45 43 54 20  el-1290..SELECT 
2e620 41 4c 4c 20 43 41 53 54 28 20 63 6f 6c 30 20 41  ALL CAST( col0 A
2e630 53 20 53 49 47 4e 45 44 20 29 20 2b 20 2b 20 63  S SIGNED ) + + c
2e640 6f 6c 31 20 2b 20 36 38 20 41 53 20 63 6f 6c 30  ol1 + 68 AS col0
2e650 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
2e660 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 34 32 0d 0a 31  r0..----..142..1
2e670 36 31 0d 0a 39 37 0d 0a 0d 0a 73 6b 69 70 69 66  61..97....skipif
2e680 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
2e690 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
2e6a0 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
2e6b0 32 39 30 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  290..SELECT ALL 
2e6c0 43 41 53 54 20 28 20 63 6f 6c 30 20 41 53 20 49  CAST ( col0 AS I
2e6d0 4e 54 45 47 45 52 20 29 20 2b 20 2b 20 63 6f 6c  NTEGER ) + + col
2e6e0 31 20 2b 20 36 38 20 41 53 20 63 6f 6c 30 20 46  1 + 68 AS col0 F
2e6f0 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
2e700 0d 0a 2d 2d 2d 2d 0d 0a 31 34 32 0d 0a 31 36 31  ..----..142..161
2e710 0d 0a 39 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..97....query I 
2e720 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
2e730 2d 20 2b 20 32 36 20 2a 20 2d 20 63 6f 6c 30 20  - + 26 * - col0 
2e740 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
2e750 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
2e760 0a 32 33 31 34 0d 0a 36 32 34 0d 0a 39 31 30 0d  .2314..624..910.
2e770 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
2e780 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79  # support for My
2e790 53 51 4c 20 73 70 65 63 69 66 69 63 20 73 79 73  SQL specific sys
2e7a0 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79  tem types and sy
2e7b0 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f  ntax..query I ro
2e7c0 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 32 39 32  wsort label-1292
2e7d0 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 2d  ..SELECT ALL + -
2e7e0 20 43 41 53 54 28 20 4e 55 4c 4c 20 41 53 20 44   CAST( NULL AS D
2e7f0 45 43 49 4d 41 4c 20 29 20 2b 20 63 6f 6c 30 20  ECIMAL ) + col0 
2e800 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
2e810 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e  0..----..NULL..N
2e820 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69  ULL..NULL....ski
2e830 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
2e840 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
2e850 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
2e860 6c 2d 31 32 39 32 0d 0a 53 45 4c 45 43 54 20 41  l-1292..SELECT A
2e870 4c 4c 20 2b 20 2d 20 43 41 53 54 20 28 20 4e 55  LL + - CAST ( NU
2e880 4c 4c 20 41 53 20 52 45 41 4c 20 29 20 2b 20 63  LL AS REAL ) + c
2e890 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol0 FROM tab0 AS
2e8a0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c   cor0..----..NUL
2e8b0 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d  L..NULL..NULL...
2e8c0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2e8d0 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 28  ..SELECT ALL + (
2e8e0 20 2b 20 39 31 20 29 20 2b 20 2d 20 63 6f 72 30   + 91 ) + - cor0
2e8f0 2e 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46 52  .col1 AS col1 FR
2e900 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
2e910 0a 2d 2d 2d 2d 0d 0a 36 35 0d 0a 37 38 0d 0a 38  .----..65..78..8
2e920 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  1....query I row
2e930 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 38  sort..SELECT - 8
2e940 35 20 2b 20 74 61 62 30 2e 63 6f 6c 30 20 2b 20  5 + tab0.col0 + 
2e950 33 33 20 46 52 4f 4d 20 74 61 62 30 2c 20 74 61  33 FROM tab0, ta
2e960 62 32 20 41 53 20 63 6f 72 30 2c 20 74 61 62 30  b2 AS cor0, tab0
2e970 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a   AS cor1..----..
2e980 32 37 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e  27 values hashin
2e990 67 20 74 6f 20 36 65 37 64 39 37 62 32 39 39 63  g to 6e7d97b299c
2e9a0 39 30 65 34 64 30 32 32 31 38 61 66 39 39 35 32  90e4d02218af9952
2e9b0 37 63 38 62 61 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  7c8ba....onlyif 
2e9c0 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20  mysql # support 
2e9d0 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66  for MySQL specif
2e9e0 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20  ic system types 
2e9f0 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72  and syntax..quer
2ea00 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
2ea10 6c 2d 31 32 39 35 0d 0a 53 45 4c 45 43 54 20 2d  l-1295..SELECT -
2ea20 20 43 41 53 54 28 20 2b 20 63 6f 6c 30 20 41 53   CAST( + col0 AS
2ea30 20 53 49 47 4e 45 44 20 29 20 2d 20 2d 20 63 6f   SIGNED ) - - co
2ea40 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72  l0 FROM tab0 cor
2ea50 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30  0..----..0..0..0
2ea60 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
2ea70 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
2ea80 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
2ea90 72 74 20 6c 61 62 65 6c 2d 31 32 39 35 0d 0a 53  rt label-1295..S
2eaa0 45 4c 45 43 54 20 2d 20 43 41 53 54 20 28 20 2b  ELECT - CAST ( +
2eab0 20 63 6f 6c 30 20 41 53 20 49 4e 54 45 47 45 52   col0 AS INTEGER
2eac0 20 29 20 2d 20 2d 20 63 6f 6c 30 20 46 52 4f 4d   ) - - col0 FROM
2ead0 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab0 cor0..----
2eae0 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a 71 75 65  ..0..0..0....que
2eaf0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
2eb00 4c 45 43 54 20 36 34 20 2a 20 2b 20 38 31 20 2d  LECT 64 * + 81 -
2eb10 20 2d 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62   - col0 FROM tab
2eb20 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
2eb30 0a 35 31 39 31 0d 0a 35 32 36 32 0d 0a 35 32 36  .5191..5262..526
2eb40 33 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  3....onlyif mysq
2eb50 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20  l # support for 
2eb60 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63 20 73  MySQL specific s
2eb70 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20  ystem types and 
2eb80 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20  syntax..query I 
2eb90 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 32  rowsort label-12
2eba0 39 37 0d 0a 53 45 4c 45 43 54 20 2d 20 43 41 53  97..SELECT - CAS
2ebb0 54 28 20 63 6f 6c 31 20 41 53 20 53 49 47 4e 45  T( col1 AS SIGNE
2ebc0 44 20 29 20 2a 20 63 6f 6c 32 20 2b 20 63 6f 6c  D ) * col2 + col
2ebd0 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  1 FROM tab0 AS c
2ebe0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 37 35 32  or0..----..-2752
2ebf0 0d 0a 2d 37 33 37 31 0d 0a 30 0d 0a 0d 0a 73 6b  ..-7371..0....sk
2ec00 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
2ec10 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
2ec20 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
2ec30 65 6c 2d 31 32 39 37 0d 0a 53 45 4c 45 43 54 20  el-1297..SELECT 
2ec40 2d 20 43 41 53 54 20 28 20 63 6f 6c 31 20 41 53  - CAST ( col1 AS
2ec50 20 49 4e 54 45 47 45 52 20 29 20 2a 20 63 6f 6c   INTEGER ) * col
2ec60 32 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61  2 + col1 FROM ta
2ec70 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
2ec80 0d 0a 2d 32 37 35 32 0d 0a 2d 37 33 37 31 0d 0a  ..-2752..-7371..
2ec90 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74  0....skipif post
2eca0 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65  gresql # Postgre
2ecb0 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20  SQL requires AS 
2ecc0 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75  when renaming ou
2ecd0 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75  tput columns..qu
2ece0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
2ecf0 45 4c 45 43 54 20 2d 20 2d 20 63 6f 6c 30 20 2b  ELECT - - col0 +
2ed00 20 2d 20 63 6f 6c 30 20 63 6f 6c 30 20 46 52 4f   - col0 col0 FRO
2ed10 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
2ed20 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d  ----..0..0..0...
2ed30 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2ed40 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 31 20  ..SELECT - col1 
2ed50 2a 20 63 6f 6c 32 20 2b 20 63 6f 6c 32 20 41 53  * col2 + col2 AS
2ed60 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20   col1 FROM tab0 
2ed70 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
2ed80 32 38 30 35 0d 0a 2d 37 33 38 30 0d 0a 2d 39 36  2805..-7380..-96
2ed90 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
2eda0 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d   # support for M
2edb0 79 53 51 4c 20 73 70 65 63 69 66 69 63 20 73 79  ySQL specific sy
2edc0 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73  stem types and s
2edd0 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72  yntax..query I r
2ede0 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 33 30  owsort label-130
2edf0 30 0d 0a 53 45 4c 45 43 54 20 2d 20 43 41 53 54  0..SELECT - CAST
2ee00 28 20 2b 20 63 6f 6c 32 20 41 53 20 53 49 47 4e  ( + col2 AS SIGN
2ee10 45 44 20 29 20 2b 20 63 6f 6c 32 20 41 53 20 63  ED ) + col2 AS c
2ee20 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol1 FROM tab1 AS
2ee30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a   cor0..----..0..
2ee40 30 0d 0a 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  0..0....skipif m
2ee50 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
2ee60 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
2ee70 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 33 30  owsort label-130
2ee80 30 0d 0a 53 45 4c 45 43 54 20 2d 20 43 41 53 54  0..SELECT - CAST
2ee90 20 28 20 2b 20 63 6f 6c 32 20 41 53 20 49 4e 54   ( + col2 AS INT
2eea0 45 47 45 52 20 29 20 2b 20 63 6f 6c 32 20 41 53  EGER ) + col2 AS
2eeb0 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20   col1 FROM tab1 
2eec0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30  AS cor0..----..0
2eed0 0d 0a 30 0d 0a 30 0d 0a 0d 0a 73 6b 69 70 69 66  ..0..0....skipif
2eee0 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f   postgresql # Po
2eef0 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65  stgreSQL require
2ef00 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69  s AS when renami
2ef10 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e  ng output column
2ef20 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  s..query I rowso
2ef30 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63  rt..SELECT ALL c
2ef40 6f 6c 32 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20  ol2 + cor0.col0 
2ef50 2b 20 2b 20 63 6f 6c 30 20 63 6f 6c 32 20 46 52  + + col0 col2 FR
2ef60 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
2ef70 0a 2d 2d 2d 2d 0d 0a 31 38 32 0d 0a 31 39 36 0d  .----..182..196.
2ef80 0a 34 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .41....query I r
2ef90 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
2efa0 20 63 6f 6c 31 20 2b 20 2d 20 32 20 2a 20 2b 20   col1 + - 2 * + 
2efb0 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41  col1 FROM tab1 A
2efc0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33  S cor0..----..-3
2efd0 30 0d 0a 2d 33 39 0d 0a 2d 37 38 0d 0a 0d 0a 71  0..-39..-78....q
2efe0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
2eff0 53 45 4c 45 43 54 20 63 6f 6c 32 20 2b 20 37 35  SELECT col2 + 75
2f000 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
2f010 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
2f020 0d 0a 31 30 38 0d 0a 31 35 37 0d 0a 37 36 0d 0a  ..108..157..76..
2f030 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2f040 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
2f050 43 54 20 63 6f 6c 30 20 2b 20 28 20 37 36 20 29  CT col0 + ( 76 )
2f060 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
2f070 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 30 0d 0a 31  b0..----..100..1
2f080 31 31 0d 0a 31 36 35 0d 0a 0d 0a 71 75 65 72 79  11..165....query
2f090 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
2f0a0 43 54 20 63 6f 72 30 2e 63 6f 6c 31 20 2a 20 63  CT cor0.col1 * c
2f0b0 6f 6c 30 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f  ol0 + col1 AS co
2f0c0 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l0 FROM tab0 AS 
2f0d0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 31 35 30  cor0..----..2150
2f0e0 0d 0a 33 34 39 32 0d 0a 38 31 39 30 0d 0a 0d 0a  ..3492..8190....
2f0f0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
2f100 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f  .SELECT ALL + co
2f110 6c 32 20 2a 20 2d 20 63 6f 72 30 2e 63 6f 6c 32  l2 * - cor0.col2
2f120 20 2b 20 2b 20 34 39 20 46 52 4f 4d 20 74 61 62   + + 49 FROM tab
2f130 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
2f140 0a 2d 31 33 39 35 0d 0a 2d 36 32 37 0d 0a 2d 36  .-1395..-627..-6
2f150 38 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  80....query I ro
2f160 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
2f170 53 54 49 4e 43 54 20 2d 20 63 6f 72 30 2e 63 6f  STINCT - cor0.co
2f180 6c 31 20 2d 20 2b 20 63 6f 6c 31 20 41 53 20 63  l1 - + col1 AS c
2f190 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol2 FROM tab1 AS
2f1a0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 30   cor0..----..-20
2f1b0 0d 0a 2d 32 36 0d 0a 2d 35 32 0d 0a 0d 0a 71 75  ..-26..-52....qu
2f1c0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
2f1d0 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 32 20 2a  ELECT ALL col2 *
2f1e0 20 63 6f 6c 30 20 2b 20 28 20 63 6f 6c 31 20 29   col0 + ( col1 )
2f1f0 20 2a 20 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c 31   * col1 * + col1
2f200 20 2b 20 2b 20 63 6f 6c 32 20 41 53 20 63 6f 6c   + + col2 AS col
2f210 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  1 FROM tab2 AS c
2f220 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 30 37 34 33  or0..----..20743
2f230 33 0d 0a 33 30 30 30 37 0d 0a 37 39 35 33 0d 0a  3..30007..7953..
2f240 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
2f250 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f   use DIV operato
2f260 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69  r for integer di
2f270 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20  vision..query I 
2f280 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 33  rowsort label-13
2f290 30 39 0d 0a 53 45 4c 45 43 54 20 2b 20 39 30 20  09..SELECT + 90 
2f2a0 2b 20 2b 20 63 6f 6c 31 20 44 49 56 20 2d 20 63  + + col1 DIV - c
2f2b0 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol0 FROM tab0 AS
2f2c0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 38 37 0d   cor0..----..87.
2f2d0 0a 38 38 0d 0a 38 39 0d 0a 0d 0a 73 6b 69 70 69  .88..89....skipi
2f2e0 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
2f2f0 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
2f300 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
2f310 31 33 30 39 0d 0a 53 45 4c 45 43 54 20 2b 20 39  1309..SELECT + 9
2f320 30 20 2b 20 2b 20 63 6f 6c 31 20 2f 20 2d 20 63  0 + + col1 / - c
2f330 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol0 FROM tab0 AS
2f340 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 38 37 0d   cor0..----..87.
2f350 0a 38 38 0d 0a 38 39 0d 0a 0d 0a 71 75 65 72 79  .88..89....query
2f360 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
2f370 43 54 20 2b 20 38 33 20 2b 20 2b 20 63 6f 6c 31  CT + 83 + + col1
2f380 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
2f390 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
2f3a0 0d 0a 31 30 39 0d 0a 39 33 0d 0a 39 36 0d 0a 0d  ..109..93..96...
2f3b0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2f3c0 0d 0a 53 45 4c 45 43 54 20 32 35 20 2a 20 2d 20  ..SELECT 25 * - 
2f3d0 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46 52 4f  col1 AS col2 FRO
2f3e0 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
2f3f0 2d 2d 2d 2d 0d 0a 2d 32 35 30 0d 0a 2d 33 32 35  ----..-250..-325
2f400 0d 0a 2d 36 35 30 0d 0a 0d 0a 71 75 65 72 79 20  ..-650....query 
2f410 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
2f420 54 20 41 4c 4c 20 63 6f 6c 32 20 2a 20 30 20 46  T ALL col2 * 0 F
2f430 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
2f440 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d  ..----..0..0..0.
2f450 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
2f460 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79  # support for My
2f470 53 51 4c 20 73 70 65 63 69 66 69 63 20 73 79 73  SQL specific sys
2f480 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79  tem types and sy
2f490 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f  ntax..query I ro
2f4a0 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 33 31 33  wsort label-1313
2f4b0 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 30 20 2a 20  ..SELECT col0 * 
2f4c0 43 41 53 54 28 20 63 6f 6c 31 20 41 53 20 53 49  CAST( col1 AS SI
2f4d0 47 4e 45 44 20 29 20 46 52 4f 4d 20 74 61 62 32  GNED ) FROM tab2
2f4e0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
2f4f0 31 33 34 33 0d 0a 32 31 37 0d 0a 34 36 30 32 0d  1343..217..4602.
2f500 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
2f510 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
2f520 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2f530 74 20 6c 61 62 65 6c 2d 31 33 31 33 0d 0a 53 45  t label-1313..SE
2f540 4c 45 43 54 20 63 6f 6c 30 20 2a 20 43 41 53 54  LECT col0 * CAST
2f550 20 28 20 63 6f 6c 31 20 41 53 20 49 4e 54 45 47   ( col1 AS INTEG
2f560 45 52 20 29 20 46 52 4f 4d 20 74 61 62 32 20 41  ER ) FROM tab2 A
2f570 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33  S cor0..----..13
2f580 34 33 0d 0a 32 31 37 0d 0a 34 36 30 32 0d 0a 0d  43..217..4602...
2f590 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2f5a0 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63  ..SELECT ALL + c
2f5b0 6f 6c 32 20 2b 20 63 6f 6c 32 20 2a 20 2b 20 63  ol2 + col2 * + c
2f5c0 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol2 FROM tab1 AS
2f5d0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 39 37   cor0..----..297
2f5e0 30 0d 0a 33 33 30 36 0d 0a 39 33 31 32 0d 0a 0d  0..3306..9312...
2f5f0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2f600 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
2f610 54 20 2d 20 63 6f 6c 31 20 2a 20 2d 20 28 20 2d  T - col1 * - ( -
2f620 20 63 6f 6c 30 20 29 20 41 53 20 63 6f 6c 31 20   col0 ) AS col1 
2f630 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
2f640 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 30 36 34 0d 0a  0..----..-2064..
2f650 2d 33 33 39 35 0d 0a 2d 38 30 39 39 0d 0a 0d 0a  -3395..-8099....
2f660 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
2f670 0a 53 45 4c 45 43 54 20 63 6f 6c 32 20 2a 20 2d  .SELECT col2 * -
2f680 20 63 6f 6c 31 20 2b 20 28 20 63 6f 72 30 2e 63   col1 + ( cor0.c
2f690 6f 6c 31 20 29 20 46 52 4f 4d 20 74 61 62 31 20  ol1 ) FROM tab1 
2f6a0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32 33  cor0..----..-123
2f6b0 35 0d 0a 2d 31 33 37 38 0d 0a 2d 35 36 30 0d 0a  5..-1378..-560..
2f6c0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2f6d0 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 34 31  t..SELECT ALL 41
2f6e0 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
2f6f0 62 31 2c 20 74 61 62 31 20 41 53 20 63 6f 72 30  b1, tab1 AS cor0
2f700 2c 20 74 61 62 30 20 41 53 20 63 6f 72 31 0d 0a  , tab0 AS cor1..
2f710 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75 65 73 20  ----..27 values 
2f720 68 61 73 68 69 6e 67 20 74 6f 20 66 36 61 34 34  hashing to f6a44
2f730 30 62 34 37 38 66 30 64 30 30 66 38 33 32 36 61  0b478f0d00f8326a
2f740 38 63 35 31 66 65 30 39 34 62 38 0d 0a 0d 0a 71  8c51fe094b8....q
2f750 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
2f760 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
2f770 2b 20 2d 20 63 6f 6c 31 20 2b 20 2b 20 35 30 20  + - col1 + + 50 
2f780 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
2f790 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
2f7a0 0a 32 34 0d 0a 33 37 0d 0a 34 30 0d 0a 0d 0a 71  .24..37..40....q
2f7b0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
2f7c0 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
2f7d0 2b 20 63 6f 6c 30 20 2a 20 2d 20 28 20 2d 20 63  + col0 * - ( - c
2f7e0 6f 6c 31 20 29 20 41 53 20 63 6f 6c 30 20 46 52  ol1 ) AS col0 FR
2f7f0 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
2f800 0a 2d 2d 2d 2d 0d 0a 31 33 34 33 0d 0a 32 31 37  .----..1343..217
2f810 0d 0a 34 36 30 32 0d 0a 0d 0a 71 75 65 72 79 20  ..4602....query 
2f820 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
2f830 54 20 41 4c 4c 20 2d 20 63 6f 6c 31 20 2b 20 2b  T ALL - col1 + +
2f840 20 63 6f 6c 32 20 2a 20 37 20 41 53 20 63 6f 6c   col2 * 7 AS col
2f850 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  2 FROM tab0 AS c
2f860 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 39 30 0d 0a  or0..----..-90..
2f870 31 34 35 0d 0a 34 38 33 0d 0a 0d 0a 71 75 65 72  145..483....quer
2f880 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
2f890 45 43 54 20 2b 20 32 32 20 46 52 4f 4d 20 74 61  ECT + 22 FROM ta
2f8a0 62 32 2c 20 74 61 62 32 20 41 53 20 63 6f 72 30  b2, tab2 AS cor0
2f8b0 2c 20 74 61 62 32 20 41 53 20 63 6f 72 31 0d 0a  , tab2 AS cor1..
2f8c0 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75 65 73 20  ----..27 values 
2f8d0 68 61 73 68 69 6e 67 20 74 6f 20 37 64 64 61 33  hashing to 7dda3
2f8e0 38 32 65 37 63 30 38 34 32 38 61 62 61 63 38 36  82e7c08428abac86
2f8f0 30 30 66 64 36 39 36 65 62 33 65 0d 0a 0d 0a 6f  00fd696eb3e....o
2f900 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73  nlyif mysql # us
2f910 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66  e DIV operator f
2f920 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73  or integer divis
2f930 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ion..query I row
2f940 73 6f 72 74 20 6c 61 62 65 6c 2d 31 33 32 32 0d  sort label-1322.
2f950 0a 53 45 4c 45 43 54 20 2d 20 2d 20 63 6f 6c 30  .SELECT - - col0
2f960 20 44 49 56 20 2d 20 28 20 2b 20 63 6f 6c 30 20   DIV - ( + col0 
2f970 29 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  ) AS col0 FROM t
2f980 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
2f990 2d 0d 0a 2d 31 0d 0a 2d 31 0d 0a 2d 31 0d 0a 0d  -..-1..-1..-1...
2f9a0 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
2f9b0 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
2f9c0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
2f9d0 6c 61 62 65 6c 2d 31 33 32 32 0d 0a 53 45 4c 45  label-1322..SELE
2f9e0 43 54 20 2d 20 2d 20 63 6f 6c 30 20 2f 20 2d 20  CT - - col0 / - 
2f9f0 28 20 2b 20 63 6f 6c 30 20 29 20 41 53 20 63 6f  ( + col0 ) AS co
2fa00 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l0 FROM tab0 AS 
2fa10 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a  cor0..----..-1..
2fa20 2d 31 0d 0a 2d 31 0d 0a 0d 0a 71 75 65 72 79 20  -1..-1....query 
2fa30 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
2fa40 54 20 2d 20 63 6f 72 31 2e 63 6f 6c 32 20 41 53  T - cor1.col2 AS
2fa50 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20   col0 FROM tab0 
2fa60 41 53 20 63 6f 72 30 20 43 52 4f 53 53 20 4a 4f  AS cor0 CROSS JO
2fa70 49 4e 20 74 61 62 30 20 41 53 20 63 6f 72 31 0d  IN tab0 AS cor1.
2fa80 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20  .----..9 values 
2fa90 68 61 73 68 69 6e 67 20 74 6f 20 62 35 61 34 31  hashing to b5a41
2faa0 30 32 31 30 37 65 35 65 62 64 32 36 65 33 34 31  02107e5ebd26e341
2fab0 35 33 38 66 34 66 65 64 65 31 65 0d 0a 0d 0a 71  538f4fede1e....q
2fac0 75 65 72 79 20 49 49 49 49 49 49 49 49 49 49 49  uery IIIIIIIIIII
2fad0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
2fae0 54 20 44 49 53 54 49 4e 43 54 20 2a 20 46 52 4f  T DISTINCT * FRO
2faf0 4d 20 74 61 62 30 20 63 6f 72 30 20 43 52 4f 53  M tab0 cor0 CROS
2fb00 53 20 4a 4f 49 4e 20 74 61 62 31 2c 20 74 61 62  S JOIN tab1, tab
2fb10 30 20 41 53 20 63 6f 72 31 2c 20 74 61 62 32 20  0 AS cor1, tab2 
2fb20 41 53 20 63 6f 72 32 0d 0a 2d 2d 2d 2d 0d 0a 39  AS cor2..----..9
2fb30 37 32 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e  72 values hashin
2fb40 67 20 74 6f 20 61 39 30 36 38 62 37 30 30 34 36  g to a9068b70046
2fb50 34 39 39 33 64 62 39 66 61 65 36 66 36 33 30 36  4993db9fae6f6306
2fb60 30 35 66 64 65 0d 0a 0d 0a 71 75 65 72 79 20 49  05fde....query I
2fb70 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
2fb80 20 44 49 53 54 49 4e 43 54 20 2b 20 2d 20 39 20   DISTINCT + - 9 
2fb90 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31  + col0 FROM tab1
2fba0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
2fbb0 2d 36 0d 0a 35 35 0d 0a 37 31 0d 0a 0d 0a 71 75  -6..55..71....qu
2fbc0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
2fbd0 45 4c 45 43 54 20 31 35 20 2a 20 35 35 20 41 53  ELECT 15 * 55 AS
2fbe0 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 0d   col2 FROM tab0.
2fbf0 0a 2d 2d 2d 2d 0d 0a 38 32 35 0d 0a 38 32 35 0d  .----..825..825.
2fc00 0a 38 32 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .825....query I 
2fc10 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
2fc20 2d 20 63 6f 6c 32 20 2a 20 37 35 20 41 53 20 63  - col2 * 75 AS c
2fc30 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d  ol2 FROM tab1..-
2fc40 2d 2d 2d 0d 0a 2d 34 30 35 30 0d 0a 2d 34 32 37  ---..-4050..-427
2fc50 35 0d 0a 2d 37 32 30 30 0d 0a 0d 0a 71 75 65 72  5..-7200....quer
2fc60 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
2fc70 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63  ECT DISTINCT + c
2fc80 6f 6c 32 20 2a 20 63 6f 6c 31 20 2b 20 35 38 20  ol2 * col1 + 58 
2fc90 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d  FROM tab1..----.
2fca0 0a 31 33 30 36 0d 0a 31 34 36 32 0d 0a 36 32 38  .1306..1462..628
2fcb0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
2fcc0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 33 31  ort..SELECT - 31
2fcd0 20 2b 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c   + + col1 AS col
2fce0 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  2 FROM tab0 AS c
2fcf0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 35 35 0d 0a 36  or0..----..55..6
2fd00 30 0d 0a 36 36 0d 0a 0d 0a 71 75 65 72 79 20 49  0..66....query I
2fd10 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
2fd20 20 63 6f 6c 30 20 2d 20 35 39 20 41 53 20 63 6f   col0 - 59 AS co
2fd30 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l2 FROM tab1 AS 
2fd40 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 36 0d  cor0..----..-56.
2fd50 0a 32 31 0d 0a 35 0d 0a 0d 0a 6f 6e 6c 79 69 66  .21..5....onlyif
2fd60 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74   mysql # support
2fd70 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69   for MySQL speci
2fd80 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73  fic system types
2fd90 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65   and syntax..que
2fda0 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
2fdb0 65 6c 2d 31 33 33 31 0d 0a 53 45 4c 45 43 54 20  el-1331..SELECT 
2fdc0 2d 20 43 41 53 54 28 20 2b 20 63 6f 6c 30 20 41  - CAST( + col0 A
2fdd0 53 20 53 49 47 4e 45 44 20 29 20 2b 20 63 6f 72  S SIGNED ) + cor
2fde0 30 2e 63 6f 6c 32 20 2a 20 2b 20 43 41 53 54 28  0.col2 * + CAST(
2fdf0 20 2d 20 33 30 20 2b 20 63 6f 6c 32 20 41 53 20   - 30 + col2 AS 
2fe00 53 49 47 4e 45 44 20 29 20 41 53 20 63 6f 6c 30  SIGNED ) AS col0
2fe10 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
2fe20 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 39 33 0d 0a  r0..----..1293..
2fe30 31 34 37 35 0d 0a 36 32 35 36 0d 0a 0d 0a 73 6b  1475..6256....sk
2fe40 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
2fe50 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
2fe60 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
2fe70 65 6c 2d 31 33 33 31 0d 0a 53 45 4c 45 43 54 20  el-1331..SELECT 
2fe80 2d 20 43 41 53 54 20 28 20 2b 20 63 6f 6c 30 20  - CAST ( + col0 
2fe90 41 53 20 49 4e 54 45 47 45 52 20 29 20 2b 20 63  AS INTEGER ) + c
2fea0 6f 72 30 2e 63 6f 6c 32 20 2a 20 2b 20 43 41 53  or0.col2 * + CAS
2feb0 54 20 28 20 2d 20 33 30 20 2b 20 63 6f 6c 32 20  T ( - 30 + col2 
2fec0 41 53 20 49 4e 54 45 47 45 52 20 29 20 41 53 20  AS INTEGER ) AS 
2fed0 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41  col0 FROM tab1 A
2fee0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32  S cor0..----..12
2fef0 39 33 0d 0a 31 34 37 35 0d 0a 36 32 35 36 0d 0a  93..1475..6256..
2ff00 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2ff10 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20  t..SELECT ALL + 
2ff20 33 33 20 2a 20 2b 20 63 6f 6c 31 20 41 53 20 63  33 * + col1 AS c
2ff30 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol1 FROM tab2 AS
2ff40 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 32   cor0..----..102
2ff50 33 0d 0a 31 39 34 37 0d 0a 35 36 31 0d 0a 0d 0a  3..1947..561....
2ff60 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
2ff70 0a 53 45 4c 45 43 54 20 2b 20 37 31 20 2b 20 63  .SELECT + 71 + c
2ff80 6f 6c 30 20 2a 20 2b 20 63 6f 6c 32 20 46 52 4f  ol0 * + col2 FRO
2ff90 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
2ffa0 2d 2d 2d 2d 0d 0a 32 30 39 39 0d 0a 32 36 30 0d  ----..2099..260.
2ffb0 0a 33 30 37 33 0d 0a 0d 0a 71 75 65 72 79 20 49  .3073....query I
2ffc0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
2ffd0 20 44 49 53 54 49 4e 43 54 20 35 37 20 2b 20 2b   DISTINCT 57 + +
2ffe0 20 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c 31 20 41   col1 * - col1 A
2fff0 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30  S col2 FROM tab0
30000 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
30010 2d 37 33 33 39 0d 0a 2d 38 32 32 34 0d 0a 2d 39  -7339..-8224..-9
30020 33 35 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  352....query I r
30030 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
30040 20 36 32 20 2b 20 2d 20 63 6f 6c 30 20 46 52 4f   62 + - col0 FRO
30050 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
30060 2d 2d 2d 2d 0d 0a 2d 31 34 30 0d 0a 2d 31 34 31  ----..-140..-141
30070 0d 0a 2d 36 39 0d 0a 0d 0a 71 75 65 72 79 20 49  ..-69....query I
30080 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
30090 20 41 4c 4c 20 2b 20 2d 20 38 35 20 2b 20 2b 20   ALL + - 85 + + 
300a0 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41  col2 FROM tab1 A
300b0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32  S cor0..----..-2
300c0 38 0d 0a 2d 33 31 0d 0a 31 31 0d 0a 0d 0a 6f 6e  8..-31..11....on
300d0 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
300e0 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
300f0 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
30100 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
30110 6f 72 74 20 6c 61 62 65 6c 2d 31 33 33 37 0d 0a  ort label-1337..
30120 53 45 4c 45 43 54 20 28 20 63 6f 6c 32 20 29 20  SELECT ( col2 ) 
30130 44 49 56 20 2d 20 63 6f 6c 32 20 46 52 4f 4d 20  DIV - col2 FROM 
30140 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
30150 2d 2d 0d 0a 2d 31 0d 0a 2d 31 0d 0a 2d 31 0d 0a  --..-1..-1..-1..
30160 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
30170 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
30180 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
30190 20 6c 61 62 65 6c 2d 31 33 33 37 0d 0a 53 45 4c   label-1337..SEL
301a0 45 43 54 20 28 20 63 6f 6c 32 20 29 20 2f 20 2d  ECT ( col2 ) / -
301b0 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20   col2 FROM tab1 
301c0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
301d0 31 0d 0a 2d 31 0d 0a 2d 31 0d 0a 0d 0a 71 75 65  1..-1..-1....que
301e0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
301f0 4c 45 43 54 20 2d 20 2d 20 63 6f 6c 30 20 2b 20  LECT - - col0 + 
30200 34 34 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  44 FROM tab2 AS 
30210 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 32 0d  cor0..----..122.
30220 0a 31 32 33 0d 0a 35 31 0d 0a 0d 0a 71 75 65 72  .123..51....quer
30230 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
30240 45 43 54 20 41 4c 4c 20 38 31 20 2b 20 2b 20 63  ECT ALL 81 + + c
30250 6f 6c 30 20 2a 20 2d 20 63 6f 6c 30 20 41 53 20  ol0 * - col0 AS 
30260 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41  col0 FROM tab1 A
30270 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 34  S cor0..----..-4
30280 30 31 35 0d 0a 2d 36 33 31 39 0d 0a 37 32 0d 0a  015..-6319..72..
30290 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
302a0 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 31  t..SELECT + col1
302b0 20 2a 20 2b 20 63 6f 6c 30 20 2d 20 37 31 20 41   * + col0 - 71 A
302c0 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31  S col1 FROM tab1
302d0 0d 0a 2d 2d 2d 2d 0d 0a 35 36 39 0d 0a 37 0d 0a  ..----..569..7..
302e0 39 36 39 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f  969....skipif po
302f0 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67  stgresql # Postg
30300 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41  reSQL requires A
30310 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20  S when renaming 
30320 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a  output columns..
30330 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
30340 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 31 20 2a  .SELECT - col1 *
30350 20 2d 20 34 39 20 63 6f 6c 31 20 46 52 4f 4d 20   - 49 col1 FROM 
30360 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
30370 2d 2d 0d 0a 31 32 37 34 0d 0a 34 39 30 0d 0a 36  --..1274..490..6
30380 33 37 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  37....onlyif mys
30390 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65  ql # use DIV ope
303a0 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65  rator for intege
303b0 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72  r division..quer
303c0 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
303d0 6c 2d 31 33 34 32 0d 0a 53 45 4c 45 43 54 20 63  l-1342..SELECT c
303e0 6f 6c 31 20 2b 20 34 36 20 44 49 56 20 63 6f 6c  ol1 + 46 DIV col
303f0 32 20 2b 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61  2 + col2 FROM ta
30400 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 30 39 0d 0a 36  b1..----..109..6
30410 37 0d 0a 38 30 0d 0a 0d 0a 73 6b 69 70 69 66 20  7..80....skipif 
30420 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
30430 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
30440 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 33  rowsort label-13
30450 34 32 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 31 20  42..SELECT col1 
30460 2b 20 34 36 20 2f 20 63 6f 6c 32 20 2b 20 63 6f  + 46 / col2 + co
30470 6c 32 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d  l2 FROM tab1..--
30480 2d 2d 0d 0a 31 30 39 0d 0a 36 37 0d 0a 38 30 0d  --..109..67..80.
30490 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
304a0 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 33 35 20  rt..SELECT - 35 
304b0 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 46 52 4f 4d  + cor0.col2 FROM
304c0 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
304d0 2d 2d 2d 0d 0a 31 39 0d 0a 32 32 0d 0a 36 31 0d  ---..19..22..61.
304e0 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
304f0 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74  # use DIV operat
30500 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64  or for integer d
30510 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49  ivision..query I
30520 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
30530 33 34 34 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f  344..SELECT + co
30540 6c 32 20 44 49 56 20 2d 20 36 34 20 46 52 4f 4d  l2 DIV - 64 FROM
30550 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a   tab2..----..0..
30560 30 0d 0a 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  0..0....skipif m
30570 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
30580 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
30590 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 33 34  owsort label-134
305a0 34 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 32  4..SELECT + col2
305b0 20 2f 20 2d 20 36 34 20 46 52 4f 4d 20 74 61 62   / - 64 FROM tab
305c0 32 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30  2..----..0..0..0
305d0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
305e0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
305f0 2b 20 63 6f 6c 32 20 2a 20 63 6f 6c 32 20 2b 20  + col2 * col2 + 
30600 2d 20 37 34 20 46 52 4f 4d 20 74 61 62 30 20 41  - 74 FROM tab0 A
30610 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 37  S cor0..----..-7
30620 33 0d 0a 31 30 31 35 0d 0a 36 36 35 30 0d 0a 0d  3..1015..6650...
30630 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
30640 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72  use DIV operator
30650 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76   for integer div
30660 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72  ision..query I r
30670 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 33 34  owsort label-134
30680 36 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  6..SELECT DISTIN
30690 43 54 20 2d 20 63 6f 6c 32 20 44 49 56 20 2d 20  CT - col2 DIV - 
306a0 31 33 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  13 FROM tab1 AS 
306b0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 34 0d 0a 37  cor0..----..4..7
306c0 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
306d0 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
306e0 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
306f0 72 74 20 6c 61 62 65 6c 2d 31 33 34 36 0d 0a 53  rt label-1346..S
30700 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d  ELECT DISTINCT -
30710 20 63 6f 6c 32 20 2f 20 2d 20 31 33 20 46 52 4f   col2 / - 13 FRO
30720 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
30730 2d 2d 2d 2d 0d 0a 34 0d 0a 37 0d 0a 0d 0a 6f 6e  ----..4..7....on
30740 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70  lyif mysql # sup
30750 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73  port for MySQL s
30760 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20 74  pecific system t
30770 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d  ypes and syntax.
30780 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
30790 20 6c 61 62 65 6c 2d 31 33 34 37 0d 0a 53 45 4c   label-1347..SEL
307a0 45 43 54 20 2b 20 43 41 53 54 28 20 2d 20 31 34  ECT + CAST( - 14
307b0 20 41 53 20 53 49 47 4e 45 44 20 29 20 2b 20 2d   AS SIGNED ) + -
307c0 20 63 6f 72 31 2e 63 6f 6c 31 20 41 53 20 63 6f   cor1.col1 AS co
307d0 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l2 FROM tab0 AS 
307e0 63 6f 72 30 20 43 52 4f 53 53 20 4a 4f 49 4e 20  cor0 CROSS JOIN 
307f0 74 61 62 32 20 41 53 20 63 6f 72 31 0d 0a 2d 2d  tab2 AS cor1..--
30800 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73  --..9 values has
30810 68 69 6e 67 20 74 6f 20 31 30 34 66 35 65 39 35  hing to 104f5e95
30820 64 39 62 66 34 35 36 35 63 38 30 32 34 65 39 65  d9bf4565c8024e9e
30830 35 34 37 32 30 31 38 39 0d 0a 0d 0a 73 6b 69 70  54720189....skip
30840 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
30850 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
30860 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
30870 2d 31 33 34 37 0d 0a 53 45 4c 45 43 54 20 2b 20  -1347..SELECT + 
30880 43 41 53 54 20 28 20 2d 20 31 34 20 41 53 20 49  CAST ( - 14 AS I
30890 4e 54 45 47 45 52 20 29 20 2b 20 2d 20 63 6f 72  NTEGER ) + - cor
308a0 31 2e 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46  1.col1 AS col2 F
308b0 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
308c0 20 43 52 4f 53 53 20 4a 4f 49 4e 20 74 61 62 32   CROSS JOIN tab2
308d0 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a   AS cor1..----..
308e0 39 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67  9 values hashing
308f0 20 74 6f 20 31 30 34 66 35 65 39 35 64 39 62 66   to 104f5e95d9bf
30900 34 35 36 35 63 38 30 32 34 65 39 65 35 34 37 32  4565c8024e9e5472
30910 30 31 38 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20  0189....query I 
30920 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
30930 44 49 53 54 49 4e 43 54 20 2d 20 2d 20 63 6f 72  DISTINCT - - cor
30940 30 2e 63 6f 6c 31 20 2a 20 35 31 20 2b 20 2d 20  0.col1 * 51 + - 
30950 31 39 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  19 AS col1 FROM 
30960 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
30970 2d 2d 0d 0a 31 33 30 37 0d 0a 34 39 31 0d 0a 36  --..1307..491..6
30980 34 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  44....query I ro
30990 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
309a0 4c 20 2b 20 2d 20 63 6f 6c 30 20 2b 20 2b 20 63  L + - col0 + + c
309b0 6f 6c 31 20 2a 20 2d 20 63 6f 6c 32 20 46 52 4f  ol1 * - col2 FRO
309c0 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
309d0 2d 2d 2d 2d 0d 0a 2d 31 33 32 0d 0a 2d 32 38 36  ----..-132..-286
309e0 32 0d 0a 2d 37 35 35 31 0d 0a 0d 0a 71 75 65 72  2..-7551....quer
309f0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
30a00 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 32 20 2a  ECT ALL + col2 *
30a10 20 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c 30 20 2b   col0 + + col0 +
30a20 20 63 6f 6c 30 20 2a 20 2d 20 63 6f 72 30 2e 63   col0 * - cor0.c
30a30 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol1 FROM tab1 AS
30a40 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 30 37   cor0..----..307
30a50 32 0d 0a 36 37 32 30 0d 0a 38 37 0d 0a 0d 0a 71  2..6720..87....q
30a60 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
30a70 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
30a80 2d 20 63 6f 6c 30 20 2b 20 2b 20 63 6f 72 30 2e  - col0 + + cor0.
30a90 63 6f 6c 30 20 2b 20 2b 20 39 33 20 2a 20 2d 20  col0 + + 93 * - 
30aa0 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46 52 4f  col1 AS col1 FRO
30ab0 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab2 cor0..---
30ac0 2d 0d 0a 2d 31 35 38 31 0d 0a 2d 32 38 38 33 0d  -..-1581..-2883.
30ad0 0a 2d 35 34 38 37 0d 0a 0d 0a 6f 6e 6c 79 69 66  .-5487....onlyif
30ae0 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74   mysql # support
30af0 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69   for MySQL speci
30b00 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73  fic system types
30b10 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65   and syntax..que
30b20 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
30b30 65 6c 2d 31 33 35 32 0d 0a 53 45 4c 45 43 54 20  el-1352..SELECT 
30b40 44 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c 30 20  DISTINCT + col0 
30b50 2a 20 43 41 53 54 28 20 63 6f 6c 32 20 41 53 20  * CAST( col2 AS 
30b60 53 49 47 4e 45 44 20 29 20 2d 20 2d 20 63 6f 6c  SIGNED ) - - col
30b70 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  1 FROM tab1 AS c
30b80 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 38 38 0d 0a  or0..----..188..
30b90 33 36 35 38 0d 0a 37 36 39 33 0d 0a 0d 0a 73 6b  3658..7693....sk
30ba0 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
30bb0 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
30bc0 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
30bd0 65 6c 2d 31 33 35 32 0d 0a 53 45 4c 45 43 54 20  el-1352..SELECT 
30be0 44 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c 30 20  DISTINCT + col0 
30bf0 2a 20 43 41 53 54 20 28 20 63 6f 6c 32 20 41 53  * CAST ( col2 AS
30c00 20 49 4e 54 45 47 45 52 20 29 20 2d 20 2d 20 63   INTEGER ) - - c
30c10 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol1 FROM tab1 AS
30c20 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 38 38   cor0..----..188
30c30 0d 0a 33 36 35 38 0d 0a 37 36 39 33 0d 0a 0d 0a  ..3658..7693....
30c40 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73  onlyif mysql # s
30c50 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c  upport for MySQL
30c60 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d   specific system
30c70 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61   types and synta
30c80 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  x..query I rowso
30c90 72 74 20 6c 61 62 65 6c 2d 31 33 35 33 0d 0a 53  rt label-1353..S
30ca0 45 4c 45 43 54 20 63 6f 6c 31 20 2b 20 43 41 53  ELECT col1 + CAS
30cb0 54 28 20 33 35 20 41 53 20 53 49 47 4e 45 44 20  T( 35 AS SIGNED 
30cc0 29 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30  ) col0 FROM tab0
30cd0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
30ce0 31 32 31 0d 0a 31 32 36 0d 0a 31 33 32 0d 0a 0d  121..126..132...
30cf0 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73  .skipif postgres
30d00 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20  ql # PostgreSQL 
30d10 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e  requires AS when
30d20 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74   renaming output
30d30 20 63 6f 6c 75 6d 6e 73 0d 0a 73 6b 69 70 69 66   columns..skipif
30d40 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
30d50 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
30d60 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
30d70 33 35 33 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 31  353..SELECT col1
30d80 20 2b 20 43 41 53 54 20 28 20 33 35 20 41 53 20   + CAST ( 35 AS 
30d90 49 4e 54 45 47 45 52 20 29 20 63 6f 6c 30 20 46  INTEGER ) col0 F
30da0 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
30db0 0d 0a 2d 2d 2d 2d 0d 0a 31 32 31 0d 0a 31 32 36  ..----..121..126
30dc0 0d 0a 31 33 32 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  ..132....onlyif 
30dd0 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20  mysql # use DIV 
30de0 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74  operator for int
30df0 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71  eger division..q
30e00 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
30e10 61 62 65 6c 2d 31 33 35 34 0d 0a 53 45 4c 45 43  abel-1354..SELEC
30e20 54 20 41 4c 4c 20 2b 20 2d 20 63 6f 6c 31 20 2a  T ALL + - col1 *
30e30 20 63 6f 6c 30 20 44 49 56 20 63 6f 6c 31 20 63   col0 DIV col1 c
30e40 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol0 FROM tab0 AS
30e50 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 34   cor0..----..-24
30e60 0d 0a 2d 33 35 0d 0a 2d 38 39 0d 0a 0d 0a 73 6b  ..-35..-89....sk
30e70 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20  ipif postgresql 
30e80 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71  # PostgreSQL req
30e90 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65  uires AS when re
30ea0 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f  naming output co
30eb0 6c 75 6d 6e 73 0d 0a 73 6b 69 70 69 66 20 6d 79  lumns..skipif my
30ec0 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
30ed0 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
30ee0 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 33 35 34  wsort label-1354
30ef0 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 2d  ..SELECT ALL + -
30f00 20 63 6f 6c 31 20 2a 20 63 6f 6c 30 20 2f 20 63   col1 * col0 / c
30f10 6f 6c 31 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61  ol1 col0 FROM ta
30f20 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
30f30 0d 0a 2d 32 34 0d 0a 2d 33 35 0d 0a 2d 38 39 0d  ..-24..-35..-89.
30f40 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
30f50 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74  # use DIV operat
30f60 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64  or for integer d
30f70 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49  ivision..query I
30f80 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
30f90 33 35 35 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  355..SELECT DIST
30fa0 49 4e 43 54 20 2d 20 63 6f 6c 31 20 2b 20 63 6f  INCT - col1 + co
30fb0 72 30 2e 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c 30  r0.col1 * - col0
30fc0 20 2b 20 2b 20 63 6f 6c 30 20 44 49 56 20 2b 20   + + col0 DIV + 
30fd0 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46 52 4f  col0 AS col1 FRO
30fe0 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
30ff0 2d 2d 2d 2d 0d 0a 2d 31 33 35 39 0d 0a 2d 32 34  ----..-1359..-24
31000 37 0d 0a 2d 34 36 36 30 0d 0a 0d 0a 73 6b 69 70  7..-4660....skip
31010 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
31020 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
31030 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
31040 2d 31 33 35 35 0d 0a 53 45 4c 45 43 54 20 44 49  -1355..SELECT DI
31050 53 54 49 4e 43 54 20 2d 20 63 6f 6c 31 20 2b 20  STINCT - col1 + 
31060 63 6f 72 30 2e 63 6f 6c 31 20 2a 20 2d 20 63 6f  cor0.col1 * - co
31070 6c 30 20 2b 20 2b 20 63 6f 6c 30 20 2f 20 2b 20  l0 + + col0 / + 
31080 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46 52 4f  col0 AS col1 FRO
31090 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
310a0 2d 2d 2d 2d 0d 0a 2d 31 33 35 39 0d 0a 2d 32 34  ----..-1359..-24
310b0 37 0d 0a 2d 34 36 36 30 0d 0a 0d 0a 71 75 65 72  7..-4660....quer
310c0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
310d0 45 43 54 20 2d 20 28 20 2b 20 36 39 20 29 20 46  ECT - ( + 69 ) F
310e0 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
310f0 0d 0a 2d 2d 2d 2d 0d 0a 2d 36 39 0d 0a 2d 36 39  ..----..-69..-69
31100 0d 0a 2d 36 39 0d 0a 0d 0a 71 75 65 72 79 20 49  ..-69....query I
31110 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
31120 20 41 4c 4c 20 2b 20 2d 20 63 6f 6c 31 20 2a 20   ALL + - col1 * 
31130 63 6f 6c 32 20 2b 20 63 6f 72 30 2e 63 6f 6c 31  col2 + cor0.col1
31140 20 2a 20 2d 20 63 6f 6c 31 20 41 53 20 63 6f 6c   * - col1 AS col
31150 30 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30  0 FROM tab0 cor0
31160 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 32 33 34 0d 0a  ..----..-10234..
31170 2d 31 35 37 34 33 0d 0a 2d 39 35 30 36 0d 0a 0d  -15743..-9506...
31180 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
31190 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51  support for MySQ
311a0 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65  L specific syste
311b0 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74  m types and synt
311c0 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ax..query I rows
311d0 6f 72 74 20 6c 61 62 65 6c 2d 31 33 35 38 0d 0a  ort label-1358..
311e0 53 45 4c 45 43 54 20 63 6f 6c 31 20 2b 20 43 41  SELECT col1 + CA
311f0 53 54 28 20 4e 55 4c 4c 20 41 53 20 44 45 43 49  ST( NULL AS DECI
31200 4d 41 4c 20 29 20 46 52 4f 4d 20 74 61 62 30 0d  MAL ) FROM tab0.
31210 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c  .----..NULL..NUL
31220 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69  L..NULL....skipi
31230 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
31240 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
31250 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
31260 31 33 35 38 0d 0a 53 45 4c 45 43 54 20 63 6f 6c  1358..SELECT col
31270 31 20 2b 20 43 41 53 54 20 28 20 4e 55 4c 4c 20  1 + CAST ( NULL 
31280 41 53 20 52 45 41 4c 20 29 20 46 52 4f 4d 20 74  AS REAL ) FROM t
31290 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d  ab0..----..NULL.
312a0 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73  .NULL..NULL....s
312b0 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c  kipif postgresql
312c0 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65   # PostgreSQL re
312d0 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72  quires AS when r
312e0 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63  enaming output c
312f0 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20  olumns..query I 
31300 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
31310 44 49 53 54 49 4e 43 54 20 28 20 2d 20 63 6f 6c  DISTINCT ( - col
31320 30 20 29 20 2a 20 63 6f 6c 30 20 63 6f 6c 30 20  0 ) * col0 col0 
31330 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d  FROM tab1..----.
31340 0a 2d 34 30 39 36 0d 0a 2d 36 34 30 30 0d 0a 2d  .-4096..-6400..-
31350 39 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  9....onlyif mysq
31360 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20  l # support for 
31370 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63 20 73  MySQL specific s
31380 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20  ystem types and 
31390 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20  syntax..query I 
313a0 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 33  rowsort label-13
313b0 36 30 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c  60..SELECT + col
313c0 30 20 2b 20 2b 20 63 6f 6c 30 20 2b 20 43 41 53  0 + + col0 + CAS
313d0 54 28 20 4e 55 4c 4c 20 41 53 20 53 49 47 4e 45  T( NULL AS SIGNE
313e0 44 20 29 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  D ) AS col1 FROM
313f0 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab1 cor0..----
31400 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55  ..NULL..NULL..NU
31410 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  LL....skipif mys
31420 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
31430 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
31440 73 6f 72 74 20 6c 61 62 65 6c 2d 31 33 36 30 0d  sort label-1360.
31450 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 30 20 2b  .SELECT + col0 +
31460 20 2b 20 63 6f 6c 30 20 2b 20 43 41 53 54 20 28   + col0 + CAST (
31470 20 4e 55 4c 4c 20 41 53 20 49 4e 54 45 47 45 52   NULL AS INTEGER
31480 20 29 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20   ) AS col1 FROM 
31490 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab1 cor0..----.
314a0 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c  .NULL..NULL..NUL
314b0 4c 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  L....query I row
314c0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
314d0 54 49 4e 43 54 20 2b 20 35 36 20 41 53 20 63 6f  TINCT + 56 AS co
314e0 6c 30 20 46 52 4f 4d 20 74 61 62 31 2c 20 74 61  l0 FROM tab1, ta
314f0 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
31500 0d 0a 35 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..56....query I 
31510 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
31520 28 20 74 61 62 32 2e 63 6f 6c 31 20 29 20 2d 20  ( tab2.col1 ) - 
31530 2b 20 63 6f 6c 30 20 2a 20 63 6f 6c 32 20 2a 20  + col0 * col2 * 
31540 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32  + col1 FROM tab2
31550 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 39 35 39 33 0d  ..----..-119593.
31560 0a 2d 35 31 30 31 37 0d 0a 2d 35 38 32 38 0d 0a  .-51017..-5828..
31570 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
31580 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 32  t..SELECT - col2
31590 20 2a 20 2b 20 28 20 63 6f 6c 32 20 29 20 41 53   * + ( col2 ) AS
315a0 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20   col0 FROM tab0 
315b0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
315c0 31 0d 0a 2d 31 30 38 39 0d 0a 2d 36 37 32 34 0d  1..-1089..-6724.
315d0 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
315e0 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74  # use DIV operat
315f0 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64  or for integer d
31600 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49  ivision..query I
31610 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
31620 33 36 34 0d 0a 53 45 4c 45 43 54 20 2d 20 31 39  364..SELECT - 19
31630 20 44 49 56 20 63 6f 6c 32 20 2b 20 2d 20 63 6f   DIV col2 + - co
31640 6c 31 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  l1 AS col1 FROM 
31650 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 36  tab0..----..-116
31660 0d 0a 2d 38 36 0d 0a 2d 39 31 0d 0a 0d 0a 73 6b  ..-86..-91....sk
31670 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
31680 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
31690 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
316a0 65 6c 2d 31 33 36 34 0d 0a 53 45 4c 45 43 54 20  el-1364..SELECT 
316b0 2d 20 31 39 20 2f 20 63 6f 6c 32 20 2b 20 2d 20  - 19 / col2 + - 
316c0 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46 52 4f  col1 AS col1 FRO
316d0 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  M tab0..----..-1
316e0 31 36 0d 0a 2d 38 36 0d 0a 2d 39 31 0d 0a 0d 0a  16..-86..-91....
316f0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
31700 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
31710 20 63 6f 6c 31 20 2a 20 63 6f 6c 30 20 2a 20 35   col1 * col0 * 5
31720 38 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d  8 FROM tab1..---
31730 2d 0d 0a 33 37 31 32 30 0d 0a 34 35 32 34 0d 0a  -..37120..4524..
31740 36 30 33 32 30 0d 0a 0d 0a 71 75 65 72 79 20 49  60320....query I
31750 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
31760 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 32 20 2a   DISTINCT col2 *
31770 20 2b 20 63 6f 6c 30 20 2b 20 33 38 20 46 52 4f   + col0 + 38 FRO
31780 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab1 cor0..---
31790 2d 0d 0a 32 30 30 0d 0a 33 36 38 36 0d 0a 37 37  -..200..3686..77
317a0 31 38 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  18....onlyif mys
317b0 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65  ql # use DIV ope
317c0 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65  rator for intege
317d0 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72  r division..quer
317e0 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
317f0 6c 2d 31 33 36 37 0d 0a 53 45 4c 45 43 54 20 2b  l-1367..SELECT +
31800 20 36 34 20 44 49 56 20 35 30 20 63 6f 6c 30 20   64 DIV 50 col0 
31810 46 52 4f 4d 20 74 61 62 30 2c 20 74 61 62 31 20  FROM tab0, tab1 
31820 63 6f 72 30 2c 20 74 61 62 32 20 41 53 20 63 6f  cor0, tab2 AS co
31830 72 31 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c  r1..----..27 val
31840 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 64  ues hashing to d
31850 61 38 61 37 32 61 37 39 36 37 63 30 63 37 33 64  a8a72a7967c0c73d
31860 39 31 32 33 39 32 37 35 32 33 30 61 65 64 39 0d  91239275230aed9.
31870 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72  ...skipif postgr
31880 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51  esql # PostgreSQ
31890 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68  L requires AS wh
318a0 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70  en renaming outp
318b0 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 73 6b 69 70  ut columns..skip
318c0 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
318d0 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
318e0 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
318f0 2d 31 33 36 37 0d 0a 53 45 4c 45 43 54 20 2b 20  -1367..SELECT + 
31900 36 34 20 2f 20 35 30 20 63 6f 6c 30 20 46 52 4f  64 / 50 col0 FRO
31910 4d 20 74 61 62 30 2c 20 74 61 62 31 20 63 6f 72  M tab0, tab1 cor
31920 30 2c 20 74 61 62 32 20 41 53 20 63 6f 72 31 0d  0, tab2 AS cor1.
31930 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75 65 73  .----..27 values
31940 20 68 61 73 68 69 6e 67 20 74 6f 20 64 61 38 61   hashing to da8a
31950 37 32 61 37 39 36 37 63 30 63 37 33 64 39 31 32  72a7967c0c73d912
31960 33 39 32 37 35 32 33 30 61 65 64 39 0d 0a 0d 0a  39275230aed9....
31970 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
31980 0a 53 45 4c 45 43 54 20 2d 20 2b 20 63 6f 72 30  .SELECT - + cor0
31990 2e 63 6f 6c 31 20 2a 20 63 6f 72 30 2e 63 6f 6c  .col1 * cor0.col
319a0 31 20 2b 20 2d 20 63 6f 6c 32 20 2a 20 2d 20 63  1 + - col2 * - c
319b0 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  ol1 AS col1 FROM
319c0 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
319d0 2d 2d 2d 0d 0a 31 30 37 39 0d 0a 34 37 30 0d 0a  ---..1079..470..
319e0 37 32 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  728....query I r
319f0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
31a00 49 53 54 49 4e 43 54 20 2d 20 2b 20 37 35 20 2a  ISTINCT - + 75 *
31a10 20 63 6f 6c 32 20 2b 20 2b 20 63 6f 6c 31 20 46   col2 + + col1 F
31a20 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d  ROM tab0 cor0..-
31a30 2d 2d 2d 0d 0a 2d 32 33 38 39 0d 0a 2d 36 30 35  ---..-2389..-605
31a40 39 0d 0a 32 32 0d 0a 0d 0a 71 75 65 72 79 20 49  9..22....query I
31a50 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
31a60 20 2b 20 28 20 63 6f 6c 30 20 2a 20 63 6f 6c 32   + ( col0 * col2
31a70 20 29 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d   ) FROM tab0..--
31a80 2d 2d 0d 0a 33 35 0d 0a 37 32 39 38 0d 0a 37 39  --..35..7298..79
31a90 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  2....query I row
31aa0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63  sort..SELECT + c
31ab0 6f 6c 30 20 2a 20 74 61 62 32 2e 63 6f 6c 31 20  ol0 * tab2.col1 
31ac0 2d 20 2b 20 28 20 2d 20 63 6f 6c 31 20 29 20 41  - + ( - col1 ) A
31ad0 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32  S col2 FROM tab2
31ae0 0d 0a 2d 2d 2d 2d 0d 0a 31 33 36 30 0d 0a 32 34  ..----..1360..24
31af0 38 0d 0a 34 36 36 31 0d 0a 0d 0a 71 75 65 72 79  8..4661....query
31b00 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
31b10 43 54 20 28 20 2b 20 63 6f 72 31 2e 63 6f 6c 32  CT ( + cor1.col2
31b20 20 29 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20   ) AS col1 FROM 
31b30 74 61 62 31 2c 20 74 61 62 31 20 41 53 20 63 6f  tab1, tab1 AS co
31b40 72 30 2c 20 74 61 62 32 20 41 53 20 63 6f 72 31  r0, tab2 AS cor1
31b50 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75 65  ..----..27 value
31b60 73 20 68 61 73 68 69 6e 67 20 74 6f 20 34 30 66  s hashing to 40f
31b70 64 38 63 63 30 64 65 39 32 65 61 36 38 64 37 33  d8cc0de92ea68d73
31b80 36 33 34 63 32 64 38 66 37 35 62 66 35 0d 0a 0d  634c2d8f75bf5...
31b90 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
31ba0 0d 0a 53 45 4c 45 43 54 20 2d 20 32 33 20 2b 20  ..SELECT - 23 + 
31bb0 2d 20 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46  - col0 AS col1 F
31bc0 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab2..----..
31bd0 2d 31 30 31 0d 0a 2d 31 30 32 0d 0a 2d 33 30 0d  -101..-102..-30.
31be0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
31bf0 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 33 20 2a  rt..SELECT + 3 *
31c00 20 2d 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62   - col1 FROM tab
31c10 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33  1 cor0..----..-3
31c20 30 0d 0a 2d 33 39 0d 0a 2d 37 38 0d 0a 0d 0a 6f  0..-39..-78....o
31c30 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73  nlyif mysql # us
31c40 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66  e DIV operator f
31c50 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73  or integer divis
31c60 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ion..query I row
31c70 73 6f 72 74 20 6c 61 62 65 6c 2d 31 33 37 35 0d  sort label-1375.
31c80 0a 53 45 4c 45 43 54 20 2d 20 32 20 2a 20 63 6f  .SELECT - 2 * co
31c90 6c 32 20 44 49 56 20 2d 20 33 31 20 46 52 4f 4d  l2 DIV - 31 FROM
31ca0 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
31cb0 2d 2d 2d 0d 0a 30 0d 0a 32 0d 0a 35 0d 0a 0d 0a  ---..0..2..5....
31cc0 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
31cd0 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
31ce0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
31cf0 61 62 65 6c 2d 31 33 37 35 0d 0a 53 45 4c 45 43  abel-1375..SELEC
31d00 54 20 2d 20 32 20 2a 20 63 6f 6c 32 20 2f 20 2d  T - 2 * col2 / -
31d10 20 33 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53   31 FROM tab0 AS
31d20 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a   cor0..----..0..
31d30 32 0d 0a 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20  2..5....query I 
31d40 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
31d50 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c 30 20 2b 20  col1 * + col0 + 
31d60 33 31 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  31 AS col0 FROM 
31d70 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 30 37 31  tab1..----..1071
31d80 0d 0a 31 30 39 0d 0a 36 37 31 0d 0a 0d 0a 71 75  ..109..671....qu
31d90 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
31da0 45 4c 45 43 54 20 63 6f 6c 31 20 2a 20 2b 20 28  ELECT col1 * + (
31db0 20 39 35 20 2b 20 63 6f 6c 30 20 29 20 46 52 4f   95 + col0 ) FRO
31dc0 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 35  M tab1..----..15
31dd0 39 30 0d 0a 32 32 37 35 0d 0a 32 35 34 38 0d 0a  90..2275..2548..
31de0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
31df0 74 0d 0a 53 45 4c 45 43 54 20 63 6f 72 30 2e 63  t..SELECT cor0.c
31e00 6f 6c 30 20 2b 20 2b 20 63 6f 72 30 2e 63 6f 6c  ol0 + + cor0.col
31e10 31 20 46 52 4f 4d 20 74 61 62 31 2c 20 74 61 62  1 FROM tab1, tab
31e20 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20  2 cor0..----..9 
31e30 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74  values hashing t
31e40 6f 20 38 38 32 66 65 66 31 39 37 65 33 62 34 31  o 882fef197e3b41
31e50 33 35 38 63 35 38 65 32 34 66 32 64 62 32 66 32  358c58e24f2db2f2
31e60 65 31 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73  e1....skipif pos
31e70 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72  tgresql # Postgr
31e80 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53  eSQL requires AS
31e90 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f   when renaming o
31ea0 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71  utput columns..q
31eb0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
31ec0 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
31ed0 2d 20 34 30 20 63 6f 6c 32 20 46 52 4f 4d 20 74  - 40 col2 FROM t
31ee0 61 62 31 2c 20 74 61 62 30 20 41 53 20 63 6f 72  ab1, tab0 AS cor
31ef0 30 2c 20 74 61 62 30 20 41 53 20 63 6f 72 31 0d  0, tab0 AS cor1.
31f00 0a 2d 2d 2d 2d 0d 0a 2d 34 30 0d 0a 0d 0a 71 75  .----..-40....qu
31f10 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
31f20 45 4c 45 43 54 20 2b 20 2d 20 32 20 2b 20 2b 20  ELECT + - 2 + + 
31f30 32 32 20 2a 20 63 6f 6c 32 20 41 53 20 63 6f 6c  22 * col2 AS col
31f40 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  0 FROM tab2 AS c
31f50 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 35 37 30 0d 0a  or0..----..570..
31f60 35 39 32 0d 0a 38 33 34 0d 0a 0d 0a 71 75 65 72  592..834....quer
31f70 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
31f80 45 43 54 20 2d 20 28 20 2b 20 63 6f 6c 32 20 29  ECT - ( + col2 )
31f90 20 2a 20 2d 20 63 6f 72 30 2e 63 6f 6c 30 20 41   * - cor0.col0 A
31fa0 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31  S col2 FROM tab1
31fb0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
31fc0 31 36 32 0d 0a 33 36 34 38 0d 0a 37 36 38 30 0d  162..3648..7680.
31fd0 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72  ...skipif postgr
31fe0 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51  esql # PostgreSQ
31ff0 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68  L requires AS wh
32000 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70  en renaming outp
32010 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72  ut columns..quer
32020 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
32030 45 43 54 20 2b 20 63 6f 6c 30 20 2a 20 34 36 20  ECT + col0 * 46 
32040 2b 20 2d 20 63 6f 6c 32 20 63 6f 6c 32 20 46 52  + - col2 col2 FR
32050 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 32  OM tab1..----..2
32060 38 38 37 0d 0a 33 35 38 34 0d 0a 38 34 0d 0a 0d  887..3584..84...
32070 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73  .skipif postgres
32080 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20  ql # PostgreSQL 
32090 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e  requires AS when
320a0 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74   renaming output
320b0 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20   columns..query 
320c0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
320d0 54 20 44 49 53 54 49 4e 43 54 20 2d 20 32 38 20  T DISTINCT - 28 
320e0 2a 20 2b 20 63 6f 6c 31 20 63 6f 6c 32 20 46 52  * + col1 col2 FR
320f0 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
32100 0a 2d 2d 2d 2d 0d 0a 2d 32 34 30 38 0d 0a 2d 32  .----..-2408..-2
32110 35 34 38 0d 0a 2d 32 37 31 36 0d 0a 0d 0a 71 75  548..-2716....qu
32120 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
32130 45 4c 45 43 54 20 2d 20 32 31 20 2a 20 2d 20 63  ELECT - 21 * - c
32140 6f 6c 32 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f  ol2 + col0 AS co
32150 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l2 FROM tab0 AS 
32160 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 38 31 31  cor0..----..1811
32170 0d 0a 35 36 0d 0a 37 31 37 0d 0a 0d 0a 71 75 65  ..56..717....que
32180 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
32190 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 31 20 2b 20  LECT ALL col1 + 
321a0 2d 20 28 20 63 6f 6c 31 20 29 20 46 52 4f 4d 20  - ( col1 ) FROM 
321b0 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30  tab1..----..0..0
321c0 0d 0a 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f  ..0....skipif po
321d0 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67  stgresql # Postg
321e0 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41  reSQL requires A
321f0 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20  S when renaming 
32200 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a  output columns..
32210 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
32220 0a 53 45 4c 45 43 54 20 2b 20 31 30 20 63 6f 6c  .SELECT + 10 col
32230 32 20 46 52 4f 4d 20 74 61 62 32 2c 20 74 61 62  2 FROM tab2, tab
32240 31 2c 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  1, tab0 AS cor0.
32250 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75 65 73  .----..27 values
32260 20 68 61 73 68 69 6e 67 20 74 6f 20 30 66 65 33   hashing to 0fe3
32270 65 34 35 61 39 65 63 64 34 39 35 38 34 63 32 61  e45a9ecd49584c2a
32280 62 34 34 32 31 30 30 64 35 31 37 36 0d 0a 0d 0a  b442100d5176....
32290 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
322a0 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f  .SELECT ALL - co
322b0 6c 32 20 2b 20 2b 20 63 6f 6c 30 20 2a 20 63 6f  l2 + + col0 * co
322c0 6c 32 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  l2 AS col1 FROM 
322d0 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 36 32 0d  tab2..----..162.
322e0 0a 32 30 30 32 0d 0a 32 39 36 34 0d 0a 0d 0a 73  .2002..2964....s
322f0 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c  kipif postgresql
32300 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65   # PostgreSQL re
32310 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72  quires AS when r
32320 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63  enaming output c
32330 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20  olumns..query I 
32340 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
32350 2d 20 74 61 62 32 2e 63 6f 6c 32 20 2a 20 32 30  - tab2.col2 * 20
32360 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 0d   col2 FROM tab2.
32370 0a 2d 2d 2d 2d 0d 0a 2d 35 32 30 0d 0a 2d 35 34  .----..-520..-54
32380 30 0d 0a 2d 37 36 30 0d 0a 0d 0a 71 75 65 72 79  0..-760....query
32390 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
323a0 43 54 20 2d 20 2d 20 37 37 20 2a 20 63 6f 6c 31  CT - - 77 * col1
323b0 20 2a 20 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20   * col2 AS col1 
323c0 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
323d0 30 0d 0a 2d 2d 2d 2d 0d 0a 32 31 38 35 32 36 0d  0..----..218526.
323e0 0a 35 37 34 35 37 34 0d 0a 37 34 36 39 0d 0a 0d  .574574..7469...
323f0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
32400 0d 0a 53 45 4c 45 43 54 20 2b 20 34 30 20 2a 20  ..SELECT + 40 * 
32410 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 41 53 20 63  + cor0.col1 AS c
32420 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 2c 20 74  ol2 FROM tab2, t
32430 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab0 cor0..----..
32440 39 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67  9 values hashing
32450 20 74 6f 20 32 36 36 39 38 63 64 63 61 64 35 38   to 26698cdcad58
32460 34 32 32 62 34 35 36 65 35 65 35 36 30 37 34 35  422b456e5e560745
32470 33 30 35 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20  3057....query I 
32480 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
32490 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 72 30 2e  DISTINCT - cor0.
324a0 63 6f 6c 32 20 2d 20 2d 20 63 6f 72 30 2e 63 6f  col2 - - cor0.co
324b0 6c 31 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  l1 AS col1 FROM 
324c0 74 61 62 30 2c 20 74 61 62 31 20 41 53 20 63 6f  tab0, tab1 AS co
324d0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 38 0d 0a 2d  r0..----..-28..-
324e0 34 37 0d 0a 2d 38 33 0d 0a 0d 0a 71 75 65 72 79  47..-83....query
324f0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
32500 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 31 32  CT DISTINCT - 12
32510 20 2a 20 2d 20 63 6f 6c 31 20 2b 20 63 6f 6c 30   * - col1 + col0
32520 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
32530 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 38 34 0d 0a 32  b1..----..184..2
32540 33 36 0d 0a 33 31 35 0d 0a 0d 0a 71 75 65 72 79  36..315....query
32550 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
32560 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 2b 20  CT DISTINCT - + 
32570 63 6f 72 30 2e 63 6f 6c 32 20 2d 20 2b 20 63 6f  cor0.col2 - + co
32580 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72  l2 FROM tab1 cor
32590 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 38 0d 0a 2d  0..----..-108..-
325a0 31 31 34 0d 0a 2d 31 39 32 0d 0a 0d 0a 73 6b 69  114..-192....ski
325b0 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23  pif postgresql #
325c0 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75   PostgreSQL requ
325d0 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e  ires AS when ren
325e0 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c  aming output col
325f0 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f  umns..query I ro
32600 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
32610 2b 20 39 30 20 2b 20 63 6f 6c 30 20 63 6f 6c 31  + 90 + col0 col1
32620 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
32630 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 36 38 0d 0a 31  r0..----..168..1
32640 36 39 0d 0a 39 37 0d 0a 0d 0a 71 75 65 72 79 20  69..97....query 
32650 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
32660 54 20 41 4c 4c 20 2d 20 63 6f 72 30 2e 63 6f 6c  T ALL - cor0.col
32670 31 20 2a 20 2b 20 63 6f 6c 30 20 2b 20 2d 20 63  1 * + col0 + - c
32680 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  ol2 AS col0 FROM
32690 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
326a0 2d 2d 2d 0d 0a 2d 32 30 39 37 0d 0a 2d 33 33 39  ---..-2097..-339
326b0 36 0d 0a 2d 38 31 38 31 0d 0a 0d 0a 71 75 65 72  6..-8181....quer
326c0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
326d0 45 43 54 20 41 4c 4c 20 63 6f 72 30 2e 63 6f 6c  ECT ALL cor0.col
326e0 31 20 2a 20 63 6f 6c 32 20 2a 20 2b 20 63 6f 72  1 * col2 * + cor
326f0 30 2e 63 6f 6c 32 20 2b 20 63 6f 72 30 2e 63 6f  0.col2 + cor0.co
32700 6c 31 20 2b 20 2b 20 63 6f 6c 30 20 46 52 4f 4d  l1 + + col0 FROM
32710 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
32720 2d 2d 2d 0d 0a 31 31 39 39 30 31 0d 0a 33 32 35  ---..119901..325
32730 36 34 0d 0a 37 35 38 34 35 0d 0a 0d 0a 6f 6e 6c  64..75845....onl
32740 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70  yif mysql # supp
32750 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70  ort for MySQL sp
32760 65 63 69 66 69 63 20 73 79 73 74 65 6d 20 74 79  ecific system ty
32770 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a  pes and syntax..
32780 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
32790 6c 61 62 65 6c 2d 31 33 39 37 0d 0a 53 45 4c 45  label-1397..SELE
327a0 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 30  CT DISTINCT col0
327b0 20 2a 20 63 6f 6c 30 20 2d 20 2d 20 43 41 53 54   * col0 - - CAST
327c0 28 20 63 6f 6c 30 20 41 53 20 53 49 47 4e 45 44  ( col0 AS SIGNED
327d0 20 29 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20   ) AS col0 FROM 
327e0 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab0 cor0..----.
327f0 0a 31 32 36 30 0d 0a 36 30 30 0d 0a 38 30 31 30  .1260..600..8010
32800 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
32810 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
32820 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
32830 72 74 20 6c 61 62 65 6c 2d 31 33 39 37 0d 0a 53  rt label-1397..S
32840 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 63  ELECT DISTINCT c
32850 6f 6c 30 20 2a 20 63 6f 6c 30 20 2d 20 2d 20 43  ol0 * col0 - - C
32860 41 53 54 20 28 20 63 6f 6c 30 20 41 53 20 49 4e  AST ( col0 AS IN
32870 54 45 47 45 52 20 29 20 41 53 20 63 6f 6c 30 20  TEGER ) AS col0 
32880 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a  FROM tab0 cor0..
32890 2d 2d 2d 2d 0d 0a 31 32 36 30 0d 0a 36 30 30 0d  ----..1260..600.
328a0 0a 38 30 31 30 0d 0a 0d 0a 71 75 65 72 79 20 49  .8010....query I
328b0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
328c0 20 2d 20 63 6f 6c 31 20 2a 20 63 6f 72 30 2e 63   - col1 * cor0.c
328d0 6f 6c 31 20 2b 20 28 20 63 6f 6c 30 20 29 20 41  ol1 + ( col0 ) A
328e0 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32  S col2 FROM tab2
328f0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
32900 2d 32 31 30 0d 0a 2d 33 34 30 33 0d 0a 2d 39 35  -210..-3403..-95
32910 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  4....query I row
32920 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63  sort..SELECT - c
32930 6f 6c 32 20 2a 20 63 6f 72 30 2e 63 6f 6c 30 20  ol2 * cor0.col0 
32940 2b 20 2b 20 28 20 63 6f 6c 32 20 29 20 41 53 20  + + ( col2 ) AS 
32950 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41  col2 FROM tab0 A
32960 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33  S cor0..----..-3
32970 34 0d 0a 2d 37 32 31 36 0d 0a 2d 37 35 39 0d 0a  4..-7216..-759..
32980 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
32990 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
329a0 43 54 20 2b 20 2b 20 32 35 20 2b 20 63 6f 6c 32  CT + + 25 + col2
329b0 20 2a 20 2b 20 63 6f 6c 32 20 46 52 4f 4d 20 74   * + col2 FROM t
329c0 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
329d0 2d 0d 0a 32 39 34 31 0d 0a 33 32 37 34 0d 0a 39  -..2941..3274..9
329e0 32 34 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  241....query I r
329f0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
32a00 49 53 54 49 4e 43 54 20 2b 20 2d 20 63 6f 6c 30  ISTINCT + - col0
32a10 20 2a 20 63 6f 72 30 2e 63 6f 6c 32 20 2b 20 63   * cor0.col2 + c
32a20 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  ol0 AS col1 FROM
32a30 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
32a40 2d 2d 2d 0d 0a 2d 37 32 30 39 0d 0a 2d 37 36 38  ---..-7209..-768
32a50 0d 0a 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  ..0....query I r
32a60 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
32a70 20 63 6f 6c 32 20 2a 20 28 20 2d 20 63 6f 6c 31   col2 * ( - col1
32a80 20 2a 20 63 6f 6c 30 20 29 20 2b 20 63 6f 72 30   * col0 ) + cor0
32a90 2e 63 6f 6c 30 20 2d 20 2b 20 63 6f 6c 31 20 2a  .col0 - + col1 *
32aa0 20 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52   col1 AS col0 FR
32ab0 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
32ac0 0a 2d 2d 2d 2d 0d 0a 33 35 33 39 0d 0a 33 36 34  .----..3539..364
32ad0 34 34 0d 0a 39 39 37 35 31 0d 0a 0d 0a 71 75 65  44..99751....que
32ae0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
32af0 4c 45 43 54 20 2d 20 2d 20 63 6f 6c 31 20 2d 20  LECT - - col1 - 
32b00 2d 20 63 6f 6c 31 20 2a 20 63 6f 6c 32 20 46 52  - col1 * col2 FR
32b10 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
32b20 0a 2d 2d 2d 2d 0d 0a 31 39 34 0d 0a 32 39 32 34  .----..194..2924
32b30 0d 0a 37 35 35 33 0d 0a 0d 0a 73 6b 69 70 69 66  ..7553....skipif
32b40 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
32b50 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
32b60 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
32b70 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 2b 20 43   + cor0.col1 + C
32b80 41 53 54 20 28 20 2b 20 63 6f 6c 32 20 41 53 20  AST ( + col2 AS 
32b90 52 45 41 4c 20 29 20 2a 20 63 6f 72 30 2e 63 6f  REAL ) * cor0.co
32ba0 6c 31 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  l1 AS col2 FROM 
32bb0 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
32bc0 2d 2d 0d 0a 31 35 39 33 0d 0a 36 36 33 0d 0a 38  --..1593..663..8
32bd0 36 38 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  68....onlyif mys
32be0 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65  ql # use DIV ope
32bf0 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65  rator for intege
32c00 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72  r division..quer
32c10 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
32c20 6c 2d 31 34 30 35 0d 0a 53 45 4c 45 43 54 20 44  l-1405..SELECT D
32c30 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c 32 20 44  ISTINCT - col2 D
32c40 49 56 20 35 37 20 2b 20 2b 20 63 6f 6c 30 20 44  IV 57 + + col0 D
32c50 49 56 20 63 6f 6c 32 20 2d 20 2d 20 32 31 20 46  IV col2 - - 21 F
32c60 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab0..----..
32c70 32 31 0d 0a 35 36 0d 0a 0d 0a 73 6b 69 70 69 66  21..56....skipif
32c80 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
32c90 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
32ca0 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
32cb0 34 30 35 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  405..SELECT DIST
32cc0 49 4e 43 54 20 2d 20 63 6f 6c 32 20 2f 20 35 37  INCT - col2 / 57
32cd0 20 2b 20 2b 20 63 6f 6c 30 20 2f 20 63 6f 6c 32   + + col0 / col2
32ce0 20 2d 20 2d 20 32 31 20 46 52 4f 4d 20 74 61 62   - - 21 FROM tab
32cf0 30 0d 0a 2d 2d 2d 2d 0d 0a 32 31 0d 0a 35 36 0d  0..----..21..56.
32d00 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
32d10 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c  rt..SELECT - col
32d20 30 20 2b 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20  0 + + cor0.col1 
32d30 2d 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61  - + col0 FROM ta
32d40 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
32d50 0d 0a 2d 31 31 38 0d 0a 2d 31 34 37 0d 0a 32 30  ..-118..-147..20
32d60 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
32d70 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f  ort..SELECT - co
32d80 6c 32 20 2d 20 28 20 2d 20 34 34 20 29 20 41 53  l2 - ( - 44 ) AS
32d90 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20   col1 FROM tab2 
32da0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
32db0 37 0d 0a 31 38 0d 0a 36 0d 0a 0d 0a 71 75 65 72  7..18..6....quer
32dc0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
32dd0 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63  ECT DISTINCT - c
32de0 6f 6c 32 20 2a 20 2d 20 28 20 2d 20 63 6f 6c 32  ol2 * - ( - col2
32df0 20 29 20 2b 20 63 6f 6c 31 20 2a 20 2b 20 63 6f   ) + col1 * + co
32e00 6c 31 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  l1 AS col2 FROM 
32e10 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab2 cor0..----.
32e20 0a 2d 31 31 35 35 0d 0a 32 33 32 0d 0a 32 38 30  .-1155..232..280
32e30 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  5....query I row
32e40 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
32e50 20 2d 20 2b 20 63 6f 6c 31 20 2a 20 2b 20 31 20   - + col1 * + 1 
32e60 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
32e70 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
32e80 0a 2d 31 30 0d 0a 2d 31 33 0d 0a 2d 32 36 0d 0a  .-10..-13..-26..
32e90 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
32ea0 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20  t..SELECT ALL + 
32eb0 63 6f 6c 30 20 2a 20 74 61 62 32 2e 63 6f 6c 32  col0 * tab2.col2
32ec0 20 2a 20 2d 20 63 6f 6c 30 20 41 53 20 63 6f 6c   * - col0 AS col
32ed0 30 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d  0 FROM tab2..---
32ee0 2d 0d 0a 2d 31 33 32 33 0d 0a 2d 31 35 38 31 38  -..-1323..-15818
32ef0 34 0d 0a 2d 32 33 37 31 35 38 0d 0a 0d 0a 73 6b  4..-237158....sk
32f00 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20  ipif postgresql 
32f10 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71  # PostgreSQL req
32f20 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65  uires AS when re
32f30 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f  naming output co
32f40 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72  lumns..query I r
32f50 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
32f60 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c 32 20 2a  ISTINCT - col2 *
32f70 20 39 33 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   93 col2 FROM ta
32f80 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
32f90 0d 0a 2d 35 30 32 32 0d 0a 2d 35 33 30 31 0d 0a  ..-5022..-5301..
32fa0 2d 38 39 32 38 0d 0a 0d 0a 71 75 65 72 79 20 49  -8928....query I
32fb0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
32fc0 20 41 4c 4c 20 63 6f 6c 30 20 2a 20 2b 20 28 20   ALL col0 * + ( 
32fd0 63 6f 6c 30 20 29 20 2b 20 63 6f 72 30 2e 63 6f  col0 ) + cor0.co
32fe0 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l0 FROM tab2 AS 
32ff0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 35 36 0d 0a  cor0..----..56..
33000 36 31 36 32 0d 0a 36 33 32 30 0d 0a 0d 0a 71 75  6162..6320....qu
33010 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
33020 45 4c 45 43 54 20 2d 20 2d 20 63 6f 6c 32 20 2b  ELECT - - col2 +
33030 20 2d 20 38 20 2a 20 2d 20 63 6f 72 30 2e 63 6f   - 8 * - cor0.co
33040 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l0 FROM tab2 AS 
33050 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 36 35 30 0d  cor0..----..650.
33060 0a 36 37 30 0d 0a 38 33 0d 0a 0d 0a 6f 6e 6c 79  .670..83....only
33070 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44  if mysql # use D
33080 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20  IV operator for 
33090 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e  integer division
330a0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
330b0 74 20 6c 61 62 65 6c 2d 31 34 31 34 0d 0a 53 45  t label-1414..SE
330c0 4c 45 43 54 20 41 4c 4c 20 28 20 28 20 2d 20 63  LECT ALL ( ( - c
330d0 6f 6c 32 20 29 20 29 20 44 49 56 20 31 30 20 46  ol2 ) ) DIV 10 F
330e0 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
330f0 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 0d 0a 2d 38 0d 0a  ..----..-3..-8..
33100 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  0....skipif mysq
33110 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
33120 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
33130 6f 72 74 20 6c 61 62 65 6c 2d 31 34 31 34 0d 0a  ort label-1414..
33140 53 45 4c 45 43 54 20 41 4c 4c 20 28 20 28 20 2d  SELECT ALL ( ( -
33150 20 63 6f 6c 32 20 29 20 29 20 2f 20 31 30 20 46   col2 ) ) / 10 F
33160 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
33170 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 0d 0a 2d 38 0d 0a  ..----..-3..-8..
33180 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  0....query I row
33190 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c  sort..SELECT col
331a0 31 20 2a 20 2b 20 38 33 20 2a 20 63 6f 6c 32 20  1 * + 83 * col2 
331b0 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
331c0 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
331d0 0a 31 32 37 33 32 32 0d 0a 35 33 36 31 38 0d 0a  .127322..53618..
331e0 36 39 34 37 31 0d 0a 0d 0a 71 75 65 72 79 20 49  69471....query I
331f0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
33200 20 44 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c 30   DISTINCT + col0
33210 20 2a 20 2b 20 37 30 20 41 53 20 63 6f 6c 31 20   * + 70 AS col1 
33220 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
33230 30 0d 0a 2d 2d 2d 2d 0d 0a 34 39 30 0d 0a 35 34  0..----..490..54
33240 36 30 0d 0a 35 35 33 30 0d 0a 0d 0a 6f 6e 6c 79  60..5530....only
33250 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f  if mysql # suppo
33260 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65  rt for MySQL spe
33270 63 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70  cific system typ
33280 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71  es and syntax..q
33290 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
332a0 61 62 65 6c 2d 31 34 31 37 0d 0a 53 45 4c 45 43  abel-1417..SELEC
332b0 54 20 2b 20 2d 20 28 20 63 6f 6c 32 20 29 20 2a  T + - ( col2 ) *
332c0 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 2a 20 43   + cor0.col0 * C
332d0 41 53 54 28 20 2b 20 34 37 20 41 53 20 53 49 47  AST( + 47 AS SIG
332e0 4e 45 44 20 29 20 46 52 4f 4d 20 74 61 62 30 20  NED ) FROM tab0 
332f0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
33300 31 36 34 35 0d 0a 2d 33 34 33 30 30 36 0d 0a 2d  1645..-343006..-
33310 33 37 32 32 34 0d 0a 0d 0a 73 6b 69 70 69 66 20  37224....skipif 
33320 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
33330 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
33340 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 34  rowsort label-14
33350 31 37 0d 0a 53 45 4c 45 43 54 20 2b 20 2d 20 28  17..SELECT + - (
33360 20 63 6f 6c 32 20 29 20 2a 20 2b 20 63 6f 72 30   col2 ) * + cor0
33370 2e 63 6f 6c 30 20 2a 20 43 41 53 54 20 28 20 2b  .col0 * CAST ( +
33380 20 34 37 20 41 53 20 49 4e 54 45 47 45 52 20 29   47 AS INTEGER )
33390 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
333a0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 36 34 35 0d  r0..----..-1645.
333b0 0a 2d 33 34 33 30 30 36 0d 0a 2d 33 37 32 32 34  .-343006..-37224
333c0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
333d0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
333e0 2b 20 32 30 20 46 52 4f 4d 20 74 61 62 32 20 63  + 20 FROM tab2 c
333f0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 30 0d 0a 32  or0..----..20..2
33400 30 0d 0a 32 30 0d 0a 0d 0a 71 75 65 72 79 20 49  0..20....query I
33410 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
33420 20 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c 32 20 2a   col0 * + col2 *
33430 20 2b 20 28 20 63 6f 6c 31 20 29 20 2b 20 2b 20   + ( col1 ) + + 
33440 28 20 2b 20 63 6f 6c 30 20 29 20 2b 20 63 6f 6c  ( + col0 ) + col
33450 31 20 2a 20 2d 20 63 6f 6c 32 20 46 52 4f 4d 20  1 * - col2 FROM 
33460 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 32 38 31 31  tab1..----..2811
33470 0d 0a 33 35 39 37 34 0d 0a 39 38 36 37 32 0d 0a  ..35974..98672..
33480 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
33490 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f   use DIV operato
334a0 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69  r for integer di
334b0 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20  vision..query I 
334c0 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 34  rowsort label-14
334d0 32 30 0d 0a 53 45 4c 45 43 54 20 2d 20 74 61 62  20..SELECT - tab
334e0 30 2e 63 6f 6c 32 20 2b 20 63 6f 6c 30 20 2b 20  0.col2 + col0 + 
334f0 2b 20 74 61 62 30 2e 63 6f 6c 30 20 44 49 56 20  + tab0.col0 DIV 
33500 2d 20 63 6f 6c 31 20 63 6f 6c 31 20 46 52 4f 4d  - col1 col1 FROM
33510 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 39 0d   tab0..----..-9.
33520 0a 33 34 0d 0a 37 0d 0a 0d 0a 73 6b 69 70 69 66  .34..7....skipif
33530 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f   postgresql # Po
33540 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65  stgreSQL require
33550 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69  s AS when renami
33560 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e  ng output column
33570 73 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  s..skipif mysql 
33580 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
33590 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
335a0 74 20 6c 61 62 65 6c 2d 31 34 32 30 0d 0a 53 45  t label-1420..SE
335b0 4c 45 43 54 20 2d 20 74 61 62 30 2e 63 6f 6c 32  LECT - tab0.col2
335c0 20 2b 20 63 6f 6c 30 20 2b 20 2b 20 74 61 62 30   + col0 + + tab0
335d0 2e 63 6f 6c 30 20 2f 20 2d 20 63 6f 6c 31 20 63  .col0 / - col1 c
335e0 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d  ol1 FROM tab0..-
335f0 2d 2d 2d 0d 0a 2d 39 0d 0a 33 34 0d 0a 37 0d 0a  ---..-9..34..7..
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 41 4c 4c 20 63 6f  t..SELECT ALL co
33620 6c 32 20 2d 20 2b 20 39 35 20 46 52 4f 4d 20 74  l2 - + 95 FROM t
33630 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 37 0d 0a  ab2..----..-57..
33640 2d 36 38 0d 0a 2d 36 39 0d 0a 0d 0a 71 75 65 72  -68..-69....quer
33650 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
33660 45 43 54 20 41 4c 4c 20 2d 20 37 20 2b 20 2d 20  ECT ALL - 7 + - 
33670 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41  col1 FROM tab1 A
33680 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
33690 37 0d 0a 2d 32 30 0d 0a 2d 33 33 0d 0a 0d 0a 73  7..-20..-33....s
336a0 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c  kipif postgresql
336b0 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65   # PostgreSQL re
336c0 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72  quires AS when r
336d0 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63  enaming output c
336e0 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20  olumns..query I 
336f0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
33700 44 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c 31 20  DISTINCT + col1 
33710 2d 20 63 6f 72 30 2e 63 6f 6c 30 20 2a 20 2b 20  - cor0.col0 * + 
33720 63 6f 72 30 2e 63 6f 6c 30 20 63 6f 6c 32 20 46  cor0.col0 col2 F
33730 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d  ROM tab1 cor0..-
33740 2d 2d 2d 0d 0a 2d 34 30 38 36 0d 0a 2d 36 33 38  ---..-4086..-638
33750 37 0d 0a 31 37 0d 0a 0d 0a 71 75 65 72 79 20 49  7..17....query I
33760 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
33770 20 41 4c 4c 20 2d 20 28 20 63 6f 6c 32 20 29 20   ALL - ( col2 ) 
33780 2a 20 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c 31 20  * col0 * - col1 
33790 2b 20 2d 20 63 6f 6c 32 20 2a 20 63 6f 72 30 2e  + - col2 * cor0.
337a0 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41  col2 FROM tab1 A
337b0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32  S cor0..----..12
337c0 39 36 0d 0a 33 33 32 33 31 0d 0a 39 30 36 32 34  96..33231..90624
337d0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
337e0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
337f0 49 4e 43 54 20 37 33 20 2a 20 63 6f 6c 31 20 41  INCT 73 * col1 A
33800 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32  S col2 FROM tab2
33810 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
33820 31 32 34 31 0d 0a 32 32 36 33 0d 0a 34 33 30 37  1241..2263..4307
33830 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
33840 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
33850 49 4e 43 54 20 74 61 62 31 2e 63 6f 6c 31 20 41  INCT tab1.col1 A
33860 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31  S col2 FROM tab1
33870 2c 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d  , tab2 cor0..---
33880 2d 0d 0a 31 30 0d 0a 31 33 0d 0a 32 36 0d 0a 0d  -..10..13..26...
33890 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
338a0 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 72  ..SELECT ALL cor
338b0 30 2e 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c 30 20  0.col0 + + col0 
338c0 2a 20 2d 20 63 6f 6c 31 20 2a 20 63 6f 6c 31 20  * - col1 * col1 
338d0 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
338e0 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 32 37 35 32 0d  0..----..-22752.
338f0 0a 2d 32 37 31 34 34 30 0d 0a 2d 36 37 32 30 0d  .-271440..-6720.
33900 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
33910 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d  rt..SELECT ALL -
33920 20 37 35 20 2b 20 2d 20 63 6f 6c 31 20 46 52 4f   75 + - col1 FRO
33930 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
33940 2d 2d 2d 2d 0d 0a 2d 31 30 36 0d 0a 2d 31 33 34  ----..-106..-134
33950 0d 0a 2d 39 32 0d 0a 0d 0a 71 75 65 72 79 20 49  ..-92....query I
33960 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
33970 20 2b 20 63 6f 6c 32 20 2b 20 2d 20 63 6f 72 30   + col2 + - cor0
33980 2e 63 6f 6c 31 20 2a 20 63 6f 6c 32 20 46 52 4f  .col1 * col2 FRO
33990 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
339a0 2d 2d 2d 2d 0d 0a 2d 31 31 35 32 0d 0a 2d 31 33  ----..-1152..-13
339b0 35 30 0d 0a 2d 35 31 33 0d 0a 0d 0a 71 75 65 72  50..-513....quer
339c0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
339d0 45 43 54 20 41 4c 4c 20 63 6f 6c 30 20 2b 20 63  ECT ALL col0 + c
339e0 6f 72 30 2e 63 6f 6c 32 20 2a 20 2b 20 63 6f 72  or0.col2 * + cor
339f0 30 2e 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46  0.col0 AS col2 F
33a00 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d  ROM tab0 cor0..-
33a10 2d 2d 2d 0d 0a 37 30 0d 0a 37 33 38 37 0d 0a 38  ---..70..7387..8
33a20 31 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  16....query I ro
33a30 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 28 20  wsort..SELECT ( 
33a40 2b 20 63 6f 6c 30 20 29 20 2d 20 63 6f 6c 30 20  + col0 ) - col0 
33a50 2a 20 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46  * col2 AS col1 F
33a60 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab2..----..
33a70 2d 31 38 32 0d 0a 2d 31 39 35 30 0d 0a 2d 32 39  -182..-1950..-29
33a80 32 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  23....query I ro
33a90 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 35 34  wsort..SELECT 54
33aa0 20 2a 20 63 6f 72 30 2e 63 6f 6c 30 20 46 52 4f   * cor0.col0 FRO
33ab0 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
33ac0 2d 2d 2d 2d 0d 0a 33 37 38 0d 0a 34 32 31 32 0d  ----..378..4212.
33ad0 0a 34 32 36 36 0d 0a 0d 0a 71 75 65 72 79 20 49  .4266....query I
33ae0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
33af0 20 44 49 53 54 49 4e 43 54 20 2d 20 2b 20 34 33   DISTINCT - + 43
33b00 20 2a 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62   * col0 FROM tab
33b10 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
33b20 0a 2d 31 32 39 0d 0a 2d 32 37 35 32 0d 0a 2d 33  .-129..-2752..-3
33b30 34 34 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  440....query I r
33b40 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
33b50 20 63 6f 6c 30 20 2b 20 63 6f 6c 30 20 2a 20 63   col0 + col0 * c
33b60 6f 6c 32 20 2d 20 63 6f 6c 30 20 46 52 4f 4d 20  ol2 - col0 FROM 
33b70 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
33b80 2d 2d 0d 0a 33 35 0d 0a 37 32 39 38 0d 0a 37 39  --..35..7298..79
33b90 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  2....query I row
33ba0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 72  sort..SELECT cor
33bb0 30 2e 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c 31 20  0.col0 + - col1 
33bc0 2a 20 63 6f 6c 30 20 2d 20 63 6f 6c 32 20 2a 20  * col0 - col2 * 
33bd0 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46 52 4f  col1 AS col2 FRO
33be0 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
33bf0 2d 2d 2d 2d 0d 0a 2d 31 30 34 37 0d 0a 2d 31 39  ----..-1047..-19
33c00 31 30 0d 0a 2d 36 30 35 38 0d 0a 0d 0a 71 75 65  10..-6058....que
33c10 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
33c20 4c 45 43 54 20 32 38 20 2a 20 63 6f 6c 30 20 2b  LECT 28 * col0 +
33c30 20 2b 20 74 61 62 32 2e 63 6f 6c 31 20 46 52 4f   + tab2.col1 FRO
33c40 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 32 32  M tab2..----..22
33c50 32 39 0d 0a 32 32 34 33 0d 0a 32 32 37 0d 0a 0d  29..2243..227...
33c60 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
33c70 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 30 20  ..SELECT - col0 
33c80 2a 20 63 6f 6c 30 20 2d 20 63 6f 6c 31 20 46 52  * col0 - col1 FR
33c90 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d  OM tab1..----..-
33ca0 33 35 0d 0a 2d 34 31 30 36 0d 0a 2d 36 34 31 33  35..-4106..-6413
33cb0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
33cc0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
33cd0 49 4e 43 54 20 2d 20 63 6f 6c 32 20 2a 20 2d 20  INCT - col2 * - 
33ce0 33 35 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  35 FROM tab1 AS 
33cf0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 38 39 30  cor0..----..1890
33d00 0d 0a 31 39 39 35 0d 0a 33 33 36 30 0d 0a 0d 0a  ..1995..3360....
33d10 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
33d20 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 32 34  .SELECT ALL - 24
33d30 20 2b 20 2b 20 35 31 20 2a 20 2d 20 63 6f 6c 31   + + 51 * - col1
33d40 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
33d50 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
33d60 0d 0a 2d 31 33 35 30 0d 0a 2d 35 33 34 0d 0a 2d  ..-1350..-534..-
33d70 36 38 37 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  687....onlyif my
33d80 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70  sql # use DIV op
33d90 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67  erator for integ
33da0 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65  er division..que
33db0 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
33dc0 65 6c 2d 31 34 34 30 0d 0a 53 45 4c 45 43 54 20  el-1440..SELECT 
33dd0 44 49 53 54 49 4e 43 54 20 2d 20 28 20 2d 20 63  DISTINCT - ( - c
33de0 6f 6c 31 20 29 20 44 49 56 20 2b 20 63 6f 6c 31  ol1 ) DIV + col1
33df0 20 2b 20 2b 20 63 6f 6c 32 20 63 6f 6c 31 20 46   + + col2 col1 F
33e00 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
33e10 0d 0a 2d 2d 2d 2d 0d 0a 32 37 0d 0a 32 38 0d 0a  ..----..27..28..
33e20 33 39 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73  39....skipif pos
33e30 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72  tgresql # Postgr
33e40 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53  eSQL requires AS
33e50 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f   when renaming o
33e60 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 73  utput columns..s
33e70 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
33e80 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
33e90 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
33ea0 62 65 6c 2d 31 34 34 30 0d 0a 53 45 4c 45 43 54  bel-1440..SELECT
33eb0 20 44 49 53 54 49 4e 43 54 20 2d 20 28 20 2d 20   DISTINCT - ( - 
33ec0 63 6f 6c 31 20 29 20 2f 20 2b 20 63 6f 6c 31 20  col1 ) / + col1 
33ed0 2b 20 2b 20 63 6f 6c 32 20 63 6f 6c 31 20 46 52  + + col2 col1 FR
33ee0 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
33ef0 0a 2d 2d 2d 2d 0d 0a 32 37 0d 0a 32 38 0d 0a 33  .----..27..28..3
33f00 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  9....query I row
33f10 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
33f20 54 49 4e 43 54 20 2d 20 63 6f 6c 30 20 2a 20 63  TINCT - col0 * c
33f30 6f 6c 30 20 2b 20 2b 20 74 61 62 31 2e 63 6f 6c  ol0 + + tab1.col
33f40 32 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d  2 FROM tab1..---
33f50 2d 0d 0a 2d 34 30 33 39 0d 0a 2d 36 33 30 34 0d  -..-4039..-6304.
33f60 0a 34 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .45....query I r
33f70 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
33f80 49 53 54 49 4e 43 54 20 63 6f 6c 32 20 2b 20 2b  ISTINCT col2 + +
33f90 20 39 36 20 2a 20 37 37 20 2a 20 2d 20 63 6f 6c   96 * 77 * - col
33fa0 31 20 2b 20 2d 20 63 6f 6c 30 20 46 52 4f 4d 20  1 + - col0 FROM 
33fb0 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 39 32  tab1..----..-192
33fc0 31 34 31 0d 0a 2d 37 33 39 32 37 0d 0a 2d 39 36  141..-73927..-96
33fd0 30 38 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  080....query I r
33fe0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
33ff0 4c 4c 20 2d 20 2d 20 38 30 20 46 52 4f 4d 20 74  LL - - 80 FROM t
34000 61 62 32 20 63 6f 72 30 20 43 52 4f 53 53 20 4a  ab2 cor0 CROSS J
34010 4f 49 4e 20 74 61 62 32 20 41 53 20 63 6f 72 31  OIN tab2 AS cor1
34020 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73  ..----..9 values
34030 20 68 61 73 68 69 6e 67 20 74 6f 20 38 37 38 66   hashing to 878f
34040 30 31 32 64 37 30 37 61 61 62 31 31 33 63 65 64  012d707aab113ced
34050 61 66 35 36 65 36 63 35 32 65 39 34 0d 0a 0d 0a  af56e6c52e94....
34060 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71  skipif postgresq
34070 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72  l # PostgreSQL r
34080 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20  equires AS when 
34090 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20  renaming output 
340a0 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49  columns..query I
340b0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
340c0 20 63 6f 6c 31 20 2a 20 2b 20 28 20 63 6f 6c 32   col1 * + ( col2
340d0 20 2a 20 2b 20 63 6f 6c 32 20 29 20 2b 20 2d 20   * + col2 ) + - 
340e0 63 6f 6c 32 20 63 6f 6c 32 20 46 52 4f 4d 20 74  col2 col2 FROM t
340f0 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 32 32 35 37 32  ab2..----..22572
34100 0d 0a 32 34 35 31 30 0d 0a 33 39 38 35 38 0d 0a  ..24510..39858..
34110 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
34120 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
34130 43 54 20 2b 20 63 6f 6c 30 20 2a 20 2d 20 39 36  CT + col0 * - 96
34140 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d   FROM tab0..----
34150 0d 0a 2d 32 33 30 34 0d 0a 2d 33 33 36 30 0d 0a  ..-2304..-3360..
34160 2d 38 35 34 34 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  -8544....onlyif 
34170 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20  mysql # support 
34180 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66  for MySQL specif
34190 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20  ic system types 
341a0 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72  and syntax..quer
341b0 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
341c0 6c 2d 31 34 34 36 0d 0a 53 45 4c 45 43 54 20 2d  l-1446..SELECT -
341d0 20 43 41 53 54 28 20 2d 20 35 31 20 2a 20 2b 20   CAST( - 51 * + 
341e0 63 6f 6c 30 20 41 53 20 53 49 47 4e 45 44 20 29  col0 AS SIGNED )
341f0 20 2b 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c   + + col1 AS col
34200 32 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d  2 FROM tab1..---
34210 2d 0d 0a 31 37 39 0d 0a 33 32 37 34 0d 0a 34 30  -..179..3274..40
34220 39 33 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  93....skipif mys
34230 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
34240 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
34250 73 6f 72 74 20 6c 61 62 65 6c 2d 31 34 34 36 0d  sort label-1446.
34260 0a 53 45 4c 45 43 54 20 2d 20 43 41 53 54 20 28  .SELECT - CAST (
34270 20 2d 20 35 31 20 2a 20 2b 20 63 6f 6c 30 20 41   - 51 * + col0 A
34280 53 20 49 4e 54 45 47 45 52 20 29 20 2b 20 2b 20  S INTEGER ) + + 
34290 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46 52 4f  col1 AS col2 FRO
342a0 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 37  M tab1..----..17
342b0 39 0d 0a 33 32 37 34 0d 0a 34 30 39 33 0d 0a 0d  9..3274..4093...
342c0 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
342d0 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72  use DIV operator
342e0 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76   for integer div
342f0 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72  ision..query I r
34300 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 34 34  owsort label-144
34310 37 0d 0a 53 45 4c 45 43 54 20 2b 20 2b 20 63 6f  7..SELECT + + co
34320 6c 30 20 44 49 56 20 2b 20 28 20 63 6f 6c 32 20  l0 DIV + ( col2 
34330 29 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  ) FROM tab1 AS c
34340 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d  or0..----..0..0.
34350 0a 31 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  .1....skipif mys
34360 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
34370 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
34380 73 6f 72 74 20 6c 61 62 65 6c 2d 31 34 34 37 0d  sort label-1447.
34390 0a 53 45 4c 45 43 54 20 2b 20 2b 20 63 6f 6c 30  .SELECT + + col0
343a0 20 2f 20 2b 20 28 20 63 6f 6c 32 20 29 20 46 52   / + ( col2 ) FR
343b0 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
343c0 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 31 0d 0a  .----..0..0..1..
343d0 0d 0a 71 75 65 72 79 20 49 49 49 20 72 6f 77 73  ..query III rows
343e0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2a 20 46 52  ort..SELECT * FR
343f0 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 20  OM tab2 AS cor0 
34400 57 48 45 52 45 20 4e 55 4c 4c 20 3e 3d 20 4e 55  WHERE NULL >= NU
34410 4c 4c 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a 71 75 65 72  LL..----....quer
34420 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
34430 45 43 54 20 74 61 62 31 2e 63 6f 6c 32 20 2a 20  ECT tab1.col2 * 
34440 2d 20 74 61 62 31 2e 63 6f 6c 31 20 41 53 20 63  - tab1.col1 AS c
34450 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d  ol0 FROM tab1..-
34460 2d 2d 2d 0d 0a 2d 31 32 34 38 0d 0a 2d 31 34 30  ---..-1248..-140
34470 34 0d 0a 2d 35 37 30 0d 0a 0d 0a 71 75 65 72 79  4..-570....query
34480 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
34490 43 54 20 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20  CT col2 AS col0 
344a0 46 52 4f 4d 20 74 61 62 30 20 57 48 45 52 45 20  FROM tab0 WHERE 
344b0 4e 4f 54 20 4e 55 4c 4c 20 3e 20 4e 55 4c 4c 0d  NOT NULL > NULL.
344c0 0a 2d 2d 2d 2d 0d 0a 0d 0a 71 75 65 72 79 20 49  .----....query I
344d0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
344e0 20 2b 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62   + col2 FROM tab
344f0 30 20 57 48 45 52 45 20 4e 4f 54 20 63 6f 6c 32  0 WHERE NOT col2
34500 20 2f 20 63 6f 6c 32 20 49 4e 20 28 20 2d 20 74   / col2 IN ( - t
34510 61 62 30 2e 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c  ab0.col2 * - col
34520 31 20 29 0d 0a 2d 2d 2d 2d 0d 0a 31 0d 0a 33 33  1 )..----..1..33
34530 0d 0a 38 32 0d 0a 0d 0a 71 75 65 72 79 20 49 49  ..82....query II
34540 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
34550 54 20 44 49 53 54 49 4e 43 54 20 2a 20 46 52 4f  T DISTINCT * FRO
34560 4d 20 74 61 62 32 20 57 48 45 52 45 20 28 20 2b  M tab2 WHERE ( +
34570 20 63 6f 6c 31 20 29 20 3c 3e 20 4e 55 4c 4c 0d   col1 ) <> NULL.
34580 0a 2d 2d 2d 2d 0d 0a 0d 0a 71 75 65 72 79 20 49  .----....query I
34590 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
345a0 20 41 4c 4c 20 63 6f 6c 31 20 2b 20 2b 20 63 6f   ALL col1 + + co
345b0 6c 31 20 2a 20 2b 20 63 6f 6c 32 20 2a 20 2d 20  l1 * + col2 * - 
345c0 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41  col2 FROM tab2 A
345d0 53 20 63 6f 72 30 20 57 48 45 52 45 20 4e 55 4c  S cor0 WHERE NUL
345e0 4c 20 42 45 54 57 45 45 4e 20 2d 20 63 6f 6c 30  L BETWEEN - col0
345f0 20 2f 20 2d 20 63 6f 6c 30 20 2d 20 63 6f 6c 32   / - col0 - col2
34600 20 2a 20 63 6f 6c 31 20 41 4e 44 20 4e 55 4c 4c   * col1 AND NULL
34610 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a 71 75 65 72 79 20  ..----....query 
34620 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
34630 54 20 2d 20 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c  T - col0 + + col
34640 30 20 2a 20 2b 20 74 61 62 32 2e 63 6f 6c 30 20  0 * + tab2.col0 
34650 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d  FROM tab2..----.
34660 0a 34 32 0d 0a 36 30 30 36 0d 0a 36 31 36 32 0d  .42..6006..6162.
34670 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
34680 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63  rt..SELECT ALL c
34690 6f 6c 30 20 2a 20 2d 20 74 61 62 30 2e 63 6f 6c  ol0 * - tab0.col
346a0 31 20 46 52 4f 4d 20 74 61 62 30 20 57 48 45 52  1 FROM tab0 WHER
346b0 45 20 4e 55 4c 4c 20 3e 20 4e 55 4c 4c 0d 0a 2d  E NULL > NULL..-
346c0 2d 2d 2d 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  ---....query I r
346d0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
346e0 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c 32 20 41  ISTINCT - col2 A
346f0 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31  S col2 FROM tab1
34700 20 41 53 20 63 6f 72 30 20 57 48 45 52 45 20 28   AS cor0 WHERE (
34710 20 4e 55 4c 4c 20 29 20 4e 4f 54 20 49 4e 20 28   NULL ) NOT IN (
34720 20 63 6f 6c 30 20 2f 20 63 6f 6c 30 20 2b 20 63   col0 / col0 + c
34730 6f 6c 30 20 2a 20 63 6f 72 30 2e 63 6f 6c 32 20  ol0 * cor0.col2 
34740 29 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a 71 75 65 72 79  )..----....query
34750 20 49 49 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45   III rowsort..SE
34760 4c 45 43 54 20 2a 20 46 52 4f 4d 20 74 61 62 30  LECT * FROM tab0
34770 20 41 53 20 63 6f 72 30 20 57 48 45 52 45 20 4e   AS cor0 WHERE N
34780 55 4c 4c 20 3c 20 28 20 2d 20 63 6f 6c 32 20 2b  ULL < ( - col2 +
34790 20 63 6f 6c 32 20 29 0d 0a 2d 2d 2d 2d 0d 0a 0d   col2 )..----...
347a0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
347b0 0d 0a 53 45 4c 45 43 54 20 2b 20 74 61 62 30 2e  ..SELECT + tab0.
347c0 63 6f 6c 31 20 2b 20 2d 20 63 6f 6c 30 20 41 53  col1 + - col0 AS
347d0 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d   col0 FROM tab0.
347e0 0a 2d 2d 2d 2d 0d 0a 32 0d 0a 36 32 0d 0a 36 32  .----..2..62..62
347f0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
34800 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f  ort..SELECT + co
34810 6c 32 20 2b 20 63 6f 6c 31 20 2b 20 2d 20 63 6f  l2 + col1 + - co
34820 6c 31 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d  l1 FROM tab2..--
34830 2d 2d 0d 0a 32 36 0d 0a 32 37 0d 0a 33 38 0d 0a  --..26..27..38..
34840 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
34850 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 31 20 2a  t..SELECT col1 *
34860 20 2b 20 63 6f 6c 31 20 2a 20 63 6f 6c 32 20 2b   + col1 * col2 +
34870 20 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46 52   col2 AS col0 FR
34880 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31  OM tab2..----..1
34890 31 30 32 30 0d 0a 32 35 39 37 34 0d 0a 39 30 35  1020..25974..905
348a0 33 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  32....query I ro
348b0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
348c0 63 6f 6c 31 20 2b 20 63 6f 6c 30 20 2b 20 63 6f  col1 + col0 + co
348d0 6c 32 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d  l2 FROM tab0..--
348e0 2d 2d 0d 0a 2d 32 39 0d 0a 2d 36 31 0d 0a 38 30  --..-29..-61..80
348f0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
34900 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f  ort..SELECT + co
34910 72 30 2e 63 6f 6c 30 20 2b 20 63 6f 72 30 2e 63  r0.col0 + cor0.c
34920 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  ol2 AS col2 FROM
34930 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
34940 2d 2d 2d 0d 0a 31 30 34 0d 0a 31 31 37 0d 0a 33  ---..104..117..3
34950 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  4....query I row
34960 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
34970 20 2d 20 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c 32   - col2 * + col2
34980 20 2d 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 41   - + cor0.col2 A
34990 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30  S col2 FROM tab0
349a0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
349b0 2d 31 31 32 32 0d 0a 2d 32 0d 0a 2d 36 38 30 36  -1122..-2..-6806
349c0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
349d0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f  ort..SELECT - co
349e0 6c 31 20 2a 20 63 6f 6c 30 20 2b 20 63 6f 72 30  l1 * col0 + cor0
349f0 2e 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20  .col0 FROM tab2 
34a00 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
34a10 31 32 36 34 0d 0a 2d 32 31 30 0d 0a 2d 34 35 32  1264..-210..-452
34a20 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  4....query I row
34a30 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
34a40 54 49 4e 43 54 20 63 6f 6c 30 20 2a 20 2d 20 63  TINCT col0 * - c
34a50 6f 6c 32 20 2b 20 2d 20 63 6f 6c 30 20 2d 20 63  ol2 + - col0 - c
34a60 6f 6c 30 20 2a 20 63 6f 6c 32 20 41 53 20 63 6f  ol0 * col2 AS co
34a70 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l0 FROM tab2 AS 
34a80 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 38 35  cor0..----..-385
34a90 0d 0a 2d 34 31 33 34 0d 0a 2d 36 30 38 33 0d 0a  ..-4134..-6083..
34aa0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
34ab0 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20  t..SELECT ALL - 
34ac0 63 6f 6c 32 20 2b 20 2b 20 63 6f 6c 32 20 2a 20  col2 + + col2 * 
34ad0 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 46 52 4f 4d  + cor0.col1 FROM
34ae0 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
34af0 2d 2d 2d 0d 0a 32 38 30 35 0d 0a 37 33 38 30 0d  ---..2805..7380.
34b00 0a 39 36 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  .96....onlyif my
34b10 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70  sql # use DIV op
34b20 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67  erator for integ
34b30 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65  er division..que
34b40 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
34b50 65 6c 2d 31 34 36 37 0d 0a 53 45 4c 45 43 54 20  el-1467..SELECT 
34b60 41 4c 4c 20 2b 20 2d 20 63 6f 72 30 2e 63 6f 6c  ALL + - cor0.col
34b70 32 20 44 49 56 20 63 6f 6c 30 20 46 52 4f 4d 20  2 DIV col0 FROM 
34b80 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
34b90 2d 2d 0d 0a 2d 31 0d 0a 2d 31 38 0d 0a 30 0d 0a  --..-1..-18..0..
34ba0 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
34bb0 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
34bc0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
34bd0 20 6c 61 62 65 6c 2d 31 34 36 37 0d 0a 53 45 4c   label-1467..SEL
34be0 45 43 54 20 41 4c 4c 20 2b 20 2d 20 63 6f 72 30  ECT ALL + - cor0
34bf0 2e 63 6f 6c 32 20 2f 20 63 6f 6c 30 20 46 52 4f  .col2 / col0 FRO
34c00 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
34c10 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 2d 31 38 0d 0a 30  ----..-1..-18..0
34c20 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
34c30 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 32  ort..SELECT col2
34c40 20 2b 20 2b 20 63 6f 6c 30 20 2a 20 63 6f 72 30   + + col0 * cor0
34c50 2e 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52  .col1 AS col0 FR
34c60 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
34c70 0a 2d 2d 2d 2d 0d 0a 32 30 39 37 0d 0a 33 33 39  .----..2097..339
34c80 36 0d 0a 38 31 38 31 0d 0a 0d 0a 71 75 65 72 79  6..8181....query
34c90 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
34ca0 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 30 20 2a 20  CT ALL + col0 * 
34cb0 63 6f 6c 32 20 2b 20 63 6f 6c 32 20 41 53 20 63  col2 + col2 AS c
34cc0 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol2 FROM tab2 AS
34cd0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 30 35   cor0..----..205
34ce0 34 0d 0a 32 31 36 0d 0a 33 30 34 30 0d 0a 0d 0a  4..216..3040....
34cf0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
34d00 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
34d10 20 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c 32 20 2a   col0 + - col2 *
34d20 20 63 6f 6c 32 20 2d 20 63 6f 6c 30 20 46 52 4f   col2 - col0 FRO
34d30 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
34d40 2d 2d 2d 2d 0d 0a 2d 31 34 34 34 0d 0a 2d 36 37  ----..-1444..-67
34d50 36 0d 0a 2d 37 32 39 0d 0a 0d 0a 71 75 65 72 79  6..-729....query
34d60 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
34d70 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 32  CT DISTINCT col2
34d80 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 2a 20 63   - cor0.col2 * c
34d90 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol0 FROM tab0 AS
34da0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 34   cor0..----..-34
34db0 0d 0a 2d 37 32 31 36 0d 0a 2d 37 35 39 0d 0a 0d  ..-7216..-759...
34dc0 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73  .skipif postgres
34dd0 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20  ql # PostgreSQL 
34de0 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e  requires AS when
34df0 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74   renaming output
34e00 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20   columns..query 
34e10 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
34e20 54 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 2a 20  T + cor0.col0 * 
34e30 2b 20 63 6f 6c 32 20 2b 20 63 6f 6c 32 20 63 6f  + col2 + col2 co
34e40 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l0 FROM tab1 AS 
34e50 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 31 36 0d  cor0..----..216.
34e60 0a 33 37 30 35 0d 0a 37 37 37 36 0d 0a 0d 0a 71  .3705..7776....q
34e70 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
34e80 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 74 61 62  SELECT ALL - tab
34e90 32 2e 63 6f 6c 32 20 2b 20 2b 20 63 6f 6c 31 20  2.col2 + + col1 
34ea0 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d  FROM tab2..----.
34eb0 0a 2d 32 31 0d 0a 33 33 0d 0a 34 0d 0a 0d 0a 71  .-21..33..4....q
34ec0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
34ed0 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 31 20  SELECT ALL col1 
34ee0 2a 20 63 6f 6c 30 20 2b 20 63 6f 6c 31 20 2a 20  * col0 + col1 * 
34ef0 2d 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30  - col2 FROM tab0
34f00 0d 0a 2d 2d 2d 2d 0d 0a 2d 37 37 34 0d 0a 33 32  ..----..-774..32
34f10 39 38 0d 0a 36 33 37 0d 0a 0d 0a 71 75 65 72 79  98..637....query
34f20 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
34f30 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63 6f  CT DISTINCT + co
34f40 6c 30 20 2b 20 2d 20 63 6f 6c 31 20 2a 20 2b 20  l0 + - col1 * + 
34f50 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46 52 4f  col2 AS col1 FRO
34f60 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  M tab1..----..-1
34f70 31 36 38 0d 0a 2d 31 34 30 31 0d 0a 2d 35 30 36  168..-1401..-506
34f80 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
34f90 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f  ort..SELECT + co
34fa0 6c 30 20 2a 20 2b 20 63 6f 72 30 2e 63 6f 6c 31  l0 * + cor0.col1
34fb0 20 2b 20 63 6f 6c 32 20 2a 20 2d 20 63 6f 72 30   + col2 * - cor0
34fc0 2e 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20  .col0 FROM tab1 
34fd0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
34fe0 33 30 30 38 0d 0a 2d 36 36 34 30 0d 0a 2d 38 34  3008..-6640..-84
34ff0 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
35000 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61   # use DIV opera
35010 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20  tor for integer 
35020 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20  division..query 
35030 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
35040 31 34 37 37 0d 0a 53 45 4c 45 43 54 20 2d 20 2b  1477..SELECT - +
35050 20 63 6f 6c 30 20 44 49 56 20 63 6f 6c 30 20 2b   col0 DIV col0 +
35060 20 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c 30 20 2a   col1 * - col0 *
35070 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20   col0 FROM tab2 
35080 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 36  cor0..----..-106
35090 30 39 38 0d 0a 2d 31 35 32 30 0d 0a 2d 33 35 38  098..-1520..-358
350a0 39 35 37 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  957....skipif my
350b0 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
350c0 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
350d0 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 34 37 37  wsort label-1477
350e0 0d 0a 53 45 4c 45 43 54 20 2d 20 2b 20 63 6f 6c  ..SELECT - + col
350f0 30 20 2f 20 63 6f 6c 30 20 2b 20 63 6f 6c 31 20  0 / col0 + col1 
35100 2a 20 2d 20 63 6f 6c 30 20 2a 20 63 6f 6c 30 20  * - col0 * col0 
35110 46 52 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a  FROM tab2 cor0..
35120 2d 2d 2d 2d 0d 0a 2d 31 30 36 30 39 38 0d 0a 2d  ----..-106098..-
35130 31 35 32 30 0d 0a 2d 33 35 38 39 35 37 0d 0a 0d  1520..-358957...
35140 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
35150 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 72 30 2e  ..SELECT + cor0.
35160 63 6f 6c 31 20 2a 20 63 6f 6c 31 20 2b 20 2b 20  col1 * col1 + + 
35170 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41  col2 FROM tab1 A
35180 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 35  S cor0..----..15
35190 37 0d 0a 32 36 35 0d 0a 37 33 30 0d 0a 0d 0a 71  7..265..730....q
351a0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
351b0 53 45 4c 45 43 54 20 2b 20 63 6f 6c 32 20 2b 20  SELECT + col2 + 
351c0 2b 20 32 35 20 46 52 4f 4d 20 74 61 62 32 20 41  + 25 FROM tab2 A
351d0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 35 31  S cor0..----..51
351e0 0d 0a 35 32 0d 0a 36 33 0d 0a 0d 0a 71 75 65 72  ..52..63....quer
351f0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
35200 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 2d  ECT DISTINCT + -
35210 20 34 32 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d   42 AS col1 FROM
35220 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
35230 2d 2d 2d 0d 0a 2d 34 32 0d 0a 0d 0a 71 75 65 72  ---..-42....quer
35240 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
35250 45 43 54 20 41 4c 4c 20 2d 20 2d 20 39 33 20 46  ECT ALL - - 93 F
35260 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
35270 0d 0a 2d 2d 2d 2d 0d 0a 39 33 0d 0a 39 33 0d 0a  ..----..93..93..
35280 39 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  93....query I ro
35290 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
352a0 4c 20 2b 20 63 6f 6c 32 20 2a 20 34 32 20 46 52  L + col2 * 42 FR
352b0 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
352c0 0a 2d 2d 2d 2d 0d 0a 31 30 39 32 0d 0a 31 31 33  .----..1092..113
352d0 34 0d 0a 31 35 39 36 0d 0a 0d 0a 71 75 65 72 79  4..1596....query
352e0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
352f0 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63 6f  CT DISTINCT + co
35300 6c 32 20 2a 20 31 35 20 46 52 4f 4d 20 74 61 62  l2 * 15 FROM tab
35310 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 33 30 0d 0a 31  0..----..1230..1
35320 35 0d 0a 34 39 35 0d 0a 0d 0a 71 75 65 72 79 20  5..495....query 
35330 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
35340 54 20 2d 20 74 61 62 32 2e 63 6f 6c 30 20 2d 20  T - tab2.col0 - 
35350 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46 52 4f  col2 AS col2 FRO
35360 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  M tab2..----..-1
35370 30 34 0d 0a 2d 31 31 37 0d 0a 2d 33 34 0d 0a 0d  04..-117..-34...
35380 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73  .skipif postgres
35390 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20  ql # PostgreSQL 
353a0 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e  requires AS when
353b0 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74   renaming output
353c0 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20   columns..query 
353d0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
353e0 54 20 44 49 53 54 49 4e 43 54 20 2b 20 74 61 62  T DISTINCT + tab
353f0 31 2e 63 6f 6c 31 20 2b 20 2b 20 63 6f 6c 32 20  1.col1 + + col2 
35400 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 0d 0a  col1 FROM tab1..
35410 2d 2d 2d 2d 0d 0a 31 30 39 0d 0a 36 37 0d 0a 38  ----..109..67..8
35420 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  0....onlyif mysq
35430 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20  l # support for 
35440 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63 20 73  MySQL specific s
35450 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20  ystem types and 
35460 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20  syntax..query I 
35470 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 34  rowsort label-14
35480 38 36 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b  86..SELECT ALL +
35490 20 43 41 53 54 28 20 4e 55 4c 4c 20 41 53 20 53   CAST( NULL AS S
354a0 49 47 4e 45 44 20 29 20 2a 20 2b 20 38 38 20 2b  IGNED ) * + 88 +
354b0 20 63 6f 6c 30 20 2b 20 2d 20 39 31 20 46 52 4f   col0 + - 91 FRO
354c0 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 4e 55  M tab1..----..NU
354d0 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a  LL..NULL..NULL..
354e0 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
354f0 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
35500 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
35510 20 6c 61 62 65 6c 2d 31 34 38 36 0d 0a 53 45 4c   label-1486..SEL
35520 45 43 54 20 41 4c 4c 20 2b 20 43 41 53 54 20 28  ECT ALL + CAST (
35530 20 4e 55 4c 4c 20 41 53 20 49 4e 54 45 47 45 52   NULL AS INTEGER
35540 20 29 20 2a 20 2b 20 38 38 20 2b 20 63 6f 6c 30   ) * + 88 + col0
35550 20 2b 20 2d 20 39 31 20 46 52 4f 4d 20 74 61 62   + - 91 FROM tab
35560 31 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e  1..----..NULL..N
35570 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75 65  ULL..NULL....que
35580 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
35590 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 35 20  LECT DISTINCT 5 
355a0 2b 20 38 38 20 46 52 4f 4d 20 74 61 62 32 0d 0a  + 88 FROM tab2..
355b0 2d 2d 2d 2d 0d 0a 39 33 0d 0a 0d 0a 6f 6e 6c 79  ----..93....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 38 0d 0a 53 45  t label-1488..SE
35610 4c 45 43 54 20 39 20 44 49 56 20 36 34 20 46 52  LECT 9 DIV 64 FR
35620 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 30  OM tab2..----..0
35630 0d 0a 30 0d 0a 30 0d 0a 0d 0a 73 6b 69 70 69 66  ..0..0....skipif
35640 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
35650 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
35660 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
35670 34 38 38 0d 0a 53 45 4c 45 43 54 20 39 20 2f 20  488..SELECT 9 / 
35680 36 34 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d  64 FROM tab2..--
35690 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a 71  --..0..0..0....q
356a0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
356b0 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
356c0 2b 20 2b 20 63 6f 72 31 2e 63 6f 6c 31 20 2d 20  + + cor1.col1 - 
356d0 63 6f 72 30 2e 63 6f 6c 30 20 46 52 4f 4d 20 74  cor0.col0 FROM t
356e0 61 62 30 20 41 53 20 63 6f 72 30 20 43 52 4f 53  ab0 AS cor0 CROS
356f0 53 20 4a 4f 49 4e 20 74 61 62 32 20 41 53 20 63  S JOIN tab2 AS c
35700 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c  or1..----..9 val
35710 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 64  ues hashing to d
35720 62 66 63 36 65 31 34 61 35 31 36 62 32 66 34 61  bfc6e14a516b2f4a
35730 33 62 61 64 30 34 34 30 39 61 38 31 35 66 63 0d  3bad04409a815fc.
35740 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
35750 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 28 20 63  rt..SELECT - ( c
35760 6f 6c 32 20 29 20 2b 20 2d 20 63 6f 72 30 2e 63  ol2 ) + - cor0.c
35770 6f 6c 30 20 2a 20 2d 20 63 6f 6c 32 20 46 52 4f  ol0 * - col2 FRO
35780 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
35790 2d 2d 2d 2d 0d 0a 31 36 32 0d 0a 32 30 30 32 0d  ----..162..2002.
357a0 0a 32 39 36 34 0d 0a 0d 0a 71 75 65 72 79 20 49  .2964....query I
357b0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
357c0 20 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c 31 20 2b   col0 * + col1 +
357d0 20 36 33 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d   63 AS col0 FROM
357e0 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
357f0 2d 2d 2d 0d 0a 32 31 32 37 0d 0a 33 34 35 38 0d  ---..2127..3458.
35800 0a 38 31 36 32 0d 0a 0d 0a 73 6b 69 70 69 66 20  .8162....skipif 
35810 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73  postgresql # Pos
35820 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73  tgreSQL requires
35830 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e   AS when renamin
35840 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73  g output columns
35850 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
35860 74 0d 0a 53 45 4c 45 43 54 20 63 6f 72 31 2e 63  t..SELECT cor1.c
35870 6f 6c 30 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61  ol0 col0 FROM ta
35880 62 30 20 63 6f 72 30 20 43 52 4f 53 53 20 4a 4f  b0 cor0 CROSS JO
35890 49 4e 20 74 61 62 32 20 41 53 20 63 6f 72 31 0d  IN tab2 AS cor1.
358a0 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20  .----..9 values 
358b0 68 61 73 68 69 6e 67 20 74 6f 20 39 35 62 39 36  hashing to 95b96
358c0 63 61 31 64 62 65 32 65 33 39 61 30 66 61 37 38  ca1dbe2e39a0fa78
358d0 66 35 30 64 33 37 34 66 35 31 61 0d 0a 0d 0a 71  f50d374f51a....q
358e0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
358f0 53 45 4c 45 43 54 20 2d 20 2b 20 63 6f 72 30 2e  SELECT - + cor0.
35900 63 6f 6c 31 20 2d 20 63 6f 6c 30 20 41 53 20 63  col1 - col0 AS c
35910 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol1 FROM tab0 AS
35920 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31   cor0..----..-11
35930 30 0d 0a 2d 31 33 32 0d 0a 2d 31 38 30 0d 0a 0d  0..-132..-180...
35940 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
35950 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63  ..SELECT ALL - c
35960 6f 6c 32 20 2a 20 2d 20 63 6f 6c 31 20 2a 20 74  ol2 * - col1 * t
35970 61 62 30 2e 63 6f 6c 32 20 41 53 20 63 6f 6c 32  ab0.col2 AS col2
35980 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d   FROM tab0..----
35990 0d 0a 36 31 31 38 38 34 0d 0a 39 33 36 35 34 0d  ..611884..93654.
359a0 0a 39 37 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f  .97....skipif po
359b0 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67  stgresql # Postg
359c0 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41  reSQL requires A
359d0 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20  S when renaming 
359e0 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a  output columns..
359f0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
35a00 0a 53 45 4c 45 43 54 20 41 4c 4c 20 74 61 62 32  .SELECT ALL tab2
35a10 2e 63 6f 6c 30 20 2a 20 63 6f 6c 30 20 2d 20 63  .col0 * col0 - c
35a20 6f 6c 32 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61  ol2 col2 FROM ta
35a30 62 32 0d 0a 2d 2d 2d 2d 0d 0a 32 32 0d 0a 36 30  b2..----..22..60
35a40 35 38 0d 0a 36 32 30 33 0d 0a 0d 0a 6f 6e 6c 79  58..6203....only
35a50 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44  if mysql # use D
35a60 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20  IV operator for 
35a70 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e  integer division
35a80 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
35a90 74 20 6c 61 62 65 6c 2d 31 34 39 36 0d 0a 53 45  t label-1496..SE
35aa0 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 74 61  LECT DISTINCT ta
35ab0 62 32 2e 63 6f 6c 32 20 44 49 56 20 2b 20 63 6f  b2.col2 DIV + co
35ac0 6c 31 20 2d 20 35 36 20 46 52 4f 4d 20 74 61 62  l1 - 56 FROM tab
35ad0 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 34 0d 0a 2d 35  2..----..-54..-5
35ae0 36 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  6....skipif mysq
35af0 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
35b00 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
35b10 6f 72 74 20 6c 61 62 65 6c 2d 31 34 39 36 0d 0a  ort label-1496..
35b20 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
35b30 74 61 62 32 2e 63 6f 6c 32 20 2f 20 2b 20 63 6f  tab2.col2 / + co
35b40 6c 31 20 2d 20 35 36 20 46 52 4f 4d 20 74 61 62  l1 - 56 FROM tab
35b50 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 34 0d 0a 2d 35  2..----..-54..-5
35b60 36 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74  6....skipif post
35b70 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65  gresql # Postgre
35b80 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20  SQL requires AS 
35b90 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75  when renaming ou
35ba0 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75  tput columns..qu
35bb0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
35bc0 45 4c 45 43 54 20 2b 20 63 6f 6c 32 20 2a 20 28  ELECT + col2 * (
35bd0 20 2b 20 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c 30   + col2 * + col0
35be0 20 29 20 2d 20 63 6f 6c 30 20 63 6f 6c 32 20 46   ) - col0 col2 F
35bf0 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
35c00 0d 0a 2d 2d 2d 2d 0d 0a 32 30 37 38 37 32 0d 0a  ..----..207872..
35c10 37 33 37 32 30 30 0d 0a 38 37 34 35 0d 0a 0d 0a  737200..8745....
35c20 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75  onlyif mysql # u
35c30 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20  se DIV operator 
35c40 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69  for integer divi
35c50 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f  sion..query I ro
35c60 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 34 39 38  wsort label-1498
35c70 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c  ..SELECT ALL col
35c80 30 20 2b 20 63 6f 6c 30 20 44 49 56 20 63 6f 6c  0 + col0 DIV col
35c90 31 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  1 AS col1 FROM t
35ca0 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab0 cor0..----..
35cb0 32 34 0d 0a 33 35 0d 0a 38 39 0d 0a 0d 0a 73 6b  24..35..89....sk
35cc0 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
35cd0 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
35ce0 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
35cf0 65 6c 2d 31 34 39 38 0d 0a 53 45 4c 45 43 54 20  el-1498..SELECT 
35d00 41 4c 4c 20 63 6f 6c 30 20 2b 20 63 6f 6c 30 20  ALL col0 + col0 
35d10 2f 20 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46  / col1 AS col1 F
35d20 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d  ROM tab0 cor0..-
35d30 2d 2d 2d 0d 0a 32 34 0d 0a 33 35 0d 0a 38 39 0d  ---..24..35..89.
35d40 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
35d50 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
35d60 4e 43 54 20 2d 20 63 6f 6c 30 20 2b 20 2d 20 28  NCT - col0 + - (
35d70 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 29 20 41   - cor0.col2 ) A
35d80 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30  S col2 FROM tab0
35d90 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
35da0 2d 33 34 0d 0a 2d 37 0d 0a 39 0d 0a 0d 0a 71 75  -34..-7..9....qu
35db0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
35dc0 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 31  ELECT ALL - col1
35dd0 20 2b 20 35 31 20 2a 20 2b 20 63 6f 6c 30 20 41   + 51 * + col0 A
35de0 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30  S col0 FROM tab0
35df0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
35e00 31 31 33 38 0d 0a 31 36 38 38 0d 0a 34 34 34 38  1138..1688..4448
35e10 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
35e20 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61   # use DIV opera
35e30 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20  tor for integer 
35e40 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20  division..query 
35e50 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
35e60 31 35 30 31 0d 0a 53 45 4c 45 43 54 20 36 20 2a  1501..SELECT 6 *
35e70 20 63 6f 6c 31 20 44 49 56 20 28 20 63 6f 6c 31   col1 DIV ( col1
35e80 20 29 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d   ) FROM tab0..--
35e90 2d 2d 0d 0a 36 0d 0a 36 0d 0a 36 0d 0a 0d 0a 73  --..6..6..6....s
35ea0 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
35eb0 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
35ec0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
35ed0 62 65 6c 2d 31 35 30 31 0d 0a 53 45 4c 45 43 54  bel-1501..SELECT
35ee0 20 36 20 2a 20 63 6f 6c 31 20 2f 20 28 20 63 6f   6 * col1 / ( co
35ef0 6c 31 20 29 20 46 52 4f 4d 20 74 61 62 30 0d 0a  l1 ) FROM tab0..
35f00 2d 2d 2d 2d 0d 0a 36 0d 0a 36 0d 0a 36 0d 0a 0d  ----..6..6..6...
35f10 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
35f20 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 38  ..SELECT ALL + 8
35f30 36 20 2d 20 74 61 62 30 2e 63 6f 6c 32 20 41 53  6 - tab0.col2 AS
35f40 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d   col0 FROM tab0.
35f50 0a 2d 2d 2d 2d 0d 0a 34 0d 0a 35 33 0d 0a 38 35  .----..4..53..85
35f60 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
35f70 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
35f80 2d 20 63 6f 6c 30 20 2d 20 2d 20 63 6f 6c 32 20  - col0 - - col2 
35f90 2a 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31  * col1 FROM tab1
35fa0 0d 0a 2d 2d 2d 2d 0d 0a 31 31 36 38 0d 0a 31 34  ..----..1168..14
35fb0 30 31 0d 0a 35 30 36 0d 0a 0d 0a 71 75 65 72 79  01..506....query
35fc0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
35fd0 43 54 20 41 4c 4c 20 63 6f 6c 31 20 2a 20 63 6f  CT ALL col1 * co
35fe0 6c 32 20 2d 20 2b 20 28 20 2d 20 63 6f 6c 30 20  l2 - + ( - col0 
35ff0 2b 20 63 6f 6c 30 20 29 20 46 52 4f 4d 20 74 61  + col0 ) FROM ta
36000 62 30 0d 0a 2d 2d 2d 2d 0d 0a 32 38 33 38 0d 0a  b0..----..2838..
36010 37 34 36 32 0d 0a 39 37 0d 0a 0d 0a 73 6b 69 70  7462..97....skip
36020 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20  if postgresql # 
36030 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69  PostgreSQL requi
36040 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61  res AS when rena
36050 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75  ming output colu
36060 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  mns..query I row
36070 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63  sort..SELECT - c
36080 6f 72 30 2e 63 6f 6c 30 20 2b 20 2d 20 28 20 37  or0.col0 + - ( 7
36090 39 20 2a 20 63 6f 6c 31 20 29 20 2b 20 2d 20 63  9 * col1 ) + - c
360a0 6f 6c 31 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61  ol1 col2 FROM ta
360b0 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
360c0 0d 0a 2d 31 31 32 30 0d 0a 2d 32 30 38 33 0d 0a  ..-1120..-2083..
360d0 2d 38 36 34 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  -864....onlyif m
360e0 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f  ysql # use DIV o
360f0 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65  perator for inte
36100 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75  ger division..qu
36110 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
36120 62 65 6c 2d 31 35 30 36 0d 0a 53 45 4c 45 43 54  bel-1506..SELECT
36130 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 44 49 56   + cor0.col0 DIV
36140 20 2d 20 28 20 63 6f 6c 32 20 2b 20 2b 20 63 6f   - ( col2 + + co
36150 6c 31 20 29 20 46 52 4f 4d 20 74 61 62 31 20 41  l1 ) FROM tab1 A
36160 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d  S cor0..----..0.
36170 0a 30 0d 0a 30 0d 0a 0d 0a 73 6b 69 70 69 66 20  .0..0....skipif 
36180 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
36190 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
361a0 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 35  rowsort label-15
361b0 30 36 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 72  06..SELECT + cor
361c0 30 2e 63 6f 6c 30 20 2f 20 2d 20 28 20 63 6f 6c  0.col0 / - ( col
361d0 32 20 2b 20 2b 20 63 6f 6c 31 20 29 20 46 52 4f  2 + + col1 ) FRO
361e0 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
361f0 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d  ----..0..0..0...
36200 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
36210 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 32 20 2a 20  ..SELECT col2 * 
36220 2b 20 63 6f 6c 32 20 2b 20 28 20 2b 20 63 6f 6c  + col2 + ( + col
36230 32 20 29 20 2b 20 2b 20 63 6f 72 30 2e 63 6f 6c  2 ) + + cor0.col
36240 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  2 FROM tab0 AS c
36250 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 35 35 0d  or0..----..1155.
36260 0a 33 0d 0a 36 38 38 38 0d 0a 0d 0a 71 75 65 72  .3..6888....quer
36270 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
36280 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 31 20 2b  ECT ALL + col1 +
36290 20 2b 20 28 20 63 6f 6c 30 20 29 20 46 52 4f 4d   + ( col0 ) FROM
362a0 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
362b0 2d 2d 2d 0d 0a 31 33 37 0d 0a 33 38 0d 0a 39 36  ---..137..38..96
362c0 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
362d0 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61   # use DIV opera
362e0 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20  tor for integer 
362f0 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20  division..query 
36300 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
36310 31 35 30 39 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  1509..SELECT ALL
36320 20 2b 20 63 6f 6c 30 20 2b 20 63 6f 6c 31 20 44   + col0 + col1 D
36330 49 56 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c  IV + col0 AS col
36340 30 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30  0 FROM tab0 cor0
36350 0d 0a 2d 2d 2d 2d 0d 0a 32 37 0d 0a 33 37 0d 0a  ..----..27..37..
36360 39 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  90....skipif mys
36370 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
36380 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
36390 73 6f 72 74 20 6c 61 62 65 6c 2d 31 35 30 39 0d  sort label-1509.
363a0 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f  .SELECT ALL + co
363b0 6c 30 20 2b 20 63 6f 6c 31 20 2f 20 2b 20 63 6f  l0 + col1 / + co
363c0 6c 30 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  l0 AS col0 FROM 
363d0 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab0 cor0..----.
363e0 0a 32 37 0d 0a 33 37 0d 0a 39 30 0d 0a 0d 0a 71  .27..37..90....q
363f0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
36400 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c  SELECT ALL + col
36410 30 20 2a 20 2d 20 36 32 20 41 53 20 63 6f 6c 31  0 * - 62 AS col1
36420 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
36430 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 38 36 0d 0a  r0..----..-186..
36440 2d 33 39 36 38 0d 0a 2d 34 39 36 30 0d 0a 0d 0a  -3968..-4960....
36450 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
36460 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
36470 20 63 6f 6c 30 20 2a 20 28 20 2b 20 38 31 20 29   col0 * ( + 81 )
36480 20 2b 20 63 6f 6c 32 20 2b 20 63 6f 6c 32 20 46   + col2 + col2 F
36490 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
364a0 0d 0a 2d 2d 2d 2d 0d 0a 36 32 31 0d 0a 36 33 37  ..----..621..637
364b0 30 0d 0a 36 34 37 35 0d 0a 0d 0a 71 75 65 72 79  0..6475....query
364c0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
364d0 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 32 20 2b 20  CT ALL + col2 + 
364e0 28 20 63 6f 6c 30 20 29 20 2a 20 2b 20 63 6f 6c  ( col0 ) * + col
364f0 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  2 FROM tab0 AS c
36500 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 36 0d 0a 37  or0..----..36..7
36510 33 38 30 0d 0a 38 32 35 0d 0a 0d 0a 6f 6e 6c 79  380..825....only
36520 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44  if mysql # use D
36530 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20  IV operator for 
36540 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e  integer division
36550 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
36560 74 20 6c 61 62 65 6c 2d 31 35 31 33 0d 0a 53 45  t label-1513..SE
36570 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20  LECT DISTINCT + 
36580 63 6f 72 30 2e 63 6f 6c 31 20 44 49 56 20 28 20  cor0.col1 DIV ( 
36590 63 6f 6c 30 20 29 20 2b 20 2b 20 63 6f 6c 32 20  col0 ) + + col2 
365a0 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
365b0 30 0d 0a 2d 2d 2d 2d 0d 0a 32 36 0d 0a 33 31 0d  0..----..26..31.
365c0 0a 33 38 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  .38....skipif my
365d0 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
365e0 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
365f0 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 35 31 33  wsort label-1513
36600 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
36610 54 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 2f 20  T + cor0.col1 / 
36620 28 20 63 6f 6c 30 20 29 20 2b 20 2b 20 63 6f 6c  ( col0 ) + + col
36630 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  2 FROM tab2 AS c
36640 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 36 0d 0a 33  or0..----..26..3
36650 31 0d 0a 33 38 0d 0a 0d 0a 73 6b 69 70 69 66 20  1..38....skipif 
36660 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73  postgresql # Pos
36670 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73  tgreSQL requires
36680 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e   AS when renamin
36690 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73  g output columns
366a0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
366b0 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20  t..SELECT ALL - 
366c0 63 6f 6c 31 20 2b 20 2d 20 28 20 2b 20 63 6f 72  col1 + - ( + cor
366d0 30 2e 63 6f 6c 31 20 2a 20 2b 20 63 6f 72 30 2e  0.col1 * + cor0.
366e0 63 6f 6c 32 20 29 20 63 6f 6c 32 20 46 52 4f 4d  col2 ) col2 FROM
366f0 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
36700 2d 2d 2d 0d 0a 2d 31 32 36 31 0d 0a 2d 31 34 33  ---..-1261..-143
36710 30 0d 0a 2d 35 38 30 0d 0a 0d 0a 71 75 65 72 79  0..-580....query
36720 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
36730 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f  CT DISTINCT - co
36740 6c 31 20 2b 20 2b 20 28 20 63 6f 6c 32 20 29 20  l1 + + ( col2 ) 
36750 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
36760 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
36770 0a 32 38 0d 0a 34 37 0d 0a 38 33 0d 0a 0d 0a 71  .28..47..83....q
36780 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
36790 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
367a0 2b 20 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c 31 20  + col1 * - col1 
367b0 2a 20 2d 20 63 6f 6c 30 20 41 53 20 63 6f 6c 31  * - col0 AS col1
367c0 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
367d0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 37 37 35 30 34  r0..----..177504
367e0 0d 0a 33 32 39 33 31 35 0d 0a 37 33 37 30 30 39  ..329315..737009
367f0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
36800 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
36810 63 6f 72 30 2e 63 6f 6c 32 20 2a 20 63 6f 72 30  cor0.col2 * cor0
36820 2e 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c 30 20 2b  .col0 + - col0 +
36830 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20   + col0 AS col1 
36840 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
36850 30 0d 0a 2d 2d 2d 2d 0d 0a 33 35 0d 0a 37 32 39  0..----..35..729
36860 38 0d 0a 37 39 32 0d 0a 0d 0a 71 75 65 72 79 20  8..792....query 
36870 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
36880 54 20 63 6f 72 30 2e 63 6f 6c 30 20 2b 20 63 6f  T cor0.col0 + co
36890 72 30 2e 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20  r0.col1 AS col0 
368a0 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
368b0 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 30 0d 0a 31 33  0..----..110..13
368c0 32 0d 0a 31 38 30 0d 0a 0d 0a 71 75 65 72 79 20  2..180....query 
368d0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
368e0 54 20 33 38 20 2b 20 2d 20 38 35 20 41 53 20 63  T 38 + - 85 AS c
368f0 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol1 FROM tab1 AS
36900 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 37   cor0..----..-47
36910 0d 0a 2d 34 37 0d 0a 2d 34 37 0d 0a 0d 0a 71 75  ..-47..-47....qu
36920 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
36930 45 4c 45 43 54 20 63 6f 6c 32 20 2a 20 2d 20 63  ELECT col2 * - c
36940 6f 6c 32 20 2b 20 74 61 62 31 2e 63 6f 6c 30 20  ol2 + tab1.col0 
36950 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
36960 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 39 31 33 0d 0a  1..----..-2913..
36970 2d 33 31 38 35 0d 0a 2d 39 31 33 36 0d 0a 0d 0a  -3185..-9136....
36980 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
36990 0a 53 45 4c 45 43 54 20 2b 20 2d 20 32 31 20 2a  .SELECT + - 21 *
369a0 20 2b 20 37 33 20 2a 20 2d 20 63 6f 6c 32 20 46   + 73 * - col2 F
369b0 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
369c0 0d 0a 2d 2d 2d 2d 0d 0a 31 32 35 37 30 36 0d 0a  ..----..125706..
369d0 31 35 33 33 0d 0a 35 30 35 38 39 0d 0a 0d 0a 71  1533..50589....q
369e0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
369f0 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 2d 20 28  SELECT ALL + - (
36a00 20 63 6f 6c 31 20 29 20 2a 20 2b 20 63 6f 6c 31   col1 ) * + col1
36a10 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
36a20 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
36a30 0d 0a 2d 37 33 39 36 0d 0a 2d 38 32 38 31 0d 0a  ..-7396..-8281..
36a40 2d 39 34 30 39 0d 0a 0d 0a 71 75 65 72 79 20 49  -9409....query I
36a50 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
36a60 20 2d 20 28 20 2d 20 32 20 29 20 2a 20 63 6f 6c   - ( - 2 ) * col
36a70 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  1 FROM tab0 AS c
36a80 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 37 32 0d 0a  or0..----..172..
36a90 31 38 32 0d 0a 31 39 34 0d 0a 0d 0a 71 75 65 72  182..194....quer
36aa0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
36ab0 45 43 54 20 2b 20 36 36 20 2a 20 63 6f 6c 30 20  ECT + 66 * col0 
36ac0 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
36ad0 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 34 36  2 cor0..----..46
36ae0 32 0d 0a 35 31 34 38 0d 0a 35 32 31 34 0d 0a 0d  2..5148..5214...
36af0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
36b00 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 31 20  ..SELECT - col1 
36b10 2a 20 2d 20 37 39 20 2a 20 2b 20 63 6f 6c 30 20  * - 79 * + col0 
36b20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
36b30 30 0d 0a 2d 2d 2d 2d 0d 0a 31 36 33 30 35 36 0d  0..----..163056.
36b40 0a 32 36 38 32 30 35 0d 0a 36 33 39 38 32 31 0d  .268205..639821.
36b50 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
36b60 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
36b70 4e 43 54 20 63 6f 72 30 2e 63 6f 6c 30 20 2b 20  NCT cor0.col0 + 
36b80 2d 20 37 30 20 46 52 4f 4d 20 74 61 62 31 2c 20  - 70 FROM tab1, 
36b90 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
36ba0 2d 2d 0d 0a 2d 33 35 0d 0a 2d 34 36 0d 0a 31 39  --..-35..-46..19
36bb0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
36bc0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
36bd0 49 4e 43 54 20 63 6f 72 30 2e 63 6f 6c 31 20 2b  INCT cor0.col1 +
36be0 20 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46 52   col2 AS col0 FR
36bf0 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d  OM tab0 cor0..--
36c00 2d 2d 0d 0a 31 31 39 0d 0a 31 37 33 0d 0a 39 38  --..119..173..98
36c10 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
36c20 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d   # support for M
36c30 79 53 51 4c 20 73 70 65 63 69 66 69 63 20 73 79  ySQL specific sy
36c40 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73  stem types and s
36c50 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72  yntax..query I r
36c60 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 35 32  owsort label-152
36c70 38 0d 0a 53 45 4c 45 43 54 20 2d 20 2b 20 63 6f  8..SELECT - + co
36c80 6c 30 20 2a 20 63 6f 72 30 2e 63 6f 6c 31 20 2d  l0 * cor0.col1 -
36c90 20 2d 20 43 41 53 54 28 20 38 30 20 41 53 20 53   - CAST( 80 AS S
36ca0 49 47 4e 45 44 20 29 20 2a 20 63 6f 72 30 2e 63  IGNED ) * cor0.c
36cb0 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  ol2 AS col2 FROM
36cc0 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
36cd0 2d 2d 2d 0d 0a 2d 31 35 33 39 0d 0a 2d 33 33 31  ---..-1539..-331
36ce0 35 0d 0a 35 37 36 0d 0a 0d 0a 73 6b 69 70 69 66  5..576....skipif
36cf0 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
36d00 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
36d10 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
36d20 35 32 38 0d 0a 53 45 4c 45 43 54 20 2d 20 2b 20  528..SELECT - + 
36d30 63 6f 6c 30 20 2a 20 63 6f 72 30 2e 63 6f 6c 31  col0 * cor0.col1
36d40 20 2d 20 2d 20 43 41 53 54 20 28 20 38 30 20 41   - - CAST ( 80 A
36d50 53 20 49 4e 54 45 47 45 52 20 29 20 2a 20 63 6f  S INTEGER ) * co
36d60 72 30 2e 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20  r0.col2 AS col2 
36d70 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
36d80 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 35 33 39 0d 0a  0..----..-1539..
36d90 2d 33 33 31 35 0d 0a 35 37 36 0d 0a 0d 0a 71 75  -3315..576....qu
36da0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
36db0 45 4c 45 43 54 20 41 4c 4c 20 2b 20 2b 20 39 38  ELECT ALL + + 98
36dc0 20 2d 20 2d 20 63 6f 6c 32 20 41 53 20 63 6f 6c   - - col2 AS col
36dd0 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  0 FROM tab2 AS c
36de0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 34 0d 0a  or0..----..124..
36df0 31 32 35 0d 0a 31 33 36 0d 0a 0d 0a 71 75 65 72  125..136....quer
36e00 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
36e10 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 30 20 2a  ECT ALL + col0 *
36e20 20 2b 20 74 61 62 31 2e 63 6f 6c 32 20 46 52 4f   + tab1.col2 FRO
36e30 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 36  M tab1..----..16
36e40 32 0d 0a 33 36 34 38 0d 0a 37 36 38 30 0d 0a 0d  2..3648..7680...
36e50 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73  .skipif postgres
36e60 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20  ql # PostgreSQL 
36e70 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e  requires AS when
36e80 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74   renaming output
36e90 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20   columns..query 
36ea0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
36eb0 54 20 44 49 53 54 49 4e 43 54 20 28 20 32 35 20  T DISTINCT ( 25 
36ec0 29 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30  ) col0 FROM tab0
36ed0 0d 0a 2d 2d 2d 2d 0d 0a 32 35 0d 0a 0d 0a 71 75  ..----..25....qu
36ee0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
36ef0 45 4c 45 43 54 20 2d 20 39 35 20 2a 20 38 38 20  ELECT - 95 * 88 
36f00 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d  FROM tab2..----.
36f10 0a 2d 38 33 36 30 0d 0a 2d 38 33 36 30 0d 0a 2d  .-8360..-8360..-
36f20 38 33 36 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20  8360....query I 
36f30 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
36f40 63 6f 72 30 2e 63 6f 6c 30 20 2b 20 2d 20 38 32  cor0.col0 + - 82
36f50 20 2a 20 36 34 20 41 53 20 63 6f 6c 32 20 46 52   * 64 AS col2 FR
36f60 4f 4d 20 74 61 62 30 2c 20 74 61 62 32 20 41 53  OM tab0, tab2 AS
36f70 20 63 6f 72 30 2c 20 74 61 62 32 20 41 53 20 63   cor0, tab2 AS c
36f80 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61  or1..----..27 va
36f90 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20  lues hashing to 
36fa0 61 66 31 34 34 32 66 31 30 61 62 66 38 36 65 66  af1442f10abf86ef
36fb0 64 62 34 32 38 37 35 38 38 63 38 65 63 39 35 65  db4287588c8ec95e
36fc0 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
36fd0 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d   # support for M
36fe0 79 53 51 4c 20 73 70 65 63 69 66 69 63 20 73 79  ySQL specific sy
36ff0 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73  stem types and s
37000 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72  yntax..query I r
37010 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 35 33  owsort label-153
37020 34 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  4..SELECT DISTIN
37030 43 54 20 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c 31  CT col0 * - col1
37040 20 2b 20 2b 20 43 41 53 54 28 20 4e 55 4c 4c 20   + + CAST( NULL 
37050 41 53 20 53 49 47 4e 45 44 20 29 20 2b 20 35 39  AS SIGNED ) + 59
37060 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
37070 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a  r0..----..NULL..
37080 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
37090 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
370a0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
370b0 20 6c 61 62 65 6c 2d 31 35 33 34 0d 0a 53 45 4c   label-1534..SEL
370c0 45 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c  ECT DISTINCT col
370d0 30 20 2a 20 2d 20 63 6f 6c 31 20 2b 20 2b 20 43  0 * - col1 + + C
370e0 41 53 54 20 28 20 4e 55 4c 4c 20 41 53 20 49 4e  AST ( NULL AS IN
370f0 54 45 47 45 52 20 29 20 2b 20 35 39 20 46 52 4f  TEGER ) + 59 FRO
37100 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
37110 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75  ----..NULL....qu
37120 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
37130 45 4c 45 43 54 20 2d 20 2b 20 37 36 20 41 53 20  ELECT - + 76 AS 
37140 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41  col1 FROM tab1 A
37150 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 37  S cor0..----..-7
37160 36 0d 0a 2d 37 36 0d 0a 2d 37 36 0d 0a 0d 0a 71  6..-76..-76....q
37170 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
37180 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
37190 2b 20 2d 20 63 6f 6c 30 20 2a 20 63 6f 72 30 2e  + - col0 * cor0.
371a0 63 6f 6c 32 20 2d 20 2d 20 63 6f 6c 32 20 41 53  col2 - - col2 AS
371b0 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20   col0 FROM tab1 
371c0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
371d0 31 30 38 0d 0a 2d 33 35 39 31 0d 0a 2d 37 35 38  108..-3591..-758
371e0 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  4....query I row
371f0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
37200 54 49 4e 43 54 20 63 6f 6c 30 20 2a 20 63 6f 6c  TINCT col0 * col
37210 32 20 2b 20 35 37 20 46 52 4f 4d 20 74 61 62 31  2 + 57 FROM tab1
37220 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 31 39   cor0..----..219
37230 0d 0a 33 37 30 35 0d 0a 37 37 33 37 0d 0a 0d 0a  ..3705..7737....
37240 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
37250 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
37260 20 2b 20 2b 20 36 32 20 2b 20 2d 20 63 6f 6c 32   + + 62 + - col2
37270 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
37280 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 34 0d 0a 35  r0..----..-34..5
37290 0d 0a 38 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  ..8....onlyif my
372a0 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70  sql # use DIV op
372b0 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67  erator for integ
372c0 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65  er division..que
372d0 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
372e0 65 6c 2d 31 35 33 39 0d 0a 53 45 4c 45 43 54 20  el-1539..SELECT 
372f0 2d 20 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c 30 20  - col0 * + col0 
37300 44 49 56 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20  DIV + col0 FROM 
37310 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
37320 2d 2d 0d 0a 2d 33 0d 0a 2d 36 34 0d 0a 2d 38 30  --..-3..-64..-80
37330 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
37340 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
37350 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
37360 72 74 20 6c 61 62 65 6c 2d 31 35 33 39 0d 0a 53  rt label-1539..S
37370 45 4c 45 43 54 20 2d 20 63 6f 6c 30 20 2a 20 2b  ELECT - col0 * +
37380 20 63 6f 6c 30 20 2f 20 2b 20 63 6f 6c 30 20 46   col0 / + col0 F
37390 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
373a0 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 0d 0a 2d 36 34 0d  ..----..-3..-64.
373b0 0a 2d 38 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  .-80....onlyif m
373c0 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66  ysql # support f
373d0 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69  or MySQL specifi
373e0 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61  c system types a
373f0 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79  nd syntax..query
37400 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
37410 2d 31 35 34 30 0d 0a 53 45 4c 45 43 54 20 44 49  -1540..SELECT DI
37420 53 54 49 4e 43 54 20 2d 20 2d 20 63 6f 6c 31 20  STINCT - - col1 
37430 2a 20 2d 20 43 41 53 54 28 20 4e 55 4c 4c 20 41  * - CAST( NULL A
37440 53 20 44 45 43 49 4d 41 4c 20 29 20 46 52 4f 4d  S DECIMAL ) FROM
37450 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
37460 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69  ---..NULL....ski
37470 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
37480 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
37490 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
374a0 6c 2d 31 35 34 30 0d 0a 53 45 4c 45 43 54 20 44  l-1540..SELECT D
374b0 49 53 54 49 4e 43 54 20 2d 20 2d 20 63 6f 6c 31  ISTINCT - - col1
374c0 20 2a 20 2d 20 43 41 53 54 20 28 20 4e 55 4c 4c   * - CAST ( NULL
374d0 20 41 53 20 52 45 41 4c 20 29 20 46 52 4f 4d 20   AS REAL ) FROM 
374e0 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
374f0 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 6f 6e 6c 79  --..NULL....only
37500 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f  if mysql # suppo
37510 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65  rt for MySQL spe
37520 63 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70  cific system typ
37530 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71  es and syntax..q
37540 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
37550 61 62 65 6c 2d 31 35 34 31 0d 0a 53 45 4c 45 43  abel-1541..SELEC
37560 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 31 20  T DISTINCT col1 
37570 2b 20 2b 20 43 41 53 54 28 20 4e 55 4c 4c 20 41  + + CAST( NULL A
37580 53 20 53 49 47 4e 45 44 20 29 20 41 53 20 63 6f  S SIGNED ) AS co
37590 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l0 FROM tab0 AS 
375a0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c  cor0..----..NULL
375b0 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
375c0 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
375d0 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
375e0 72 74 20 6c 61 62 65 6c 2d 31 35 34 31 0d 0a 53  rt label-1541..S
375f0 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 63  ELECT DISTINCT c
37600 6f 6c 31 20 2b 20 2b 20 43 41 53 54 20 28 20 4e  ol1 + + CAST ( N
37610 55 4c 4c 20 41 53 20 49 4e 54 45 47 45 52 20 29  ULL AS INTEGER )
37620 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
37630 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
37640 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 6f 6e 6c 79 69 66  ..NULL....onlyif
37650 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74   mysql # support
37660 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69   for MySQL speci
37670 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73  fic system types
37680 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65   and syntax..que
37690 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
376a0 65 6c 2d 31 35 34 32 0d 0a 53 45 4c 45 43 54 20  el-1542..SELECT 
376b0 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c 30 20  DISTINCT - col0 
376c0 2f 20 43 41 53 54 28 20 4e 55 4c 4c 20 41 53 20  / CAST( NULL AS 
376d0 53 49 47 4e 45 44 20 29 20 41 53 20 63 6f 6c 30  SIGNED ) AS col0
376e0 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
376f0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a  r0..----..NULL..
37700 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
37710 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
37720 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
37730 20 6c 61 62 65 6c 2d 31 35 34 32 0d 0a 53 45 4c   label-1542..SEL
37740 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63  ECT DISTINCT - c
37750 6f 6c 30 20 2f 20 43 41 53 54 20 28 20 4e 55 4c  ol0 / CAST ( NUL
37760 4c 20 41 53 20 49 4e 54 45 47 45 52 20 29 20 41  L AS INTEGER ) A
37770 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30  S col0 FROM tab0
37780 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
37790 4e 55 4c 4c 0d 0a 0d 0a 71 75 65 72 79 20 49 20  NULL....query I 
377a0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
377b0 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c 30 20  DISTINCT - col0 
377c0 2b 20 63 6f 6c 32 20 2a 20 2d 20 33 34 20 46 52  + col2 * - 34 FR
377d0 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
377e0 0a 2d 2d 2d 2d 0d 0a 2d 31 38 33 39 0d 0a 2d 32  .----..-1839..-2
377f0 30 30 32 0d 0a 2d 33 33 34 34 0d 0a 0d 0a 71 75  002..-3344....qu
37800 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
37810 45 4c 45 43 54 20 2d 20 63 6f 72 30 2e 63 6f 6c  ELECT - cor0.col
37820 30 20 2a 20 63 6f 6c 32 20 2b 20 2d 20 63 6f 72  0 * col2 + - cor
37830 30 2e 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46  0.col1 AS col1 F
37840 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d  ROM tab0 cor0..-
37850 2d 2d 2d 0d 0a 2d 31 33 32 0d 0a 2d 37 33 38 39  ---..-132..-7389
37860 0d 0a 2d 38 37 38 0d 0a 0d 0a 6f 6e 6c 79 69 66  ..-878....onlyif
37870 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56   mysql # use DIV
37880 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e   operator for in
37890 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a  teger division..
378a0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
378b0 6c 61 62 65 6c 2d 31 35 34 35 0d 0a 53 45 4c 45  label-1545..SELE
378c0 43 54 20 41 4c 4c 20 63 6f 6c 31 20 2b 20 63 6f  CT ALL col1 + co
378d0 72 30 2e 63 6f 6c 31 20 44 49 56 20 2b 20 63 6f  r0.col1 DIV + co
378e0 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 63 6f 72  l1 FROM tab2 cor
378f0 30 0d 0a 2d 2d 2d 2d 0d 0a 31 38 0d 0a 33 32 0d  0..----..18..32.
37900 0a 36 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  .60....skipif my
37910 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
37920 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
37930 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 35 34 35  wsort label-1545
37940 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c  ..SELECT ALL col
37950 31 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 2f 20  1 + cor0.col1 / 
37960 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32  + col1 FROM tab2
37970 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 38 0d   cor0..----..18.
37980 0a 33 32 0d 0a 36 30 0d 0a 0d 0a 71 75 65 72 79  .32..60....query
37990 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
379a0 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63 6f  CT DISTINCT + co
379b0 6c 32 20 2a 20 2d 20 63 6f 6c 32 20 2b 20 2d 20  l2 * - col2 + - 
379c0 63 6f 72 30 2e 63 6f 6c 30 20 2a 20 2d 20 63 6f  cor0.col0 * - co
379d0 72 30 2e 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  r0.col2 FROM tab
379e0 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
379f0 0a 2d 32 39 37 0d 0a 33 34 0d 0a 35 37 34 0d 0a  .-297..34..574..
37a00 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
37a10 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2d 20 63 6f  t..SELECT + - co
37a20 6c 32 20 2b 20 2d 20 28 20 63 6f 6c 31 20 29 20  l2 + - ( col1 ) 
37a30 2a 20 2b 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61  * + col2 FROM ta
37a40 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
37a50 0d 0a 2d 31 35 36 30 0d 0a 2d 36 38 34 0d 0a 2d  ..-1560..-684..-
37a60 38 36 34 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  864....onlyif my
37a70 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f  sql # support fo
37a80 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63  r MySQL specific
37a90 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e   system types an
37aa0 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20  d syntax..query 
37ab0 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
37ac0 31 35 34 38 0d 0a 53 45 4c 45 43 54 20 2d 20 63  1548..SELECT - c
37ad0 6f 6c 30 20 2a 20 43 41 53 54 28 20 33 39 20 41  ol0 * CAST( 39 A
37ae0 53 20 53 49 47 4e 45 44 20 29 20 2d 20 2b 20 63  S SIGNED ) - + c
37af0 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  ol2 AS col2 FROM
37b00 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
37b10 2d 2d 2d 0d 0a 2d 31 33 36 36 0d 0a 2d 33 35 35  ---..-1366..-355
37b20 33 0d 0a 2d 39 36 39 0d 0a 0d 0a 73 6b 69 70 69  3..-969....skipi
37b30 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
37b40 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
37b50 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
37b60 31 35 34 38 0d 0a 53 45 4c 45 43 54 20 2d 20 63  1548..SELECT - c
37b70 6f 6c 30 20 2a 20 43 41 53 54 20 28 20 33 39 20  ol0 * CAST ( 39 
37b80 41 53 20 49 4e 54 45 47 45 52 20 29 20 2d 20 2b  AS INTEGER ) - +
37b90 20 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46 52   col2 AS col2 FR
37ba0 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
37bb0 0a 2d 2d 2d 2d 0d 0a 2d 31 33 36 36 0d 0a 2d 33  .----..-1366..-3
37bc0 35 35 33 0d 0a 2d 39 36 39 0d 0a 0d 0a 71 75 65  553..-969....que
37bd0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
37be0 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20  LECT DISTINCT + 
37bf0 63 6f 6c 30 20 2a 20 63 6f 6c 32 20 2d 20 63 6f  col0 * col2 - co
37c00 72 30 2e 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20  r0.col1 AS col1 
37c10 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
37c20 30 0d 0a 2d 2d 2d 2d 0d 0a 31 35 38 0d 0a 31 39  0..----..158..19
37c30 36 39 0d 0a 32 39 38 35 0d 0a 0d 0a 71 75 65 72  69..2985....quer
37c40 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
37c50 45 43 54 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20  ECT + cor0.col0 
37c60 2a 20 2d 20 63 6f 6c 31 20 2d 20 2b 20 63 6f 6c  * - col1 - + col
37c70 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  0 FROM tab1 AS c
37c80 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 32 30  or0..----..-1120
37c90 0d 0a 2d 37 30 34 0d 0a 2d 38 31 0d 0a 0d 0a 71  ..-704..-81....q
37ca0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
37cb0 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
37cc0 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 2d 20 2d 20  + cor0.col0 - - 
37cd0 28 20 36 20 29 20 46 52 4f 4d 20 74 61 62 32 20  ( 6 ) FROM tab2 
37ce0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
37cf0 33 0d 0a 38 34 0d 0a 38 35 0d 0a 0d 0a 71 75 65  3..84..85....que
37d00 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
37d10 4c 45 43 54 20 2d 20 2d 20 63 6f 6c 32 20 2b 20  LECT - - col2 + 
37d20 2d 20 28 20 63 6f 6c 31 20 29 20 46 52 4f 4d 20  - ( col1 ) FROM 
37d30 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab0 cor0..----.
37d40 0a 2d 35 33 0d 0a 2d 39 0d 0a 2d 39 36 0d 0a 0d  .-53..-9..-96...
37d50 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
37d60 0d 0a 53 45 4c 45 43 54 20 2b 20 2b 20 63 6f 6c  ..SELECT + + col
37d70 31 20 2a 20 63 6f 6c 31 20 2b 20 2d 20 38 39 20  1 * col1 + - 89 
37d80 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
37d90 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
37da0 0a 37 33 30 37 0d 0a 38 31 39 32 0d 0a 39 33 32  .7307..8192..932
37db0 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  0....onlyif mysq
37dc0 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72  l # use DIV oper
37dd0 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72  ator for integer
37de0 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79   division..query
37df0 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
37e00 2d 31 35 35 34 0d 0a 53 45 4c 45 43 54 20 41 4c  -1554..SELECT AL
37e10 4c 20 2d 20 63 6f 6c 32 20 2b 20 63 6f 6c 32 20  L - col2 + col2 
37e20 44 49 56 20 2d 20 63 6f 6c 31 20 41 53 20 63 6f  DIV - col1 AS co
37e30 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l2 FROM tab0 AS 
37e40 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a  cor0..----..-1..
37e50 2d 33 33 0d 0a 2d 38 32 0d 0a 0d 0a 73 6b 69 70  -33..-82....skip
37e60 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
37e70 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
37e80 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
37e90 2d 31 35 35 34 0d 0a 53 45 4c 45 43 54 20 41 4c  -1554..SELECT AL
37ea0 4c 20 2d 20 63 6f 6c 32 20 2b 20 63 6f 6c 32 20  L - col2 + col2 
37eb0 2f 20 2d 20 63 6f 6c 31 20 41 53 20 63 6f 6c 32  / - col1 AS col2
37ec0 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
37ed0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 2d 33  r0..----..-1..-3
37ee0 33 0d 0a 2d 38 32 0d 0a 0d 0a 71 75 65 72 79 20  3..-82....query 
37ef0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
37f00 54 20 2d 20 38 32 20 2b 20 2b 20 63 6f 72 30 2e  T - 82 + + cor0.
37f10 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41  col0 FROM tab1 A
37f20 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
37f30 38 0d 0a 2d 32 0d 0a 2d 37 39 0d 0a 0d 0a 71 75  8..-2..-79....qu
37f40 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
37f50 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 32 20 2b  ELECT ALL col2 +
37f60 20 63 6f 6c 32 20 2b 20 63 6f 6c 31 20 46 52 4f   col2 + col1 FRO
37f70 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
37f80 2d 2d 2d 2d 0d 0a 31 35 32 0d 0a 32 35 35 0d 0a  ----..152..255..
37f90 39 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  99....query I ro
37fa0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
37fb0 4c 20 2b 20 63 6f 6c 30 20 2a 20 2b 20 28 20 63  L + col0 * + ( c
37fc0 6f 6c 31 20 29 20 2a 20 63 6f 6c 31 20 41 53 20  ol1 ) * col1 AS 
37fd0 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 63  col2 FROM tab1 c
37fe0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33 35 32 30  or0..----..13520
37ff0 0d 0a 32 30 32 38 0d 0a 36 34 30 30 0d 0a 0d 0a  ..2028..6400....
38000 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
38010 0a 53 45 4c 45 43 54 20 41 4c 4c 20 28 20 2d 20  .SELECT ALL ( - 
38020 63 6f 72 30 2e 63 6f 6c 30 20 29 20 2a 20 2b 20  cor0.col0 ) * + 
38030 63 6f 6c 31 20 2a 20 63 6f 72 30 2e 63 6f 6c 32  col1 * cor0.col2
38040 20 2b 20 2d 20 63 6f 6c 31 20 41 53 20 63 6f 6c   + - col1 AS col
38050 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  2 FROM tab1 AS c
38060 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 36 34 39  or0..----..-3649
38070 30 0d 0a 2d 34 32 33 38 0d 0a 2d 39 39 38 35 33  0..-4238..-99853
38080 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
38090 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 30  ort..SELECT col0
380a0 20 2a 20 63 6f 6c 32 20 2b 20 28 20 2d 20 63 6f   * col2 + ( - co
380b0 6c 32 20 29 20 2b 20 2b 20 39 38 20 41 53 20 63  l2 ) + + 98 AS c
380c0 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d  ol1 FROM tab0..-
380d0 2d 2d 2d 0d 0a 31 33 32 0d 0a 37 33 31 34 0d 0a  ---..132..7314..
380e0 38 35 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  857....query I r
380f0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
38100 20 36 38 20 2a 20 2d 20 63 6f 6c 30 20 2d 20 63   68 * - col0 - c
38110 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol1 FROM tab0 AS
38120 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 35 34   cor0..----..154
38130 36 0d 0a 32 32 38 33 0d 0a 35 39 36 31 0d 0a 0d  6..2283..5961...
38140 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
38150 0d 0a 53 45 4c 45 43 54 20 28 20 2d 20 33 36 20  ..SELECT ( - 36 
38160 29 20 2a 20 63 6f 6c 32 20 2a 20 63 6f 6c 31 20  ) * col2 * col1 
38170 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
38180 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
38190 0a 2d 32 33 32 35 36 0d 0a 2d 33 30 31 33 32 0d  .-23256..-30132.
381a0 0a 2d 35 35 32 32 34 0d 0a 0d 0a 6f 6e 6c 79 69  .-55224....onlyi
381b0 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49  f mysql # use DI
381c0 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69  V operator for i
381d0 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d  nteger division.
381e0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
381f0 20 6c 61 62 65 6c 2d 31 35 36 32 0d 0a 53 45 4c   label-1562..SEL
38200 45 43 54 20 63 6f 6c 31 20 2b 20 2b 20 32 33 20  ECT col1 + + 23 
38210 44 49 56 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61  DIV col1 FROM ta
38220 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
38230 0d 0a 31 32 0d 0a 31 34 0d 0a 32 36 0d 0a 0d 0a  ..12..14..26....
38240 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
38250 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
38260 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
38270 61 62 65 6c 2d 31 35 36 32 0d 0a 53 45 4c 45 43  abel-1562..SELEC
38280 54 20 63 6f 6c 31 20 2b 20 2b 20 32 33 20 2f 20  T col1 + + 23 / 
38290 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41  col1 FROM tab1 A
382a0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32  S cor0..----..12
382b0 0d 0a 31 34 0d 0a 32 36 0d 0a 0d 0a 71 75 65 72  ..14..26....quer
382c0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
382d0 45 43 54 20 2b 20 2b 20 33 38 20 2b 20 63 6f 6c  ECT + + 38 + col
382e0 31 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  1 AS col1 FROM t
382f0 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab0 cor0..----..
38300 31 32 34 0d 0a 31 32 39 0d 0a 31 33 35 0d 0a 0d  124..129..135...
38310 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
38320 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 30 20  ..SELECT - col0 
38330 2b 20 35 34 20 2a 20 2d 20 63 6f 6c 30 20 2a 20  + 54 * - col0 * 
38340 37 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  72 AS col2 FROM 
38350 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab0 cor0..----.
38360 0a 2d 31 33 36 31 31 35 0d 0a 2d 33 34 36 31 32  .-136115..-34612
38370 31 0d 0a 2d 39 33 33 33 36 0d 0a 0d 0a 71 75 65  1..-93336....que
38380 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
38390 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 33 20  LECT DISTINCT 3 
383a0 2a 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c 32  * + col0 AS col2
383b0 20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d   FROM tab1 cor0.
383c0 0a 2d 2d 2d 2d 0d 0a 31 39 32 0d 0a 32 34 30 0d  .----..192..240.
383d0 0a 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  .9....query I ro
383e0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
383f0 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c 30 20 2a 20  col0 * - col0 * 
38400 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46 52 4f  col0 AS col0 FRO
38410 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
38420 2d 2d 2d 2d 0d 0a 31 33 38 32 34 0d 0a 34 32 38  ----..13824..428
38430 37 35 0d 0a 37 30 34 39 36 39 0d 0a 0d 0a 71 75  75..704969....qu
38440 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
38450 45 4c 45 43 54 20 2b 20 63 6f 6c 31 20 2a 20 2b  ELECT + col1 * +
38460 20 63 6f 6c 30 20 2b 20 63 6f 6c 30 20 2a 20 63   col0 + col0 * c
38470 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol0 FROM tab2 AS
38480 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 36   cor0..----..106
38490 38 36 0d 0a 32 36 36 0d 0a 37 35 38 34 0d 0a 0d  86..266..7584...
384a0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
384b0 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
384c0 54 20 2d 20 38 35 20 2d 20 31 36 20 46 52 4f 4d  T - 85 - 16 FROM
384d0 20 74 61 62 31 2c 20 74 61 62 31 20 41 53 20 63   tab1, tab1 AS c
384e0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 31 0d  or0..----..-101.
384f0 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
38500 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74  # use DIV operat
38510 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64  or for integer d
38520 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49  ivision..query I
38530 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
38540 35 36 39 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  569..SELECT ALL 
38550 63 6f 6c 30 20 2a 20 37 38 20 44 49 56 20 31 35  col0 * 78 DIV 15
38560 20 2b 20 63 6f 6c 32 20 2b 20 28 20 2b 20 36 35   + col2 + ( + 65
38570 20 2b 20 74 61 62 30 2e 63 6f 6c 31 20 29 20 2a   + tab0.col1 ) *
38580 20 2d 20 34 38 20 41 53 20 63 6f 6c 30 20 46 52   - 48 AS col0 FR
38590 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  OM tab0..----..-
385a0 36 39 34 34 0d 0a 2d 37 30 39 31 0d 0a 2d 37 35  6944..-7091..-75
385b0 39 33 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  93....skipif mys
385c0 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
385d0 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
385e0 73 6f 72 74 20 6c 61 62 65 6c 2d 31 35 36 39 0d  sort label-1569.
385f0 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 30  .SELECT ALL col0
38600 20 2a 20 37 38 20 2f 20 31 35 20 2b 20 63 6f 6c   * 78 / 15 + col
38610 32 20 2b 20 28 20 2b 20 36 35 20 2b 20 74 61 62  2 + ( + 65 + tab
38620 30 2e 63 6f 6c 31 20 29 20 2a 20 2d 20 34 38 20  0.col1 ) * - 48 
38630 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
38640 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 36 39 34 34 0d 0a  0..----..-6944..
38650 2d 37 30 39 31 0d 0a 2d 37 35 39 33 0d 0a 0d 0a  -7091..-7593....
38660 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
38670 0a 53 45 4c 45 43 54 20 2d 20 38 31 20 41 53 20  .SELECT - 81 AS 
38680 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 2c 20  col2 FROM tab2, 
38690 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab0 cor0..----.
386a0 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e  .9 values hashin
386b0 67 20 74 6f 20 32 30 35 62 33 66 66 32 64 37 62  g to 205b3ff2d7b
386c0 31 38 31 37 63 39 38 64 37 39 38 30 62 38 63 31  1817c98d7980b8c1
386d0 37 65 36 63 31 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  7e6c1....onlyif 
386e0 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20  mysql # use DIV 
386f0 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74  operator for int
38700 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71  eger division..q
38710 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
38720 61 62 65 6c 2d 31 35 37 31 0d 0a 53 45 4c 45 43  abel-1571..SELEC
38730 54 20 2b 20 34 20 2d 20 2d 20 63 6f 72 30 2e 63  T + 4 - - cor0.c
38740 6f 6c 31 20 44 49 56 20 2b 20 63 6f 6c 31 20 41  ol1 DIV + col1 A
38750 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31  S col2 FROM tab1
38760 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 35 0d 0a   cor0..----..5..
38770 35 0d 0a 35 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  5..5....skipif m
38780 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
38790 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
387a0 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 35 37  owsort label-157
387b0 31 0d 0a 53 45 4c 45 43 54 20 2b 20 34 20 2d 20  1..SELECT + 4 - 
387c0 2d 20 63 6f 72 30 2e 63 6f 6c 31 20 2f 20 2b 20  - cor0.col1 / + 
387d0 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46 52 4f  col1 AS col2 FRO
387e0 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab1 cor0..---
387f0 2d 0d 0a 35 0d 0a 35 0d 0a 35 0d 0a 0d 0a 73 6b  -..5..5..5....sk
38800 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20  ipif postgresql 
38810 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71  # PostgreSQL req
38820 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65  uires AS when re
38830 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f  naming output co
38840 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72  lumns..query I r
38850 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
38860 20 34 34 20 2a 20 2b 20 63 6f 6c 32 20 63 6f 6c   44 * + col2 col
38870 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  0 FROM tab0 AS c
38880 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 34 35 32 0d  or0..----..1452.
38890 0a 33 36 30 38 0d 0a 34 34 0d 0a 0d 0a 71 75 65  .3608..44....que
388a0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
388b0 4c 45 43 54 20 2b 20 36 37 20 2a 20 63 6f 6c 32  LECT + 67 * col2
388c0 20 2d 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74   - + col0 FROM t
388d0 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
388e0 2d 0d 0a 33 36 31 35 0d 0a 33 37 35 35 0d 0a 36  -..3615..3755..6
388f0 33 35 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  352....query I r
38900 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
38910 4c 4c 20 31 32 20 2a 20 35 39 20 41 53 20 63 6f  LL 12 * 59 AS co
38920 6c 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d  l1 FROM tab0..--
38930 2d 2d 0d 0a 37 30 38 0d 0a 37 30 38 0d 0a 37 30  --..708..708..70
38940 38 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74  8....skipif post
38950 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65  gresql # Postgre
38960 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20  SQL requires AS 
38970 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75  when renaming ou
38980 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75  tput columns..qu
38990 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
389a0 45 4c 45 43 54 20 2d 20 63 6f 72 31 2e 63 6f 6c  ELECT - cor1.col
389b0 31 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32  1 col1 FROM tab2
389c0 20 41 53 20 63 6f 72 30 20 43 52 4f 53 53 20 4a   AS cor0 CROSS J
389d0 4f 49 4e 20 74 61 62 31 20 63 6f 72 31 0d 0a 2d  OIN tab1 cor1..-
389e0 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61  ---..9 values ha
389f0 73 68 69 6e 67 20 74 6f 20 62 32 33 34 37 39 38  shing to b234798
38a00 64 34 37 30 36 33 31 34 62 61 31 34 65 61 61 64  d4706314ba14eaad
38a10 35 33 39 64 30 61 61 38 38 0d 0a 0d 0a 71 75 65  539d0aa88....que
38a20 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
38a30 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 28 20  LECT DISTINCT ( 
38a40 2d 20 63 6f 6c 32 20 2a 20 2d 20 74 61 62 30 2e  - col2 * - tab0.
38a50 63 6f 6c 31 20 29 20 46 52 4f 4d 20 74 61 62 30  col1 ) FROM tab0
38a60 0d 0a 2d 2d 2d 2d 0d 0a 32 38 33 38 0d 0a 37 34  ..----..2838..74
38a70 36 32 0d 0a 39 37 0d 0a 0d 0a 71 75 65 72 79 20  62..97....query 
38a80 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
38a90 54 20 33 37 20 41 53 20 63 6f 6c 30 20 46 52 4f  T 37 AS col0 FRO
38aa0 4d 20 74 61 62 31 2c 20 74 61 62 30 20 41 53 20  M tab1, tab0 AS 
38ab0 63 6f 72 30 2c 20 74 61 62 31 20 41 53 20 63 6f  cor0, tab1 AS co
38ac0 72 31 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c  r1..----..27 val
38ad0 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 63  ues hashing to c
38ae0 30 32 33 35 30 39 66 36 33 66 61 61 30 34 34 64  023509f63faa044d
38af0 36 35 34 39 34 33 65 36 64 66 35 35 63 61 32 0d  654943e6df55ca2.
38b00 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
38b10 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74  # use DIV operat
38b20 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64  or for integer d
38b30 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49  ivision..query I
38b40 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
38b50 35 37 38 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 31  578..SELECT col1
38b60 20 44 49 56 20 2d 20 28 20 34 30 20 2a 20 2b 20   DIV - ( 40 * + 
38b70 63 6f 6c 30 20 29 20 63 6f 6c 30 20 46 52 4f 4d  col0 ) col0 FROM
38b80 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a   tab0..----..0..
38b90 30 0d 0a 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 70  0..0....skipif p
38ba0 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74  ostgresql # Post
38bb0 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20  greSQL requires 
38bc0 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67  AS when renaming
38bd0 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d   output columns.
38be0 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
38bf0 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
38c00 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
38c10 6c 61 62 65 6c 2d 31 35 37 38 0d 0a 53 45 4c 45  label-1578..SELE
38c20 43 54 20 63 6f 6c 31 20 2f 20 2d 20 28 20 34 30  CT col1 / - ( 40
38c30 20 2a 20 2b 20 63 6f 6c 30 20 29 20 63 6f 6c 30   * + col0 ) col0
38c40 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d   FROM tab0..----
38c50 0d 0a 30 0d 0a 30 0d 0a 30 0d