sqllogictest
Hex Artifact Content
Not logged in

Artifact a889a9bdf116a5e83d91a10e0c2763b4926939b7:


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 44 49 53 54 49  rt..SELECT DISTI
02e0: 4e 43 54 20 63 6f 6c 32 20 2b 20 2b 20 63 6f 6c  NCT col2 + + col
02f0: 30 20 2a 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f  0 * + col0 AS co
0300: 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l0 FROM tab0 AS 
0310: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 32 36  cor0..----..1226
0320: 0d 0a 36 30 39 0d 0a 38 30 30 33 0d 0a 0d 0a 6f  ..609..8003....o
0330: 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73  nlyif mysql # us
0340: 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66  e DIV operator f
0350: 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73  or integer divis
0360: 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ion..query I row
0370: 73 6f 72 74 20 6c 61 62 65 6c 2d 31 0d 0a 53 45  sort label-1..SE
0380: 4c 45 43 54 20 2d 20 63 6f 6c 31 20 2b 20 2d 20  LECT - col1 + - 
0390: 63 6f 6c 30 20 44 49 56 20 2d 20 28 20 2b 20 63  col0 DIV - ( + c
03a0: 6f 6c 30 20 29 20 41 53 20 63 6f 6c 32 20 46 52  ol0 ) AS col2 FR
03b0: 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
03c0: 0a 2d 2d 2d 2d 0d 0a 2d 31 32 0d 0a 2d 32 35 0d  .----..-12..-25.
03d0: 0a 2d 39 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  .-9....skipif my
03e0: 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
03f0: 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
0400: 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 0d 0a 53  wsort label-1..S
0410: 45 4c 45 43 54 20 2d 20 63 6f 6c 31 20 2b 20 2d  ELECT - col1 + -
0420: 20 63 6f 6c 30 20 2f 20 2d 20 28 20 2b 20 63 6f   col0 / - ( + co
0430: 6c 30 20 29 20 41 53 20 63 6f 6c 32 20 46 52 4f  l0 ) AS col2 FRO
0440: 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
0450: 2d 2d 2d 2d 0d 0a 2d 31 32 0d 0a 2d 32 35 0d 0a  ----..-12..-25..
0460: 2d 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  -9....query I ro
0470: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
0480: 4c 20 2d 20 63 6f 6c 31 20 2a 20 2d 20 32 37 20  L - col1 * - 27 
0490: 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
04a0: 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 37  1 cor0..----..27
04b0: 30 0d 0a 33 35 31 0d 0a 37 30 32 0d 0a 0d 0a 6f  0..351..702....o
04c0: 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75  nlyif mysql # su
04d0: 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20  pport for MySQL 
04e0: 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20  specific system 
04f0: 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78  types and syntax
0500: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
0510: 74 20 6c 61 62 65 6c 2d 33 0d 0a 53 45 4c 45 43  t label-3..SELEC
0520: 54 20 63 6f 6c 31 20 2a 20 2d 20 43 41 53 54 28  T col1 * - CAST(
0530: 20 2b 20 39 20 2b 20 2d 20 63 6f 6c 30 20 41 53   + 9 + - col0 AS
0540: 20 53 49 47 4e 45 44 20 29 20 41 53 20 63 6f 6c   SIGNED ) AS col
0550: 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  0 FROM tab0 AS c
0560: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 39 30 0d  or0..----..1290.
0570: 0a 32 35 32 32 0d 0a 37 32 38 30 0d 0a 0d 0a 73  .2522..7280....s
0580: 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
0590: 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
05a0: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
05b0: 62 65 6c 2d 33 0d 0a 53 45 4c 45 43 54 20 63 6f  bel-3..SELECT co
05c0: 6c 31 20 2a 20 2d 20 43 41 53 54 20 28 20 2b 20  l1 * - CAST ( + 
05d0: 39 20 2b 20 2d 20 63 6f 6c 30 20 41 53 20 49 4e  9 + - col0 AS IN
05e0: 54 45 47 45 52 20 29 20 41 53 20 63 6f 6c 30 20  TEGER ) AS col0 
05f0: 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
0600: 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 39 30 0d 0a 32  0..----..1290..2
0610: 35 32 32 0d 0a 37 32 38 30 0d 0a 0d 0a 73 6b 69  522..7280....ski
0620: 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23  pif postgresql #
0630: 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75   PostgreSQL requ
0640: 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e  ires AS when ren
0650: 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c  aming output col
0660: 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f  umns..query I ro
0670: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
0680: 4c 20 2d 20 2b 20 63 6f 6c 32 20 2b 20 63 6f 6c  L - + col2 + col
0690: 31 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30  1 col2 FROM tab0
06a0: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
06b0: 35 33 0d 0a 39 0d 0a 39 36 0d 0a 0d 0a 6f 6e 6c  53..9..96....onl
06c0: 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20  yif mysql # use 
06d0: 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72  DIV operator for
06e0: 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f   integer divisio
06f0: 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  n..query I rowso
0700: 72 74 20 6c 61 62 65 6c 2d 35 0d 0a 53 45 4c 45  rt label-5..SELE
0710: 43 54 20 41 4c 4c 20 2b 20 2b 20 63 6f 6c 32 20  CT ALL + + col2 
0720: 44 49 56 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f  DIV + col0 AS co
0730: 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l2 FROM tab0 AS 
0740: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30  cor0..----..0..0
0750: 0d 0a 31 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  ..1....skipif my
0760: 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
0770: 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
0780: 77 73 6f 72 74 20 6c 61 62 65 6c 2d 35 0d 0a 53  wsort label-5..S
0790: 45 4c 45 43 54 20 41 4c 4c 20 2b 20 2b 20 63 6f  ELECT ALL + + co
07a0: 6c 32 20 2f 20 2b 20 63 6f 6c 30 20 41 53 20 63  l2 / + col0 AS c
07b0: 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol2 FROM tab0 AS
07c0: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a   cor0..----..0..
07d0: 30 0d 0a 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20  0..1....query I 
07e0: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
07f0: 44 49 53 54 49 4e 43 54 20 63 6f 6c 32 20 2a 20  DISTINCT col2 * 
0800: 2d 20 32 32 20 2a 20 34 33 20 46 52 4f 4d 20 74  - 22 * 43 FROM t
0810: 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
0820: 2d 0d 0a 2d 35 31 30 38 34 0d 0a 2d 35 33 39 32  -..-51084..-5392
0830: 32 0d 0a 2d 39 30 38 31 36 0d 0a 0d 0a 6f 6e 6c  2..-90816....onl
0840: 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20  yif mysql # use 
0850: 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72  DIV operator for
0860: 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f   integer divisio
0870: 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  n..query I rowso
0880: 72 74 20 6c 61 62 65 6c 2d 37 0d 0a 53 45 4c 45  rt label-7..SELE
0890: 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63 6f  CT DISTINCT + co
08a0: 72 30 2e 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c 31  r0.col0 + + col1
08b0: 20 44 49 56 20 2b 20 63 6f 6c 32 20 63 6f 6c 30   DIV + col2 col0
08c0: 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
08d0: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 0d 0a 36 34 0d  r0..----..3..64.
08e0: 0a 38 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f  .80....skipif po
08f0: 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67  stgresql # Postg
0900: 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41  reSQL requires A
0910: 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20  S when renaming 
0920: 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a  output columns..
0930: 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
0940: 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
0950: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
0960: 61 62 65 6c 2d 37 0d 0a 53 45 4c 45 43 54 20 44  abel-7..SELECT D
0970: 49 53 54 49 4e 43 54 20 2b 20 63 6f 72 30 2e 63  ISTINCT + cor0.c
0980: 6f 6c 30 20 2b 20 2b 20 63 6f 6c 31 20 2f 20 2b  ol0 + + col1 / +
0990: 20 63 6f 6c 32 20 63 6f 6c 30 20 46 52 4f 4d 20   col2 col0 FROM 
09a0: 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
09b0: 2d 2d 0d 0a 33 0d 0a 36 34 0d 0a 38 30 0d 0a 0d  --..3..64..80...
09c0: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
09d0: 0d 0a 53 45 4c 45 43 54 20 2b 20 2b 20 63 6f 6c  ..SELECT + + col
09e0: 31 20 2b 20 2b 20 35 30 20 2a 20 2d 20 63 6f 6c  1 + + 50 * - col
09f0: 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  2 FROM tab0 AS c
0a00: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 35 36 34  or0..----..-1564
0a10: 0d 0a 2d 34 30 30 39 0d 0a 34 37 0d 0a 0d 0a 73  ..-4009..47....s
0a20: 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c  kipif postgresql
0a30: 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65   # PostgreSQL re
0a40: 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72  quires AS when r
0a50: 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63  enaming output c
0a60: 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20  olumns..query I 
0a70: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
0a80: 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 72 30 2e  DISTINCT - cor0.
0a90: 63 6f 6c 30 20 2a 20 2b 20 36 31 20 63 6f 6c 31  col0 * + 61 col1
0aa0: 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
0ab0: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 32 37 0d 0a  r0..----..-427..
0ac0: 2d 34 37 35 38 0d 0a 2d 34 38 31 39 0d 0a 0d 0a  -4758..-4819....
0ad0: 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71  skipif postgresq
0ae0: 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72  l # PostgreSQL r
0af0: 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20  equires AS when 
0b00: 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20  renaming output 
0b10: 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49  columns..query I
0b20: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
0b30: 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 32 20 2b   DISTINCT col2 +
0b40: 20 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c 32 20 63   col1 * - col2 c
0b50: 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d  ol0 FROM tab0..-
0b60: 2d 2d 2d 0d 0a 2d 32 38 30 35 0d 0a 2d 37 33 38  ---..-2805..-738
0b70: 30 0d 0a 2d 39 36 0d 0a 0d 0a 71 75 65 72 79 20  0..-96....query 
0b80: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
0b90: 54 20 41 4c 4c 20 2b 20 63 6f 6c 32 20 2a 20 2d  T ALL + col2 * -
0ba0: 20 63 6f 6c 32 20 2b 20 2b 20 63 6f 6c 31 20 46   col2 + + col1 F
0bb0: 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab0..----..
0bc0: 2d 31 30 30 33 0d 0a 2d 36 36 33 33 0d 0a 39 36  -1003..-6633..96
0bd0: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
0be0: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
0bf0: 2d 20 35 39 20 2a 20 2b 20 39 20 2b 20 2d 20 63  - 59 * + 9 + - c
0c00: 6f 6c 32 20 2a 20 28 20 63 6f 72 30 2e 63 6f 6c  ol2 * ( cor0.col
0c10: 31 20 2b 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20  1 + - cor0.col2 
0c20: 29 20 2a 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61  ) * col1 FROM ta
0c30: 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
0c40: 0d 0a 2d 33 38 37 39 0d 0a 2d 35 31 31 35 33 0d  ..-3879..-51153.
0c50: 0a 31 33 30 33 35 0d 0a 0d 0a 6f 6e 6c 79 69 66  .13035....onlyif
0c60: 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74   mysql # support
0c70: 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69   for MySQL speci
0c80: 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73  fic system types
0c90: 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65   and syntax..que
0ca0: 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
0cb0: 65 6c 2d 31 33 0d 0a 53 45 4c 45 43 54 20 2b 20  el-13..SELECT + 
0cc0: 43 41 53 54 28 20 4e 55 4c 4c 20 41 53 20 53 49  CAST( NULL AS SI
0cd0: 47 4e 45 44 20 29 20 2a 20 63 6f 6c 31 20 2b 20  GNED ) * col1 + 
0ce0: 2d 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31  - col2 FROM tab1
0cf0: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
0d00: 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c  NULL..NULL..NULL
0d10: 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
0d20: 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
0d30: 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
0d40: 72 74 20 6c 61 62 65 6c 2d 31 33 0d 0a 53 45 4c  rt label-13..SEL
0d50: 45 43 54 20 2b 20 43 41 53 54 20 28 20 4e 55 4c  ECT + CAST ( NUL
0d60: 4c 20 41 53 20 49 4e 54 45 47 45 52 20 29 20 2a  L AS INTEGER ) *
0d70: 20 63 6f 6c 31 20 2b 20 2d 20 63 6f 6c 32 20 46   col1 + - col2 F
0d80: 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
0d90: 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55  ..----..NULL..NU
0da0: 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 6f 6e 6c 79  LL..NULL....only
0db0: 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44  if mysql # use D
0dc0: 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20  IV operator for 
0dd0: 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e  integer division
0de0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
0df0: 74 20 6c 61 62 65 6c 2d 31 34 0d 0a 53 45 4c 45  t label-14..SELE
0e00: 43 54 20 41 4c 4c 20 2b 20 2d 20 63 6f 72 30 2e  CT ALL + - cor0.
0e10: 63 6f 6c 30 20 44 49 56 20 2d 20 63 6f 6c 32 20  col0 DIV - col2 
0e20: 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31  + col1 FROM tab1
0e30: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
0e40: 31 31 0d 0a 31 33 0d 0a 32 36 0d 0a 0d 0a 73 6b  11..13..26....sk
0e50: 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
0e60: 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
0e70: 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
0e80: 65 6c 2d 31 34 0d 0a 53 45 4c 45 43 54 20 41 4c  el-14..SELECT AL
0e90: 4c 20 2b 20 2d 20 63 6f 72 30 2e 63 6f 6c 30 20  L + - cor0.col0 
0ea0: 2f 20 2d 20 63 6f 6c 32 20 2b 20 63 6f 6c 31 20  / - col2 + col1 
0eb0: 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
0ec0: 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 0d 0a 31 33 0d  0..----..11..13.
0ed0: 0a 32 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .26....query I r
0ee0: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
0ef0: 49 53 54 49 4e 43 54 20 28 20 2b 20 63 6f 6c 31  ISTINCT ( + col1
0f00: 20 29 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20   ) AS col1 FROM 
0f10: 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab0 cor0..----.
0f20: 0a 38 36 0d 0a 39 31 0d 0a 39 37 0d 0a 0d 0a 71  .86..91..97....q
0f30: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
0f40: 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
0f50: 28 20 63 6f 6c 30 20 29 20 2b 20 63 6f 6c 32 20  ( col0 ) + col2 
0f60: 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
0f70: 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
0f80: 0a 31 37 31 0d 0a 33 36 0d 0a 35 37 0d 0a 0d 0a  .171..36..57....
0f90: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
0fa0: 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
0fb0: 20 35 32 20 2a 20 63 6f 6c 32 20 46 52 4f 4d 20   52 * col2 FROM 
0fc0: 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab0 cor0..----.
0fd0: 0a 31 37 31 36 0d 0a 34 32 36 34 0d 0a 35 32 0d  .1716..4264..52.
0fe0: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
0ff0: 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 31 31 20  rt..SELECT - 11 
1000: 2a 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32  * col2 FROM tab2
1010: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
1020: 2d 32 38 36 0d 0a 2d 32 39 37 0d 0a 2d 34 31 38  -286..-297..-418
1030: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
1040: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
1050: 49 4e 43 54 20 28 20 2d 20 63 6f 6c 30 20 29 20  INCT ( - col0 ) 
1060: 2a 20 2b 20 63 6f 6c 31 20 2b 20 32 33 20 46 52  * + col1 + 23 FR
1070: 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
1080: 0a 2d 2d 2d 2d 0d 0a 2d 31 33 32 30 0d 0a 2d 31  .----..-1320..-1
1090: 39 34 0d 0a 2d 34 35 37 39 0d 0a 0d 0a 71 75 65  94..-4579....que
10a0: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
10b0: 4c 45 43 54 20 63 6f 6c 32 20 2a 20 2d 20 63 6f  LECT col2 * - co
10c0: 6c 31 20 2a 20 2d 20 63 6f 6c 32 20 41 53 20 63  l1 * - col2 AS c
10d0: 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol2 FROM tab1 AS
10e0: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 39   cor0..----..119
10f0: 38 30 38 0d 0a 33 32 34 39 30 0d 0a 37 35 38 31  808..32490..7581
1100: 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  6....query I row
1110: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
1120: 54 49 4e 43 54 20 28 20 63 6f 6c 31 20 29 20 2a  TINCT ( col1 ) *
1130: 20 2b 20 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20   + col2 AS col0 
1140: 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
1150: 30 0d 0a 2d 2d 2d 2d 0d 0a 31 35 33 34 0d 0a 36  0..----..1534..6
1160: 34 36 0d 0a 38 33 37 0d 0a 0d 0a 71 75 65 72 79  46..837....query
1170: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
1180: 43 54 20 44 49 53 54 49 4e 43 54 20 32 31 20 2b  CT DISTINCT 21 +
1190: 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20   col1 FROM tab0 
11a0: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
11b0: 30 37 0d 0a 31 31 32 0d 0a 31 31 38 0d 0a 0d 0a  07..112..118....
11c0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
11d0: 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
11e0: 20 74 61 62 31 2e 63 6f 6c 31 20 2a 20 2b 20 31   tab1.col1 * + 1
11f0: 36 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d  6 FROM tab1..---
1200: 2d 0d 0a 31 36 30 0d 0a 32 30 38 0d 0a 34 31 36  -..160..208..416
1210: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
1220: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 30  ort..SELECT col0
1230: 20 2b 20 2d 20 39 35 20 46 52 4f 4d 20 74 61 62   + - 95 FROM tab
1240: 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
1250: 0a 2d 31 36 0d 0a 2d 31 37 0d 0a 2d 38 38 0d 0a  .-16..-17..-88..
1260: 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
1270: 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f   use DIV operato
1280: 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69  r for integer di
1290: 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20  vision..query I 
12a0: 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 32 35  rowsort label-25
12b0: 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63  ..SELECT ALL + c
12c0: 6f 6c 32 20 2b 20 63 6f 6c 31 20 44 49 56 20 63  ol2 + col1 DIV c
12d0: 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol2 FROM tab1 AS
12e0: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 35 34 0d   cor0..----..54.
12f0: 0a 35 37 0d 0a 39 36 0d 0a 0d 0a 73 6b 69 70 69  .57..96....skipi
1300: 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
1310: 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
1320: 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
1330: 32 35 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b  25..SELECT ALL +
1340: 20 63 6f 6c 32 20 2b 20 63 6f 6c 31 20 2f 20 63   col2 + col1 / c
1350: 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol2 FROM tab1 AS
1360: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 35 34 0d   cor0..----..54.
1370: 0a 35 37 0d 0a 39 36 0d 0a 0d 0a 6f 6e 6c 79 69  .57..96....onlyi
1380: 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49  f mysql # use DI
1390: 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69  V operator for i
13a0: 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d  nteger division.
13b0: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
13c0: 20 6c 61 62 65 6c 2d 32 36 0d 0a 53 45 4c 45 43   label-26..SELEC
13d0: 54 20 41 4c 4c 20 2d 20 2b 20 39 31 20 44 49 56  T ALL - + 91 DIV
13e0: 20 63 6f 6c 30 20 2b 20 63 6f 6c 30 20 46 52 4f   col0 + col0 FRO
13f0: 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
1400: 2d 2d 2d 2d 0d 0a 2d 36 0d 0a 37 37 0d 0a 37 38  ----..-6..77..78
1410: 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
1420: 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
1430: 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
1440: 72 74 20 6c 61 62 65 6c 2d 32 36 0d 0a 53 45 4c  rt label-26..SEL
1450: 45 43 54 20 41 4c 4c 20 2d 20 2b 20 39 31 20 2f  ECT ALL - + 91 /
1460: 20 63 6f 6c 30 20 2b 20 63 6f 6c 30 20 46 52 4f   col0 + col0 FRO
1470: 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
1480: 2d 2d 2d 2d 0d 0a 2d 36 0d 0a 37 37 0d 0a 37 38  ----..-6..77..78
1490: 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
14a0: 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
14b0: 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
14c0: 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
14d0: 4e 43 54 20 2b 20 43 41 53 54 20 28 20 2b 20 31  NCT + CAST ( + 1
14e0: 38 20 41 53 20 52 45 41 4c 20 29 20 2d 20 63 6f  8 AS REAL ) - co
14f0: 6c 31 20 2a 20 2d 20 33 20 41 53 20 63 6f 6c 31  l1 * - 3 AS col1
1500: 20 46 52 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d   FROM tab2 cor0.
1510: 0a 2d 2d 2d 2d 0d 0a 31 31 31 0d 0a 31 39 35 0d  .----..111..195.
1520: 0a 36 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .69....query I r
1530: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
1540: 4c 4c 20 28 20 63 6f 6c 31 20 29 20 2d 20 63 6f  LL ( col1 ) - co
1550: 6c 30 20 2a 20 37 36 20 41 53 20 63 6f 6c 31 20  l0 * 76 AS col1 
1560: 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d  FROM tab0..----.
1570: 0a 2d 31 37 33 38 0d 0a 2d 32 35 36 33 0d 0a 2d  .-1738..-2563..-
1580: 36 36 37 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20  6673....query I 
1590: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
15a0: 2b 20 34 37 20 46 52 4f 4d 20 74 61 62 31 2c 20  + 47 FROM tab1, 
15b0: 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
15c0: 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73  --..9 values has
15d0: 68 69 6e 67 20 74 6f 20 34 66 65 31 39 32 66 32  hing to 4fe192f2
15e0: 39 36 37 39 31 65 31 65 34 30 65 61 30 30 61 36  96791e1e40ea00a6
15f0: 38 61 61 38 64 61 62 37 0d 0a 0d 0a 71 75 65 72  8aa8dab7....quer
1600: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
1610: 45 43 54 20 41 4c 4c 20 2d 20 2d 20 28 20 63 6f  ECT ALL - - ( co
1620: 6c 30 20 29 20 2b 20 63 6f 6c 30 20 46 52 4f 4d  l0 ) + col0 FROM
1630: 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
1640: 2d 2d 2d 0d 0a 31 32 38 0d 0a 31 36 30 0d 0a 36  ---..128..160..6
1650: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
1660: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
1670: 2d 20 2b 20 63 6f 6c 31 20 2b 20 63 6f 6c 30 20  - + col1 + col0 
1680: 2a 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46  * col0 AS col0 F
1690: 52 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d  ROM tab2 cor0..-
16a0: 2d 2d 2d 0d 0a 31 38 0d 0a 36 30 32 35 0d 0a 36  ---..18..6025..6
16b0: 32 32 34 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  224....onlyif my
16c0: 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f  sql # support fo
16d0: 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63  r MySQL specific
16e0: 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e   system types an
16f0: 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20  d syntax..query 
1700: 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
1710: 33 32 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  32..SELECT DISTI
1720: 4e 43 54 20 2d 20 43 41 53 54 28 20 4e 55 4c 4c  NCT - CAST( NULL
1730: 20 41 53 20 53 49 47 4e 45 44 20 29 20 41 53 20   AS SIGNED ) AS 
1740: 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 2c 20  col0 FROM tab2, 
1750: 74 61 62 30 20 41 53 20 63 6f 72 30 20 43 52 4f  tab0 AS cor0 CRO
1760: 53 53 20 4a 4f 49 4e 20 74 61 62 31 0d 0a 2d 2d  SS JOIN tab1..--
1770: 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70  --..NULL....skip
1780: 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
1790: 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
17a0: 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
17b0: 2d 33 32 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  -32..SELECT DIST
17c0: 49 4e 43 54 20 2d 20 43 41 53 54 20 28 20 4e 55  INCT - CAST ( NU
17d0: 4c 4c 20 41 53 20 49 4e 54 45 47 45 52 20 29 20  LL AS INTEGER ) 
17e0: 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
17f0: 32 2c 20 74 61 62 30 20 41 53 20 63 6f 72 30 20  2, tab0 AS cor0 
1800: 43 52 4f 53 53 20 4a 4f 49 4e 20 74 61 62 31 0d  CROSS JOIN tab1.
1810: 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71  .----..NULL....q
1820: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
1830: 53 45 4c 45 43 54 20 32 20 46 52 4f 4d 20 74 61  SELECT 2 FROM ta
1840: 62 31 2c 20 74 61 62 30 20 41 53 20 63 6f 72 30  b1, tab0 AS cor0
1850: 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73  ..----..9 values
1860: 20 68 61 73 68 69 6e 67 20 74 6f 20 38 34 64 62   hashing to 84db
1870: 66 61 66 39 62 63 31 37 64 64 30 39 37 66 31 35  faf9bc17dd097f15
1880: 62 63 33 36 62 34 31 38 36 32 36 31 0d 0a 0d 0a  bc36b4186261....
1890: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
18a0: 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 30 20 2a  .SELECT + col0 *
18b0: 20 2d 20 39 31 20 46 52 4f 4d 20 74 61 62 32 20   - 91 FROM tab2 
18c0: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
18d0: 36 33 37 0d 0a 2d 37 30 39 38 0d 0a 2d 37 31 38  637..-7098..-718
18e0: 39 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  9....onlyif mysq
18f0: 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20  l # support for 
1900: 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63 20 73  MySQL specific s
1910: 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20  ystem types and 
1920: 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20  syntax..query I 
1930: 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 33 35  rowsort label-35
1940: 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 2b  ..SELECT ALL + +
1950: 20 43 41 53 54 28 20 63 6f 6c 30 20 41 53 20 53   CAST( col0 AS S
1960: 49 47 4e 45 44 20 29 20 2d 20 63 6f 6c 32 20 2a  IGNED ) - col2 *
1970: 20 2b 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62   + col2 FROM tab
1980: 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  2 cor0..----..-1
1990: 33 36 35 0d 0a 2d 35 39 38 0d 0a 2d 37 32 32 0d  365..-598..-722.
19a0: 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
19b0: 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
19c0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
19d0: 74 20 6c 61 62 65 6c 2d 33 35 0d 0a 53 45 4c 45  t label-35..SELE
19e0: 43 54 20 41 4c 4c 20 2b 20 2b 20 43 41 53 54 20  CT ALL + + CAST 
19f0: 28 20 63 6f 6c 30 20 41 53 20 49 4e 54 45 47 45  ( col0 AS INTEGE
1a00: 52 20 29 20 2d 20 63 6f 6c 32 20 2a 20 2b 20 63  R ) - col2 * + c
1a10: 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 63 6f  ol2 FROM tab2 co
1a20: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 36 35 0d  r0..----..-1365.
1a30: 0a 2d 35 39 38 0d 0a 2d 37 32 32 0d 0a 0d 0a 71  .-598..-722....q
1a40: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
1a50: 53 45 4c 45 43 54 20 2b 20 63 6f 6c 32 20 2a 20  SELECT + col2 * 
1a60: 36 36 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  66 FROM tab0 AS 
1a70: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 31 37 38  cor0..----..2178
1a80: 0d 0a 35 34 31 32 0d 0a 36 36 0d 0a 0d 0a 71 75  ..5412..66....qu
1a90: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
1aa0: 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 63  ELECT DISTINCT c
1ab0: 6f 6c 31 20 2d 20 63 6f 6c 31 20 2a 20 2d 20 63  ol1 - col1 * - c
1ac0: 6f 6c 30 20 2a 20 63 6f 6c 32 20 41 53 20 63 6f  ol0 * col2 AS co
1ad0: 6c 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d  l1 FROM tab0..--
1ae0: 2d 2d 0d 0a 33 34 39 32 0d 0a 36 36 34 32 30 39  --..3492..664209
1af0: 0d 0a 36 38 31 39 38 0d 0a 0d 0a 71 75 65 72 79  ..68198....query
1b00: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
1b10: 43 54 20 2b 20 63 6f 6c 30 20 2b 20 63 6f 6c 30  CT + col0 + col0
1b20: 20 2a 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74   * + col1 FROM t
1b30: 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 34 32 32 0d  ab2..----..1422.
1b40: 0a 32 32 34 0d 0a 34 36 38 30 0d 0a 0d 0a 6f 6e  .224..4680....on
1b50: 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
1b60: 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
1b70: 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
1b80: 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
1b90: 6f 72 74 20 6c 61 62 65 6c 2d 33 39 0d 0a 53 45  ort label-39..SE
1ba0: 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 35 36  LECT DISTINCT 56
1bb0: 20 2a 20 63 6f 6c 32 20 2a 20 63 6f 6c 32 20 2b   * col2 * col2 +
1bc0: 20 2b 20 63 6f 6c 32 20 44 49 56 20 63 6f 6c 32   + col2 DIV col2
1bd0: 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d   FROM tab1..----
1be0: 0d 0a 31 36 33 32 39 37 0d 0a 31 38 31 39 34 35  ..163297..181945
1bf0: 0d 0a 35 31 36 30 39 37 0d 0a 0d 0a 73 6b 69 70  ..516097....skip
1c00: 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
1c10: 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
1c20: 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
1c30: 2d 33 39 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  -39..SELECT DIST
1c40: 49 4e 43 54 20 35 36 20 2a 20 63 6f 6c 32 20 2a  INCT 56 * col2 *
1c50: 20 63 6f 6c 32 20 2b 20 2b 20 63 6f 6c 32 20 2f   col2 + + col2 /
1c60: 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 0d   col2 FROM tab1.
1c70: 0a 2d 2d 2d 2d 0d 0a 31 36 33 32 39 37 0d 0a 31  .----..163297..1
1c80: 38 31 39 34 35 0d 0a 35 31 36 30 39 37 0d 0a 0d  81945..516097...
1c90: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1ca0: 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 32 20  ..SELECT + col2 
1cb0: 2b 20 63 6f 6c 30 20 2d 20 28 20 63 6f 6c 30 20  + col0 - ( col0 
1cc0: 29 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  ) AS col1 FROM t
1cd0: 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
1ce0: 2d 0d 0a 32 36 0d 0a 32 37 0d 0a 33 38 0d 0a 0d  -..26..27..38...
1cf0: 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73  .skipif postgres
1d00: 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20  ql # PostgreSQL 
1d10: 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e  requires AS when
1d20: 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74   renaming output
1d30: 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20   columns..query 
1d40: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
1d50: 54 20 2b 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20  T + + cor0.col0 
1d60: 2a 20 2d 20 63 6f 6c 30 20 63 6f 6c 30 20 46 52  * - col0 col0 FR
1d70: 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
1d80: 0a 2d 2d 2d 2d 0d 0a 2d 34 30 39 36 0d 0a 2d 36  .----..-4096..-6
1d90: 34 30 30 0d 0a 2d 39 0d 0a 0d 0a 71 75 65 72 79  400..-9....query
1da0: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
1db0: 43 54 20 41 4c 4c 20 74 61 62 32 2e 63 6f 6c 30  CT ALL tab2.col0
1dc0: 20 46 52 4f 4d 20 74 61 62 32 2c 20 74 61 62 31   FROM tab2, tab1
1dd0: 20 41 53 20 63 6f 72 30 2c 20 74 61 62 30 20 41   AS cor0, tab0 A
1de0: 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 32 37  S cor1..----..27
1df0: 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20   values hashing 
1e00: 74 6f 20 31 65 31 66 31 30 39 35 33 65 62 38 65  to 1e1f10953eb8e
1e10: 66 66 65 39 62 32 30 65 37 34 36 66 38 61 37 66  ffe9b20e746f8a7f
1e20: 64 38 33 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  d83....onlyif my
1e30: 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70  sql # use DIV op
1e40: 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67  erator for integ
1e50: 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65  er division..que
1e60: 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
1e70: 65 6c 2d 34 33 0d 0a 53 45 4c 45 43 54 20 63 6f  el-43..SELECT co
1e80: 6c 32 20 2b 20 2b 20 74 61 62 31 2e 63 6f 6c 30  l2 + + tab1.col0
1e90: 20 44 49 56 20 2b 20 63 6f 6c 32 20 63 6f 6c 30   DIV + col2 col0
1ea0: 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d   FROM tab1..----
1eb0: 0d 0a 35 34 0d 0a 35 38 0d 0a 39 36 0d 0a 0d 0a  ..54..58..96....
1ec0: 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71  skipif postgresq
1ed0: 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72  l # PostgreSQL r
1ee0: 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20  equires AS when 
1ef0: 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20  renaming output 
1f00: 63 6f 6c 75 6d 6e 73 0d 0a 73 6b 69 70 69 66 20  columns..skipif 
1f10: 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
1f20: 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
1f30: 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 34 33  rowsort label-43
1f40: 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 32 20 2b 20  ..SELECT col2 + 
1f50: 2b 20 74 61 62 31 2e 63 6f 6c 30 20 2f 20 2b 20  + tab1.col0 / + 
1f60: 63 6f 6c 32 20 63 6f 6c 30 20 46 52 4f 4d 20 74  col2 col0 FROM t
1f70: 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 35 34 0d 0a 35  ab1..----..54..5
1f80: 38 0d 0a 39 36 0d 0a 0d 0a 71 75 65 72 79 20 49  8..96....query I
1f90: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
1fa0: 20 44 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c 32   DISTINCT + col2
1fb0: 20 2a 20 2d 20 38 38 20 41 53 20 63 6f 6c 30 20   * - 88 AS col0 
1fc0: 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d  FROM tab1..----.
1fd0: 0a 2d 34 37 35 32 0d 0a 2d 35 30 31 36 0d 0a 2d  .-4752..-5016..-
1fe0: 38 34 34 38 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  8448....onlyif m
1ff0: 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66  ysql # support f
2000: 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69  or MySQL specifi
2010: 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61  c system types a
2020: 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79  nd syntax..query
2030: 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
2040: 2d 34 35 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  -45..SELECT ALL 
2050: 2d 20 43 41 53 54 28 20 4e 55 4c 4c 20 41 53 20  - CAST( NULL AS 
2060: 53 49 47 4e 45 44 20 29 20 2a 20 2b 20 74 61 62  SIGNED ) * + tab
2070: 30 2e 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46  0.col1 AS col0 F
2080: 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab0..----..
2090: 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c  NULL..NULL..NULL
20a0: 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
20b0: 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
20c0: 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
20d0: 72 74 20 6c 61 62 65 6c 2d 34 35 0d 0a 53 45 4c  rt label-45..SEL
20e0: 45 43 54 20 41 4c 4c 20 2d 20 43 41 53 54 20 28  ECT ALL - CAST (
20f0: 20 4e 55 4c 4c 20 41 53 20 49 4e 54 45 47 45 52   NULL AS INTEGER
2100: 20 29 20 2a 20 2b 20 74 61 62 30 2e 63 6f 6c 31   ) * + tab0.col1
2110: 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
2120: 62 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a  b0..----..NULL..
2130: 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b  NULL..NULL....sk
2140: 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20  ipif postgresql 
2150: 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71  # PostgreSQL req
2160: 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65  uires AS when re
2170: 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f  naming output co
2180: 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72  lumns..query I r
2190: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
21a0: 49 53 54 49 4e 43 54 20 28 20 2d 20 74 61 62 31  ISTINCT ( - tab1
21b0: 2e 63 6f 6c 31 20 2b 20 28 20 2d 20 74 61 62 31  .col1 + ( - tab1
21c0: 2e 63 6f 6c 31 20 29 20 29 20 63 6f 6c 31 20 46  .col1 ) ) col1 F
21d0: 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab1..----..
21e0: 2d 32 30 0d 0a 2d 32 36 0d 0a 2d 35 32 0d 0a 0d  -20..-26..-52...
21f0: 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73  .skipif postgres
2200: 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20  ql # PostgreSQL 
2210: 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e  requires AS when
2220: 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74   renaming output
2230: 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20   columns..query 
2240: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
2250: 54 20 44 49 53 54 49 4e 43 54 20 2b 20 28 20 63  T DISTINCT + ( c
2260: 6f 6c 30 20 29 20 63 6f 6c 31 20 46 52 4f 4d 20  ol0 ) col1 FROM 
2270: 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
2280: 2d 2d 0d 0a 32 34 0d 0a 33 35 0d 0a 38 39 0d 0a  --..24..35..89..
2290: 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65  ..skipif postgre
22a0: 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c  sql # PostgreSQL
22b0: 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65   requires AS whe
22c0: 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75  n renaming outpu
22d0: 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79  t columns..query
22e0: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
22f0: 43 54 20 41 4c 4c 20 2b 20 63 6f 72 30 2e 63 6f  CT ALL + cor0.co
2300: 6c 31 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  l1 col2 FROM tab
2310: 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 37  2 cor0..----..17
2320: 0d 0a 33 31 0d 0a 35 39 0d 0a 0d 0a 6f 6e 6c 79  ..31..59....only
2330: 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44  if mysql # use D
2340: 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20  IV operator for 
2350: 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e  integer division
2360: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2370: 74 20 6c 61 62 65 6c 2d 34 39 0d 0a 53 45 4c 45  t label-49..SELE
2380: 43 54 20 2b 20 63 6f 6c 31 20 2d 20 63 6f 6c 31  CT + col1 - col1
2390: 20 44 49 56 20 2b 20 63 6f 6c 32 20 46 52 4f 4d   DIV + col2 FROM
23a0: 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
23b0: 2d 2d 2d 0d 0a 31 30 0d 0a 31 33 0d 0a 32 36 0d  ---..10..13..26.
23c0: 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
23d0: 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
23e0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
23f0: 74 20 6c 61 62 65 6c 2d 34 39 0d 0a 53 45 4c 45  t label-49..SELE
2400: 43 54 20 2b 20 63 6f 6c 31 20 2d 20 63 6f 6c 31  CT + col1 - col1
2410: 20 2f 20 2b 20 63 6f 6c 32 20 46 52 4f 4d 20 74   / + col2 FROM t
2420: 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
2430: 2d 0d 0a 31 30 0d 0a 31 33 0d 0a 32 36 0d 0a 0d  -..10..13..26...
2440: 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
2450: 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72  use DIV operator
2460: 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76   for integer div
2470: 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72  ision..query I r
2480: 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 35 30 0d  owsort label-50.
2490: 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f  .SELECT ALL - co
24a0: 6c 30 20 2d 20 2d 20 63 6f 72 30 2e 63 6f 6c 32  l0 - - cor0.col2
24b0: 20 44 49 56 20 2b 20 28 20 63 6f 6c 30 20 29 20   DIV + ( col0 ) 
24c0: 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
24d0: 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 34  2 cor0..----..-4
24e0: 0d 0a 2d 37 38 0d 0a 2d 37 39 0d 0a 0d 0a 73 6b  ..-78..-79....sk
24f0: 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
2500: 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
2510: 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
2520: 65 6c 2d 35 30 0d 0a 53 45 4c 45 43 54 20 41 4c  el-50..SELECT AL
2530: 4c 20 2d 20 63 6f 6c 30 20 2d 20 2d 20 63 6f 72  L - col0 - - cor
2540: 30 2e 63 6f 6c 32 20 2f 20 2b 20 28 20 63 6f 6c  0.col2 / + ( col
2550: 30 20 29 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  0 ) AS col0 FROM
2560: 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab2 cor0..----
2570: 0d 0a 2d 34 0d 0a 2d 37 38 0d 0a 2d 37 39 0d 0a  ..-4..-78..-79..
2580: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2590: 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
25a0: 43 54 20 2d 20 2b 20 38 38 20 2b 20 63 6f 72 30  CT - + 88 + cor0
25b0: 2e 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46 52  .col0 AS col0 FR
25c0: 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
25d0: 0a 2d 2d 2d 2d 0d 0a 2d 35 33 0d 0a 2d 36 34 0d  .----..-53..-64.
25e0: 0a 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  .1....query I ro
25f0: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
2600: 2d 20 63 6f 6c 32 20 2d 20 2b 20 63 6f 6c 31 20  - col2 - + col1 
2610: 2a 20 2d 20 63 6f 6c 30 20 41 53 20 63 6f 6c 32  * - col0 AS col2
2620: 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
2630: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33 30 35 0d 0a  r0..----..1305..
2640: 31 39 30 0d 0a 34 35 37 36 0d 0a 0d 0a 71 75 65  190..4576....que
2650: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
2660: 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 28 20  LECT DISTINCT ( 
2670: 63 6f 6c 30 20 29 20 2a 20 2b 20 31 20 41 53 20  col0 ) * + 1 AS 
2680: 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41  col2 FROM tab0 A
2690: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 34  S cor0..----..24
26a0: 0d 0a 33 35 0d 0a 38 39 0d 0a 0d 0a 73 6b 69 70  ..35..89....skip
26b0: 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20  if postgresql # 
26c0: 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69  PostgreSQL requi
26d0: 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61  res AS when rena
26e0: 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75  ming output colu
26f0: 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  mns..query I row
2700: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
2710: 20 2d 20 63 6f 6c 31 20 2b 20 63 6f 6c 31 20 2b   - col1 + col1 +
2720: 20 2d 20 63 6f 6c 31 20 63 6f 6c 31 20 46 52 4f   - col1 col1 FRO
2730: 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
2740: 2d 2d 2d 2d 0d 0a 2d 31 30 0d 0a 2d 31 33 0d 0a  ----..-10..-13..
2750: 2d 32 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  -26....query I r
2760: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
2770: 20 39 30 20 46 52 4f 4d 20 74 61 62 31 2c 20 74   90 FROM tab1, t
2780: 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
2790: 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68  -..9 values hash
27a0: 69 6e 67 20 74 6f 20 39 36 66 37 61 39 30 34 32  ing to 96f7a9042
27b0: 38 64 62 39 33 66 34 37 32 65 30 64 32 31 39 62  8db93f472e0d219b
27c0: 61 62 36 34 38 35 33 0d 0a 0d 0a 73 6b 69 70 69  ab64853....skipi
27d0: 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50  f postgresql # P
27e0: 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72  ostgreSQL requir
27f0: 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d  es AS when renam
2800: 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d  ing output colum
2810: 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ns..query I rows
2820: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 37 38  ort..SELECT + 78
2830: 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 2c   col1 FROM tab0,
2840: 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
2850: 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61  ---..9 values ha
2860: 73 68 69 6e 67 20 74 6f 20 32 61 66 66 34 32 64  shing to 2aff42d
2870: 33 65 30 31 35 30 32 32 61 37 33 38 39 30 35 30  3e015022a7389050
2880: 39 30 61 32 30 64 66 64 34 0d 0a 0d 0a 6f 6e 6c  90a20dfd4....onl
2890: 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20  yif mysql # use 
28a0: 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72  DIV operator for
28b0: 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f   integer divisio
28c0: 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  n..query I rowso
28d0: 72 74 20 6c 61 62 65 6c 2d 35 37 0d 0a 53 45 4c  rt label-57..SEL
28e0: 45 43 54 20 41 4c 4c 20 2b 20 2d 20 63 6f 6c 32  ECT ALL + - col2
28f0: 20 44 49 56 20 2b 20 43 41 53 54 28 20 2d 20 63   DIV + CAST( - c
2900: 6f 6c 31 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20  ol1 + cor0.col0 
2910: 41 53 20 53 49 47 4e 45 44 20 29 20 41 53 20 63  AS SIGNED ) AS c
2920: 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol0 FROM tab1 AS
2930: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d   cor0..----..-1.
2940: 0a 2d 31 0d 0a 32 0d 0a 0d 0a 73 6b 69 70 69 66  .-1..2....skipif
2950: 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
2960: 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
2970: 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 35   rowsort label-5
2980: 37 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20  7..SELECT ALL + 
2990: 2d 20 63 6f 6c 32 20 2f 20 2b 20 43 41 53 54 20  - col2 / + CAST 
29a0: 28 20 2d 20 63 6f 6c 31 20 2b 20 63 6f 72 30 2e  ( - col1 + cor0.
29b0: 63 6f 6c 30 20 41 53 20 49 4e 54 45 47 45 52 20  col0 AS INTEGER 
29c0: 29 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  ) AS col0 FROM t
29d0: 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
29e0: 2d 0d 0a 2d 31 0d 0a 2d 31 0d 0a 32 0d 0a 0d 0a  -..-1..-1..2....
29f0: 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75  onlyif mysql # u
2a00: 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20  se DIV operator 
2a10: 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69  for integer divi
2a20: 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f  sion..query I ro
2a30: 77 73 6f 72 74 20 6c 61 62 65 6c 2d 35 38 0d 0a  wsort label-58..
2a40: 53 45 4c 45 43 54 20 63 6f 6c 31 20 44 49 56 20  SELECT col1 DIV 
2a50: 2b 20 34 33 20 2b 20 38 34 20 2b 20 2d 20 63 6f  + 43 + 84 + - co
2a60: 6c 32 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  l2 AS col1 FROM 
2a70: 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
2a80: 2d 2d 0d 0a 34 0d 0a 35 33 0d 0a 38 35 0d 0a 0d  --..4..53..85...
2a90: 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
2aa0: 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
2ab0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
2ac0: 6c 61 62 65 6c 2d 35 38 0d 0a 53 45 4c 45 43 54  label-58..SELECT
2ad0: 20 63 6f 6c 31 20 2f 20 2b 20 34 33 20 2b 20 38   col1 / + 43 + 8
2ae0: 34 20 2b 20 2d 20 63 6f 6c 32 20 41 53 20 63 6f  4 + - col2 AS co
2af0: 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l1 FROM tab0 AS 
2b00: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 34 0d 0a 35  cor0..----..4..5
2b10: 33 0d 0a 38 35 0d 0a 0d 0a 71 75 65 72 79 20 49  3..85....query I
2b20: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
2b30: 20 41 4c 4c 20 2d 20 2b 20 63 6f 6c 30 20 2b 20   ALL - + col0 + 
2b40: 2b 20 28 20 2d 20 63 6f 6c 31 20 29 20 41 53 20  + ( - col1 ) AS 
2b50: 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41  col0 FROM tab2 A
2b60: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
2b70: 33 37 0d 0a 2d 33 38 0d 0a 2d 39 36 0d 0a 0d 0a  37..-38..-96....
2b80: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
2b90: 0a 53 45 4c 45 43 54 20 2d 20 63 6f 72 30 2e 63  .SELECT - cor0.c
2ba0: 6f 6c 32 20 2a 20 2b 20 63 6f 6c 30 20 41 53 20  ol2 * + col0 AS 
2bb0: 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 63  col0 FROM tab1 c
2bc0: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 36 32 0d  or0..----..-162.
2bd0: 0a 2d 33 36 34 38 0d 0a 2d 37 36 38 30 0d 0a 0d  .-3648..-7680...
2be0: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2bf0: 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 30 20  ..SELECT - col0 
2c00: 2b 20 31 39 20 2b 20 63 6f 72 30 2e 63 6f 6c 32  + 19 + cor0.col2
2c10: 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
2c20: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 32 0d 0a 2d  r0..----..-22..-
2c30: 33 33 0d 0a 33 39 0d 0a 0d 0a 71 75 65 72 79 20  33..39....query 
2c40: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
2c50: 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c  T DISTINCT - col
2c60: 30 20 2a 20 2b 20 63 6f 6c 31 20 2b 20 31 33 20  0 * + col1 + 13 
2c70: 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
2c80: 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 30 35 31 0d 0a  0..----..-2051..
2c90: 2d 33 33 38 32 0d 0a 2d 38 30 38 36 0d 0a 0d 0a  -3382..-8086....
2ca0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
2cb0: 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
2cc0: 20 2d 20 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c 32   - col1 * - col2
2cd0: 20 2a 20 2b 20 63 6f 6c 31 20 2b 20 2b 20 63 6f   * + col1 + + co
2ce0: 6c 32 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  l2 AS col1 FROM 
2cf0: 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
2d00: 2d 2d 0d 0a 31 36 33 32 30 0d 0a 33 36 35 35 38  --..16320..36558
2d10: 0d 0a 35 37 35 37 0d 0a 0d 0a 71 75 65 72 79 20  ..5757....query 
2d20: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
2d30: 54 20 63 6f 72 30 2e 63 6f 6c 31 20 2b 20 2d 20  T cor0.col1 + - 
2d40: 63 6f 72 30 2e 63 6f 6c 30 20 46 52 4f 4d 20 74  cor0.col0 FROM t
2d50: 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
2d60: 2d 0d 0a 32 0d 0a 36 32 0d 0a 36 32 0d 0a 0d 0a  -..2..62..62....
2d70: 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75  onlyif mysql # u
2d80: 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20  se DIV operator 
2d90: 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69  for integer divi
2da0: 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f  sion..query I ro
2db0: 77 73 6f 72 74 20 6c 61 62 65 6c 2d 36 35 0d 0a  wsort label-65..
2dc0: 53 45 4c 45 43 54 20 2b 20 63 6f 6c 31 20 44 49  SELECT + col1 DI
2dd0: 56 20 28 20 2b 20 63 6f 6c 31 20 29 20 41 53 20  V ( + col1 ) AS 
2de0: 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41  col2 FROM tab2 A
2df0: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 0d  S cor0..----..1.
2e00: 0a 31 0d 0a 31 0d 0a 0d 0a 73 6b 69 70 69 66 20  .1..1....skipif 
2e10: 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
2e20: 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
2e30: 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 36 35  rowsort label-65
2e40: 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 31 20  ..SELECT + col1 
2e50: 2f 20 28 20 2b 20 63 6f 6c 31 20 29 20 41 53 20  / ( + col1 ) AS 
2e60: 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41  col2 FROM tab2 A
2e70: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 0d  S cor0..----..1.
2e80: 0a 31 0d 0a 31 0d 0a 0d 0a 71 75 65 72 79 20 49  .1..1....query I
2e90: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
2ea0: 20 41 4c 4c 20 2d 20 63 6f 6c 31 20 2a 20 63 6f   ALL - col1 * co
2eb0: 6c 30 20 2a 20 63 6f 6c 30 20 41 53 20 63 6f 6c  l0 * col0 AS col
2ec0: 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  0 FROM tab1 AS c
2ed0: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 33 34 0d  or0..----..-234.
2ee0: 0a 2d 34 30 39 36 30 0d 0a 2d 38 33 32 30 30 0d  .-40960..-83200.
2ef0: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
2f00: 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d  rt..SELECT ALL -
2f10: 20 63 6f 6c 32 20 2a 20 33 31 20 46 52 4f 4d 20   col2 * 31 FROM 
2f20: 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
2f30: 2d 2d 0d 0a 2d 31 36 37 34 0d 0a 2d 31 37 36 37  --..-1674..-1767
2f40: 0d 0a 2d 32 39 37 36 0d 0a 0d 0a 71 75 65 72 79  ..-2976....query
2f50: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
2f60: 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 28 20  CT DISTINCT - ( 
2f70: 31 32 20 29 20 2d 20 2b 20 63 6f 6c 31 20 41 53  12 ) - + col1 AS
2f80: 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20   col0 FROM tab2 
2f90: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
2fa0: 32 39 0d 0a 2d 34 33 0d 0a 2d 37 31 0d 0a 0d 0a  29..-43..-71....
2fb0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
2fc0: 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 31  .SELECT ALL col1
2fd0: 20 2a 20 2b 20 74 61 62 30 2e 63 6f 6c 32 20 41   * + tab0.col2 A
2fe0: 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30  S col1 FROM tab0
2ff0: 0d 0a 2d 2d 2d 2d 0d 0a 32 38 33 38 0d 0a 37 34  ..----..2838..74
3000: 36 32 0d 0a 39 37 0d 0a 0d 0a 71 75 65 72 79 20  62..97....query 
3010: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
3020: 54 20 44 49 53 54 49 4e 43 54 20 2b 20 2d 20 63  T DISTINCT + - c
3030: 6f 6c 31 20 2a 20 2b 20 32 36 20 41 53 20 63 6f  ol1 * + 26 AS co
3040: 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72  l1 FROM tab0 cor
3050: 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 32 33 36 0d 0a  0..----..-2236..
3060: 2d 32 33 36 36 0d 0a 2d 32 35 32 32 0d 0a 0d 0a  -2366..-2522....
3070: 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73  onlyif mysql # s
3080: 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c  upport for MySQL
3090: 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d   specific system
30a0: 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61   types and synta
30b0: 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  x..query I rowso
30c0: 72 74 20 6c 61 62 65 6c 2d 37 31 0d 0a 53 45 4c  rt label-71..SEL
30d0: 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 43  ECT DISTINCT + C
30e0: 41 53 54 28 20 4e 55 4c 4c 20 41 53 20 53 49 47  AST( NULL AS SIG
30f0: 4e 45 44 20 29 20 2f 20 2b 20 63 6f 6c 31 20 46  NED ) / + col1 F
3100: 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
3110: 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 0d 0a  ..----..NULL....
3120: 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
3130: 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
3140: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
3150: 61 62 65 6c 2d 37 31 0d 0a 53 45 4c 45 43 54 20  abel-71..SELECT 
3160: 44 49 53 54 49 4e 43 54 20 2b 20 43 41 53 54 20  DISTINCT + CAST 
3170: 28 20 4e 55 4c 4c 20 41 53 20 49 4e 54 45 47 45  ( NULL AS INTEGE
3180: 52 20 29 20 2f 20 2b 20 63 6f 6c 31 20 46 52 4f  R ) / + col1 FRO
3190: 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
31a0: 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75  ----..NULL....qu
31b0: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
31c0: 45 4c 45 43 54 20 63 6f 72 30 2e 63 6f 6c 30 20  ELECT cor0.col0 
31d0: 2a 20 2d 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61  * - col0 FROM ta
31e0: 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  b1 cor0..----..-
31f0: 34 30 39 36 0d 0a 2d 36 34 30 30 0d 0a 2d 39 0d  4096..-6400..-9.
3200: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
3210: 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 38  rt..SELECT ALL 8
3220: 34 20 46 52 4f 4d 20 74 61 62 30 2c 20 74 61 62  4 FROM tab0, tab
3230: 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
3240: 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e  .9 values hashin
3250: 67 20 74 6f 20 63 61 64 64 38 37 36 63 32 36 33  g to cadd876c263
3260: 33 38 66 63 35 38 62 39 32 39 37 65 37 34 66 63  38fc58b9297e74fc
3270: 33 32 34 64 38 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  324d8....onlyif 
3280: 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20  mysql # use DIV 
3290: 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74  operator for int
32a0: 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71  eger division..q
32b0: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
32c0: 61 62 65 6c 2d 37 34 0d 0a 53 45 4c 45 43 54 20  abel-74..SELECT 
32d0: 2b 20 63 6f 6c 32 20 44 49 56 20 36 30 20 46 52  + col2 DIV 60 FR
32e0: 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
32f0: 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 31 0d 0a  .----..0..0..1..
3300: 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
3310: 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
3320: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
3330: 20 6c 61 62 65 6c 2d 37 34 0d 0a 53 45 4c 45 43   label-74..SELEC
3340: 54 20 2b 20 63 6f 6c 32 20 2f 20 36 30 20 46 52  T + col2 / 60 FR
3350: 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
3360: 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 31 0d 0a  .----..0..0..1..
3370: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
3380: 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
3390: 43 54 20 2d 20 28 20 28 20 74 61 62 31 2e 63 6f  CT - ( ( tab1.co
33a0: 6c 30 20 29 20 29 20 46 52 4f 4d 20 74 61 62 31  l0 ) ) FROM tab1
33b0: 2c 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  , tab2 AS cor0..
33c0: 2d 2d 2d 2d 0d 0a 2d 33 0d 0a 2d 36 34 0d 0a 2d  ----..-3..-64..-
33d0: 38 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  80....query I ro
33e0: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
33f0: 53 54 49 4e 43 54 20 2d 20 63 6f 6c 31 20 2a 20  STINCT - col1 * 
3400: 2d 20 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53  - 1 FROM tab0 AS
3410: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 38 36 0d   cor0..----..86.
3420: 0a 39 31 0d 0a 39 37 0d 0a 0d 0a 71 75 65 72 79  .91..97....query
3430: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
3440: 43 54 20 2b 20 2d 20 63 6f 6c 30 20 2a 20 32 37  CT + - col0 * 27
3450: 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20   + col1 AS col0 
3460: 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
3470: 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 35 38 0d 0a 2d  0..----..-158..-
3480: 32 30 34 37 0d 0a 2d 32 31 31 36 0d 0a 0d 0a 71  2047..-2116....q
3490: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
34a0: 53 45 4c 45 43 54 20 41 4c 4c 20 36 38 20 41 53  SELECT ALL 68 AS
34b0: 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 2c   col2 FROM tab2,
34c0: 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
34d0: 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61  ---..9 values ha
34e0: 73 68 69 6e 67 20 74 6f 20 35 39 39 62 65 65 31  shing to 599bee1
34f0: 35 61 63 34 63 63 33 39 62 38 35 39 38 35 34 65  5ac4cc39b859854e
3500: 30 37 64 66 65 37 39 39 30 0d 0a 0d 0a 71 75 65  07dfe7990....que
3510: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
3520: 4c 45 43 54 20 41 4c 4c 20 2b 20 2b 20 28 20 63  LECT ALL + + ( c
3530: 6f 6c 32 20 29 20 2b 20 2d 20 63 6f 6c 31 20 2a  ol2 ) + - col1 *
3540: 20 37 37 20 46 52 4f 4d 20 74 61 62 31 20 41 53   77 FROM tab1 AS
3550: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 39   cor0..----..-19
3560: 34 38 0d 0a 2d 37 31 33 0d 0a 2d 39 30 35 0d 0a  48..-713..-905..
3570: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
3580: 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2b 20 63 6f  t..SELECT - + co
3590: 6c 30 20 2a 20 35 34 20 2d 20 63 6f 6c 32 20 41  l0 * 54 - col2 A
35a0: 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30  S col2 FROM tab0
35b0: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
35c0: 2d 31 33 32 39 0d 0a 2d 31 38 39 31 0d 0a 2d 34  -1329..-1891..-4
35d0: 38 38 38 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  888....onlyif my
35e0: 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f  sql # support fo
35f0: 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63  r MySQL specific
3600: 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e   system types an
3610: 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20  d syntax..query 
3620: 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
3630: 38 31 0d 0a 53 45 4c 45 43 54 20 2d 20 43 41 53  81..SELECT - CAS
3640: 54 28 20 63 6f 6c 31 20 41 53 20 53 49 47 4e 45  T( col1 AS SIGNE
3650: 44 20 29 20 2b 20 63 6f 6c 32 20 46 52 4f 4d 20  D ) + col2 FROM 
3660: 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab1 cor0..----.
3670: 0a 32 38 0d 0a 34 37 0d 0a 38 33 0d 0a 0d 0a 73  .28..47..83....s
3680: 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
3690: 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
36a0: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
36b0: 62 65 6c 2d 38 31 0d 0a 53 45 4c 45 43 54 20 2d  bel-81..SELECT -
36c0: 20 43 41 53 54 20 28 20 63 6f 6c 31 20 41 53 20   CAST ( col1 AS 
36d0: 49 4e 54 45 47 45 52 20 29 20 2b 20 63 6f 6c 32  INTEGER ) + col2
36e0: 20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d   FROM tab1 cor0.
36f0: 0a 2d 2d 2d 2d 0d 0a 32 38 0d 0a 34 37 0d 0a 38  .----..28..47..8
3700: 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  3....query I row
3710: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2d  sort..SELECT + -
3720: 20 38 32 20 2b 20 63 6f 6c 32 20 41 53 20 63 6f   82 + col2 AS co
3730: 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l0 FROM tab1 AS 
3740: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 35 0d  cor0..----..-25.
3750: 0a 2d 32 38 0d 0a 31 34 0d 0a 0d 0a 71 75 65 72  .-28..14....quer
3760: 79 20 49 49 49 49 49 49 49 49 49 49 49 49 20 72  y IIIIIIIIIIII r
3770: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2a  owsort..SELECT *
3780: 20 46 52 4f 4d 20 74 61 62 31 2c 20 74 61 62 30   FROM tab1, tab0
3790: 20 63 6f 72 30 2c 20 74 61 62 30 2c 20 74 61 62   cor0, tab0, tab
37a0: 30 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d  0 AS cor1..----.
37b0: 0a 39 37 32 20 76 61 6c 75 65 73 20 68 61 73 68  .972 values hash
37c0: 69 6e 67 20 74 6f 20 33 34 30 36 34 39 37 33 35  ing to 340649735
37d0: 31 65 34 37 38 39 63 38 39 61 32 39 35 65 65 39  1e4789c89a295ee9
37e0: 62 36 34 62 32 30 31 0d 0a 0d 0a 71 75 65 72 79  b64b201....query
37f0: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
3800: 43 54 20 74 61 62 31 2e 63 6f 6c 32 20 2a 20 35  CT tab1.col2 * 5
3810: 35 20 46 52 4f 4d 20 74 61 62 31 2c 20 74 61 62  5 FROM tab1, tab
3820: 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
3830: 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e  .9 values hashin
3840: 67 20 74 6f 20 37 37 37 61 65 62 30 64 61 35 63  g to 777aeb0da5c
3850: 65 35 66 36 31 63 31 39 61 39 33 32 38 37 30 36  e5f61c19a9328706
3860: 61 64 32 65 63 0d 0a 0d 0a 71 75 65 72 79 20 49  ad2ec....query I
3870: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
3880: 20 63 6f 72 30 2e 63 6f 6c 30 20 2a 20 2b 20 63   cor0.col0 * + c
3890: 6f 72 31 2e 63 6f 6c 31 20 46 52 4f 4d 20 74 61  or1.col1 FROM ta
38a0: 62 31 2c 20 74 61 62 30 20 63 6f 72 30 2c 20 74  b1, tab0 cor0, t
38b0: 61 62 31 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d  ab1 AS cor1..---
38c0: 2d 0d 0a 32 37 20 76 61 6c 75 65 73 20 68 61 73  -..27 values has
38d0: 68 69 6e 67 20 74 6f 20 35 35 39 36 33 62 66 30  hing to 55963bf0
38e0: 33 36 32 63 37 65 30 30 37 37 33 62 34 30 39 64  362c7e00773b409d
38f0: 34 34 35 34 65 64 36 39 0d 0a 0d 0a 71 75 65 72  4454ed69....quer
3900: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
3910: 45 43 54 20 41 4c 4c 20 2d 20 2b 20 63 6f 6c 32  ECT ALL - + col2
3920: 20 2a 20 63 6f 6c 31 20 2d 20 36 20 2a 20 63 6f   * col1 - 6 * co
3930: 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l0 FROM tab2 AS 
3940: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 32  cor0..----..-112
3950: 30 0d 0a 2d 32 30 30 32 0d 0a 2d 38 37 39 0d 0a  0..-2002..-879..
3960: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
3970: 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 32 20 2a  t..SELECT col2 *
3980: 20 63 6f 6c 31 20 2a 20 63 6f 6c 31 20 2b 20 63   col1 * col1 + c
3990: 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 63 6f  ol2 FROM tab1 co
39a0: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 36 33 32 30 0d  r0..----..16320.
39b0: 0a 33 36 35 35 38 0d 0a 35 37 35 37 0d 0a 0d 0a  .36558..5757....
39c0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
39d0: 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 31 39  .SELECT ALL - 19
39e0: 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
39f0: 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 39 0d 0a 2d  b0..----..-19..-
3a00: 31 39 0d 0a 2d 31 39 0d 0a 0d 0a 71 75 65 72 79  19..-19....query
3a10: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
3a20: 43 54 20 2d 20 74 61 62 32 2e 63 6f 6c 32 20 46  CT - tab2.col2 F
3a30: 52 4f 4d 20 74 61 62 32 2c 20 74 61 62 31 2c 20  ROM tab2, tab1, 
3a40: 74 61 62 31 20 41 53 20 63 6f 72 30 2c 20 74 61  tab1 AS cor0, ta
3a50: 62 30 0d 0a 2d 2d 2d 2d 0d 0a 38 31 20 76 61 6c  b0..----..81 val
3a60: 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 63  ues hashing to c
3a70: 35 36 39 36 33 38 65 38 61 30 39 66 66 38 31 39  569638e8a09ff819
3a80: 34 35 38 64 36 32 64 64 62 64 65 39 39 34 63 0d  458d62ddbde994c.
3a90: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
3aa0: 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
3ab0: 4e 43 54 20 2d 20 28 20 63 6f 6c 32 20 29 20 2b  NCT - ( col2 ) +
3ac0: 20 63 6f 6c 31 20 2a 20 63 6f 6c 31 20 41 53 20   col1 * col1 AS 
3ad0: 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41  col2 FROM tab1 A
3ae0: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 34 33  S cor0..----..43
3af0: 0d 0a 36 32 32 0d 0a 37 33 0d 0a 0d 0a 71 75 65  ..622..73....que
3b00: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
3b10: 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20  LECT DISTINCT - 
3b20: 28 20 2b 20 74 61 62 32 2e 63 6f 6c 30 20 29 20  ( + tab2.col0 ) 
3b30: 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d  FROM tab2..----.
3b40: 0a 2d 37 0d 0a 2d 37 38 0d 0a 2d 37 39 0d 0a 0d  .-7..-78..-79...
3b50: 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
3b60: 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72  use DIV operator
3b70: 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76   for integer div
3b80: 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72  ision..query I r
3b90: 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 39 32 0d  owsort label-92.
3ba0: 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
3bb0: 20 2d 20 32 39 20 44 49 56 20 2d 20 34 38 20 46   - 29 DIV - 48 F
3bc0: 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 20 43 52  ROM tab0 cor0 CR
3bd0: 4f 53 53 20 4a 4f 49 4e 20 74 61 62 31 20 41 53  OSS JOIN tab1 AS
3be0: 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a   cor1..----..0..
3bf0: 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
3c00: 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
3c10: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
3c20: 20 6c 61 62 65 6c 2d 39 32 0d 0a 53 45 4c 45 43   label-92..SELEC
3c30: 54 20 44 49 53 54 49 4e 43 54 20 2d 20 32 39 20  T DISTINCT - 29 
3c40: 2f 20 2d 20 34 38 20 46 52 4f 4d 20 74 61 62 30  / - 48 FROM tab0
3c50: 20 63 6f 72 30 20 43 52 4f 53 53 20 4a 4f 49 4e   cor0 CROSS JOIN
3c60: 20 74 61 62 31 20 41 53 20 63 6f 72 31 0d 0a 2d   tab1 AS cor1..-
3c70: 2d 2d 2d 0d 0a 30 0d 0a 0d 0a 6f 6e 6c 79 69 66  ---..0....onlyif
3c80: 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56   mysql # use DIV
3c90: 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e   operator for in
3ca0: 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a  teger division..
3cb0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
3cc0: 6c 61 62 65 6c 2d 39 33 0d 0a 53 45 4c 45 43 54  label-93..SELECT
3cd0: 20 44 49 53 54 49 4e 43 54 20 38 31 20 2b 20 2b   DISTINCT 81 + +
3ce0: 20 74 61 62 30 2e 63 6f 6c 30 20 44 49 56 20 28   tab0.col0 DIV (
3cf0: 20 63 6f 6c 30 20 2a 20 74 61 62 30 2e 63 6f 6c   col0 * tab0.col
3d00: 31 20 29 20 2b 20 2d 20 28 20 2d 20 33 35 20 29  1 ) + - ( - 35 )
3d10: 20 2a 20 2b 20 74 61 62 30 2e 63 6f 6c 32 20 2a   * + tab0.col2 *
3d20: 20 2d 20 28 20 63 6f 6c 30 20 29 20 41 53 20 63   - ( col0 ) AS c
3d30: 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d  ol1 FROM tab0..-
3d40: 2d 2d 2d 0d 0a 2d 31 31 34 34 0d 0a 2d 32 35 35  ---..-1144..-255
3d50: 33 34 39 0d 0a 2d 32 37 36 33 39 0d 0a 0d 0a 73  349..-27639....s
3d60: 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
3d70: 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
3d80: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
3d90: 62 65 6c 2d 39 33 0d 0a 53 45 4c 45 43 54 20 44  bel-93..SELECT D
3da0: 49 53 54 49 4e 43 54 20 38 31 20 2b 20 2b 20 74  ISTINCT 81 + + t
3db0: 61 62 30 2e 63 6f 6c 30 20 2f 20 28 20 63 6f 6c  ab0.col0 / ( col
3dc0: 30 20 2a 20 74 61 62 30 2e 63 6f 6c 31 20 29 20  0 * tab0.col1 ) 
3dd0: 2b 20 2d 20 28 20 2d 20 33 35 20 29 20 2a 20 2b  + - ( - 35 ) * +
3de0: 20 74 61 62 30 2e 63 6f 6c 32 20 2a 20 2d 20 28   tab0.col2 * - (
3df0: 20 63 6f 6c 30 20 29 20 41 53 20 63 6f 6c 31 20   col0 ) AS col1 
3e00: 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d  FROM tab0..----.
3e10: 0a 2d 31 31 34 34 0d 0a 2d 32 35 35 33 34 39 0d  .-1144..-255349.
3e20: 0a 2d 32 37 36 33 39 0d 0a 0d 0a 6f 6e 6c 79 69  .-27639....onlyi
3e30: 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49  f mysql # use DI
3e40: 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69  V operator for i
3e50: 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d  nteger division.
3e60: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
3e70: 20 6c 61 62 65 6c 2d 39 34 0d 0a 53 45 4c 45 43   label-94..SELEC
3e80: 54 20 2d 20 63 6f 6c 32 20 2d 20 2d 20 63 6f 6c  T - col2 - - col
3e90: 31 20 44 49 56 20 63 6f 6c 30 20 46 52 4f 4d 20  1 DIV col0 FROM 
3ea0: 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 33 0d  tab2..----..-23.
3eb0: 0a 2d 32 36 0d 0a 2d 33 38 0d 0a 0d 0a 73 6b 69  .-26..-38....ski
3ec0: 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
3ed0: 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
3ee0: 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
3ef0: 6c 2d 39 34 0d 0a 53 45 4c 45 43 54 20 2d 20 63  l-94..SELECT - c
3f00: 6f 6c 32 20 2d 20 2d 20 63 6f 6c 31 20 2f 20 63  ol2 - - col1 / c
3f10: 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d  ol0 FROM tab2..-
3f20: 2d 2d 2d 0d 0a 2d 32 33 0d 0a 2d 32 36 0d 0a 2d  ---..-23..-26..-
3f30: 33 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  38....query I ro
3f40: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
3f50: 63 6f 6c 31 20 2b 20 2d 20 32 36 20 41 53 20 63  col1 + - 26 AS c
3f60: 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d  ol1 FROM tab0..-
3f70: 2d 2d 2d 0d 0a 2d 31 31 32 0d 0a 2d 31 31 37 0d  ---..-112..-117.
3f80: 0a 2d 31 32 33 0d 0a 0d 0a 71 75 65 72 79 20 49  .-123....query I
3f90: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
3fa0: 20 63 6f 6c 30 20 2a 20 2d 20 31 39 20 2b 20 28   col0 * - 19 + (
3fb0: 20 2b 20 63 6f 6c 31 20 2b 20 28 20 63 6f 6c 32   + col1 + ( col2
3fc0: 20 29 20 2a 20 2d 20 63 6f 6c 30 20 29 20 46 52   ) * - col0 ) FR
3fd0: 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d  OM tab2..----..-
3fe0: 32 39 31 0d 0a 2d 33 34 35 31 0d 0a 2d 34 34 38  291..-3451..-448
3ff0: 36 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  6....onlyif mysq
4000: 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72  l # use DIV oper
4010: 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72  ator for integer
4020: 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79   division..query
4030: 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
4040: 2d 39 37 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 31  -97..SELECT col1
4050: 20 2d 20 63 6f 6c 32 20 44 49 56 20 63 6f 6c 30   - col2 DIV col0
4060: 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d   FROM tab0..----
4070: 0d 0a 38 35 0d 0a 39 31 0d 0a 39 37 0d 0a 0d 0a  ..85..91..97....
4080: 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
4090: 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
40a0: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
40b0: 61 62 65 6c 2d 39 37 0d 0a 53 45 4c 45 43 54 20  abel-97..SELECT 
40c0: 63 6f 6c 31 20 2d 20 63 6f 6c 32 20 2f 20 63 6f  col1 - col2 / co
40d0: 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d  l0 FROM tab0..--
40e0: 2d 2d 0d 0a 38 35 0d 0a 39 31 0d 0a 39 37 0d 0a  --..85..91..97..
40f0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
4100: 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20  t..SELECT ALL + 
4110: 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c 32 20 2a 20  col1 * + col2 * 
4120: 2b 20 32 35 20 46 52 4f 4d 20 74 61 62 32 20 41  + 25 FROM tab2 A
4130: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 36  S cor0..----..16
4140: 31 35 30 0d 0a 32 30 39 32 35 0d 0a 33 38 33 35  150..20925..3835
4150: 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  0....query I row
4160: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63  sort..SELECT + c
4170: 6f 6c 30 20 2a 20 2b 20 63 6f 6c 30 20 2a 20 63  ol0 * + col0 * c
4180: 6f 72 30 2e 63 6f 6c 31 20 41 53 20 63 6f 6c 31  or0.col1 AS col1
4190: 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
41a0: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 36 30 39 37  r0..----..106097
41b0: 0d 0a 31 35 31 39 0d 0a 33 35 38 39 35 36 0d 0a  ..1519..358956..
41c0: 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
41d0: 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f   use DIV operato
41e0: 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69  r for integer di
41f0: 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20  vision..query I 
4200: 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 30  rowsort label-10
4210: 30 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f  0..SELECT ALL co
4220: 6c 32 20 44 49 56 20 2d 20 33 36 20 46 52 4f 4d  l2 DIV - 36 FROM
4230: 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
4240: 2d 2d 2d 0d 0a 2d 31 0d 0a 30 0d 0a 30 0d 0a 0d  ---..-1..0..0...
4250: 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
4260: 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
4270: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
4280: 6c 61 62 65 6c 2d 31 30 30 0d 0a 53 45 4c 45 43  label-100..SELEC
4290: 54 20 41 4c 4c 20 63 6f 6c 32 20 2f 20 2d 20 33  T ALL col2 / - 3
42a0: 36 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  6 FROM tab2 AS c
42b0: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 30  or0..----..-1..0
42c0: 0d 0a 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  ..0....query I r
42d0: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
42e0: 20 74 61 62 32 2e 63 6f 6c 31 20 2a 20 2d 20 63   tab2.col1 * - c
42f0: 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  ol0 AS col1 FROM
4300: 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33   tab2..----..-13
4310: 34 33 0d 0a 2d 32 31 37 0d 0a 2d 34 36 30 32 0d  43..-217..-4602.
4320: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
4330: 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
4340: 4e 43 54 20 2b 20 63 6f 6c 31 20 2a 20 63 6f 6c  NCT + col1 * col
4350: 31 20 2d 20 2d 20 63 6f 6c 30 20 2a 20 63 6f 6c  1 - - col0 * col
4360: 31 20 2a 20 35 37 20 46 52 4f 4d 20 74 61 62 32  1 * 57 FROM tab2
4370: 0d 0a 2d 2d 2d 2d 0d 0a 31 33 33 33 30 0d 0a 32  ..----..13330..2
4380: 36 35 37 39 35 0d 0a 37 36 38 34 30 0d 0a 0d 0a  65795..76840....
4390: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
43a0: 0a 53 45 4c 45 43 54 20 28 20 63 6f 6c 32 20 29  .SELECT ( col2 )
43b0: 20 2a 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c   * + col0 AS col
43c0: 31 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d  1 FROM tab2..---
43d0: 2d 0d 0a 31 38 39 0d 0a 32 30 32 38 0d 0a 33 30  -..189..2028..30
43e0: 30 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  02....query I ro
43f0: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
4400: 53 54 49 4e 43 54 20 2d 20 63 6f 6c 30 20 2a 20  STINCT - col0 * 
4410: 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c 30 20 2d 20  col2 * - col0 - 
4420: 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46 52 4f  col0 AS col0 FRO
4430: 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31  M tab0..----..11
4440: 39 30 0d 0a 31 38 39 38 34 0d 0a 36 34 39 34 33  90..18984..64943
4450: 33 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  3....onlyif mysq
4460: 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72  l # use DIV oper
4470: 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72  ator for integer
4480: 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79   division..query
4490: 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
44a0: 2d 31 30 35 0d 0a 53 45 4c 45 43 54 20 38 33 20  -105..SELECT 83 
44b0: 44 49 56 20 2d 20 34 34 20 46 52 4f 4d 20 74 61  DIV - 44 FROM ta
44c0: 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 2d 31  b1..----..-1..-1
44d0: 0d 0a 2d 31 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  ..-1....skipif m
44e0: 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
44f0: 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
4500: 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 30 35  owsort label-105
4510: 0d 0a 53 45 4c 45 43 54 20 38 33 20 2f 20 2d 20  ..SELECT 83 / - 
4520: 34 34 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d  44 FROM tab1..--
4530: 2d 2d 0d 0a 2d 31 0d 0a 2d 31 0d 0a 2d 31 0d 0a  --..-1..-1..-1..
4540: 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65  ..skipif postgre
4550: 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c  sql # PostgreSQL
4560: 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65   requires AS whe
4570: 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75  n renaming outpu
4580: 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79  t columns..query
4590: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
45a0: 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 74 61  CT DISTINCT - ta
45b0: 62 32 2e 63 6f 6c 32 20 63 6f 6c 32 20 46 52 4f  b2.col2 col2 FRO
45c0: 4d 20 74 61 62 32 2c 20 74 61 62 30 20 41 53 20  M tab2, tab0 AS 
45d0: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 36 0d  cor0..----..-26.
45e0: 0a 2d 32 37 0d 0a 2d 33 38 0d 0a 0d 0a 71 75 65  .-27..-38....que
45f0: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
4600: 4c 45 43 54 20 63 6f 6c 30 20 2a 20 28 20 63 6f  LECT col0 * ( co
4610: 6c 30 20 29 20 2b 20 28 20 2b 20 34 36 20 29 20  l0 ) + ( + 46 ) 
4620: 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
4630: 30 0d 0a 2d 2d 2d 2d 0d 0a 36 31 33 30 0d 0a 36  0..----..6130..6
4640: 32 38 37 0d 0a 39 35 0d 0a 0d 0a 71 75 65 72 79  287..95....query
4650: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
4660: 43 54 20 2b 20 2b 20 35 36 20 2b 20 63 6f 72 30  CT + + 56 + cor0
4670: 2e 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c 30 20 46  .col1 * - col0 F
4680: 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
4690: 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 30 30 38 0d 0a 2d  ..----..-2008..-
46a0: 33 33 33 39 0d 0a 2d 38 30 34 33 0d 0a 0d 0a 71  3339..-8043....q
46b0: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
46c0: 53 45 4c 45 43 54 20 2d 20 63 6f 6c 30 20 2b 20  SELECT - col0 + 
46d0: 35 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  5 AS col1 FROM t
46e0: 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
46f0: 2d 0d 0a 2d 31 39 0d 0a 2d 33 30 0d 0a 2d 38 34  -..-19..-30..-84
4700: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
4710: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
4720: 2d 20 30 20 46 52 4f 4d 20 74 61 62 32 20 63 6f  - 0 FROM tab2 co
4730: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a  r0..----..0..0..
4740: 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  0....query I row
4750: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 36  sort..SELECT - 6
4760: 30 20 2a 20 2b 20 63 6f 6c 30 20 2b 20 28 20 63  0 * + col0 + ( c
4770: 6f 72 30 2e 63 6f 6c 30 20 29 20 41 53 20 63 6f  or0.col0 ) AS co
4780: 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l0 FROM tab1 AS 
4790: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 37 37  cor0..----..-177
47a0: 0d 0a 2d 33 37 37 36 0d 0a 2d 34 37 32 30 0d 0a  ..-3776..-4720..
47b0: 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
47c0: 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53   support for MyS
47d0: 51 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74  QL specific syst
47e0: 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e  em types and syn
47f0: 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  tax..query I row
4800: 73 6f 72 74 20 6c 61 62 65 6c 2d 31 31 32 0d 0a  sort label-112..
4810: 53 45 4c 45 43 54 20 2b 20 34 34 20 2a 20 2b 20  SELECT + 44 * + 
4820: 63 6f 6c 30 20 2a 20 43 41 53 54 28 20 4e 55 4c  col0 * CAST( NUL
4830: 4c 20 41 53 20 53 49 47 4e 45 44 20 29 20 46 52  L AS SIGNED ) FR
4840: 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
4850: 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c  .----..NULL..NUL
4860: 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69  L..NULL....skipi
4870: 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
4880: 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
4890: 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
48a0: 31 31 32 0d 0a 53 45 4c 45 43 54 20 2b 20 34 34  112..SELECT + 44
48b0: 20 2a 20 2b 20 63 6f 6c 30 20 2a 20 43 41 53 54   * + col0 * CAST
48c0: 20 28 20 4e 55 4c 4c 20 41 53 20 49 4e 54 45 47   ( NULL AS INTEG
48d0: 45 52 20 29 20 46 52 4f 4d 20 74 61 62 31 20 41  ER ) FROM tab1 A
48e0: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55  S cor0..----..NU
48f0: 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a  LL..NULL..NULL..
4900: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
4910: 74 0d 0a 53 45 4c 45 43 54 20 28 20 2b 20 63 6f  t..SELECT ( + co
4920: 72 30 2e 63 6f 6c 30 20 29 20 2b 20 2d 20 63 6f  r0.col0 ) + - co
4930: 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l0 FROM tab0 AS 
4940: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30  cor0..----..0..0
4950: 0d 0a 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  ..0....query I r
4960: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
4970: 20 2d 20 39 39 20 2a 20 2b 20 63 6f 6c 30 20 2a   - 99 * + col0 *
4980: 20 2b 20 28 20 37 31 20 29 20 46 52 4f 4d 20 74   + ( 71 ) FROM t
4990: 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
49a0: 2d 0d 0a 2d 31 36 38 36 39 36 0d 0a 2d 32 34 36  -..-168696..-246
49b0: 30 31 35 0d 0a 2d 36 32 35 35 38 31 0d 0a 0d 0a  015..-625581....
49c0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
49d0: 0a 53 45 4c 45 43 54 20 2d 20 2b 20 28 20 2d 20  .SELECT - + ( - 
49e0: 63 6f 6c 31 20 29 20 2b 20 28 20 63 6f 72 30 2e  col1 ) + ( cor0.
49f0: 63 6f 6c 30 20 29 20 46 52 4f 4d 20 74 61 62 32  col0 ) FROM tab2
4a00: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
4a10: 31 33 37 0d 0a 33 38 0d 0a 39 36 0d 0a 0d 0a 71  137..38..96....q
4a20: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
4a30: 53 45 4c 45 43 54 20 2b 20 2b 20 63 6f 6c 30 20  SELECT + + col0 
4a40: 2a 20 63 6f 6c 32 20 2b 20 2d 20 28 20 2d 20 36  * col2 + - ( - 6
4a50: 36 20 29 20 2b 20 2b 20 63 6f 6c 31 20 41 53 20  6 ) + + col1 AS 
4a60: 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41  col0 FROM tab0 A
4a70: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 39  S cor0..----..19
4a80: 38 0d 0a 37 34 35 35 0d 0a 39 34 34 0d 0a 0d 0a  8..7455..944....
4a90: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
4aa0: 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
4ab0: 20 38 38 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d   88 AS col1 FROM
4ac0: 20 74 61 62 30 2c 20 74 61 62 31 20 63 6f 72 30   tab0, tab1 cor0
4ad0: 0d 0a 2d 2d 2d 2d 0d 0a 38 38 0d 0a 0d 0a 73 6b  ..----..88....sk
4ae0: 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20  ipif postgresql 
4af0: 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71  # PostgreSQL req
4b00: 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65  uires AS when re
4b10: 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f  naming output co
4b20: 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72  lumns..query I r
4b30: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 28  owsort..SELECT (
4b40: 20 2b 20 63 6f 6c 30 20 2a 20 2d 20 74 61 62 31   + col0 * - tab1
4b50: 2e 63 6f 6c 32 20 2b 20 63 6f 6c 31 20 29 20 63  .col2 + col1 ) c
4b60: 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d  ol1 FROM tab1..-
4b70: 2d 2d 2d 0d 0a 2d 31 33 36 0d 0a 2d 33 36 33 38  ---..-136..-3638
4b80: 0d 0a 2d 37 36 36 37 0d 0a 0d 0a 71 75 65 72 79  ..-7667....query
4b90: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
4ba0: 43 54 20 2d 20 2b 20 33 38 20 2a 20 2d 20 63 6f  CT - + 38 * - co
4bb0: 6c 31 20 2b 20 2d 20 63 6f 6c 31 20 2a 20 63 6f  l1 + - col1 * co
4bc0: 6c 31 20 2a 20 2b 20 63 6f 6c 32 20 41 53 20 63  l1 * + col2 AS c
4bd0: 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol0 FROM tab1 AS
4be0: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 35   cor0..----..-15
4bf0: 37 33 30 0d 0a 2d 33 35 35 31 36 0d 0a 2d 35 33  730..-35516..-53
4c00: 32 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  20....query I ro
4c10: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
4c20: 53 54 49 4e 43 54 20 2d 20 2b 20 33 38 20 46 52  STINCT - + 38 FR
4c30: 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
4c40: 0a 2d 2d 2d 2d 0d 0a 2d 33 38 0d 0a 0d 0a 71 75  .----..-38....qu
4c50: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
4c60: 45 4c 45 43 54 20 2b 20 38 20 2a 20 2b 20 63 6f  ELECT + 8 * + co
4c70: 6c 31 20 2a 20 36 38 20 2b 20 33 39 20 2b 20 2b  l1 * 68 + 39 + +
4c80: 20 63 6f 6c 30 20 2a 20 63 6f 6c 32 20 2a 20 2d   col0 * col2 * -
4c90: 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20   col1 FROM tab0 
4ca0: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
4cb0: 32 31 32 38 39 0d 0a 2d 36 31 34 35 37 35 0d 0a  21289..-614575..
4cc0: 34 39 34 31 32 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  49412....onlyif 
4cd0: 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20  mysql # use DIV 
4ce0: 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74  operator for int
4cf0: 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71  eger division..q
4d00: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
4d10: 61 62 65 6c 2d 31 32 32 0d 0a 53 45 4c 45 43 54  abel-122..SELECT
4d20: 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 32 20 2a   DISTINCT col2 *
4d30: 20 63 6f 6c 32 20 44 49 56 20 2d 20 63 6f 6c 30   col2 DIV - col0
4d40: 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
4d50: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 35 0d 0a 2d  r0..----..-45..-
4d60: 37 35 0d 0a 30 0d 0a 0d 0a 73 6b 69 70 69 66 20  75..0....skipif 
4d70: 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
4d80: 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
4d90: 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 32  rowsort label-12
4da0: 32 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  2..SELECT DISTIN
4db0: 43 54 20 63 6f 6c 32 20 2a 20 63 6f 6c 32 20 2f  CT col2 * col2 /
4dc0: 20 2d 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62   - col0 FROM tab
4dd0: 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
4de0: 0a 2d 34 35 0d 0a 2d 37 35 0d 0a 30 0d 0a 0d 0a  .-45..-75..0....
4df0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
4e00: 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f  .SELECT ALL + co
4e10: 6c 31 20 2a 20 2b 20 63 6f 6c 32 20 46 52 4f 4d  l1 * + col2 FROM
4e20: 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab0 cor0..----
4e30: 0d 0a 32 38 33 38 0d 0a 37 34 36 32 0d 0a 39 37  ..2838..7462..97
4e40: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
4e50: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 35 33  ort..SELECT - 53
4e60: 20 2b 20 63 6f 6c 32 20 2b 20 63 6f 72 30 2e 63   + col2 + cor0.c
4e70: 6f 6c 30 20 2a 20 63 6f 6c 32 20 41 53 20 63 6f  ol0 * col2 AS co
4e80: 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l1 FROM tab1 AS 
4e90: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 36 33 0d  cor0..----..163.
4ea0: 0a 33 36 35 32 0d 0a 37 37 32 33 0d 0a 0d 0a 71  .3652..7723....q
4eb0: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
4ec0: 53 45 4c 45 43 54 20 41 4c 4c 20 74 61 62 32 2e  SELECT ALL tab2.
4ed0: 63 6f 6c 30 20 2d 20 28 20 2d 20 63 6f 6c 31 20  col0 - ( - col1 
4ee0: 29 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d  ) FROM tab2..---
4ef0: 2d 0d 0a 31 33 37 0d 0a 33 38 0d 0a 39 36 0d 0a  -..137..38..96..
4f00: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
4f10: 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 74 61  t..SELECT ALL ta
4f20: 62 30 2e 63 6f 6c 32 20 2a 20 63 6f 6c 31 20 2b  b0.col2 * col1 +
4f30: 20 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c 31 20 46   col2 * + col1 F
4f40: 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab0..----..
4f50: 31 34 39 32 34 0d 0a 31 39 34 0d 0a 35 36 37 36  14924..194..5676
4f60: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
4f70: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 74 61  ort..SELECT - ta
4f80: 62 32 2e 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  b2.col2 FROM tab
4f90: 32 2c 20 74 61 62 32 20 63 6f 72 30 2c 20 74 61  2, tab2 cor0, ta
4fa0: 62 32 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d  b2 AS cor1..----
4fb0: 0d 0a 32 37 20 76 61 6c 75 65 73 20 68 61 73 68  ..27 values hash
4fc0: 69 6e 67 20 74 6f 20 66 39 64 34 62 62 38 36 37  ing to f9d4bb867
4fd0: 37 64 62 37 62 39 38 63 37 65 64 38 39 64 30 36  7db7b98c7ed89d06
4fe0: 65 36 65 38 63 64 36 0d 0a 0d 0a 73 6b 69 70 69  e6e8cd6....skipi
4ff0: 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50  f postgresql # P
5000: 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72  ostgreSQL requir
5010: 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d  es AS when renam
5020: 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d  ing output colum
5030: 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ns..query I rows
5040: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
5050: 63 6f 6c 31 20 2a 20 2b 20 28 20 2d 20 63 6f 72  col1 * + ( - cor
5060: 30 2e 63 6f 6c 32 20 2a 20 63 6f 6c 32 20 29 20  0.col2 * col2 ) 
5070: 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41  col2 FROM tab0 A
5080: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 36  S cor0..----..-6
5090: 31 31 38 38 34 0d 0a 2d 39 33 36 35 34 0d 0a 2d  11884..-93654..-
50a0: 39 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  97....query I ro
50b0: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
50c0: 53 54 49 4e 43 54 20 2d 20 2b 20 63 6f 6c 32 20  STINCT - + col2 
50d0: 2b 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 41 53  + + cor0.col0 AS
50e0: 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20   col1 FROM tab2 
50f0: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
5100: 32 30 0d 0a 34 31 0d 0a 35 32 0d 0a 0d 0a 6f 6e  20..41..52....on
5110: 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
5120: 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
5130: 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
5140: 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
5150: 6f 72 74 20 6c 61 62 65 6c 2d 31 33 30 0d 0a 53  ort label-130..S
5160: 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d  ELECT DISTINCT -
5170: 20 38 38 20 44 49 56 20 2d 20 63 6f 72 31 2e 63   88 DIV - cor1.c
5180: 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 2c 20 74  ol1 FROM tab0, t
5190: 61 62 30 20 41 53 20 63 6f 72 30 2c 20 74 61 62  ab0 AS cor0, tab
51a0: 30 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d  0 AS cor1..----.
51b0: 0a 30 0d 0a 31 0d 0a 0d 0a 73 6b 69 70 69 66 20  .0..1....skipif 
51c0: 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
51d0: 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
51e0: 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 33  rowsort label-13
51f0: 30 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  0..SELECT DISTIN
5200: 43 54 20 2d 20 38 38 20 2f 20 2d 20 63 6f 72 31  CT - 88 / - cor1
5210: 2e 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 2c  .col1 FROM tab0,
5220: 20 74 61 62 30 20 41 53 20 63 6f 72 30 2c 20 74   tab0 AS cor0, t
5230: 61 62 30 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d  ab0 AS cor1..---
5240: 2d 0d 0a 30 0d 0a 31 0d 0a 0d 0a 6f 6e 6c 79 69  -..0..1....onlyi
5250: 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72  f mysql # suppor
5260: 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63  t for MySQL spec
5270: 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65  ific system type
5280: 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75  s and syntax..qu
5290: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
52a0: 62 65 6c 2d 31 33 31 0d 0a 53 45 4c 45 43 54 20  bel-131..SELECT 
52b0: 43 41 53 54 28 20 2d 20 63 6f 6c 31 20 41 53 20  CAST( - col1 AS 
52c0: 53 49 47 4e 45 44 20 29 20 2b 20 63 6f 6c 30 20  SIGNED ) + col0 
52d0: 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
52e0: 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 33 0d 0a 35 34  0..----..-23..54
52f0: 0d 0a 36 37 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  ..67....skipif m
5300: 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
5310: 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
5320: 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 33 31  owsort label-131
5330: 0d 0a 53 45 4c 45 43 54 20 43 41 53 54 20 28 20  ..SELECT CAST ( 
5340: 2d 20 63 6f 6c 31 20 41 53 20 49 4e 54 45 47 45  - col1 AS INTEGE
5350: 52 20 29 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20  R ) + col0 FROM 
5360: 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
5370: 2d 2d 0d 0a 2d 32 33 0d 0a 35 34 0d 0a 36 37 0d  --..-23..54..67.
5380: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
5390: 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
53a0: 4e 43 54 20 2b 20 63 6f 6c 32 20 2a 20 2b 20 63  NCT + col2 * + c
53b0: 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  ol2 AS col0 FROM
53c0: 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab0 cor0..----
53d0: 0d 0a 31 0d 0a 31 30 38 39 0d 0a 36 37 32 34 0d  ..1..1089..6724.
53e0: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
53f0: 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
5400: 4e 43 54 20 2b 20 2d 20 38 20 46 52 4f 4d 20 74  NCT + - 8 FROM t
5410: 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
5420: 2d 0d 0a 2d 38 0d 0a 0d 0a 71 75 65 72 79 20 49  -..-8....query I
5430: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
5440: 20 2b 20 32 30 20 2b 20 63 6f 6c 31 20 2a 20 63   + 20 + col1 * c
5450: 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol0 FROM tab0 AS
5460: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 30 38   cor0..----..208
5470: 34 0d 0a 33 34 31 35 0d 0a 38 31 31 39 0d 0a 0d  4..3415..8119...
5480: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
5490: 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63  ..SELECT ALL + c
54a0: 6f 6c 32 20 2a 20 28 20 63 6f 6c 30 20 2b 20 2b  ol2 * ( col0 + +
54b0: 20 63 6f 6c 31 20 29 20 41 53 20 63 6f 6c 31 20   col1 ) AS col1 
54c0: 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a  FROM tab1 cor0..
54d0: 2d 2d 2d 2d 0d 0a 31 35 36 36 0d 0a 34 32 31 38  ----..1566..4218
54e0: 0d 0a 38 39 32 38 0d 0a 0d 0a 71 75 65 72 79 20  ..8928....query 
54f0: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
5500: 54 20 2d 20 2b 20 34 38 20 2a 20 63 6f 72 30 2e  T - + 48 * cor0.
5510: 63 6f 6c 30 20 2a 20 63 6f 6c 30 20 2b 20 63 6f  col0 * col0 + co
5520: 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l2 FROM tab0 AS 
5530: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 37 36  cor0..----..-276
5540: 31 35 0d 0a 2d 33 38 30 31 32 36 0d 0a 2d 35 38  15..-380126..-58
5550: 37 39 39 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  799....onlyif my
5560: 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70  sql # use DIV op
5570: 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67  erator for integ
5580: 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65  er division..que
5590: 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
55a0: 65 6c 2d 31 33 37 0d 0a 53 45 4c 45 43 54 20 2d  el-137..SELECT -
55b0: 20 2b 20 63 6f 6c 30 20 2a 20 33 20 44 49 56 20   + col0 * 3 DIV 
55c0: 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46 52 4f  col0 AS col0 FRO
55d0: 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
55e0: 2d 2d 2d 2d 0d 0a 2d 33 0d 0a 2d 33 0d 0a 2d 33  ----..-3..-3..-3
55f0: 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
5600: 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
5610: 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
5620: 72 74 20 6c 61 62 65 6c 2d 31 33 37 0d 0a 53 45  rt label-137..SE
5630: 4c 45 43 54 20 2d 20 2b 20 63 6f 6c 30 20 2a 20  LECT - + col0 * 
5640: 33 20 2f 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30  3 / col0 AS col0
5650: 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
5660: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 0d 0a 2d 33  r0..----..-3..-3
5670: 0d 0a 2d 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..-3....query I 
5680: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
5690: 44 49 53 54 49 4e 43 54 20 2d 20 2d 20 63 6f 72  DISTINCT - - cor
56a0: 30 2e 63 6f 6c 32 20 2b 20 33 39 20 41 53 20 63  0.col2 + 39 AS c
56b0: 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 63 6f  ol1 FROM tab0 co
56c0: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 31 0d 0a 34  r0..----..121..4
56d0: 30 0d 0a 37 32 0d 0a 0d 0a 71 75 65 72 79 20 49  0..72....query I
56e0: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
56f0: 20 44 49 53 54 49 4e 43 54 20 2b 20 2d 20 28 20   DISTINCT + - ( 
5700: 63 6f 6c 30 20 29 20 41 53 20 63 6f 6c 32 20 46  col0 ) AS col2 F
5710: 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
5720: 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 34 0d 0a 2d 33 35  ..----..-24..-35
5730: 0d 0a 2d 38 39 0d 0a 0d 0a 71 75 65 72 79 20 49  ..-89....query I
5740: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
5750: 20 41 4c 4c 20 2b 20 31 37 20 41 53 20 63 6f 6c   ALL + 17 AS col
5760: 30 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30  0 FROM tab0 cor0
5770: 0d 0a 2d 2d 2d 2d 0d 0a 31 37 0d 0a 31 37 0d 0a  ..----..17..17..
5780: 31 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  17....query I ro
5790: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
57a0: 4c 20 2d 20 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c  L - col0 + - col
57b0: 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  0 AS col1 FROM t
57c0: 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
57d0: 2d 0d 0a 2d 31 32 38 0d 0a 2d 31 36 30 0d 0a 2d  -..-128..-160..-
57e0: 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  6....query I row
57f0: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 74 61 62  sort..SELECT tab
5800: 30 2e 63 6f 6c 30 20 2a 20 2d 20 33 39 20 2d 20  0.col0 * - 39 - 
5810: 39 33 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  93 AS col2 FROM 
5820: 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 32  tab0..----..-102
5830: 39 0d 0a 2d 31 34 35 38 0d 0a 2d 33 35 36 34 0d  9..-1458..-3564.
5840: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
5850: 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 74 61 62  rt..SELECT - tab
5860: 30 2e 63 6f 6c 32 20 2d 20 2b 20 31 35 20 2a 20  0.col2 - + 15 * 
5870: 34 37 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  47 AS col0 FROM 
5880: 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 37 30 36  tab0..----..-706
5890: 0d 0a 2d 37 33 38 0d 0a 2d 37 38 37 0d 0a 0d 0a  ..-738..-787....
58a0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
58b0: 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f  .SELECT ALL - co
58c0: 6c 31 20 2a 20 32 32 20 46 52 4f 4d 20 74 61 62  l1 * 22 FROM tab
58d0: 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  0 cor0..----..-1
58e0: 38 39 32 0d 0a 2d 32 30 30 32 0d 0a 2d 32 31 33  892..-2002..-213
58f0: 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  4....query I row
5900: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
5910: 54 49 4e 43 54 20 2b 20 2d 20 63 6f 6c 31 20 2b  TINCT + - col1 +
5920: 20 2d 20 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c 32   - col0 * - col2
5930: 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
5940: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 36 32 0d 0a 37  r0..----..-62..7
5950: 30 36 0d 0a 37 32 30 37 0d 0a 0d 0a 71 75 65 72  06..7207....quer
5960: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
5970: 45 43 54 20 41 4c 4c 20 2b 20 28 20 63 6f 6c 31  ECT ALL + ( col1
5980: 20 29 20 2a 20 2b 20 63 6f 6c 30 20 46 52 4f 4d   ) * + col0 FROM
5990: 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
59a0: 2d 2d 2d 0d 0a 31 30 34 30 0d 0a 36 34 30 0d 0a  ---..1040..640..
59b0: 37 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  78....query I ro
59c0: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
59d0: 53 54 49 4e 43 54 20 2b 20 2b 20 38 39 20 46 52  STINCT + + 89 FR
59e0: 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
59f0: 0a 2d 2d 2d 2d 0d 0a 38 39 0d 0a 0d 0a 6f 6e 6c  .----..89....onl
5a00: 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20  yif mysql # use 
5a10: 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72  DIV operator for
5a20: 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f   integer divisio
5a30: 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  n..query I rowso
5a40: 72 74 20 6c 61 62 65 6c 2d 31 34 38 0d 0a 53 45  rt label-148..SE
5a50: 4c 45 43 54 20 63 6f 6c 32 20 44 49 56 20 2b 20  LECT col2 DIV + 
5a60: 35 33 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  53 AS col2 FROM 
5a70: 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab2 cor0..----.
5a80: 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a 73 6b 69 70  .0..0..0....skip
5a90: 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
5aa0: 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
5ab0: 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
5ac0: 2d 31 34 38 0d 0a 53 45 4c 45 43 54 20 63 6f 6c  -148..SELECT col
5ad0: 32 20 2f 20 2b 20 35 33 20 41 53 20 63 6f 6c 32  2 / + 53 AS col2
5ae0: 20 46 52 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d   FROM tab2 cor0.
5af0: 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a  .----..0..0..0..
5b00: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
5b10: 74 0d 0a 53 45 4c 45 43 54 20 28 20 2b 20 34 31  t..SELECT ( + 41
5b20: 20 29 20 2a 20 2b 20 63 6f 6c 31 20 2b 20 37 32   ) * + col1 + 72
5b30: 20 2a 20 2d 20 63 6f 6c 30 20 2a 20 2d 20 63 6f   * - col0 * - co
5b40: 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l0 FROM tab1 AS 
5b50: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 37 31 34  cor0..----..1714
5b60: 0d 0a 32 39 35 33 32 32 0d 0a 34 36 31 33 33 33  ..295322..461333
5b70: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
5b80: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
5b90: 38 38 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  88 AS col2 FROM 
5ba0: 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab0 cor0..----.
5bb0: 0a 38 38 0d 0a 38 38 0d 0a 38 38 0d 0a 0d 0a 71  .88..88..88....q
5bc0: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
5bd0: 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
5be0: 2d 20 39 36 20 2b 20 2b 20 63 6f 6c 30 20 2b 20  - 96 + + col0 + 
5bf0: 2d 20 28 20 2b 20 63 6f 6c 32 20 29 20 46 52 4f  - ( + col2 ) FRO
5c00: 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
5c10: 2d 2d 2d 2d 0d 0a 2d 31 30 35 0d 0a 2d 36 32 0d  ----..-105..-62.
5c20: 0a 2d 38 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .-89....query I 
5c30: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
5c40: 2b 20 32 33 20 2b 20 63 6f 6c 31 20 41 53 20 63  + 23 + col1 AS c
5c50: 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d  ol0 FROM tab2..-
5c60: 2d 2d 2d 0d 0a 34 30 0d 0a 35 34 0d 0a 38 32 0d  ---..40..54..82.
5c70: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
5c80: 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
5c90: 4e 43 54 20 63 6f 72 30 2e 63 6f 6c 31 20 2b 20  NCT cor0.col1 + 
5ca0: 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 63  col1 FROM tab0 c
5cb0: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 37 32 0d 0a  or0..----..172..
5cc0: 31 38 32 0d 0a 31 39 34 0d 0a 0d 0a 71 75 65 72  182..194....quer
5cd0: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
5ce0: 45 43 54 20 41 4c 4c 20 63 6f 6c 31 20 2a 20 63  ECT ALL col1 * c
5cf0: 6f 72 30 2e 63 6f 6c 31 20 2b 20 31 20 46 52 4f  or0.col1 + 1 FRO
5d00: 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
5d10: 2d 2d 2d 2d 0d 0a 37 33 39 37 0d 0a 38 32 38 32  ----..7397..8282
5d20: 0d 0a 39 34 31 30 0d 0a 0d 0a 71 75 65 72 79 20  ..9410....query 
5d30: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
5d40: 54 20 41 4c 4c 20 2b 20 2b 20 32 38 20 2a 20 2b  T ALL + + 28 * +
5d50: 20 63 6f 6c 31 20 2b 20 28 20 2b 20 63 6f 6c 32   col1 + ( + col2
5d60: 20 29 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20   ) FROM tab2 AS 
5d70: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 36 37 38  cor0..----..1678
5d80: 0d 0a 35 31 34 0d 0a 38 39 35 0d 0a 0d 0a 71 75  ..514..895....qu
5d90: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
5da0: 45 4c 45 43 54 20 41 4c 4c 20 2b 20 38 39 20 2d  ELECT ALL + 89 -
5db0: 20 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46 52   col1 AS col1 FR
5dc0: 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
5dd0: 0a 2d 2d 2d 2d 0d 0a 33 30 0d 0a 35 38 0d 0a 37  .----..30..58..7
5de0: 32 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  2....onlyif mysq
5df0: 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72  l # use DIV oper
5e00: 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72  ator for integer
5e10: 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79   division..query
5e20: 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
5e30: 2d 31 35 37 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  -157..SELECT ALL
5e40: 20 2d 20 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c 32   - col0 * - col2
5e50: 20 2b 20 2d 20 39 36 20 2a 20 2b 20 63 6f 6c 30   + - 96 * + col0
5e60: 20 2b 20 2d 20 63 6f 6c 32 20 44 49 56 20 2d 20   + - col2 DIV - 
5e70: 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46 52 4f  col0 AS col0 FRO
5e80: 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
5e90: 2d 2d 2d 2d 0d 0a 2d 31 32 34 36 0d 0a 2d 31 35  ----..-1246..-15
5ea0: 31 31 0d 0a 2d 33 33 32 35 0d 0a 0d 0a 73 6b 69  11..-3325....ski
5eb0: 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
5ec0: 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
5ed0: 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
5ee0: 6c 2d 31 35 37 0d 0a 53 45 4c 45 43 54 20 41 4c  l-157..SELECT AL
5ef0: 4c 20 2d 20 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c  L - col0 * - col
5f00: 32 20 2b 20 2d 20 39 36 20 2a 20 2b 20 63 6f 6c  2 + - 96 * + col
5f10: 30 20 2b 20 2d 20 63 6f 6c 32 20 2f 20 2d 20 63  0 + - col2 / - c
5f20: 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  ol0 AS col0 FROM
5f30: 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
5f40: 2d 2d 2d 0d 0a 2d 31 32 34 36 0d 0a 2d 31 35 31  ---..-1246..-151
5f50: 31 0d 0a 2d 33 33 32 35 0d 0a 0d 0a 71 75 65 72  1..-3325....quer
5f60: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
5f70: 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63  ECT DISTINCT - c
5f80: 6f 6c 31 20 2a 20 2d 20 63 6f 6c 32 20 2b 20 2d  ol1 * - col2 + -
5f90: 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20   col1 FROM tab2 
5fa0: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
5fb0: 34 37 35 0d 0a 36 32 39 0d 0a 38 30 36 0d 0a 0d  475..629..806...
5fc0: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
5fd0: 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 2b  ..SELECT ALL + +
5fe0: 20 63 6f 72 30 2e 63 6f 6c 32 20 2a 20 2b 20 63   cor0.col2 * + c
5ff0: 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol0 FROM tab2 AS
6000: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 38 39   cor0..----..189
6010: 0d 0a 32 30 32 38 0d 0a 33 30 30 32 0d 0a 0d 0a  ..2028..3002....
6020: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
6030: 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 2b 20  .SELECT ALL - + 
6040: 28 20 2b 20 63 6f 6c 30 20 29 20 2a 20 2b 20 63  ( + col0 ) * + c
6050: 6f 6c 32 20 2b 20 63 6f 6c 30 20 2a 20 2b 20 63  ol2 + col0 * + c
6060: 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  ol2 AS col0 FROM
6070: 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
6080: 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a  ---..0..0..0....
6090: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
60a0: 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 30 20 2b  .SELECT + col0 +
60b0: 20 2d 20 63 6f 72 30 2e 63 6f 6c 31 20 46 52 4f   - cor0.col1 FRO
60c0: 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab2 cor0..---
60d0: 2d 0d 0a 2d 32 34 0d 0a 31 39 0d 0a 36 32 0d 0a  -..-24..19..62..
60e0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
60f0: 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
6100: 43 54 20 2d 20 28 20 63 6f 6c 32 20 29 20 2b 20  CT - ( col2 ) + 
6110: 2d 20 63 6f 6c 32 20 2b 20 2d 20 63 6f 6c 30 20  - col2 + - col0 
6120: 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
6130: 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
6140: 0a 2d 31 33 30 0d 0a 2d 31 35 35 0d 0a 2d 36 31  .-130..-155..-61
6150: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
6160: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
6170: 2d 20 2d 20 34 38 20 2d 20 2d 20 63 6f 6c 30 20  - - 48 - - col0 
6180: 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
6190: 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 36 0d 0a 31 32  0..----..126..12
61a0: 37 0d 0a 35 35 0d 0a 0d 0a 71 75 65 72 79 20 49  7..55....query I
61b0: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
61c0: 20 41 4c 4c 20 2d 20 63 6f 72 30 2e 63 6f 6c 32   ALL - cor0.col2
61d0: 20 2a 20 2d 20 63 6f 6c 32 20 41 53 20 63 6f 6c   * - col2 AS col
61e0: 32 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30  2 FROM tab0 cor0
61f0: 0d 0a 2d 2d 2d 2d 0d 0a 31 0d 0a 31 30 38 39 0d  ..----..1..1089.
6200: 0a 36 37 32 34 0d 0a 0d 0a 73 6b 69 70 69 66 20  .6724....skipif 
6210: 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
6220: 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
6230: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
6240: 44 49 53 54 49 4e 43 54 20 63 6f 72 30 2e 63 6f  DISTINCT cor0.co
6250: 6c 30 20 2b 20 2d 20 43 41 53 54 20 28 20 63 6f  l0 + - CAST ( co
6260: 6c 31 20 41 53 20 52 45 41 4c 20 29 20 2f 20 2d  l1 AS REAL ) / -
6270: 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20   col1 FROM tab2 
6280: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 37  AS cor0..----..7
6290: 39 0d 0a 38 0d 0a 38 30 0d 0a 0d 0a 73 6b 69 70  9..8..80....skip
62a0: 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20  if postgresql # 
62b0: 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69  PostgreSQL requi
62c0: 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61  res AS when rena
62d0: 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75  ming output colu
62e0: 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  mns..query I row
62f0: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63  sort..SELECT - c
6300: 6f 6c 32 20 2a 20 2b 20 63 6f 72 30 2e 63 6f 6c  ol2 * + cor0.col
6310: 32 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32  2 col2 FROM tab2
6320: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 34   cor0..----..-14
6330: 34 34 0d 0a 2d 36 37 36 0d 0a 2d 37 32 39 0d 0a  44..-676..-729..
6340: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
6350: 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
6360: 43 54 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 2a  CT + cor0.col0 *
6370: 20 28 20 63 6f 6c 32 20 29 20 46 52 4f 4d 20 74   ( col2 ) FROM t
6380: 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
6390: 2d 0d 0a 31 38 39 0d 0a 32 30 32 38 0d 0a 33 30  -..189..2028..30
63a0: 30 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  02....query I ro
63b0: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
63c0: 63 6f 72 30 2e 63 6f 6c 30 20 2a 20 32 30 20 46  cor0.col0 * 20 F
63d0: 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
63e0: 20 43 52 4f 53 53 20 4a 4f 49 4e 20 74 61 62 32   CROSS JOIN tab2
63f0: 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a   AS cor1..----..
6400: 39 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67  9 values hashing
6410: 20 74 6f 20 63 63 66 62 39 34 37 32 64 34 39 65   to ccfb9472d49e
6420: 39 37 64 34 37 39 37 38 35 32 30 66 62 64 66 35  97d47978520fbdf5
6430: 63 62 66 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20  cbf1....query I 
6440: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
6450: 41 4c 4c 20 2b 20 63 6f 6c 32 20 2b 20 2d 20 63  ALL + col2 + - c
6460: 6f 6c 30 20 2d 20 2b 20 39 38 20 41 53 20 63 6f  ol0 - + 98 AS co
6470: 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l2 FROM tab2 AS 
6480: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 39  cor0..----..-139
6490: 0d 0a 2d 31 35 30 0d 0a 2d 37 38 0d 0a 0d 0a 71  ..-150..-78....q
64a0: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
64b0: 53 45 4c 45 43 54 20 2b 20 2d 20 63 6f 6c 30 20  SELECT + - col0 
64c0: 2b 20 63 6f 6c 31 20 2a 20 63 6f 72 30 2e 63 6f  + col1 * cor0.co
64d0: 6c 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  l0 AS col1 FROM 
64e0: 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
64f0: 2d 2d 0d 0a 35 37 36 0d 0a 37 35 0d 0a 39 36 30  --..576..75..960
6500: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
6510: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 30  ort..SELECT col0
6520: 20 2b 20 39 37 20 41 53 20 63 6f 6c 32 20 46 52   + 97 AS col2 FR
6530: 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
6540: 0a 2d 2d 2d 2d 0d 0a 31 32 31 0d 0a 31 33 32 0d  .----..121..132.
6550: 0a 31 38 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .186....query I 
6560: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
6570: 41 4c 4c 20 2d 20 63 6f 6c 32 20 2b 20 28 20 63  ALL - col2 + ( c
6580: 6f 6c 31 20 29 20 41 53 20 63 6f 6c 31 20 46 52  ol1 ) AS col1 FR
6590: 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d  OM tab2 cor0..--
65a0: 2d 2d 0d 0a 2d 32 31 0d 0a 33 33 0d 0a 34 0d 0a  --..-21..33..4..
65b0: 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
65c0: 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53   support for MyS
65d0: 51 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74  QL specific syst
65e0: 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e  em types and syn
65f0: 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  tax..query I row
6600: 73 6f 72 74 20 6c 61 62 65 6c 2d 31 37 33 0d 0a  sort label-173..
6610: 53 45 4c 45 43 54 20 2d 20 63 6f 6c 30 20 2b 20  SELECT - col0 + 
6620: 2b 20 43 41 53 54 28 20 4e 55 4c 4c 20 41 53 20  + CAST( NULL AS 
6630: 53 49 47 4e 45 44 20 29 20 2a 20 2b 20 63 6f 6c  SIGNED ) * + col
6640: 31 20 2a 20 2d 20 63 6f 6c 30 20 41 53 20 63 6f  1 * - col0 AS co
6650: 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72  l2 FROM tab0 cor
6660: 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e  0..----..NULL..N
6670: 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69  ULL..NULL....ski
6680: 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
6690: 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
66a0: 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
66b0: 6c 2d 31 37 33 0d 0a 53 45 4c 45 43 54 20 2d 20  l-173..SELECT - 
66c0: 63 6f 6c 30 20 2b 20 2b 20 43 41 53 54 20 28 20  col0 + + CAST ( 
66d0: 4e 55 4c 4c 20 41 53 20 49 4e 54 45 47 45 52 20  NULL AS INTEGER 
66e0: 29 20 2a 20 2b 20 63 6f 6c 31 20 2a 20 2d 20 63  ) * + col1 * - c
66f0: 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  ol0 AS col2 FROM
6700: 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab0 cor0..----
6710: 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55  ..NULL..NULL..NU
6720: 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73  LL....skipif pos
6730: 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72  tgresql # Postgr
6740: 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53  eSQL requires AS
6750: 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f   when renaming o
6760: 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71  utput columns..q
6770: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
6780: 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
6790: 2d 20 63 6f 6c 32 20 2a 20 63 6f 6c 31 20 2b 20  - col2 * col1 + 
67a0: 2b 20 63 6f 6c 30 20 63 6f 6c 31 20 46 52 4f 4d  + col0 col1 FROM
67b0: 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
67c0: 2d 2d 2d 0d 0a 2d 31 31 36 38 0d 0a 2d 31 34 30  ---..-1168..-140
67d0: 31 0d 0a 2d 35 30 36 0d 0a 0d 0a 71 75 65 72 79  1..-506....query
67e0: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
67f0: 43 54 20 28 20 63 6f 6c 32 20 29 20 2a 20 28 20  CT ( col2 ) * ( 
6800: 2b 20 63 6f 6c 32 20 29 20 2d 20 63 6f 6c 30 20  + col2 ) - col0 
6810: 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
6820: 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 34 0d 0a 31 30  0..----..-34..10
6830: 36 35 0d 0a 36 36 33 35 0d 0a 0d 0a 6f 6e 6c 79  65..6635....only
6840: 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44  if mysql # use D
6850: 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20  IV operator for 
6860: 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e  integer division
6870: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
6880: 74 20 6c 61 62 65 6c 2d 31 37 36 0d 0a 53 45 4c  t label-176..SEL
6890: 45 43 54 20 2b 20 63 6f 6c 30 20 2b 20 63 6f 6c  ECT + col0 + col
68a0: 32 20 44 49 56 20 2b 20 74 61 62 31 2e 63 6f 6c  2 DIV + tab1.col
68b0: 30 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31  0 col1 FROM tab1
68c0: 0d 0a 2d 2d 2d 2d 0d 0a 32 31 0d 0a 36 34 0d 0a  ..----..21..64..
68d0: 38 31 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73  81....skipif pos
68e0: 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72  tgresql # Postgr
68f0: 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53  eSQL requires AS
6900: 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f   when renaming o
6910: 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 73  utput columns..s
6920: 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
6930: 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
6940: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
6950: 62 65 6c 2d 31 37 36 0d 0a 53 45 4c 45 43 54 20  bel-176..SELECT 
6960: 2b 20 63 6f 6c 30 20 2b 20 63 6f 6c 32 20 2f 20  + col0 + col2 / 
6970: 2b 20 74 61 62 31 2e 63 6f 6c 30 20 63 6f 6c 31  + tab1.col0 col1
6980: 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d   FROM tab1..----
6990: 0d 0a 32 31 0d 0a 36 34 0d 0a 38 31 0d 0a 0d 0a  ..21..64..81....
69a0: 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71  skipif postgresq
69b0: 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72  l # PostgreSQL r
69c0: 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20  equires AS when 
69d0: 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20  renaming output 
69e0: 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49  columns..query I
69f0: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
6a00: 20 2b 20 38 35 20 63 6f 6c 31 20 46 52 4f 4d 20   + 85 col1 FROM 
6a10: 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 38 35 0d 0a  tab1..----..85..
6a20: 38 35 0d 0a 38 35 0d 0a 0d 0a 71 75 65 72 79 20  85..85....query 
6a30: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
6a40: 54 20 2b 20 2d 20 63 6f 6c 32 20 2b 20 2b 20 63  T + - col2 + + c
6a50: 6f 72 30 2e 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c  or0.col2 * + col
6a60: 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  0 AS col1 FROM t
6a70: 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
6a80: 2d 0d 0a 33 34 0d 0a 37 32 31 36 0d 0a 37 35 39  -..34..7216..759
6a90: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
6aa0: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 31  ort..SELECT col1
6ab0: 20 2a 20 2d 20 63 6f 6c 30 20 2a 20 2d 20 63 6f   * - col0 * - co
6ac0: 72 30 2e 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20  r0.col2 AS col1 
6ad0: 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
6ae0: 30 0d 0a 2d 2d 2d 2d 0d 0a 33 36 34 38 30 0d 0a  0..----..36480..
6af0: 34 32 31 32 0d 0a 39 39 38 34 30 0d 0a 0d 0a 71  4212..99840....q
6b00: 75 65 72 79 20 49 49 49 49 49 49 49 49 49 49 49  uery IIIIIIIIIII
6b10: 49 49 49 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  IIII rowsort..SE
6b20: 4c 45 43 54 20 41 4c 4c 20 2a 20 46 52 4f 4d 20  LECT ALL * FROM 
6b30: 74 61 62 32 20 41 53 20 63 6f 72 30 20 43 52 4f  tab2 AS cor0 CRO
6b40: 53 53 20 4a 4f 49 4e 20 74 61 62 32 2c 20 74 61  SS JOIN tab2, ta
6b50: 62 31 20 41 53 20 63 6f 72 31 2c 20 74 61 62 30  b1 AS cor1, tab0
6b60: 2c 20 74 61 62 30 20 41 53 20 63 6f 72 32 0d 0a  , tab0 AS cor2..
6b70: 2d 2d 2d 2d 0d 0a 33 36 34 35 20 76 61 6c 75 65  ----..3645 value
6b80: 73 20 68 61 73 68 69 6e 67 20 74 6f 20 37 38 30  s hashing to 780
6b90: 37 37 37 32 37 36 30 31 63 30 35 36 61 64 30 64  77727601c056ad0d
6ba0: 34 66 34 63 31 31 63 38 64 61 66 66 62 0d 0a 0d  4f4c11c8daffb...
6bb0: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
6bc0: 0d 0a 53 45 4c 45 43 54 20 39 30 20 2d 20 32 31  ..SELECT 90 - 21
6bd0: 20 46 52 4f 4d 20 74 61 62 31 2c 20 74 61 62 32   FROM tab1, tab2
6be0: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
6bf0: 39 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67  9 values hashing
6c00: 20 74 6f 20 38 35 64 39 62 39 30 61 30 33 62 39   to 85d9b90a03b9
6c10: 64 65 66 31 36 31 38 39 31 62 31 33 30 38 35 32  def161891b130852
6c20: 37 31 66 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20  71f7....query I 
6c30: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
6c40: 63 6f 6c 30 20 2a 20 74 61 62 32 2e 63 6f 6c 31  col0 * tab2.col1
6c50: 20 2b 20 2d 20 37 32 20 41 53 20 63 6f 6c 32 20   + - 72 AS col2 
6c60: 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d  FROM tab2..----.
6c70: 0a 31 32 37 31 0d 0a 31 34 35 0d 0a 34 35 33 30  .1271..145..4530
6c80: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
6c90: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 33 35 20 46  ort..SELECT 35 F
6ca0: 52 4f 4d 20 74 61 62 32 2c 20 74 61 62 32 20 41  ROM tab2, tab2 A
6cb0: 53 20 63 6f 72 30 2c 20 74 61 62 31 20 41 53 20  S cor0, tab1 AS 
6cc0: 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76  cor1..----..27 v
6cd0: 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f  alues hashing to
6ce0: 20 30 64 31 33 64 66 64 34 63 34 61 39 64 35 31   0d13dfd4c4a9d51
6cf0: 61 63 65 33 35 38 32 63 33 31 63 61 64 63 64 62  ace3582c31cadcdb
6d00: 63 0d 0a 0d 0a 71 75 65 72 79 20 49 49 49 49 49  c....query IIIII
6d10: 49 49 49 49 49 49 49 49 49 49 49 49 49 20 72 6f  IIIIIIIIIIIII ro
6d20: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2a 20  wsort..SELECT * 
6d30: 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
6d40: 30 20 43 52 4f 53 53 20 4a 4f 49 4e 20 74 61 62  0 CROSS JOIN tab
6d50: 31 2c 20 74 61 62 32 20 41 53 20 63 6f 72 31 2c  1, tab2 AS cor1,
6d60: 20 74 61 62 32 2c 20 74 61 62 32 20 41 53 20 63   tab2, tab2 AS c
6d70: 6f 72 32 2c 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d  or2, tab0..----.
6d80: 0a 31 33 31 32 32 20 76 61 6c 75 65 73 20 68 61  .13122 values ha
6d90: 73 68 69 6e 67 20 74 6f 20 30 33 61 33 39 63 33  shing to 03a39c3
6da0: 35 65 35 39 64 35 31 61 34 65 37 38 33 66 37 30  5e59d51a4e783f70
6db0: 64 66 31 33 63 32 64 32 38 0d 0a 0d 0a 71 75 65  df13c2d28....que
6dc0: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
6dd0: 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f  LECT DISTINCT co
6de0: 6c 32 20 2b 20 2b 20 38 38 20 41 53 20 63 6f 6c  l2 + + 88 AS col
6df0: 30 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d  0 FROM tab2..---
6e00: 2d 0d 0a 31 31 34 0d 0a 31 31 35 0d 0a 31 32 36  -..114..115..126
6e10: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
6e20: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2b 20  ort..SELECT - + 
6e30: 32 33 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  23 AS col0 FROM 
6e40: 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
6e50: 2d 2d 0d 0a 2d 32 33 0d 0a 2d 32 33 0d 0a 2d 32  --..-23..-23..-2
6e60: 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  3....query I row
6e70: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
6e80: 20 39 33 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d   93 AS col2 FROM
6e90: 20 74 61 62 30 2c 20 74 61 62 31 20 41 53 20 63   tab0, tab1 AS c
6ea0: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c  or0..----..9 val
6eb0: 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 65  ues hashing to e
6ec0: 36 34 31 30 35 64 66 61 61 39 66 62 64 32 30 31  64105dfaa9fbd201
6ed0: 61 64 62 62 31 66 33 66 36 39 36 38 62 64 65 0d  adbb1f3f6968bde.
6ee0: 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
6ef0: 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74  # use DIV operat
6f00: 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64  or for integer d
6f10: 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49  ivision..query I
6f20: 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
6f30: 38 38 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d  88..SELECT ALL -
6f40: 20 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c 30 20 2b   col0 + - col0 +
6f50: 20 2d 20 63 6f 6c 32 20 44 49 56 20 2d 20 63 6f   - col2 DIV - co
6f60: 6c 31 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d  l1 FROM tab1..--
6f70: 2d 2d 0d 0a 2d 31 32 33 0d 0a 2d 31 35 33 0d 0a  --..-123..-153..
6f80: 2d 34 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  -4....skipif mys
6f90: 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
6fa0: 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
6fb0: 73 6f 72 74 20 6c 61 62 65 6c 2d 31 38 38 0d 0a  sort label-188..
6fc0: 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c  SELECT ALL - col
6fd0: 30 20 2b 20 2d 20 63 6f 6c 30 20 2b 20 2d 20 63  0 + - col0 + - c
6fe0: 6f 6c 32 20 2f 20 2d 20 63 6f 6c 31 20 46 52 4f  ol2 / - col1 FRO
6ff0: 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  M tab1..----..-1
7000: 32 33 0d 0a 2d 31 35 33 0d 0a 2d 34 0d 0a 0d 0a  23..-153..-4....
7010: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
7020: 0a 53 45 4c 45 43 54 20 38 30 20 2a 20 63 6f 6c  .SELECT 80 * col
7030: 30 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61  0 + col1 FROM ta
7040: 62 32 0d 0a 2d 2d 2d 2d 0d 0a 35 39 31 0d 0a 36  b2..----..591..6
7050: 32 39 39 0d 0a 36 33 33 37 0d 0a 0d 0a 71 75 65  299..6337....que
7060: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
7070: 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20  LECT DISTINCT + 
7080: 74 61 62 32 2e 63 6f 6c 31 20 41 53 20 63 6f 6c  tab2.col1 AS col
7090: 32 20 46 52 4f 4d 20 74 61 62 32 2c 20 74 61 62  2 FROM tab2, tab
70a0: 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
70b0: 0a 31 37 0d 0a 33 31 0d 0a 35 39 0d 0a 0d 0a 71  .17..31..59....q
70c0: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
70d0: 53 45 4c 45 43 54 20 2d 20 32 37 20 2a 20 63 6f  SELECT - 27 * co
70e0: 72 30 2e 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  r0.col2 FROM tab
70f0: 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  1 cor0..----..-1
7100: 34 35 38 0d 0a 2d 31 35 33 39 0d 0a 2d 32 35 39  458..-1539..-259
7110: 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  2....query I row
7120: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2d  sort..SELECT + -
7130: 20 35 33 20 2a 20 2b 20 63 6f 6c 32 20 2b 20 63   53 * + col2 + c
7140: 6f 72 30 2e 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c  or0.col0 * + col
7150: 31 20 46 52 4f 4d 20 74 61 62 32 20 63 6f 72 30  1 FROM tab2 cor0
7160: 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32 31 34 0d 0a 2d  ..----..-1214..-
7170: 36 37 31 0d 0a 33 32 32 34 0d 0a 0d 0a 71 75 65  671..3224....que
7180: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
7190: 4c 45 43 54 20 2b 20 63 6f 6c 32 20 2a 20 2b 20  LECT + col2 * + 
71a0: 63 6f 6c 32 20 2b 20 63 6f 6c 30 20 46 52 4f 4d  col2 + col0 FROM
71b0: 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab1 cor0..----
71c0: 0d 0a 32 39 31 39 0d 0a 33 33 31 33 0d 0a 39 32  ..2919..3313..92
71d0: 39 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  96....query I ro
71e0: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
71f0: 28 20 37 30 20 29 20 46 52 4f 4d 20 74 61 62 30  ( 70 ) FROM tab0
7200: 0d 0a 2d 2d 2d 2d 0d 0a 2d 37 30 0d 0a 2d 37 30  ..----..-70..-70
7210: 0d 0a 2d 37 30 0d 0a 0d 0a 71 75 65 72 79 20 49  ..-70....query I
7220: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
7230: 20 2d 20 63 6f 6c 30 20 2b 20 2b 20 36 37 20 41   - col0 + + 67 A
7240: 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32  S col0 FROM tab2
7250: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
7260: 2d 31 31 0d 0a 2d 31 32 0d 0a 36 30 0d 0a 0d 0a  -11..-12..60....
7270: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
7280: 0a 53 45 4c 45 43 54 20 2b 20 28 20 2d 20 33 39  .SELECT + ( - 39
7290: 20 29 20 46 52 4f 4d 20 74 61 62 32 20 63 6f 72   ) FROM tab2 cor
72a0: 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 39 0d 0a 2d 33  0..----..-39..-3
72b0: 39 0d 0a 2d 33 39 0d 0a 0d 0a 71 75 65 72 79 20  9..-39....query 
72c0: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
72d0: 54 20 2d 20 63 6f 6c 30 20 2b 20 2b 20 38 20 46  T - col0 + + 8 F
72e0: 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
72f0: 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 36 0d 0a 2d 32 37  ..----..-16..-27
7300: 0d 0a 2d 38 31 0d 0a 0d 0a 71 75 65 72 79 20 49  ..-81....query I
7310: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
7320: 20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c 31   DISTINCT - col1
7330: 20 2a 20 2d 20 63 6f 6c 32 20 2a 20 30 20 46 52   * - col2 * 0 FR
7340: 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
7350: 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 0d 0a 71 75 65 72  .----..0....quer
7360: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
7370: 45 43 54 20 63 6f 72 30 2e 63 6f 6c 32 20 2b 20  ECT cor0.col2 + 
7380: 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c 30 20 46 52  col2 * + col0 FR
7390: 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
73a0: 0a 2d 2d 2d 2d 0d 0a 33 36 0d 0a 37 33 38 30 0d  .----..36..7380.
73b0: 0a 38 32 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .825....query I 
73c0: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
73d0: 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 2a 20 2b 20  + cor0.col2 * + 
73e0: 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46 52 4f  col0 AS col1 FRO
73f0: 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab1 cor0..---
7400: 2d 0d 0a 31 36 32 0d 0a 33 36 34 38 0d 0a 37 36  -..162..3648..76
7410: 38 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  80....query I ro
7420: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f  wsort..SELECT co
7430: 6c 32 20 2a 20 2b 20 38 31 20 2b 20 63 6f 72 30  l2 * + 81 + cor0
7440: 2e 63 6f 6c 31 20 2a 20 63 6f 6c 31 20 46 52 4f  .col1 * col1 FRO
7450: 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
7460: 2d 2d 2d 2d 0d 0a 34 37 31 37 0d 0a 35 30 35 30  ----..4717..5050
7470: 0d 0a 37 39 34 35 0d 0a 0d 0a 71 75 65 72 79 20  ..7945....query 
7480: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
7490: 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c  T DISTINCT + col
74a0: 32 20 2d 20 63 6f 6c 32 20 2a 20 2b 20 36 31 20  2 - col2 * + 61 
74b0: 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
74c0: 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 35 36 30 0d 0a  0..----..-1560..
74d0: 2d 31 36 32 30 0d 0a 2d 32 32 38 30 0d 0a 0d 0a  -1620..-2280....
74e0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
74f0: 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 31 20 2b  .SELECT + col1 +
7500: 20 2b 20 34 31 20 46 52 4f 4d 20 74 61 62 30 20   + 41 FROM tab0 
7510: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 37 0d  cor0..----..127.
7520: 0a 31 33 32 0d 0a 31 33 38 0d 0a 0d 0a 71 75 65  .132..138....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 63 6f 6c 31 20 2b 20 2d 20 63 6f  LECT col1 + - co
7550: 6c 32 20 2a 20 63 6f 6c 31 20 2b 20 63 6f 6c 30  l2 * col1 + col0
7560: 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
7570: 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 39 37 0d  b2..----..-1397.
7580: 0a 2d 35 35 30 0d 0a 2d 37 39 39 0d 0a 0d 0a 71  .-550..-799....q
7590: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
75a0: 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
75b0: 2d 20 38 34 20 2b 20 2b 20 63 6f 6c 32 20 46 52  - 84 + + col2 FR
75c0: 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  OM tab0..----..-
75d0: 32 0d 0a 2d 35 31 0d 0a 2d 38 33 0d 0a 0d 0a 71  2..-51..-83....q
75e0: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
75f0: 53 45 4c 45 43 54 20 74 61 62 32 2e 63 6f 6c 30  SELECT tab2.col0
7600: 20 2b 20 2b 20 28 20 74 61 62 32 2e 63 6f 6c 31   + + ( tab2.col1
7610: 20 29 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d   ) FROM tab2..--
7620: 2d 2d 0d 0a 31 33 37 0d 0a 33 38 0d 0a 39 36 0d  --..137..38..96.
7630: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
7640: 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
7650: 4e 43 54 20 28 20 31 30 20 29 20 41 53 20 63 6f  NCT ( 10 ) AS co
7660: 6c 31 20 46 52 4f 4d 20 74 61 62 32 2c 20 74 61  l1 FROM tab2, ta
7670: 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
7680: 0d 0a 31 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..10....query I 
7690: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
76a0: 2b 20 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c 30 20  + col0 * - col0 
76b0: 2a 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 46 52  * - cor0.col2 FR
76c0: 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
76d0: 0a 2d 2d 2d 2d 0d 0a 31 32 32 35 0d 0a 31 39 30  .----..1225..190
76e0: 30 38 0d 0a 36 34 39 35 32 32 0d 0a 0d 0a 71 75  08..649522....qu
76f0: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
7700: 45 4c 45 43 54 20 63 6f 6c 30 20 2a 20 2b 20 74  ELECT col0 * + t
7710: 61 62 30 2e 63 6f 6c 30 20 2a 20 2d 20 74 61 62  ab0.col0 * - tab
7720: 30 2e 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30  0.col1 FROM tab0
7730: 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 38 38 32 35 0d  ..----..-118825.
7740: 0a 2d 34 39 35 33 36 0d 0a 2d 37 32 30 38 31 31  .-49536..-720811
7750: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
7760: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 32  ort..SELECT col2
7770: 20 2a 20 2d 20 36 39 20 46 52 4f 4d 20 74 61 62   * - 69 FROM tab
7780: 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 37 39 34 0d 0a  2..----..-1794..
7790: 2d 31 38 36 33 0d 0a 2d 32 36 32 32 0d 0a 0d 0a  -1863..-2622....
77a0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
77b0: 0a 53 45 4c 45 43 54 20 2d 20 34 33 20 46 52 4f  .SELECT - 43 FRO
77c0: 4d 20 74 61 62 31 2c 20 74 61 62 30 20 41 53 20  M tab1, tab0 AS 
77d0: 63 6f 72 30 2c 20 74 61 62 32 20 41 53 20 63 6f  cor0, tab2 AS co
77e0: 72 31 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c  r1..----..27 val
77f0: 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 32  ues hashing to 2
7800: 66 37 32 62 64 39 63 61 62 36 38 63 38 64 38 63  f72bd9cab68c8d8c
7810: 33 38 38 37 34 35 31 30 61 32 39 30 61 33 63 0d  38874510a290a3c.
7820: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
7830: 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d  rt..SELECT ALL -
7840: 20 28 20 32 33 20 29 20 41 53 20 63 6f 6c 32 20   ( 23 ) AS col2 
7850: 46 52 4f 4d 20 74 61 62 31 2c 20 74 61 62 32 20  FROM tab1, tab2 
7860: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39  AS cor0..----..9
7870: 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20   values hashing 
7880: 74 6f 20 63 65 36 30 62 66 34 62 30 36 34 37 64  to ce60bf4b0647d
7890: 30 66 63 62 31 38 61 30 35 36 32 65 33 35 31 63  0fcb18a0562e351c
78a0: 35 32 64 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  52d....query I r
78b0: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63  owsort..SELECT c
78c0: 6f 6c 32 20 2b 20 2b 20 32 20 46 52 4f 4d 20 74  ol2 + + 2 FROM t
78d0: 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
78e0: 2d 0d 0a 35 36 0d 0a 35 39 0d 0a 39 38 0d 0a 0d  -..56..59..98...
78f0: 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73  .skipif postgres
7900: 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20  ql # PostgreSQL 
7910: 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e  requires AS when
7920: 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74   renaming output
7930: 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20   columns..query 
7940: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
7950: 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c  T DISTINCT - col
7960: 30 20 2d 20 28 20 2b 20 63 6f 6c 32 20 2b 20 63  0 - ( + col2 + c
7970: 6f 6c 32 20 29 20 63 6f 6c 31 20 46 52 4f 4d 20  ol2 ) col1 FROM 
7980: 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
7990: 2d 2d 0d 0a 2d 31 31 31 0d 0a 2d 31 37 38 0d 0a  --..-111..-178..
79a0: 2d 32 37 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20  -272....query I 
79b0: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
79c0: 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c 31 20 2b 20  col2 * - col1 + 
79d0: 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c 32 20 46 52  col2 * - col2 FR
79e0: 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
79f0: 0a 2d 2d 2d 2d 0d 0a 2d 31 35 36 36 0d 0a 2d 32  .----..-1566..-2
7a00: 30 39 30 0d 0a 2d 32 32 31 30 0d 0a 0d 0a 71 75  090..-2210....qu
7a10: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
7a20: 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 38  ELECT DISTINCT 8
7a30: 31 20 2a 20 63 6f 6c 32 20 2d 20 2d 20 63 6f 6c  1 * col2 - - col
7a40: 31 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  1 AS col0 FROM t
7a50: 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
7a60: 2d 0d 0a 34 34 30 30 0d 0a 34 36 32 37 0d 0a 37  -..4400..4627..7
7a70: 37 38 39 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  789....onlyif my
7a80: 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70  sql # use DIV op
7a90: 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67  erator for integ
7aa0: 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65  er division..que
7ab0: 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
7ac0: 65 6c 2d 32 31 37 0d 0a 53 45 4c 45 43 54 20 41  el-217..SELECT A
7ad0: 4c 4c 20 2d 20 35 33 20 2a 20 2b 20 63 6f 6c 32  LL - 53 * + col2
7ae0: 20 2b 20 2d 20 63 6f 6c 30 20 44 49 56 20 63 6f   + - col0 DIV co
7af0: 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l1 FROM tab2 AS 
7b00: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 37  cor0..----..-137
7b10: 39 0d 0a 2d 31 34 33 31 0d 0a 2d 32 30 31 38 0d  9..-1431..-2018.
7b20: 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
7b30: 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
7b40: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
7b50: 74 20 6c 61 62 65 6c 2d 32 31 37 0d 0a 53 45 4c  t label-217..SEL
7b60: 45 43 54 20 41 4c 4c 20 2d 20 35 33 20 2a 20 2b  ECT ALL - 53 * +
7b70: 20 63 6f 6c 32 20 2b 20 2d 20 63 6f 6c 30 20 2f   col2 + - col0 /
7b80: 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20   col1 FROM tab2 
7b90: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
7ba0: 31 33 37 39 0d 0a 2d 31 34 33 31 0d 0a 2d 32 30  1379..-1431..-20
7bb0: 31 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  18....query I ro
7bc0: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
7bd0: 53 54 49 4e 43 54 20 2d 20 28 20 38 34 20 29 20  STINCT - ( 84 ) 
7be0: 46 52 4f 4d 20 74 61 62 30 2c 20 74 61 62 31 20  FROM tab0, tab1 
7bf0: 63 6f 72 30 2c 20 74 61 62 31 20 41 53 20 63 6f  cor0, tab1 AS co
7c00: 72 31 2c 20 74 61 62 31 20 41 53 20 63 6f 72 32  r1, tab1 AS cor2
7c10: 0d 0a 2d 2d 2d 2d 0d 0a 2d 38 34 0d 0a 0d 0a 71  ..----..-84....q
7c20: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
7c30: 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 2d 20 28  SELECT ALL - - (
7c40: 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 29 20 2a   + cor0.col1 ) *
7c50: 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20   col0 FROM tab1 
7c60: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
7c70: 30 34 30 0d 0a 36 34 30 0d 0a 37 38 0d 0a 0d 0a  040..640..78....
7c80: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
7c90: 0a 53 45 4c 45 43 54 20 35 32 20 2a 20 2b 20 74  .SELECT 52 * + t
7ca0: 61 62 32 2e 63 6f 6c 30 20 46 52 4f 4d 20 74 61  ab2.col0 FROM ta
7cb0: 62 32 0d 0a 2d 2d 2d 2d 0d 0a 33 36 34 0d 0a 34  b2..----..364..4
7cc0: 30 35 36 0d 0a 34 31 30 38 0d 0a 0d 0a 6f 6e 6c  056..4108....onl
7cd0: 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20  yif mysql # use 
7ce0: 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72  DIV operator for
7cf0: 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f   integer divisio
7d00: 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  n..query I rowso
7d10: 72 74 20 6c 61 62 65 6c 2d 32 32 31 0d 0a 53 45  rt label-221..SE
7d20: 4c 45 43 54 20 41 4c 4c 20 34 37 20 44 49 56 20  LECT ALL 47 DIV 
7d30: 2b 20 63 6f 6c 32 20 2b 20 2d 20 63 6f 6c 30 20  + col2 + - col0 
7d40: 2a 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31  * col1 FROM tab1
7d50: 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 34 30 0d 0a 2d  ..----..-1040..-
7d60: 36 34 30 0d 0a 2d 37 38 0d 0a 0d 0a 73 6b 69 70  640..-78....skip
7d70: 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
7d80: 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
7d90: 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
7da0: 2d 32 32 31 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  -221..SELECT ALL
7db0: 20 34 37 20 2f 20 2b 20 63 6f 6c 32 20 2b 20 2d   47 / + col2 + -
7dc0: 20 63 6f 6c 30 20 2a 20 63 6f 6c 31 20 46 52 4f   col0 * col1 FRO
7dd0: 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  M tab1..----..-1
7de0: 30 34 30 0d 0a 2d 36 34 30 0d 0a 2d 37 38 0d 0a  040..-640..-78..
7df0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
7e00: 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20  t..SELECT ALL - 
7e10: 37 20 2a 20 2d 20 63 6f 6c 30 20 2b 20 2d 20 63  7 * - col0 + - c
7e20: 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  ol2 AS col2 FROM
7e30: 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33 35   tab0..----..135
7e40: 0d 0a 32 34 34 0d 0a 35 34 31 0d 0a 0d 0a 71 75  ..244..541....qu
7e50: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
7e60: 45 4c 45 43 54 20 2b 20 63 6f 6c 31 20 2a 20 2b  ELECT + col1 * +
7e70: 20 63 6f 72 30 2e 63 6f 6c 30 20 2b 20 63 6f 6c   cor0.col0 + col
7e80: 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  2 FROM tab0 AS c
7e90: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 30 39 37 0d  or0..----..2097.
7ea0: 0a 33 33 39 36 0d 0a 38 31 38 31 0d 0a 0d 0a 71  .3396..8181....q
7eb0: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
7ec0: 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
7ed0: 2d 20 32 20 2b 20 63 6f 6c 32 20 41 53 20 63 6f  - 2 + col2 AS co
7ee0: 6c 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d  l1 FROM tab0..--
7ef0: 2d 2d 0d 0a 2d 31 0d 0a 33 31 0d 0a 38 30 0d 0a  --..-1..31..80..
7f00: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
7f10: 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
7f20: 43 54 20 2d 20 2b 20 63 6f 6c 32 20 2a 20 63 6f  CT - + col2 * co
7f30: 6c 30 20 2a 20 28 20 63 6f 72 30 2e 63 6f 6c 30  l0 * ( cor0.col0
7f40: 20 2b 20 2d 20 36 39 20 29 20 41 53 20 63 6f 6c   + - 69 ) AS col
7f50: 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  2 FROM tab1 AS c
7f60: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 38 34 34 38  or0..----..-8448
7f70: 30 0d 0a 31 30 36 39 32 0d 0a 31 38 32 34 30 0d  0..10692..18240.
7f80: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
7f90: 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2b 20 63  rt..SELECT - + c
7fa0: 6f 6c 32 20 2b 20 2d 20 63 6f 72 30 2e 63 6f 6c  ol2 + - cor0.col
7fb0: 31 20 2d 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61  1 - col1 FROM ta
7fc0: 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
7fd0: 0d 0a 2d 31 39 35 0d 0a 2d 32 30 35 0d 0a 2d 32  ..-195..-205..-2
7fe0: 36 34 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  64....onlyif mys
7ff0: 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65  ql # use DIV ope
8000: 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65  rator for intege
8010: 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72  r division..quer
8020: 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
8030: 6c 2d 32 32 37 0d 0a 53 45 4c 45 43 54 20 44 49  l-227..SELECT DI
8040: 53 54 49 4e 43 54 20 2b 20 63 6f 6c 31 20 2b 20  STINCT + col1 + 
8050: 2b 20 43 41 53 54 28 20 2b 20 63 6f 6c 30 20 41  + CAST( + col0 A
8060: 53 20 53 49 47 4e 45 44 20 29 20 2b 20 2d 20 63  S SIGNED ) + - c
8070: 6f 6c 32 20 2a 20 33 33 20 44 49 56 20 2d 20 36  ol2 * 33 DIV - 6
8080: 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
8090: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33 37 0d 0a 32  r0..----..137..2
80a0: 39 31 0d 0a 36 33 31 0d 0a 0d 0a 73 6b 69 70 69  91..631....skipi
80b0: 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
80c0: 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
80d0: 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
80e0: 32 32 37 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  227..SELECT DIST
80f0: 49 4e 43 54 20 2b 20 63 6f 6c 31 20 2b 20 2b 20  INCT + col1 + + 
8100: 43 41 53 54 20 28 20 2b 20 63 6f 6c 30 20 41 53  CAST ( + col0 AS
8110: 20 49 4e 54 45 47 45 52 20 29 20 2b 20 2d 20 63   INTEGER ) + - c
8120: 6f 6c 32 20 2a 20 33 33 20 2f 20 2d 20 36 20 46  ol2 * 33 / - 6 F
8130: 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
8140: 0d 0a 2d 2d 2d 2d 0d 0a 31 33 37 0d 0a 32 39 31  ..----..137..291
8150: 0d 0a 36 33 31 0d 0a 0d 0a 71 75 65 72 79 20 49  ..631....query I
8160: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
8170: 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 30 20 2a   DISTINCT col0 *
8180: 20 63 6f 6c 32 20 2a 20 36 30 20 46 52 4f 4d 20   col2 * 60 FROM 
8190: 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
81a0: 2d 2d 0d 0a 31 31 33 34 30 0d 0a 31 32 31 36 38  --..11340..12168
81b0: 30 0d 0a 31 38 30 31 32 30 0d 0a 0d 0a 6f 6e 6c  0..180120....onl
81c0: 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20  yif mysql # use 
81d0: 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72  DIV operator for
81e0: 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f   integer divisio
81f0: 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  n..query I rowso
8200: 72 74 20 6c 61 62 65 6c 2d 32 32 39 0d 0a 53 45  rt label-229..SE
8210: 4c 45 43 54 20 28 20 74 61 62 30 2e 63 6f 6c 31  LECT ( tab0.col1
8220: 20 29 20 44 49 56 20 63 6f 6c 31 20 2b 20 63 6f   ) DIV col1 + co
8230: 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d  l0 FROM tab0..--
8240: 2d 2d 0d 0a 32 35 0d 0a 33 36 0d 0a 39 30 0d 0a  --..25..36..90..
8250: 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
8260: 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
8270: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
8280: 20 6c 61 62 65 6c 2d 32 32 39 0d 0a 53 45 4c 45   label-229..SELE
8290: 43 54 20 28 20 74 61 62 30 2e 63 6f 6c 31 20 29  CT ( tab0.col1 )
82a0: 20 2f 20 63 6f 6c 31 20 2b 20 63 6f 6c 30 20 46   / col1 + col0 F
82b0: 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab0..----..
82c0: 32 35 0d 0a 33 36 0d 0a 39 30 0d 0a 0d 0a 6f 6e  25..36..90....on
82d0: 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
82e0: 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
82f0: 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
8300: 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
8310: 6f 72 74 20 6c 61 62 65 6c 2d 32 33 30 0d 0a 53  ort label-230..S
8320: 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 63  ELECT DISTINCT c
8330: 6f 6c 30 20 2a 20 63 6f 6c 32 20 44 49 56 20 38  ol0 * col2 DIV 8
8340: 37 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31  7 col2 FROM tab1
8350: 0d 0a 2d 2d 2d 2d 0d 0a 31 0d 0a 34 31 0d 0a 38  ..----..1..41..8
8360: 38 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74  8....skipif post
8370: 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65  gresql # Postgre
8380: 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20  SQL requires AS 
8390: 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75  when renaming ou
83a0: 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 73 6b  tput columns..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 30 0d 0a 53 45 4c 45 43 54 20 44  el-230..SELECT D
83f0: 49 53 54 49 4e 43 54 20 63 6f 6c 30 20 2a 20 63  ISTINCT col0 * c
8400: 6f 6c 32 20 2f 20 38 37 20 63 6f 6c 32 20 46 52  ol2 / 87 col2 FR
8410: 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31  OM tab1..----..1
8420: 0d 0a 34 31 0d 0a 38 38 0d 0a 0d 0a 71 75 65 72  ..41..88....quer
8430: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
8440: 45 43 54 20 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c  ECT col2 * + col
8450: 31 20 2d 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30  1 - col0 AS col0
8460: 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d   FROM tab0..----
8470: 0d 0a 32 38 31 34 0d 0a 36 32 0d 0a 37 33 37 33  ..2814..62..7373
8480: 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67  ....skipif postg
8490: 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53  resql # PostgreS
84a0: 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77  QL requires AS w
84b0: 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74  hen renaming out
84c0: 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65  put columns..que
84d0: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
84e0: 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20  LECT DISTINCT - 
84f0: 63 6f 6c 31 20 2a 20 63 6f 6c 30 20 63 6f 6c 31  col1 * col0 col1
8500: 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d   FROM tab0..----
8510: 0d 0a 2d 32 30 36 34 0d 0a 2d 33 33 39 35 0d 0a  ..-2064..-3395..
8520: 2d 38 30 39 39 0d 0a 0d 0a 71 75 65 72 79 20 49  -8099....query I
8530: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
8540: 20 63 6f 72 30 2e 63 6f 6c 30 20 2a 20 2b 20 63   cor0.col0 * + c
8550: 6f 6c 31 20 2d 20 63 6f 72 30 2e 63 6f 6c 30 20  ol1 - cor0.col0 
8560: 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
8570: 30 0d 0a 2d 2d 2d 2d 0d 0a 32 30 34 30 0d 0a 33  0..----..2040..3
8580: 33 36 30 0d 0a 38 30 31 30 0d 0a 0d 0a 6f 6e 6c  360..8010....onl
8590: 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20  yif mysql # use 
85a0: 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72  DIV operator for
85b0: 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f   integer divisio
85c0: 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  n..query I rowso
85d0: 72 74 20 6c 61 62 65 6c 2d 32 33 34 0d 0a 53 45  rt label-234..SE
85e0: 4c 45 43 54 20 2b 20 2b 20 63 6f 6c 32 20 2a 20  LECT + + col2 * 
85f0: 63 6f 6c 32 20 44 49 56 20 2d 20 63 6f 6c 30 20  col2 DIV - col0 
8600: 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 41 53 20 63  + cor0.col1 AS c
8610: 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol2 FROM tab1 AS
8620: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30   cor0..----..-10
8630: 32 0d 0a 2d 34 30 0d 0a 2d 39 34 36 0d 0a 0d 0a  2..-40..-946....
8640: 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
8650: 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
8660: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
8670: 61 62 65 6c 2d 32 33 34 0d 0a 53 45 4c 45 43 54  abel-234..SELECT
8680: 20 2b 20 2b 20 63 6f 6c 32 20 2a 20 63 6f 6c 32   + + col2 * col2
8690: 20 2f 20 2d 20 63 6f 6c 30 20 2b 20 63 6f 72 30   / - col0 + cor0
86a0: 2e 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46 52  .col1 AS col2 FR
86b0: 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
86c0: 0a 2d 2d 2d 2d 0d 0a 2d 31 30 32 0d 0a 2d 34 30  .----..-102..-40
86d0: 0d 0a 2d 39 34 36 0d 0a 0d 0a 73 6b 69 70 69 66  ..-946....skipif
86e0: 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f   postgresql # Po
86f0: 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65  stgreSQL require
8700: 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69  s AS when renami
8710: 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e  ng output column
8720: 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  s..query I rowso
8730: 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 32 20  rt..SELECT col2 
8740: 2b 20 35 31 20 63 6f 6c 32 20 46 52 4f 4d 20 74  + 51 col2 FROM t
8750: 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
8760: 2d 0d 0a 37 37 0d 0a 37 38 0d 0a 38 39 0d 0a 0d  -..77..78..89...
8770: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
8780: 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 31 20 2b 20  ..SELECT col1 + 
8790: 2b 20 31 37 20 46 52 4f 4d 20 74 61 62 32 0d 0a  + 17 FROM tab2..
87a0: 2d 2d 2d 2d 0d 0a 33 34 0d 0a 34 38 0d 0a 37 36  ----..34..48..76
87b0: 0d 0a 0d 0a 71 75 65 72 79 20 49 49 49 49 49 49  ....query IIIIII
87c0: 49 49 49 49 49 49 49 49 49 20 72 6f 77 73 6f 72  IIIIIIIII rowsor
87d0: 74 0d 0a 53 45 4c 45 43 54 20 2a 20 46 52 4f 4d  t..SELECT * FROM
87e0: 20 74 61 62 32 20 41 53 20 63 6f 72 30 20 43 52   tab2 AS cor0 CR
87f0: 4f 53 53 20 4a 4f 49 4e 20 74 61 62 31 2c 20 74  OSS JOIN tab1, t
8800: 61 62 30 20 41 53 20 63 6f 72 31 2c 20 74 61 62  ab0 AS cor1, tab
8810: 30 20 41 53 20 63 6f 72 32 2c 20 74 61 62 30 20  0 AS cor2, tab0 
8820: 41 53 20 63 6f 72 33 0d 0a 2d 2d 2d 2d 0d 0a 33  AS cor3..----..3
8830: 36 34 35 20 76 61 6c 75 65 73 20 68 61 73 68 69  645 values hashi
8840: 6e 67 20 74 6f 20 32 32 37 30 39 30 31 63 37 33  ng to 2270901c73
8850: 61 36 35 38 61 36 33 66 38 34 31 63 36 38 64 62  a658a63f841c68db
8860: 38 31 35 35 62 61 0d 0a 0d 0a 73 6b 69 70 69 66  8155ba....skipif
8870: 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f   postgresql # Po
8880: 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65  stgreSQL require
8890: 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69  s AS when renami
88a0: 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e  ng output column
88b0: 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  s..query I rowso
88c0: 72 74 0d 0a 53 45 4c 45 43 54 20 34 33 20 2a 20  rt..SELECT 43 * 
88d0: 2d 20 31 33 20 63 6f 6c 30 20 46 52 4f 4d 20 74  - 13 col0 FROM t
88e0: 61 62 31 2c 20 74 61 62 32 20 41 53 20 63 6f 72  ab1, tab2 AS cor
88f0: 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65  0..----..9 value
8900: 73 20 68 61 73 68 69 6e 67 20 74 6f 20 33 39 38  s hashing to 398
8910: 64 64 39 30 61 37 30 32 34 66 61 36 63 30 66 30  dd90a7024fa6c0f0
8920: 64 36 64 65 65 32 62 66 33 65 34 36 35 0d 0a 0d  d6dee2bf3e465...
8930: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
8940: 0d 0a 53 45 4c 45 43 54 20 63 6f 72 30 2e 63 6f  ..SELECT cor0.co
8950: 6c 32 20 2b 20 2d 20 63 6f 6c 31 20 2d 20 63 6f  l2 + - col1 - co
8960: 6c 31 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  l1 AS col2 FROM 
8970: 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
8980: 2d 2d 0d 0a 32 0d 0a 33 37 0d 0a 37 30 0d 0a 0d  --..2..37..70...
8990: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
89a0: 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 72 30 2e  ..SELECT + cor0.
89b0: 63 6f 6c 30 20 2a 20 2d 20 33 30 20 41 53 20 63  col0 * - 30 AS c
89c0: 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol1 FROM tab1 AS
89d0: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 39   cor0..----..-19
89e0: 32 30 0d 0a 2d 32 34 30 30 0d 0a 2d 39 30 0d 0a  20..-2400..-90..
89f0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
8a00: 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 30  t..SELECT - col0
8a10: 20 2a 20 28 20 2b 20 63 6f 6c 31 20 2a 20 63 6f   * ( + col1 * co
8a20: 72 30 2e 63 6f 6c 32 20 29 20 2b 20 63 6f 6c 31  r0.col2 ) + col1
8a30: 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
8a40: 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
8a50: 0d 0a 2d 33 36 34 37 30 0d 0a 2d 34 31 38 36 0d  ..-36470..-4186.
8a60: 0a 2d 39 39 38 32 37 0d 0a 0d 0a 71 75 65 72 79  .-99827....query
8a70: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
8a80: 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f  CT DISTINCT - co
8a90: 6c 32 20 2a 20 28 20 2d 20 63 6f 6c 32 20 29 20  l2 * ( - col2 ) 
8aa0: 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
8ab0: 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
8ac0: 0a 31 34 34 34 0d 0a 36 37 36 0d 0a 37 32 39 0d  .1444..676..729.
8ad0: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
8ae0: 72 74 0d 0a 53 45 4c 45 43 54 20 74 61 62 30 2e  rt..SELECT tab0.
8af0: 63 6f 6c 32 20 2b 20 2d 20 28 20 2d 20 74 61 62  col2 + - ( - tab
8b00: 30 2e 63 6f 6c 32 20 29 20 46 52 4f 4d 20 74 61  0.col2 ) FROM ta
8b10: 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 36 34 0d 0a 32  b0..----..164..2
8b20: 0d 0a 36 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..66....query I 
8b30: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
8b40: 2d 20 31 32 20 41 53 20 63 6f 6c 30 20 46 52 4f  - 12 AS col0 FRO
8b50: 4d 20 74 61 62 31 2c 20 74 61 62 32 20 41 53 20  M tab1, tab2 AS 
8b60: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61  cor0..----..9 va
8b70: 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20  lues hashing to 
8b80: 65 36 39 38 64 64 35 37 64 33 61 61 63 33 30 61  e698dd57d3aac30a
8b90: 66 31 34 63 65 33 35 64 61 34 33 34 62 62 34 35  f14ce35da434bb45
8ba0: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
8bb0: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 32  ort..SELECT col2
8bc0: 20 2b 20 2b 20 28 20 2b 20 63 6f 6c 32 20 29 20   + + ( + col2 ) 
8bd0: 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d  FROM tab1..----.
8be0: 0a 31 30 38 0d 0a 31 31 34 0d 0a 31 39 32 0d 0a  .108..114..192..
8bf0: 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
8c00: 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f   use DIV operato
8c10: 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69  r for integer di
8c20: 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20  vision..query I 
8c30: 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 32 34  rowsort label-24
8c40: 36 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 30  6..SELECT + col0
8c50: 20 44 49 56 20 37 31 20 2b 20 63 6f 6c 32 20 46   DIV 71 + col2 F
8c60: 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab0..----..
8c70: 31 0d 0a 33 33 0d 0a 38 33 0d 0a 0d 0a 73 6b 69  1..33..83....ski
8c80: 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
8c90: 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
8ca0: 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
8cb0: 6c 2d 32 34 36 0d 0a 53 45 4c 45 43 54 20 2b 20  l-246..SELECT + 
8cc0: 63 6f 6c 30 20 2f 20 37 31 20 2b 20 63 6f 6c 32  col0 / 71 + col2
8cd0: 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d   FROM tab0..----
8ce0: 0d 0a 31 0d 0a 33 33 0d 0a 38 33 0d 0a 0d 0a 71  ..1..33..83....q
8cf0: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
8d00: 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 28 20 2b  SELECT ALL + ( +
8d10: 20 33 30 20 29 20 41 53 20 63 6f 6c 30 20 46 52   30 ) AS col0 FR
8d20: 4f 4d 20 74 61 62 31 2c 20 74 61 62 30 20 41 53  OM tab1, tab0 AS
8d30: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76   cor0..----..9 v
8d40: 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f  alues hashing to
8d50: 20 64 61 35 64 65 30 63 34 31 31 61 32 63 30 66   da5de0c411a2c0f
8d60: 34 34 35 34 30 30 66 31 62 36 33 65 61 39 66 38  445400f1b63ea9f8
8d70: 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  9....query I row
8d80: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63  sort..SELECT + c
8d90: 6f 72 30 2e 63 6f 6c 31 20 2a 20 28 20 63 6f 6c  or0.col1 * ( col
8da0: 30 20 29 20 46 52 4f 4d 20 74 61 62 32 20 41 53  0 ) FROM tab2 AS
8db0: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33 34   cor0..----..134
8dc0: 33 0d 0a 32 31 37 0d 0a 34 36 30 32 0d 0a 0d 0a  3..217..4602....
8dd0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
8de0: 0a 53 45 4c 45 43 54 20 2d 20 2d 20 63 6f 6c 32  .SELECT - - col2
8df0: 20 2a 20 39 38 20 2a 20 63 6f 72 30 2e 63 6f 6c   * 98 * cor0.col
8e00: 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  0 AS col1 FROM t
8e10: 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
8e20: 2d 0d 0a 31 38 35 32 32 0d 0a 31 39 38 37 34 34  -..18522..198744
8e30: 0d 0a 32 39 34 31 39 36 0d 0a 0d 0a 73 6b 69 70  ..294196....skip
8e40: 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20  if postgresql # 
8e50: 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69  PostgreSQL requi
8e60: 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61  res AS when rena
8e70: 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75  ming output colu
8e80: 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  mns..query I row
8e90: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 38  sort..SELECT - 8
8ea0: 37 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30  7 col1 FROM tab0
8eb0: 2c 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  , tab2 AS cor0..
8ec0: 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68  ----..9 values h
8ed0: 61 73 68 69 6e 67 20 74 6f 20 38 34 62 63 61 62  ashing to 84bcab
8ee0: 35 38 61 39 36 35 63 63 38 61 65 39 37 62 33 39  58a965cc8ae97b39
8ef0: 64 32 64 30 31 62 33 64 32 33 0d 0a 0d 0a 73 6b  d2d01b3d23....sk
8f00: 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20  ipif postgresql 
8f10: 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71  # PostgreSQL req
8f20: 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65  uires AS when re
8f30: 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f  naming output co
8f40: 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72  lumns..query I r
8f50: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
8f60: 49 53 54 49 4e 43 54 20 2b 20 2d 20 63 6f 6c 30  ISTINCT + - col0
8f70: 20 2a 20 2b 20 63 6f 6c 32 20 2d 20 63 6f 6c 31   * + col2 - col1
8f80: 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20   col0 FROM tab2 
8f90: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
8fa0: 32 30 38 37 0d 0a 2d 32 32 30 0d 0a 2d 33 30 31  2087..-220..-301
8fb0: 39 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  9....onlyif mysq
8fc0: 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72  l # use DIV oper
8fd0: 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72  ator for integer
8fe0: 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79   division..query
8ff0: 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
9000: 2d 32 35 32 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  -252..SELECT ALL
9010: 20 36 34 20 44 49 56 20 2d 20 63 6f 6c 31 20 2b   64 DIV - col1 +
9020: 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46 52   col0 AS col0 FR
9030: 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 35  OM tab2..----..5
9040: 0d 0a 37 36 0d 0a 37 37 0d 0a 0d 0a 73 6b 69 70  ..76..77....skip
9050: 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
9060: 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
9070: 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
9080: 2d 32 35 32 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  -252..SELECT ALL
9090: 20 36 34 20 2f 20 2d 20 63 6f 6c 31 20 2b 20 63   64 / - col1 + c
90a0: 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  ol0 AS col0 FROM
90b0: 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 35 0d 0a   tab2..----..5..
90c0: 37 36 0d 0a 37 37 0d 0a 0d 0a 71 75 65 72 79 20  76..77....query 
90d0: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
90e0: 54 20 44 49 53 54 49 4e 43 54 20 2d 20 31 33 20  T DISTINCT - 13 
90f0: 2b 20 2d 20 63 6f 6c 31 20 41 53 20 63 6f 6c 31  + - col1 AS col1
9100: 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d   FROM tab0..----
9110: 0d 0a 2d 31 30 34 0d 0a 2d 31 31 30 0d 0a 2d 39  ..-104..-110..-9
9120: 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  9....query I row
9130: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
9140: 20 74 61 62 30 2e 63 6f 6c 31 20 2b 20 2d 20 74   tab0.col1 + - t
9150: 61 62 30 2e 63 6f 6c 30 20 41 53 20 63 6f 6c 32  ab0.col0 AS col2
9160: 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d   FROM tab0..----
9170: 0d 0a 32 0d 0a 36 32 0d 0a 36 32 0d 0a 0d 0a 71  ..2..62..62....q
9180: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
9190: 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 31 20 41  SELECT ALL - 1 A
91a0: 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31  S col2 FROM tab1
91b0: 2c 20 74 61 62 30 2c 20 74 61 62 31 20 41 53 20  , tab0, tab1 AS 
91c0: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76  cor0..----..27 v
91d0: 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f  alues hashing to
91e0: 20 38 34 64 61 37 35 37 62 31 62 37 62 30 30 36   84da757b1b7b006
91f0: 39 63 65 32 35 36 30 37 66 33 39 62 63 30 38 64  9ce25607f39bc08d
9200: 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  9....query I row
9210: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
9220: 20 2d 20 34 32 20 46 52 4f 4d 20 74 61 62 32 2c   - 42 FROM tab2,
9230: 20 74 61 62 30 2c 20 74 61 62 30 20 41 53 20 63   tab0, tab0 AS c
9240: 6f 72 30 2c 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d  or0, tab1..----.
9250: 0a 38 31 20 76 61 6c 75 65 73 20 68 61 73 68 69  .81 values hashi
9260: 6e 67 20 74 6f 20 39 66 61 33 63 30 32 65 63 61  ng to 9fa3c02eca
9270: 65 32 33 35 32 35 64 64 30 65 32 38 34 63 34 37  e23525dd0e284c47
9280: 35 31 63 31 64 66 0d 0a 0d 0a 71 75 65 72 79 20  51c1df....query 
9290: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
92a0: 54 20 2b 20 63 6f 6c 30 20 2a 20 63 6f 6c 31 20  T + col0 * col1 
92b0: 2a 20 63 6f 72 30 2e 63 6f 6c 30 20 46 52 4f 4d  * cor0.col0 FROM
92c0: 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab1 cor0..----
92d0: 0d 0a 32 33 34 0d 0a 34 30 39 36 30 0d 0a 38 33  ..234..40960..83
92e0: 32 30 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  200....query I r
92f0: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
9300: 49 53 54 49 4e 43 54 20 63 6f 6c 32 20 2a 20 2b  ISTINCT col2 * +
9310: 20 63 6f 6c 30 20 2b 20 74 61 62 30 2e 63 6f 6c   col0 + tab0.col
9320: 31 20 2a 20 2b 20 63 6f 6c 32 20 2b 20 30 20 41  1 * + col2 + 0 A
9330: 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30  S col2 FROM tab0
9340: 0d 0a 2d 2d 2d 2d 0d 0a 31 33 32 0d 0a 31 34 37  ..----..132..147
9350: 36 30 0d 0a 33 36 33 30 0d 0a 0d 0a 71 75 65 72  60..3630....quer
9360: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
9370: 45 43 54 20 2b 20 63 6f 6c 32 20 2a 20 63 6f 6c  ECT + col2 * col
9380: 32 20 2b 20 63 6f 6c 31 20 2b 20 2b 20 28 20 2b  2 + col1 + + ( +
9390: 20 63 6f 6c 31 20 29 20 46 52 4f 4d 20 74 61 62   col1 ) FROM tab
93a0: 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
93b0: 0a 31 34 37 38 0d 0a 37 39 31 0d 0a 37 39 34 0d  .1478..791..794.
93c0: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
93d0: 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b  rt..SELECT ALL +
93e0: 20 2d 20 63 6f 6c 30 20 2a 20 2b 20 37 30 20 41   - col0 * + 70 A
93f0: 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32  S col2 FROM tab2
9400: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
9410: 2d 34 39 30 0d 0a 2d 35 34 36 30 0d 0a 2d 35 35  -490..-5460..-55
9420: 33 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  30....query I ro
9430: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
9440: 4c 20 37 36 20 2a 20 63 6f 6c 31 20 2b 20 2b 20  L 76 * col1 + + 
9450: 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a  col0 FROM tab0..
9460: 2d 2d 2d 2d 0d 0a 36 35 36 30 0d 0a 37 30 30 35  ----..6560..7005
9470: 0d 0a 37 34 30 37 0d 0a 0d 0a 71 75 65 72 79 20  ..7407....query 
9480: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
9490: 54 20 28 20 63 6f 72 30 2e 63 6f 6c 30 20 29 20  T ( cor0.col0 ) 
94a0: 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a  FROM tab0 cor0..
94b0: 2d 2d 2d 2d 0d 0a 32 34 0d 0a 33 35 0d 0a 38 39  ----..24..35..89
94c0: 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
94d0: 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d   # support for M
94e0: 79 53 51 4c 20 73 70 65 63 69 66 69 63 20 73 79  ySQL specific sy
94f0: 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73  stem types and s
9500: 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72  yntax..query I r
9510: 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 32 36 33  owsort label-263
9520: 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
9530: 54 20 2b 20 2b 20 63 6f 6c 32 20 2b 20 63 6f 6c  T + + col2 + col
9540: 31 20 2f 20 2d 20 43 41 53 54 28 20 4e 55 4c 4c  1 / - CAST( NULL
9550: 20 41 53 20 53 49 47 4e 45 44 20 29 20 46 52 4f   AS SIGNED ) FRO
9560: 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab2 cor0..---
9570: 2d 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69  -..NULL....skipi
9580: 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
9590: 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
95a0: 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
95b0: 32 36 33 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  263..SELECT DIST
95c0: 49 4e 43 54 20 2b 20 2b 20 63 6f 6c 32 20 2b 20  INCT + + col2 + 
95d0: 63 6f 6c 31 20 2f 20 2d 20 43 41 53 54 20 28 20  col1 / - CAST ( 
95e0: 4e 55 4c 4c 20 41 53 20 49 4e 54 45 47 45 52 20  NULL AS INTEGER 
95f0: 29 20 46 52 4f 4d 20 74 61 62 32 20 63 6f 72 30  ) FROM tab2 cor0
9600: 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 0d 0a  ..----..NULL....
9610: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
9620: 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
9630: 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 2b 20 63   + cor0.col1 + c
9640: 6f 72 30 2e 63 6f 6c 30 20 2d 20 32 20 41 53 20  or0.col0 - 2 AS 
9650: 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 63  col0 FROM tab2 c
9660: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33 35 0d 0a  or0..----..135..
9670: 33 36 0d 0a 39 34 0d 0a 0d 0a 71 75 65 72 79 20  36..94....query 
9680: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
9690: 54 20 2b 20 38 35 20 2b 20 2d 20 63 6f 6c 30 20  T + 85 + - col0 
96a0: 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a  FROM tab1 cor0..
96b0: 2d 2d 2d 2d 0d 0a 32 31 0d 0a 35 0d 0a 38 32 0d  ----..21..5..82.
96c0: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
96d0: 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
96e0: 4e 43 54 20 2b 20 63 6f 6c 31 20 2a 20 2b 20 63  NCT + col1 * + c
96f0: 6f 72 30 2e 63 6f 6c 30 20 46 52 4f 4d 20 74 61  or0.col0 FROM ta
9700: 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
9710: 0d 0a 31 33 34 33 0d 0a 32 31 37 0d 0a 34 36 30  ..1343..217..460
9720: 32 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74  2....skipif post
9730: 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65  gresql # Postgre
9740: 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20  SQL requires AS 
9750: 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75  when renaming ou
9760: 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75  tput columns..qu
9770: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
9780: 45 4c 45 43 54 20 41 4c 4c 20 2b 20 2b 20 63 6f  ELECT ALL + + co
9790: 6c 30 20 2a 20 63 6f 6c 31 20 63 6f 6c 30 20 46  l0 * col1 col0 F
97a0: 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
97b0: 0d 0a 2d 2d 2d 2d 0d 0a 31 30 34 30 0d 0a 36 34  ..----..1040..64
97c0: 30 0d 0a 37 38 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  0..78....onlyif 
97d0: 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20  mysql # use DIV 
97e0: 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74  operator for int
97f0: 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71  eger division..q
9800: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
9810: 61 62 65 6c 2d 32 36 38 0d 0a 53 45 4c 45 43 54  abel-268..SELECT
9820: 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 32 20 2b   DISTINCT col2 +
9830: 20 2b 20 63 6f 6c 32 20 44 49 56 20 2b 20 63 6f   + col2 DIV + co
9840: 6c 31 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  l1 AS col0 FROM 
9850: 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab2 cor0..----.
9860: 0a 32 36 0d 0a 32 37 0d 0a 34 30 0d 0a 0d 0a 73  .26..27..40....s
9870: 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
9880: 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
9890: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
98a0: 62 65 6c 2d 32 36 38 0d 0a 53 45 4c 45 43 54 20  bel-268..SELECT 
98b0: 44 49 53 54 49 4e 43 54 20 63 6f 6c 32 20 2b 20  DISTINCT col2 + 
98c0: 2b 20 63 6f 6c 32 20 2f 20 2b 20 63 6f 6c 31 20  + col2 / + col1 
98d0: 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
98e0: 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 36  2 cor0..----..26
98f0: 0d 0a 32 37 0d 0a 34 30 0d 0a 0d 0a 71 75 65 72  ..27..40....quer
9900: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
9910: 45 43 54 20 2b 20 36 31 20 2b 20 63 6f 6c 30 20  ECT + 61 + col0 
9920: 2b 20 2b 20 32 31 20 41 53 20 63 6f 6c 31 20 46  + + 21 AS col1 F
9930: 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
9940: 0d 0a 2d 2d 2d 2d 0d 0a 31 34 36 0d 0a 31 36 32  ..----..146..162
9950: 0d 0a 38 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..85....query I 
9960: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
9970: 2d 20 63 6f 72 30 2e 63 6f 6c 31 20 2a 20 2b 20  - cor0.col1 * + 
9980: 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46 52 4f  col2 AS col1 FRO
9990: 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
99a0: 2d 2d 2d 2d 0d 0a 2d 31 35 33 34 0d 0a 2d 36 34  ----..-1534..-64
99b0: 36 0d 0a 2d 38 33 37 0d 0a 0d 0a 71 75 65 72 79  6..-837....query
99c0: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
99d0: 43 54 20 2d 20 37 36 20 2b 20 63 6f 6c 31 20 41  CT - 76 + col1 A
99e0: 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32  S col0 FROM tab2
99f0: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
9a00: 2d 31 37 0d 0a 2d 34 35 0d 0a 2d 35 39 0d 0a 0d  -17..-45..-59...
9a10: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
9a20: 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
9a30: 54 20 2d 20 63 6f 6c 30 20 2b 20 63 6f 6c 31 20  T - col0 + col1 
9a40: 2d 20 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46  - col2 AS col1 F
9a50: 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
9a60: 0d 0a 2d 2d 2d 2d 0d 0a 2d 38 30 0d 0a 32 39 0d  ..----..-80..29.
9a70: 0a 36 31 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f  .61....skipif po
9a80: 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67  stgresql # Postg
9a90: 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41  reSQL requires A
9aa0: 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20  S when renaming 
9ab0: 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a  output columns..
9ac0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
9ad0: 0a 53 45 4c 45 43 54 20 2b 20 2d 20 36 32 20 2a  .SELECT + - 62 *
9ae0: 20 63 6f 6c 31 20 63 6f 6c 31 20 46 52 4f 4d 20   col1 col1 FROM 
9af0: 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
9b00: 2d 2d 0d 0a 2d 31 30 35 34 0d 0a 2d 31 39 32 32  --..-1054..-1922
9b10: 0d 0a 2d 33 36 35 38 0d 0a 0d 0a 71 75 65 72 79  ..-3658....query
9b20: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
9b30: 43 54 20 34 34 20 2a 20 63 6f 6c 30 20 2b 20 34  CT 44 * col0 + 4
9b40: 20 2b 20 2d 20 38 30 20 2a 20 2d 20 63 6f 6c 32   + - 80 * - col2
9b50: 20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d   FROM tab1 cor0.
9b60: 0a 2d 2d 2d 2d 0d 0a 31 31 32 30 34 0d 0a 34 34  .----..11204..44
9b70: 35 36 0d 0a 37 33 38 30 0d 0a 0d 0a 71 75 65 72  56..7380....quer
9b80: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
9b90: 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 2b  ECT DISTINCT + +
9ba0: 20 32 31 20 46 52 4f 4d 20 74 61 62 32 20 63 6f   21 FROM tab2 co
9bb0: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 31 0d 0a 0d 0a  r0..----..21....
9bc0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
9bd0: 0a 53 45 4c 45 43 54 20 74 61 62 30 2e 63 6f 6c  .SELECT tab0.col
9be0: 30 20 2b 20 28 20 38 34 20 29 20 46 52 4f 4d 20  0 + ( 84 ) FROM 
9bf0: 74 61 62 30 2c 20 74 61 62 31 20 41 53 20 63 6f  tab0, tab1 AS co
9c00: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75  r0..----..9 valu
9c10: 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 33 66  es hashing to 3f
9c20: 37 33 30 61 64 62 30 31 32 35 34 31 30 62 34 37  730adb0125410b47
9c30: 64 65 39 66 37 63 32 39 39 30 34 32 65 63 0d 0a  de9f7c299042ec..
9c40: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
9c50: 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2d 20 63 6f  t..SELECT + - co
9c60: 6c 30 20 2b 20 2b 20 63 6f 6c 30 20 2b 20 2d 20  l0 + + col0 + - 
9c70: 28 20 2d 20 37 36 20 2a 20 63 6f 6c 32 20 29 20  ( - 76 * col2 ) 
9c80: 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
9c90: 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
9ca0: 0a 34 31 30 34 0d 0a 34 33 33 32 0d 0a 37 32 39  .4104..4332..729
9cb0: 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  6....query I row
9cc0: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 36  sort..SELECT + 6
9cd0: 31 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  1 AS col0 FROM t
9ce0: 61 62 32 2c 20 74 61 62 32 20 41 53 20 63 6f 72  ab2, tab2 AS cor
9cf0: 30 2c 20 74 61 62 31 20 41 53 20 63 6f 72 31 0d  0, tab1 AS cor1.
9d00: 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75 65 73  .----..27 values
9d10: 20 68 61 73 68 69 6e 67 20 74 6f 20 38 64 34 64   hashing to 8d4d
9d20: 66 65 36 34 39 34 33 33 61 35 39 39 66 63 34 62  fe649433a599fc4b
9d30: 31 30 38 33 30 63 63 37 63 65 35 35 0d 0a 0d 0a  10830cc7ce55....
9d40: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
9d50: 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 32 20 2b  .SELECT + col2 +
9d60: 20 63 6f 72 30 2e 63 6f 6c 31 20 2a 20 2d 20 63   cor0.col1 * - c
9d70: 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  ol1 AS col2 FROM
9d80: 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
9d90: 2d 2d 2d 0d 0a 2d 34 33 0d 0a 2d 36 32 32 0d 0a  ---..-43..-622..
9da0: 2d 37 33 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f  -73....skipif po
9db0: 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67  stgresql # Postg
9dc0: 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41  reSQL requires A
9dd0: 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20  S when renaming 
9de0: 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a  output columns..
9df0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
9e00: 0a 53 45 4c 45 43 54 20 2b 20 2d 20 63 6f 6c 31  .SELECT + - col1
9e10: 20 2b 20 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c 32   + col2 * - col2
9e20: 20 2b 20 34 37 20 63 6f 6c 31 20 46 52 4f 4d 20   + 47 col1 FROM 
9e30: 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
9e40: 2d 2d 0d 0a 2d 31 34 31 34 0d 0a 2d 36 38 38 0d  --..-1414..-688.
9e50: 0a 2d 37 31 33 0d 0a 0d 0a 71 75 65 72 79 20 49  .-713....query I
9e60: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
9e70: 20 2b 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 2a   + + cor0.col2 *
9e80: 20 2d 20 38 30 20 46 52 4f 4d 20 74 61 62 31 20   - 80 FROM tab1 
9e90: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
9ea0: 34 33 32 30 0d 0a 2d 34 35 36 30 0d 0a 2d 37 36  4320..-4560..-76
9eb0: 38 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  80....onlyif mys
9ec0: 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65  ql # use DIV ope
9ed0: 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65  rator for intege
9ee0: 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72  r division..quer
9ef0: 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
9f00: 6c 2d 32 38 32 0d 0a 53 45 4c 45 43 54 20 63 6f  l-282..SELECT co
9f10: 6c 32 20 44 49 56 20 2d 20 28 20 2b 20 63 6f 6c  l2 DIV - ( + col
9f20: 31 20 29 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  1 ) AS col0 FROM
9f30: 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
9f40: 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a  ---..0..0..0....
9f50: 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
9f60: 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
9f70: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
9f80: 61 62 65 6c 2d 32 38 32 0d 0a 53 45 4c 45 43 54  abel-282..SELECT
9f90: 20 63 6f 6c 32 20 2f 20 2d 20 28 20 2b 20 63 6f   col2 / - ( + co
9fa0: 6c 31 20 29 20 41 53 20 63 6f 6c 30 20 46 52 4f  l1 ) AS col0 FRO
9fb0: 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
9fc0: 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d  ----..0..0..0...
9fd0: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
9fe0: 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 72 30 2e  ..SELECT + cor0.
9ff0: 63 6f 6c 31 20 2b 20 63 6f 6c 31 20 2b 20 33 36  col1 + col1 + 36
a000: 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
a010: 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
a020: 0d 0a 35 36 0d 0a 36 32 0d 0a 38 38 0d 0a 0d 0a  ..56..62..88....
a030: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
a040: 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 2b 20  .SELECT ALL + + 
a050: 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c 30 20 2b 20  col2 * - col0 + 
a060: 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 2b 20 39 32  + cor0.col0 + 92
a070: 20 2a 20 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20   * col2 AS col0 
a080: 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
a090: 30 0d 0a 2d 2d 2d 2d 0d 0a 32 32 36 38 0d 0a 33  0..----..2268..3
a0a0: 33 35 0d 0a 39 32 0d 0a 0d 0a 71 75 65 72 79 20  35..92....query 
a0b0: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
a0c0: 54 20 41 4c 4c 20 2b 20 63 6f 72 30 2e 63 6f 6c  T ALL + cor0.col
a0d0: 30 20 2a 20 63 6f 6c 30 20 2b 20 63 6f 6c 31 20  0 * col0 + col1 
a0e0: 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
a0f0: 30 0d 0a 2d 2d 2d 2d 0d 0a 33 35 0d 0a 34 31 30  0..----..35..410
a100: 36 0d 0a 36 34 31 33 0d 0a 0d 0a 71 75 65 72 79  6..6413....query
a110: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
a120: 43 54 20 44 49 53 54 49 4e 43 54 20 28 20 2d 20  CT DISTINCT ( - 
a130: 63 6f 6c 32 20 29 20 2b 20 63 6f 6c 32 20 2a 20  col2 ) + col2 * 
a140: 35 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  5 AS col0 FROM t
a150: 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
a160: 2d 0d 0a 31 30 34 0d 0a 31 30 38 0d 0a 31 35 32  -..104..108..152
a170: 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
a180: 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61   # use DIV opera
a190: 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20  tor for integer 
a1a0: 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20  division..query 
a1b0: 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
a1c0: 32 38 37 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  287..SELECT ALL 
a1d0: 31 38 20 2b 20 63 6f 6c 31 20 44 49 56 20 2b 20  18 + col1 DIV + 
a1e0: 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46 52 4f  col0 AS col2 FRO
a1f0: 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
a200: 2d 2d 2d 2d 0d 0a 31 38 0d 0a 31 38 0d 0a 32 32  ----..18..18..22
a210: 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
a220: 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
a230: 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
a240: 72 74 20 6c 61 62 65 6c 2d 32 38 37 0d 0a 53 45  rt label-287..SE
a250: 4c 45 43 54 20 41 4c 4c 20 31 38 20 2b 20 63 6f  LECT ALL 18 + co
a260: 6c 31 20 2f 20 2b 20 63 6f 6c 30 20 41 53 20 63  l1 / + col0 AS c
a270: 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol2 FROM tab2 AS
a280: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 38 0d   cor0..----..18.
a290: 0a 31 38 0d 0a 32 32 0d 0a 0d 0a 6f 6e 6c 79 69  .18..22....onlyi
a2a0: 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72  f mysql # suppor
a2b0: 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63  t for MySQL spec
a2c0: 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65  ific system type
a2d0: 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75  s and syntax..qu
a2e0: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
a2f0: 62 65 6c 2d 32 38 38 0d 0a 53 45 4c 45 43 54 20  bel-288..SELECT 
a300: 2d 20 2d 20 43 41 53 54 28 20 4e 55 4c 4c 20 41  - - CAST( NULL A
a310: 53 20 53 49 47 4e 45 44 20 29 20 2a 20 31 39 20  S SIGNED ) * 19 
a320: 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
a330: 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55  0 cor0..----..NU
a340: 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a  LL..NULL..NULL..
a350: 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
a360: 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
a370: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
a380: 20 6c 61 62 65 6c 2d 32 38 38 0d 0a 53 45 4c 45   label-288..SELE
a390: 43 54 20 2d 20 2d 20 43 41 53 54 20 28 20 4e 55  CT - - CAST ( NU
a3a0: 4c 4c 20 41 53 20 49 4e 54 45 47 45 52 20 29 20  LL AS INTEGER ) 
a3b0: 2a 20 31 39 20 41 53 20 63 6f 6c 31 20 46 52 4f  * 19 AS col1 FRO
a3c0: 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab0 cor0..---
a3d0: 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e  -..NULL..NULL..N
a3e0: 55 4c 4c 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  ULL....query I r
a3f0: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
a400: 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c 32 20 2a  ISTINCT + col2 *
a410: 20 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c 31 20 41   col0 * + col1 A
a420: 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30  S col1 FROM tab0
a430: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
a440: 33 33 39 35 0d 0a 36 36 34 31 31 38 0d 0a 36 38  3395..664118..68
a450: 31 31 32 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f  112....skipif po
a460: 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67  stgresql # Postg
a470: 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41  reSQL requires A
a480: 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20  S when renaming 
a490: 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a  output columns..
a4a0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
a4b0: 0a 53 45 4c 45 43 54 20 63 6f 6c 32 20 2a 20 63  .SELECT col2 * c
a4c0: 6f 6c 30 20 2b 20 2d 20 63 6f 6c 31 20 63 6f 6c  ol0 + - col1 col
a4d0: 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  1 FROM tab0 AS c
a4e0: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 36 32 0d 0a  or0..----..-62..
a4f0: 37 30 36 0d 0a 37 32 30 37 0d 0a 0d 0a 6f 6e 6c  706..7207....onl
a500: 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20  yif mysql # use 
a510: 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72  DIV operator for
a520: 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f   integer divisio
a530: 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  n..query I rowso
a540: 72 74 20 6c 61 62 65 6c 2d 32 39 31 0d 0a 53 45  rt label-291..SE
a550: 4c 45 43 54 20 2b 20 63 6f 6c 32 20 44 49 56 20  LECT + col2 DIV 
a560: 2b 20 28 20 2d 20 63 6f 6c 30 20 29 20 2b 20 2d  + ( - col0 ) + -
a570: 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20   col0 FROM tab1 
a580: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
a590: 32 31 0d 0a 2d 36 34 0d 0a 2d 38 31 0d 0a 0d 0a  21..-64..-81....
a5a0: 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
a5b0: 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
a5c0: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
a5d0: 61 62 65 6c 2d 32 39 31 0d 0a 53 45 4c 45 43 54  abel-291..SELECT
a5e0: 20 2b 20 63 6f 6c 32 20 2f 20 2b 20 28 20 2d 20   + col2 / + ( - 
a5f0: 63 6f 6c 30 20 29 20 2b 20 2d 20 63 6f 6c 30 20  col0 ) + - col0 
a600: 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
a610: 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 31 0d 0a 2d 36  0..----..-21..-6
a620: 34 0d 0a 2d 38 31 0d 0a 0d 0a 71 75 65 72 79 20  4..-81....query 
a630: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
a640: 54 20 44 49 53 54 49 4e 43 54 20 2b 20 74 61 62  T DISTINCT + tab
a650: 32 2e 63 6f 6c 30 20 2d 20 63 6f 6c 31 20 2a 20  2.col0 - col1 * 
a660: 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 0d 0a  col1 FROM tab2..
a670: 2d 2d 2d 2d 0d 0a 2d 32 31 30 0d 0a 2d 33 34 30  ----..-210..-340
a680: 33 0d 0a 2d 39 35 34 0d 0a 0d 0a 71 75 65 72 79  3..-954....query
a690: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
a6a0: 43 54 20 2d 20 63 6f 6c 30 20 2b 20 2b 20 28 20  CT - col0 + + ( 
a6b0: 2b 20 31 30 20 29 20 41 53 20 63 6f 6c 30 20 46  + 10 ) AS col0 F
a6c0: 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab2..----..
a6d0: 2d 36 38 0d 0a 2d 36 39 0d 0a 33 0d 0a 0d 0a 71  -68..-69..3....q
a6e0: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
a6f0: 53 45 4c 45 43 54 20 2d 20 2d 20 32 20 2b 20 2b  SELECT - - 2 + +
a700: 20 28 20 63 6f 6c 32 20 29 20 46 52 4f 4d 20 74   ( col2 ) FROM t
a710: 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
a720: 2d 0d 0a 35 36 0d 0a 35 39 0d 0a 39 38 0d 0a 0d  -..56..59..98...
a730: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
a740: 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
a750: 54 20 2d 20 2b 20 37 30 20 2b 20 63 6f 6c 31 20  T - + 70 + col1 
a760: 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
a770: 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
a780: 0a 31 36 0d 0a 32 31 0d 0a 32 37 0d 0a 0d 0a 71  .16..21..27....q
a790: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
a7a0: 53 45 4c 45 43 54 20 2d 20 2d 20 63 6f 72 30 2e  SELECT - - cor0.
a7b0: 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c 32 20 2d 20  col0 * + col2 - 
a7c0: 2d 20 63 6f 6c 32 20 2a 20 38 31 20 41 53 20 63  - col2 * 81 AS c
a7d0: 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol2 FROM tab0 AS
a7e0: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 36   cor0..----..116
a7f0: 0d 0a 31 33 39 34 30 0d 0a 33 34 36 35 0d 0a 0d  ..13940..3465...
a800: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
a810: 0d 0a 53 45 4c 45 43 54 20 35 32 20 2b 20 2b 20  ..SELECT 52 + + 
a820: 63 6f 72 30 2e 63 6f 6c 30 20 41 53 20 63 6f 6c  cor0.col0 AS col
a830: 31 20 46 52 4f 4d 20 74 61 62 32 2c 20 74 61 62  1 FROM tab2, tab
a840: 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
a850: 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e  .9 values hashin
a860: 67 20 74 6f 20 37 61 35 33 63 62 30 65 65 66 62  g to 7a53cb0eefb
a870: 61 62 61 34 33 32 61 61 32 39 32 37 31 63 61 66  aba432aa29271caf
a880: 33 65 37 31 39 0d 0a 0d 0a 71 75 65 72 79 20 49  3e719....query I
a890: 49 49 49 49 49 49 49 49 49 49 49 49 49 49 20 72  IIIIIIIIIIIIII r
a8a0: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
a8b0: 4c 4c 20 2a 20 46 52 4f 4d 20 74 61 62 30 2c 20  LL * FROM tab0, 
a8c0: 74 61 62 32 20 41 53 20 63 6f 72 30 20 43 52 4f  tab2 AS cor0 CRO
a8d0: 53 53 20 4a 4f 49 4e 20 74 61 62 32 2c 20 74 61  SS JOIN tab2, ta
a8e0: 62 31 2c 20 74 61 62 32 20 41 53 20 63 6f 72 31  b1, tab2 AS cor1
a8f0: 0d 0a 2d 2d 2d 2d 0d 0a 33 36 34 35 20 76 61 6c  ..----..3645 val
a900: 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 36  ues hashing to 6
a910: 37 32 36 61 31 35 30 31 39 63 35 32 39 30 38 66  726a15019c52908f
a920: 31 66 31 64 30 64 66 30 63 64 34 63 31 62 38 0d  1f1d0df0cd4c1b8.
a930: 0a 0d 0a 71 75 65 72 79 20 49 49 49 20 72 6f 77  ...query III row
a940: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
a950: 20 2a 20 46 52 4f 4d 20 74 61 62 31 20 57 48 45   * FROM tab1 WHE
a960: 52 45 20 4e 4f 54 20 4e 55 4c 4c 20 3c 20 63 6f  RE NOT NULL < co
a970: 6c 32 20 2b 20 2b 20 63 6f 6c 31 0d 0a 2d 2d 2d  l2 + + col1..---
a980: 2d 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  -....query I row
a990: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c  sort..SELECT col
a9a0: 32 20 2d 20 63 6f 6c 30 20 2a 20 63 6f 6c 32 20  2 - col0 * col2 
a9b0: 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
a9c0: 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 38 0d 0a 2d  1..----..-108..-
a9d0: 33 35 39 31 0d 0a 2d 37 35 38 34 0d 0a 0d 0a 71  3591..-7584....q
a9e0: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
a9f0: 53 45 4c 45 43 54 20 63 6f 6c 30 20 2a 20 2d 20  SELECT col0 * - 
aa00: 63 6f 6c 32 20 2b 20 63 6f 6c 32 20 41 53 20 63  col2 + col2 AS c
aa10: 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d  ol1 FROM tab2..-
aa20: 2d 2d 2d 0d 0a 2d 31 36 32 0d 0a 2d 32 30 30 32  ---..-162..-2002
aa30: 0d 0a 2d 32 39 36 34 0d 0a 0d 0a 71 75 65 72 79  ..-2964....query
aa40: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
aa50: 43 54 20 41 4c 4c 20 63 6f 6c 32 20 2b 20 74 61  CT ALL col2 + ta
aa60: 62 30 2e 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c 31  b0.col0 * + col1
aa70: 20 2a 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20   * col0 AS col0 
aa80: 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d  FROM tab0..----.
aa90: 0a 31 31 38 38 32 36 0d 0a 34 39 35 36 39 0d 0a  .118826..49569..
aaa0: 37 32 30 38 39 33 0d 0a 0d 0a 6f 6e 6c 79 69 66  720893....onlyif
aab0: 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56   mysql # use DIV
aac0: 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e   operator for in
aad0: 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a  teger division..
aae0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
aaf0: 6c 61 62 65 6c 2d 33 30 33 0d 0a 53 45 4c 45 43  label-303..SELEC
ab00: 54 20 2d 20 63 6f 6c 30 20 44 49 56 20 2d 20 63  T - col0 DIV - c
ab10: 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  ol0 AS col0 FROM
ab20: 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 0d 0a   tab2..----..1..
ab30: 31 0d 0a 31 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  1..1....skipif m
ab40: 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
ab50: 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
ab60: 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 33 30 33  owsort label-303
ab70: 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 30 20  ..SELECT - col0 
ab80: 2f 20 2d 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30  / - col0 AS col0
ab90: 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d   FROM tab2..----
aba0: 0d 0a 31 0d 0a 31 0d 0a 31 0d 0a 0d 0a 71 75 65  ..1..1..1....que
abb0: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
abc0: 4c 45 43 54 20 63 6f 6c 31 20 2b 20 63 6f 6c 30  LECT col1 + col0
abd0: 20 46 52 4f 4d 20 74 61 62 30 20 57 48 45 52 45   FROM tab0 WHERE
abe0: 20 4e 4f 54 20 28 20 4e 55 4c 4c 20 29 20 3c 20   NOT ( NULL ) < 
abf0: 63 6f 6c 31 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a 71 75  col1..----....qu
ac00: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
ac10: 45 4c 45 43 54 20 2b 20 63 6f 6c 30 20 2a 20 2b  ELECT + col0 * +
ac20: 20 63 6f 6c 32 20 2b 20 2b 20 63 6f 6c 30 20 46   col2 + + col0 F
ac30: 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab1..----..
ac40: 31 36 35 0d 0a 33 37 31 32 0d 0a 37 37 36 30 0d  165..3712..7760.
ac50: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
ac60: 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 32 20  rt..SELECT col2 
ac70: 2a 20 2d 20 63 6f 6c 30 20 2b 20 63 6f 6c 30 20  * - col0 + col0 
ac80: 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d  FROM tab0..----.
ac90: 0a 2d 37 32 30 39 0d 0a 2d 37 36 38 0d 0a 30 0d  .-7209..-768..0.
aca0: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
acb0: 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
acc0: 4e 43 54 20 2d 20 74 61 62 32 2e 63 6f 6c 31 20  NCT - tab2.col1 
acd0: 2a 20 63 6f 6c 31 20 2b 20 63 6f 6c 32 20 41 53  * col1 + col2 AS
ace0: 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 0d   col2 FROM tab2.
acf0: 0a 2d 2d 2d 2d 0d 0a 2d 32 35 31 0d 0a 2d 33 34  .----..-251..-34
ad00: 35 35 0d 0a 2d 39 33 34 0d 0a 0d 0a 71 75 65 72  55..-934....quer
ad10: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
ad20: 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 74  ECT DISTINCT - t
ad30: 61 62 30 2e 63 6f 6c 32 20 2b 20 2d 20 74 61 62  ab0.col2 + - tab
ad40: 30 2e 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46  0.col2 AS col2 F
ad50: 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab0..----..
ad60: 2d 31 36 34 0d 0a 2d 32 0d 0a 2d 36 36 0d 0a 0d  -164..-2..-66...
ad70: 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
ad80: 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72  use DIV operator
ad90: 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76   for integer div
ada0: 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72  ision..query I r
adb0: 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 33 30 39  owsort label-309
adc0: 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c  ..SELECT ALL col
add0: 30 20 2a 20 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c  0 * col0 + + col
ade0: 30 20 44 49 56 20 63 6f 6c 31 20 46 52 4f 4d 20  0 DIV col1 FROM 
adf0: 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 34 31 30 32  tab1..----..4102
ae00: 0d 0a 36 34 30 36 0d 0a 39 0d 0a 0d 0a 73 6b 69  ..6406..9....ski
ae10: 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
ae20: 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
ae30: 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
ae40: 6c 2d 33 30 39 0d 0a 53 45 4c 45 43 54 20 41 4c  l-309..SELECT AL
ae50: 4c 20 63 6f 6c 30 20 2a 20 63 6f 6c 30 20 2b 20  L col0 * col0 + 
ae60: 2b 20 63 6f 6c 30 20 2f 20 63 6f 6c 31 20 46 52  + col0 / col1 FR
ae70: 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 34  OM tab1..----..4
ae80: 31 30 32 0d 0a 36 34 30 36 0d 0a 39 0d 0a 0d 0a  102..6406..9....
ae90: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
aea0: 0a 53 45 4c 45 43 54 20 74 61 62 30 2e 63 6f 6c  .SELECT tab0.col
aeb0: 31 20 2a 20 2b 20 63 6f 6c 32 20 41 53 20 63 6f  1 * + col2 AS co
aec0: 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d  l0 FROM tab0..--
aed0: 2d 2d 0d 0a 32 38 33 38 0d 0a 37 34 36 32 0d 0a  --..2838..7462..
aee0: 39 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  97....query I ro
aef0: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
af00: 53 54 49 4e 43 54 20 63 6f 6c 31 20 2a 20 2b 20  STINCT col1 * + 
af10: 63 6f 6c 32 20 2a 20 63 6f 6c 30 20 46 52 4f 4d  col2 * col0 FROM
af20: 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 33 33 39   tab0..----..339
af30: 35 0d 0a 36 36 34 31 31 38 0d 0a 36 38 31 31 32  5..664118..68112
af40: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
af50: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 30  ort..SELECT col0
af60: 20 46 52 4f 4d 20 74 61 62 31 20 57 48 45 52 45   FROM tab1 WHERE
af70: 20 4e 4f 54 20 4e 55 4c 4c 20 4e 4f 54 20 49 4e   NOT NULL NOT IN
af80: 20 28 20 2d 20 63 6f 6c 30 20 29 0d 0a 2d 2d 2d   ( - col0 )..---
af90: 2d 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  -....query I row
afa0: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63  sort..SELECT + c
afb0: 6f 6c 30 20 2b 20 63 6f 6c 31 20 2a 20 63 6f 6c  ol0 + col1 * col
afc0: 31 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  1 AS col0 FROM t
afd0: 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 36 34 0d 0a  ab1..----..164..
afe0: 32 34 39 0d 0a 36 37 39 0d 0a 0d 0a 71 75 65 72  249..679....quer
aff0: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
b000: 45 43 54 20 63 6f 6c 32 20 2b 20 2d 20 63 6f 6c  ECT col2 + - col
b010: 31 20 2d 20 74 61 62 31 2e 63 6f 6c 32 20 46 52  1 - tab1.col2 FR
b020: 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d  OM tab1..----..-
b030: 31 30 0d 0a 2d 31 33 0d 0a 2d 32 36 0d 0a 0d 0a  10..-13..-26....
b040: 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71  skipif postgresq
b050: 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72  l # PostgreSQL r
b060: 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20  equires AS when 
b070: 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20  renaming output 
b080: 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49  columns..query I
b090: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
b0a0: 20 2d 20 63 6f 6c 31 20 63 6f 6c 32 20 46 52 4f   - col1 col2 FRO
b0b0: 4d 20 74 61 62 30 20 57 48 45 52 45 20 4e 4f 54  M tab0 WHERE NOT
b0c0: 20 4e 55 4c 4c 20 42 45 54 57 45 45 4e 20 28 20   NULL BETWEEN ( 
b0d0: 4e 55 4c 4c 20 29 20 41 4e 44 20 28 20 63 6f 6c  NULL ) AND ( col
b0e0: 32 20 29 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a 71 75 65  2 )..----....que
b0f0: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
b100: 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 32 20 2a 20  LECT ALL col2 * 
b110: 2b 20 74 61 62 32 2e 63 6f 6c 31 20 41 53 20 63  + tab2.col1 AS c
b120: 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d  ol1 FROM tab2..-
b130: 2d 2d 2d 0d 0a 31 35 33 34 0d 0a 36 34 36 0d 0a  ---..1534..646..
b140: 38 33 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  837....query I r
b150: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
b160: 20 74 61 62 30 2e 63 6f 6c 32 20 2a 20 2b 20 63   tab0.col2 * + c
b170: 6f 6c 31 20 2b 20 2b 20 63 6f 6c 32 20 2b 20 2b  ol1 + + col2 + +
b180: 20 74 61 62 30 2e 63 6f 6c 32 20 41 53 20 63 6f   tab0.col2 AS co
b190: 6c 32 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d  l2 FROM tab0..--
b1a0: 2d 2d 0d 0a 32 39 30 34 0d 0a 37 36 32 36 0d 0a  --..2904..7626..
b1b0: 39 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  99....query I ro
b1c0: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f  wsort..SELECT co
b1d0: 6c 32 20 2a 20 63 6f 6c 30 20 2b 20 63 6f 6c 30  l2 * col0 + col0
b1e0: 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d   FROM tab1..----
b1f0: 0d 0a 31 36 35 0d 0a 33 37 31 32 0d 0a 37 37 36  ..165..3712..776
b200: 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74  0....skipif post
b210: 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65  gresql # Postgre
b220: 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20  SQL requires AS 
b230: 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75  when renaming ou
b240: 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75  tput columns..qu
b250: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
b260: 45 4c 45 43 54 20 63 6f 6c 31 20 2a 20 74 61 62  ELECT col1 * tab
b270: 30 2e 63 6f 6c 31 20 63 6f 6c 32 20 46 52 4f 4d  0.col1 col2 FROM
b280: 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 37 33 39   tab0..----..739
b290: 36 0d 0a 38 32 38 31 0d 0a 39 34 30 39 0d 0a 0d  6..8281..9409...
b2a0: 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73  .skipif postgres
b2b0: 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20  ql # PostgreSQL 
b2c0: 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e  requires AS when
b2d0: 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74   renaming output
b2e0: 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20   columns..query 
b2f0: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
b300: 54 20 41 4c 4c 20 63 6f 6c 31 20 2b 20 74 61 62  T ALL col1 + tab
b310: 32 2e 63 6f 6c 31 20 2b 20 63 6f 6c 31 20 2a 20  2.col1 + col1 * 
b320: 2d 20 63 6f 6c 30 20 63 6f 6c 31 20 46 52 4f 4d  - col0 col1 FROM
b330: 20 74 61 62 32 20 57 48 45 52 45 20 4e 55 4c 4c   tab2 WHERE NULL
b340: 20 4e 4f 54 20 49 4e 20 28 20 2b 20 63 6f 6c 30   NOT IN ( + col0
b350: 20 29 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a 71 75 65 72   )..----....quer
b360: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
b370: 45 43 54 20 63 6f 6c 31 20 41 53 20 63 6f 6c 30  ECT col1 AS col0
b380: 20 46 52 4f 4d 20 74 61 62 32 20 57 48 45 52 45   FROM tab2 WHERE
b390: 20 4e 55 4c 4c 20 49 4e 20 28 20 63 6f 6c 31 20   NULL IN ( col1 
b3a0: 2b 20 2d 20 63 6f 6c 31 20 29 0d 0a 2d 2d 2d 2d  + - col1 )..----
b3b0: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
b3c0: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 30  ort..SELECT col0
b3d0: 20 2a 20 63 6f 6c 30 20 2b 20 63 6f 6c 32 20 41   * col0 + col2 A
b3e0: 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30  S col2 FROM tab0
b3f0: 0d 0a 2d 2d 2d 2d 0d 0a 31 32 32 36 0d 0a 36 30  ..----..1226..60
b400: 39 0d 0a 38 30 30 33 0d 0a 0d 0a 73 6b 69 70 69  9..8003....skipi
b410: 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50  f postgresql # P
b420: 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72  ostgreSQL requir
b430: 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d  es AS when renam
b440: 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d  ing output colum
b450: 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ns..query I rows
b460: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 31  ort..SELECT col1
b470: 20 2a 20 2d 20 63 6f 6c 32 20 63 6f 6c 31 20 46   * - col2 col1 F
b480: 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab0..----..
b490: 2d 32 38 33 38 0d 0a 2d 37 34 36 32 0d 0a 2d 39  -2838..-7462..-9
b4a0: 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  7....query I row
b4b0: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
b4c0: 54 49 4e 43 54 20 2b 20 63 6f 6c 30 20 2a 20 2d  TINCT + col0 * -
b4d0: 20 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c 31 20 2b   col2 * - col1 +
b4e0: 20 2b 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62   + col2 FROM tab
b4f0: 32 0d 0a 2d 2d 2d 2d 0d 0a 31 31 39 36 37 38 0d  2..----..119678.
b500: 0a 35 31 30 37 32 0d 0a 35 38 38 36 0d 0a 0d 0a  .51072..5886....
b510: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
b520: 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
b530: 20 63 6f 6c 31 20 2f 20 2b 20 63 6f 6c 31 20 46   col1 / + col1 F
b540: 52 4f 4d 20 74 61 62 32 20 57 48 45 52 45 20 63  ROM tab2 WHERE c
b550: 6f 6c 32 20 49 4e 20 28 20 2d 20 63 6f 6c 32 20  ol2 IN ( - col2 
b560: 29 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a 6f 6e 6c 79 69  )..----....onlyi
b570: 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49  f mysql # use DI
b580: 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69  V operator for i
b590: 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d  nteger division.
b5a0: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
b5b0: 20 6c 61 62 65 6c 2d 33 32 36 0d 0a 53 45 4c 45   label-326..SELE
b5c0: 43 54 20 2d 20 63 6f 6c 30 20 2b 20 2b 20 63 6f  CT - col0 + + co
b5d0: 6c 30 20 44 49 56 20 2d 20 63 6f 6c 31 20 41 53  l0 DIV - col1 AS
b5e0: 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20   col0 FROM tab2 
b5f0: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
b600: 37 0d 0a 2d 37 39 0d 0a 2d 38 33 0d 0a 0d 0a 73  7..-79..-83....s
b610: 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
b620: 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
b630: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
b640: 62 65 6c 2d 33 32 36 0d 0a 53 45 4c 45 43 54 20  bel-326..SELECT 
b650: 2d 20 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c 30 20  - col0 + + col0 
b660: 2f 20 2d 20 63 6f 6c 31 20 41 53 20 63 6f 6c 30  / - col1 AS col0
b670: 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
b680: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 37 0d 0a 2d 37  r0..----..-7..-7
b690: 39 0d 0a 2d 38 33 0d 0a 0d 0a 6f 6e 6c 79 69 66  9..-83....onlyif
b6a0: 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56   mysql # use DIV
b6b0: 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e   operator for in
b6c0: 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a  teger division..
b6d0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
b6e0: 6c 61 62 65 6c 2d 33 32 37 0d 0a 53 45 4c 45 43  label-327..SELEC
b6f0: 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c  T DISTINCT + col
b700: 30 20 2a 20 63 6f 6c 31 20 44 49 56 20 74 61 62  0 * col1 DIV tab
b710: 31 2e 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46  1.col0 AS col1 F
b720: 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab1..----..
b730: 31 30 0d 0a 31 33 0d 0a 32 36 0d 0a 0d 0a 73 6b  10..13..26....sk
b740: 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
b750: 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
b760: 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
b770: 65 6c 2d 33 32 37 0d 0a 53 45 4c 45 43 54 20 44  el-327..SELECT D
b780: 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c 30 20 2a  ISTINCT + col0 *
b790: 20 63 6f 6c 31 20 2f 20 74 61 62 31 2e 63 6f 6c   col1 / tab1.col
b7a0: 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  0 AS col1 FROM t
b7b0: 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 30 0d 0a 31  ab1..----..10..1
b7c0: 33 0d 0a 32 36 0d 0a 0d 0a 73 6b 69 70 69 66 20  3..26....skipif 
b7d0: 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73  postgresql # Pos
b7e0: 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73  tgreSQL requires
b7f0: 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e   AS when renamin
b800: 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73  g output columns
b810: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
b820: 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f  t..SELECT ALL co
b830: 6c 32 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  l2 col0 FROM tab
b840: 31 20 57 48 45 52 45 20 4e 4f 54 20 4e 55 4c 4c  1 WHERE NOT NULL
b850: 20 4e 4f 54 20 49 4e 20 28 20 2d 20 63 6f 6c 30   NOT IN ( - col0
b860: 20 2a 20 2b 20 63 6f 6c 31 20 29 0d 0a 2d 2d 2d   * + col1 )..---
b870: 2d 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  -....query I row
b880: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 72  sort..SELECT cor
b890: 30 2e 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c 30 20  0.col0 + + col0 
b8a0: 2a 20 2b 20 63 6f 6c 31 20 2a 20 63 6f 72 30 2e  * + col1 * cor0.
b8b0: 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46 52 4f  col1 AS col1 FRO
b8c0: 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
b8d0: 2d 2d 2d 2d 0d 0a 32 32 39 31 30 0d 0a 32 37 31  ----..22910..271
b8e0: 35 39 36 0d 0a 36 37 33 34 0d 0a 0d 0a 71 75 65  596..6734....que
b8f0: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
b900: 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 32 20 2a 20  LECT ALL col2 * 
b910: 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 41 53 20 63  + cor0.col0 AS c
b920: 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 63 6f  ol1 FROM tab2 co
b930: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 38 39 0d 0a 32  r0..----..189..2
b940: 30 32 38 0d 0a 33 30 30 32 0d 0a 0d 0a 71 75 65  028..3002....que
b950: 72 79 20 49 49 49 49 49 49 20 72 6f 77 73 6f 72  ry IIIIII rowsor
b960: 74 0d 0a 53 45 4c 45 43 54 20 2a 20 46 52 4f 4d  t..SELECT * FROM
b970: 20 74 61 62 30 2c 20 74 61 62 30 20 41 53 20 63   tab0, tab0 AS c
b980: 6f 72 30 20 57 48 45 52 45 20 4e 4f 54 20 4e 55  or0 WHERE NOT NU
b990: 4c 4c 20 3c 3d 20 4e 55 4c 4c 0d 0a 2d 2d 2d 2d  LL <= NULL..----
b9a0: 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
b9b0: 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61   # use DIV opera
b9c0: 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20  tor for integer 
b9d0: 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20  division..query 
b9e0: 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
b9f0: 33 33 32 0d 0a 53 45 4c 45 43 54 20 74 61 62 32  332..SELECT tab2
ba00: 2e 63 6f 6c 31 20 44 49 56 20 63 6f 6c 31 20 41  .col1 DIV col1 A
ba10: 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32  S col2 FROM tab2
ba20: 0d 0a 2d 2d 2d 2d 0d 0a 31 0d 0a 31 0d 0a 31 0d  ..----..1..1..1.
ba30: 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
ba40: 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
ba50: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
ba60: 74 20 6c 61 62 65 6c 2d 33 33 32 0d 0a 53 45 4c  t label-332..SEL
ba70: 45 43 54 20 74 61 62 32 2e 63 6f 6c 31 20 2f 20  ECT tab2.col1 / 
ba80: 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46 52 4f  col1 AS col2 FRO
ba90: 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 0d  M tab2..----..1.
baa0: 0a 31 0d 0a 31 0d 0a 0d 0a 71 75 65 72 79 20 49  .1..1....query I
bab0: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
bac0: 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 30 20 2b   DISTINCT col0 +
bad0: 20 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c 32 20 2b   col0 * + col2 +
bae0: 20 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52   col1 AS col0 FR
baf0: 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31  OM tab0..----..1
bb00: 36 37 0d 0a 37 34 37 38 0d 0a 39 30 32 0d 0a 0d  67..7478..902...
bb10: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
bb20: 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 30 20  ..SELECT + col0 
bb30: 2d 20 28 20 2b 20 63 6f 6c 32 20 29 20 41 53 20  - ( + col2 ) AS 
bb40: 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41  col1 FROM tab1 A
bb50: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
bb60: 36 0d 0a 2d 35 31 0d 0a 37 0d 0a 0d 0a 6f 6e 6c  6..-51..7....onl
bb70: 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20  yif mysql # use 
bb80: 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72  DIV operator for
bb90: 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f   integer divisio
bba0: 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  n..query I rowso
bbb0: 72 74 20 6c 61 62 65 6c 2d 33 33 35 0d 0a 53 45  rt label-335..SE
bbc0: 4c 45 43 54 20 2b 20 2d 20 63 6f 6c 30 20 44 49  LECT + - col0 DI
bbd0: 56 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61  V + col1 FROM ta
bbe0: 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
bbf0: 0d 0a 2d 36 0d 0a 2d 36 0d 0a 30 0d 0a 0d 0a 73  ..-6..-6..0....s
bc00: 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
bc10: 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
bc20: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
bc30: 62 65 6c 2d 33 33 35 0d 0a 53 45 4c 45 43 54 20  bel-335..SELECT 
bc40: 2b 20 2d 20 63 6f 6c 30 20 2f 20 2b 20 63 6f 6c  + - col0 / + col
bc50: 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  1 FROM tab1 AS c
bc60: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 36 0d 0a 2d  or0..----..-6..-
bc70: 36 0d 0a 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20  6..0....query I 
bc80: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
bc90: 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c 31 20 2a 20  col0 + + col1 * 
bca0: 2b 20 74 61 62 32 2e 63 6f 6c 31 20 46 52 4f 4d  + tab2.col1 FROM
bcb0: 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 33 35 35   tab2..----..355
bcc0: 39 0d 0a 33 36 38 0d 0a 39 36 38 0d 0a 0d 0a 71  9..368..968....q
bcd0: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
bce0: 53 45 4c 45 43 54 20 2b 20 2b 20 63 6f 6c 31 20  SELECT + + col1 
bcf0: 2b 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 46 52  + + cor0.col1 FR
bd00: 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
bd10: 0a 2d 2d 2d 2d 0d 0a 31 31 38 0d 0a 33 34 0d 0a  .----..118..34..
bd20: 36 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  62....query I ro
bd30: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
bd40: 4c 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 2a 20  L - cor0.col2 * 
bd50: 2d 20 28 20 63 6f 72 30 2e 63 6f 6c 31 20 29 20  - ( cor0.col1 ) 
bd60: 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
bd70: 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32  1 cor0..----..12
bd80: 34 38 0d 0a 31 34 30 34 0d 0a 35 37 30 0d 0a 0d  48..1404..570...
bd90: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
bda0: 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63  ..SELECT ALL + c
bdb0: 6f 6c 30 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f  ol0 + col1 AS co
bdc0: 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l2 FROM tab1 AS 
bdd0: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 39 0d 0a  cor0..----..29..
bde0: 37 34 0d 0a 39 33 0d 0a 0d 0a 71 75 65 72 79 20  74..93....query 
bdf0: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
be00: 54 20 41 4c 4c 20 63 6f 72 30 2e 63 6f 6c 31 20  T ALL cor0.col1 
be10: 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46  + col1 AS col2 F
be20: 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
be30: 0d 0a 2d 2d 2d 2d 0d 0a 31 31 38 0d 0a 33 34 0d  ..----..118..34.
be40: 0a 36 32 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  .62....onlyif my
be50: 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70  sql # use DIV op
be60: 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67  erator for integ
be70: 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65  er division..que
be80: 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
be90: 65 6c 2d 33 34 31 0d 0a 53 45 4c 45 43 54 20 44  el-341..SELECT D
bea0: 49 53 54 49 4e 43 54 20 63 6f 6c 32 20 2b 20 63  ISTINCT col2 + c
beb0: 6f 6c 32 20 44 49 56 20 28 20 2d 20 63 6f 6c 31  ol2 DIV ( - col1
bec0: 20 29 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62   ) col0 FROM tab
bed0: 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
bee0: 0a 31 0d 0a 33 33 0d 0a 38 32 0d 0a 0d 0a 73 6b  .1..33..82....sk
bef0: 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20  ipif postgresql 
bf00: 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71  # PostgreSQL req
bf10: 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65  uires AS when re
bf20: 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f  naming output co
bf30: 6c 75 6d 6e 73 0d 0a 73 6b 69 70 69 66 20 6d 79  lumns..skipif my
bf40: 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
bf50: 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
bf60: 77 73 6f 72 74 20 6c 61 62 65 6c 2d 33 34 31 0d  wsort label-341.
bf70: 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
bf80: 20 63 6f 6c 32 20 2b 20 63 6f 6c 32 20 2f 20 28   col2 + col2 / (
bf90: 20 2d 20 63 6f 6c 31 20 29 20 63 6f 6c 30 20 46   - col1 ) col0 F
bfa0: 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
bfb0: 0d 0a 2d 2d 2d 2d 0d 0a 31 0d 0a 33 33 0d 0a 38  ..----..1..33..8
bfc0: 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  2....query I row
bfd0: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
bfe0: 20 2d 20 63 6f 72 30 2e 63 6f 6c 30 20 2a 20 2d   - cor0.col0 * -
bff0: 20 32 35 20 2b 20 2b 20 63 6f 6c 32 20 41 53 20   25 + + col2 AS 
c000: 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41  col0 FROM tab0 A
c010: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 33  S cor0..----..23
c020: 30 37 0d 0a 36 33 33 0d 0a 38 37 36 0d 0a 0d 0a  07..633..876....
c030: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
c040: 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
c050: 20 2d 20 2d 20 63 6f 72 30 2e 63 6f 6c 30 20 2b   - - cor0.col0 +
c060: 20 2d 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62   - col2 FROM tab
c070: 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  1 cor0..----..-1
c080: 36 0d 0a 2d 35 31 0d 0a 37 0d 0a 0d 0a 71 75 65  6..-51..7....que
c090: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
c0a0: 4c 45 43 54 20 63 6f 6c 32 20 2a 20 2b 20 63 6f  LECT col2 * + co
c0b0: 6c 32 20 2d 20 2d 20 63 6f 6c 30 20 2a 20 2b 20  l2 - - col0 * + 
c0c0: 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41  col1 FROM tab1 A
c0d0: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30  S cor0..----..10
c0e0: 32 35 36 0d 0a 32 39 39 34 0d 0a 33 38 38 39 0d  256..2994..3889.
c0f0: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
c100: 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c  rt..SELECT - col
c110: 32 20 2b 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20  2 + - cor0.col2 
c120: 2a 20 2d 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61  * - col2 FROM ta
c130: 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
c140: 0d 0a 31 34 30 36 0d 0a 36 35 30 0d 0a 37 30 32  ..1406..650..702
c150: 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
c160: 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61   # use DIV opera
c170: 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20  tor for integer 
c180: 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20  division..query 
c190: 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
c1a0: 33 34 36 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  346..SELECT ALL 
c1b0: 2b 20 63 6f 6c 31 20 44 49 56 20 2b 20 37 36 20  + col1 DIV + 76 
c1c0: 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
c1d0: 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30  0..----..0..0..0
c1e0: 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
c1f0: 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
c200: 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
c210: 72 74 20 6c 61 62 65 6c 2d 33 34 36 0d 0a 53 45  rt label-346..SE
c220: 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 31 20  LECT ALL + col1 
c230: 2f 20 2b 20 37 36 20 46 52 4f 4d 20 74 61 62 31  / + 76 FROM tab1
c240: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
c250: 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a 71 75 65 72 79  0..0..0....query
c260: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
c270: 43 54 20 2b 20 63 6f 6c 30 20 2a 20 63 6f 6c 30  CT + col0 * col0
c280: 20 2b 20 2d 20 28 20 63 6f 6c 31 20 29 20 2d 20   + - ( col1 ) - 
c290: 2b 20 38 37 20 2a 20 2b 20 63 6f 6c 32 20 2a 20  + 87 * + col2 * 
c2a0: 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41  col2 FROM tab0 A
c2b0: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 35  S cor0..----..-5
c2c0: 37 37 31 35 38 0d 0a 2d 39 34 32 35 33 0d 0a 31  77158..-94253..1
c2d0: 30 34 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  041....query I r
c2e0: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
c2f0: 4c 4c 20 2d 20 63 6f 6c 30 20 2a 20 2d 20 63 6f  LL - col0 * - co
c300: 6c 31 20 2b 20 28 20 2b 20 63 6f 72 30 2e 63 6f  l1 + ( + cor0.co
c310: 6c 32 20 29 20 2a 20 34 35 20 41 53 20 63 6f 6c  l2 ) * 45 AS col
c320: 32 20 46 52 4f 4d 20 74 61 62 32 20 63 6f 72 30  2 FROM tab2 cor0
c330: 0d 0a 2d 2d 2d 2d 0d 0a 31 34 33 32 0d 0a 33 30  ..----..1432..30
c340: 35 33 0d 0a 35 37 37 32 0d 0a 0d 0a 71 75 65 72  53..5772....quer
c350: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
c360: 45 43 54 20 44 49 53 54 49 4e 43 54 20 39 34 20  ECT DISTINCT 94 
c370: 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
c380: 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
c390: 0a 39 34 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  .94....onlyif my
c3a0: 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f  sql # support fo
c3b0: 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63  r MySQL specific
c3c0: 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e   system types an
c3d0: 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20  d syntax..query 
c3e0: 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
c3f0: 33 35 30 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  350..SELECT DIST
c400: 49 4e 43 54 20 2b 20 43 41 53 54 28 20 2d 20 63  INCT + CAST( - c
c410: 6f 6c 32 20 41 53 20 53 49 47 4e 45 44 20 29 20  ol2 AS SIGNED ) 
c420: 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
c430: 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
c440: 0a 2d 35 34 0d 0a 2d 35 37 0d 0a 2d 39 36 0d 0a  .-54..-57..-96..
c450: 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
c460: 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
c470: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
c480: 20 6c 61 62 65 6c 2d 33 35 30 0d 0a 53 45 4c 45   label-350..SELE
c490: 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 43 41  CT DISTINCT + CA
c4a0: 53 54 20 28 20 2d 20 63 6f 6c 32 20 41 53 20 49  ST ( - col2 AS I
c4b0: 4e 54 45 47 45 52 20 29 20 41 53 20 63 6f 6c 31  NTEGER ) AS col1
c4c0: 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
c4d0: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 34 0d 0a 2d  r0..----..-54..-
c4e0: 35 37 0d 0a 2d 39 36 0d 0a 0d 0a 71 75 65 72 79  57..-96....query
c4f0: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
c500: 43 54 20 41 4c 4c 20 28 20 2d 20 28 20 2d 20 63  CT ALL ( - ( - c
c510: 6f 72 30 2e 63 6f 6c 31 20 29 20 29 20 2a 20 2b  or0.col1 ) ) * +
c520: 20 28 20 63 6f 72 30 2e 63 6f 6c 31 20 29 20 46   ( cor0.col1 ) F
c530: 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
c540: 0d 0a 2d 2d 2d 2d 0d 0a 32 38 39 0d 0a 33 34 38  ..----..289..348
c550: 31 0d 0a 39 36 31 0d 0a 0d 0a 71 75 65 72 79 20  1..961....query 
c560: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
c570: 54 20 44 49 53 54 49 4e 43 54 20 2d 20 2d 20 63  T DISTINCT - - c
c580: 6f 6c 30 20 2b 20 28 20 63 6f 6c 30 20 2b 20 2d  ol0 + ( col0 + -
c590: 20 35 30 20 29 20 41 53 20 63 6f 6c 30 20 46 52   50 ) AS col0 FR
c5a0: 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
c5b0: 0a 2d 2d 2d 2d 0d 0a 2d 33 36 0d 0a 31 30 36 0d  .----..-36..106.
c5c0: 0a 31 30 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .108....query I 
c5d0: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
c5e0: 44 49 53 54 49 4e 43 54 20 2b 20 2d 20 63 6f 72  DISTINCT + - cor
c5f0: 30 2e 63 6f 6c 32 20 2b 20 63 6f 6c 32 20 46 52  0.col2 + col2 FR
c600: 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d  OM tab1 cor0..--
c610: 2d 2d 0d 0a 30 0d 0a 0d 0a 71 75 65 72 79 20 49  --..0....query I
c620: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
c630: 20 28 20 28 20 2b 20 63 6f 6c 30 20 29 20 29 20   ( ( + col0 ) ) 
c640: 2d 20 28 20 2b 20 32 35 20 29 20 41 53 20 63 6f  - ( + 25 ) AS co
c650: 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 63 6f 72  l1 FROM tab2 cor
c660: 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 38 0d 0a 35 33  0..----..-18..53
c670: 0d 0a 35 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..54....query I 
c680: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
c690: 41 4c 4c 20 63 6f 6c 30 20 2a 20 63 6f 6c 32 20  ALL col0 * col2 
c6a0: 2d 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31  - col1 FROM tab1
c6b0: 0d 0a 2d 2d 2d 2d 0d 0a 31 33 36 0d 0a 33 36 33  ..----..136..363
c6c0: 38 0d 0a 37 36 36 37 0d 0a 0d 0a 71 75 65 72 79  8..7667....query
c6d0: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
c6e0: 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 38 32  CT DISTINCT - 82
c6f0: 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
c700: 62 32 2c 20 74 61 62 31 20 41 53 20 63 6f 72 30  b2, tab1 AS cor0
c710: 2c 20 74 61 62 31 20 41 53 20 63 6f 72 31 0d 0a  , tab1 AS cor1..
c720: 2d 2d 2d 2d 0d 0a 2d 38 32 0d 0a 0d 0a 71 75 65  ----..-82....que
c730: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
c740: 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 28 20  LECT DISTINCT ( 
c750: 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 29 20 41 53  + cor0.col0 ) AS
c760: 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20   col0 FROM tab1 
c770: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33  AS cor0..----..3
c780: 0d 0a 36 34 0d 0a 38 30 0d 0a 0d 0a 71 75 65 72  ..64..80....quer
c790: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
c7a0: 45 43 54 20 33 36 20 2a 20 2d 20 63 6f 6c 31 20  ECT 36 * - col1 
c7b0: 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
c7c0: 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 30 39 36 0d 0a  0..----..-3096..
c7d0: 2d 33 32 37 36 0d 0a 2d 33 34 39 32 0d 0a 0d 0a  -3276..-3492....
c7e0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
c7f0: 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 30  .SELECT ALL col0
c800: 20 2a 20 2b 20 63 6f 6c 30 20 2b 20 63 6f 6c 32   * + col0 + col2
c810: 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d   FROM tab2..----
c820: 0d 0a 36 31 31 30 0d 0a 36 32 37 39 0d 0a 37 36  ..6110..6279..76
c830: 0d 0a 0d 0a 71 75 65 72 79 20 49 49 49 20 72 6f  ....query III ro
c840: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
c850: 4c 20 2a 20 46 52 4f 4d 20 74 61 62 31 20 57 48  L * FROM tab1 WH
c860: 45 52 45 20 4e 55 4c 4c 20 4e 4f 54 20 42 45 54  ERE NULL NOT BET
c870: 57 45 45 4e 20 4e 55 4c 4c 20 41 4e 44 20 2d 20  WEEN NULL AND - 
c880: 63 6f 6c 32 20 2a 20 63 6f 6c 32 0d 0a 2d 2d 2d  col2 * col2..---
c890: 2d 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  -....onlyif mysq
c8a0: 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72  l # use DIV oper
c8b0: 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72  ator for integer
c8c0: 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79   division..query
c8d0: 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
c8e0: 2d 33 36 31 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  -361..SELECT ALL
c8f0: 20 63 6f 6c 31 20 2b 20 2d 20 63 6f 6c 30 20 44   col1 + - col0 D
c900: 49 56 20 2d 20 63 6f 6c 30 20 46 52 4f 4d 20 74  IV - col0 FROM t
c910: 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 38 37 0d 0a 39  ab0..----..87..9
c920: 32 0d 0a 39 38 0d 0a 0d 0a 73 6b 69 70 69 66 20  2..98....skipif 
c930: 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
c940: 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
c950: 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 33 36  rowsort label-36
c960: 31 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f  1..SELECT ALL co
c970: 6c 31 20 2b 20 2d 20 63 6f 6c 30 20 2f 20 2d 20  l1 + - col0 / - 
c980: 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a  col0 FROM tab0..
c990: 2d 2d 2d 2d 0d 0a 38 37 0d 0a 39 32 0d 0a 39 38  ----..87..92..98
c9a0: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
c9b0: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
c9c0: 2b 20 2d 20 39 34 20 46 52 4f 4d 20 74 61 62 31  + - 94 FROM tab1
c9d0: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
c9e0: 2d 39 34 0d 0a 2d 39 34 0d 0a 2d 39 34 0d 0a 0d  -94..-94..-94...
c9f0: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
ca00: 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 33  ..SELECT ALL + 3
ca10: 39 20 2a 20 2d 20 63 6f 6c 32 20 46 52 4f 4d 20  9 * - col2 FROM 
ca20: 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
ca30: 2d 2d 0d 0a 2d 32 31 30 36 0d 0a 2d 32 32 32 33  --..-2106..-2223
ca40: 0d 0a 2d 33 37 34 34 0d 0a 0d 0a 71 75 65 72 79  ..-3744....query
ca50: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
ca60: 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 34 33  CT DISTINCT + 43
ca70: 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20   + col1 AS col2 
ca80: 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
ca90: 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 39 0d 0a 31 33  0..----..129..13
caa0: 34 0d 0a 31 34 30 0d 0a 0d 0a 71 75 65 72 79 20  4..140....query 
cab0: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
cac0: 54 20 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  T 0 AS col1 FROM
cad0: 20 74 61 62 32 2c 20 74 61 62 31 20 41 53 20 63   tab2, tab1 AS c
cae0: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c  or0..----..9 val
caf0: 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 38  ues hashing to 8
cb00: 62 37 35 31 33 36 62 32 62 35 31 63 37 37 33 34  b75136b2b51c7734
cb10: 35 63 30 33 38 30 34 65 63 31 63 64 61 35 63 0d  5c03804ec1cda5c.
cb20: 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72  ...skipif postgr
cb30: 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51  esql # PostgreSQ
cb40: 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68  L requires AS wh
cb50: 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70  en renaming outp
cb60: 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72  ut columns..quer
cb70: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
cb80: 45 43 54 20 41 4c 4c 20 2d 20 63 6f 72 30 2e 63  ECT ALL - cor0.c
cb90: 6f 6c 31 20 2b 20 2b 20 32 38 20 2a 20 63 6f 6c  ol1 + + 28 * col
cba0: 32 20 2a 20 2d 20 63 6f 6c 30 20 63 6f 6c 31 20  2 * - col0 col1 
cbb0: 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
cbc0: 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 33 32 33 0d 0a  0..----..-5323..
cbd0: 2d 35 36 38 34 33 0d 0a 2d 38 34 30 37 33 0d 0a  -56843..-84073..
cbe0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
cbf0: 74 0d 0a 53 45 4c 45 43 54 20 37 31 20 41 53 20  t..SELECT 71 AS 
cc00: 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 2c 20  col0 FROM tab0, 
cc10: 74 61 62 32 2c 20 74 61 62 30 20 41 53 20 63 6f  tab2, tab0 AS co
cc20: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c  r0..----..27 val
cc30: 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 39  ues hashing to 9
cc40: 35 61 36 66 66 33 35 62 37 62 38 66 30 30 38 36  5a6ff35b7b8f0086
cc50: 38 66 62 35 38 62 63 61 61 33 32 64 30 63 32 0d  8fb58bcaa32d0c2.
cc60: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
cc70: 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2d 20 31  rt..SELECT - - 1
cc80: 39 20 2a 20 63 6f 6c 32 20 41 53 20 63 6f 6c 30  9 * col2 AS col0
cc90: 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
cca0: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 35 35 38 0d 0a  r0..----..1558..
ccb0: 31 39 0d 0a 36 32 37 0d 0a 0d 0a 71 75 65 72 79  19..627....query
ccc0: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
ccd0: 43 54 20 41 4c 4c 20 2b 20 36 39 20 46 52 4f 4d  CT ALL + 69 FROM
cce0: 20 74 61 62 30 2c 20 74 61 62 32 20 41 53 20 63   tab0, tab2 AS c
ccf0: 6f 72 30 2c 20 74 61 62 31 20 63 6f 72 31 2c 20  or0, tab1 cor1, 
cd00: 74 61 62 30 20 41 53 20 63 6f 72 32 0d 0a 2d 2d  tab0 AS cor2..--
cd10: 2d 2d 0d 0a 38 31 20 76 61 6c 75 65 73 20 68 61  --..81 values ha
cd20: 73 68 69 6e 67 20 74 6f 20 64 66 61 64 61 31 65  shing to dfada1e
cd30: 65 37 61 34 65 33 65 35 63 37 34 61 30 36 33 61  e7a4e3e5c74a063a
cd40: 31 32 38 32 37 36 39 66 39 0d 0a 0d 0a 6f 6e 6c  1282769f9....onl
cd50: 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70  yif mysql # supp
cd60: 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70  ort for MySQL sp
cd70: 65 63 69 66 69 63 20 73 79 73 74 65 6d 20 74 79  ecific system ty
cd80: 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a  pes and syntax..
cd90: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
cda0: 6c 61 62 65 6c 2d 33 37 30 0d 0a 53 45 4c 45 43  label-370..SELEC
cdb0: 54 20 2b 20 2d 20 43 41 53 54 28 20 4e 55 4c 4c  T + - CAST( NULL
cdc0: 20 41 53 20 53 49 47 4e 45 44 20 29 20 2a 20 39   AS SIGNED ) * 9
cdd0: 33 20 2b 20 2b 20 63 6f 6c 31 20 2a 20 2b 20 39  3 + + col1 * + 9
cde0: 33 20 2a 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20  3 * + col1 FROM 
cdf0: 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab2 cor0..----.
ce00: 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c  .NULL..NULL..NUL
ce10: 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  L....skipif mysq
ce20: 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
ce30: 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
ce40: 6f 72 74 20 6c 61 62 65 6c 2d 33 37 30 0d 0a 53  ort label-370..S
ce50: 45 4c 45 43 54 20 2b 20 2d 20 43 41 53 54 20 28  ELECT + - CAST (
ce60: 20 4e 55 4c 4c 20 41 53 20 49 4e 54 45 47 45 52   NULL AS INTEGER
ce70: 20 29 20 2a 20 39 33 20 2b 20 2b 20 63 6f 6c 31   ) * 93 + + col1
ce80: 20 2a 20 2b 20 39 33 20 2a 20 2b 20 63 6f 6c 31   * + 93 * + col1
ce90: 20 46 52 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d   FROM tab2 cor0.
cea0: 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c  .----..NULL..NUL
ceb0: 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 6f 6e 6c 79 69  L..NULL....onlyi
cec0: 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72  f mysql # suppor
ced0: 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63  t for MySQL spec
cee0: 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65  ific system type
cef0: 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75  s and syntax..qu
cf00: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
cf10: 62 65 6c 2d 33 37 31 0d 0a 53 45 4c 45 43 54 20  bel-371..SELECT 
cf20: 41 4c 4c 20 2d 20 43 41 53 54 28 20 2d 20 35 37  ALL - CAST( - 57
cf30: 20 41 53 20 53 49 47 4e 45 44 20 29 20 41 53 20   AS SIGNED ) AS 
cf40: 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41  col0 FROM tab2 A
cf50: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 35 37  S cor0..----..57
cf60: 0d 0a 35 37 0d 0a 35 37 0d 0a 0d 0a 73 6b 69 70  ..57..57....skip
cf70: 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
cf80: 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
cf90: 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
cfa0: 2d 33 37 31 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  -371..SELECT ALL
cfb0: 20 2d 20 43 41 53 54 20 28 20 2d 20 35 37 20 41   - CAST ( - 57 A
cfc0: 53 20 49 4e 54 45 47 45 52 20 29 20 41 53 20 63  S INTEGER ) AS c
cfd0: 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol0 FROM tab2 AS
cfe0: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 35 37 0d   cor0..----..57.
cff0: 0a 35 37 0d 0a 35 37 0d 0a 0d 0a 71 75 65 72 79  .57..57....query
d000: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
d010: 43 54 20 41 4c 4c 20 63 6f 72 30 2e 63 6f 6c 30  CT ALL cor0.col0
d020: 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
d030: 62 31 2c 20 74 61 62 30 20 41 53 20 63 6f 72 30  b1, tab0 AS cor0
d040: 2c 20 74 61 62 31 20 41 53 20 63 6f 72 31 2c 20  , tab1 AS cor1, 
d050: 74 61 62 30 20 41 53 20 63 6f 72 32 0d 0a 2d 2d  tab0 AS cor2..--
d060: 2d 2d 0d 0a 38 31 20 76 61 6c 75 65 73 20 68 61  --..81 values ha
d070: 73 68 69 6e 67 20 74 6f 20 32 33 30 34 66 63 63  shing to 2304fcc
d080: 31 34 30 65 39 35 35 65 62 32 64 31 65 65 32 38  140e955eb2d1ee28
d090: 61 62 31 65 65 61 39 39 34 0d 0a 0d 0a 71 75 65  ab1eea994....que
d0a0: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
d0b0: 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20  LECT DISTINCT - 
d0c0: 63 6f 6c 30 20 2b 20 2b 20 63 6f 72 30 2e 63 6f  col0 + + cor0.co
d0d0: 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72  l0 FROM tab0 cor
d0e0: 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 0d 0a 71 75  0..----..0....qu
d0f0: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
d100: 45 4c 45 43 54 20 63 6f 6c 30 20 2a 20 2b 20 36  ELECT col0 * + 6
d110: 34 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30  4 + col0 AS col0
d120: 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
d130: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 39 35 0d 0a 34  r0..----..195..4
d140: 31 36 30 0d 0a 35 32 30 30 0d 0a 0d 0a 71 75 65  160..5200....que
d150: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
d160: 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20  LECT DISTINCT + 
d170: 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 2b 20 63 6f  + cor0.col1 + co
d180: 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l0 FROM tab0 AS 
d190: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 30 0d  cor0..----..110.
d1a0: 0a 31 33 32 0d 0a 31 38 30 0d 0a 0d 0a 71 75 65  .132..180....que
d1b0: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
d1c0: 4c 45 43 54 20 41 4c 4c 20 2d 20 39 20 2a 20 2b  LECT ALL - 9 * +
d1d0: 20 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c 32 20 46   col1 * + col2 F
d1e0: 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
d1f0: 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 35 35 34 32 0d 0a  ..----..-25542..
d200: 2d 36 37 31 35 38 0d 0a 2d 38 37 33 0d 0a 0d 0a  -67158..-873....
d210: 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71  skipif postgresq
d220: 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72  l # PostgreSQL r
d230: 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20  equires AS when 
d240: 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20  renaming output 
d250: 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49  columns..query I
d260: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
d270: 20 2b 20 63 6f 6c 32 20 2a 20 2b 20 63 6f 72 30   + col2 * + cor0
d280: 2e 63 6f 6c 31 20 63 6f 6c 31 20 46 52 4f 4d 20  .col1 col1 FROM 
d290: 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
d2a0: 2d 2d 0d 0a 31 35 33 34 0d 0a 36 34 36 0d 0a 38  --..1534..646..8
d2b0: 33 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  37....query I ro
d2c0: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
d2d0: 53 54 49 4e 43 54 20 2b 20 28 20 2b 20 63 6f 6c  STINCT + ( + col
d2e0: 30 20 29 20 2a 20 63 6f 6c 31 20 2d 20 63 6f 6c  0 ) * col1 - col
d2f0: 32 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  2 AS col0 FROM t
d300: 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
d310: 2d 0d 0a 31 33 30 35 0d 0a 31 39 30 0d 0a 34 35  -..1305..190..45
d320: 37 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  76....query I ro
d330: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
d340: 53 54 49 4e 43 54 20 2b 20 28 20 35 34 20 29 20  STINCT + ( 54 ) 
d350: 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31  + col0 FROM tab1
d360: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
d370: 31 31 38 0d 0a 31 33 34 0d 0a 35 37 0d 0a 0d 0a  118..134..57....
d380: 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75  onlyif mysql # u
d390: 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20  se DIV operator 
d3a0: 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69  for integer divi
d3b0: 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f  sion..query I ro
d3c0: 77 73 6f 72 74 20 6c 61 62 65 6c 2d 33 38 30 0d  wsort label-380.
d3d0: 0a 53 45 4c 45 43 54 20 2d 20 74 61 62 30 2e 63  .SELECT - tab0.c
d3e0: 6f 6c 31 20 44 49 56 20 63 6f 6c 30 20 2b 20 74  ol1 DIV col0 + t
d3f0: 61 62 30 2e 63 6f 6c 31 20 41 53 20 63 6f 6c 30  ab0.col1 AS col0
d400: 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d   FROM tab0..----
d410: 0d 0a 38 33 0d 0a 39 30 0d 0a 39 35 0d 0a 0d 0a  ..83..90..95....
d420: 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
d430: 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
d440: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
d450: 61 62 65 6c 2d 33 38 30 0d 0a 53 45 4c 45 43 54  abel-380..SELECT
d460: 20 2d 20 74 61 62 30 2e 63 6f 6c 31 20 2f 20 63   - tab0.col1 / c
d470: 6f 6c 30 20 2b 20 74 61 62 30 2e 63 6f 6c 31 20  ol0 + tab0.col1 
d480: 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
d490: 30 0d 0a 2d 2d 2d 2d 0d 0a 38 33 0d 0a 39 30 0d  0..----..83..90.
d4a0: 0a 39 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .95....query I r
d4b0: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 28  owsort..SELECT (
d4c0: 20 2b 20 63 6f 6c 30 20 29 20 2b 20 2d 20 63 6f   + col0 ) + - co
d4d0: 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l0 FROM tab2 AS 
d4e0: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30  cor0..----..0..0
d4f0: 0d 0a 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  ..0....query I r
d500: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
d510: 4c 4c 20 2d 20 37 36 20 2a 20 31 31 20 41 53 20  LL - 76 * 11 AS 
d520: 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 2c 20  col2 FROM tab1, 
d530: 74 61 62 30 2c 20 74 61 62 32 20 63 6f 72 30 0d  tab0, tab2 cor0.
d540: 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75 65 73  .----..27 values
d550: 20 68 61 73 68 69 6e 67 20 74 6f 20 66 31 62 30   hashing to f1b0
d560: 36 61 33 62 63 38 39 62 34 34 32 30 61 64 61 63  6a3bc89b4420adac
d570: 64 30 34 35 62 31 34 31 30 32 38 62 0d 0a 0d 0a  d045b141028b....
d580: 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73  onlyif mysql # s
d590: 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c  upport for MySQL
d5a0: 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d   specific system
d5b0: 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61   types and synta
d5c0: 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  x..query I rowso
d5d0: 72 74 20 6c 61 62 65 6c 2d 33 38 33 0d 0a 53 45  rt label-383..SE
d5e0: 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 43 41  LECT DISTINCT CA
d5f0: 53 54 28 20 4e 55 4c 4c 20 41 53 20 44 45 43 49  ST( NULL AS DECI
d600: 4d 41 4c 20 29 20 41 53 20 63 6f 6c 32 20 46 52  MAL ) AS col2 FR
d610: 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 4e  OM tab0..----..N
d620: 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  ULL....skipif my
d630: 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
d640: 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
d650: 77 73 6f 72 74 20 6c 61 62 65 6c 2d 33 38 33 0d  wsort label-383.
d660: 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
d670: 20 43 41 53 54 20 28 20 4e 55 4c 4c 20 41 53 20   CAST ( NULL AS 
d680: 52 45 41 4c 20 29 20 41 53 20 63 6f 6c 32 20 46  REAL ) AS col2 F
d690: 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab0..----..
d6a0: 4e 55 4c 4c 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  NULL....onlyif m
d6b0: 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66  ysql # support f
d6c0: 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69  or MySQL specifi
d6d0: 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61  c system types a
d6e0: 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79  nd syntax..query
d6f0: 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
d700: 2d 33 38 34 0d 0a 53 45 4c 45 43 54 20 2d 20 43  -384..SELECT - C
d710: 41 53 54 28 20 2b 20 63 6f 6c 32 20 41 53 20 53  AST( + col2 AS S
d720: 49 47 4e 45 44 20 29 20 46 52 4f 4d 20 74 61 62  IGNED ) FROM tab
d730: 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 36 0d 0a 2d 32  2..----..-26..-2
d740: 37 0d 0a 2d 33 38 0d 0a 0d 0a 73 6b 69 70 69 66  7..-38....skipif
d750: 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
d760: 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
d770: 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 33   rowsort label-3
d780: 38 34 0d 0a 53 45 4c 45 43 54 20 2d 20 43 41 53  84..SELECT - CAS
d790: 54 20 28 20 2b 20 63 6f 6c 32 20 41 53 20 49 4e  T ( + col2 AS IN
d7a0: 54 45 47 45 52 20 29 20 46 52 4f 4d 20 74 61 62  TEGER ) FROM tab
d7b0: 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 36 0d 0a 2d 32  2..----..-26..-2
d7c0: 37 0d 0a 2d 33 38 0d 0a 0d 0a 6f 6e 6c 79 69 66  7..-38....onlyif
d7d0: 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56   mysql # use DIV
d7e0: 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e   operator for in
d7f0: 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a  teger division..
d800: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
d810: 6c 61 62 65 6c 2d 33 38 35 0d 0a 53 45 4c 45 43  label-385..SELEC
d820: 54 20 31 35 20 2b 20 2b 20 63 6f 6c 30 20 44 49  T 15 + + col0 DI
d830: 56 20 2d 20 74 61 62 31 2e 63 6f 6c 30 20 41 53  V - tab1.col0 AS
d840: 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 0d   col1 FROM tab1.
d850: 0a 2d 2d 2d 2d 0d 0a 31 34 0d 0a 31 34 0d 0a 31  .----..14..14..1
d860: 34 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  4....skipif mysq
d870: 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
d880: 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
d890: 6f 72 74 20 6c 61 62 65 6c 2d 33 38 35 0d 0a 53  ort label-385..S
d8a0: 45 4c 45 43 54 20 31 35 20 2b 20 2b 20 63 6f 6c  ELECT 15 + + col
d8b0: 30 20 2f 20 2d 20 74 61 62 31 2e 63 6f 6c 30 20  0 / - tab1.col0 
d8c0: 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
d8d0: 31 0d 0a 2d 2d 2d 2d 0d 0a 31 34 0d 0a 31 34 0d  1..----..14..14.
d8e0: 0a 31 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .14....query I r
d8f0: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 28  owsort..SELECT (
d900: 20 63 6f 6c 30 20 29 20 2b 20 2b 20 35 30 20 41   col0 ) + + 50 A
d910: 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30  S col0 FROM tab0
d920: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33 39   cor0..----..139
d930: 0d 0a 37 34 0d 0a 38 35 0d 0a 0d 0a 71 75 65 72  ..74..85....quer
d940: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
d950: 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63  ECT DISTINCT + c
d960: 6f 72 30 2e 63 6f 6c 32 20 2d 20 2b 20 35 35 20  or0.col2 - + 55 
d970: 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
d980: 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 37 0d 0a 2d 32  0..----..-17..-2
d990: 38 0d 0a 2d 32 39 0d 0a 0d 0a 71 75 65 72 79 20  8..-29....query 
d9a0: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
d9b0: 54 20 2d 20 33 36 20 2a 20 2b 20 63 6f 6c 31 20  T - 36 * + col1 
d9c0: 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d  FROM tab0..----.
d9d0: 0a 2d 33 30 39 36 0d 0a 2d 33 32 37 36 0d 0a 2d  .-3096..-3276..-
d9e0: 33 34 39 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20  3492....query I 
d9f0: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
da00: 2b 20 35 34 20 2a 20 63 6f 6c 30 20 2a 20 2d 20  + 54 * col0 * - 
da10: 74 61 62 30 2e 63 6f 6c 30 20 2b 20 63 6f 6c 30  tab0.col0 + col0
da20: 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
da30: 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 31 30 38 30  b0..----..-31080
da40: 0d 0a 2d 34 32 37 36 34 35 0d 0a 2d 36 36 31 31  ..-427645..-6611
da50: 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  5....query I row
da60: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63  sort..SELECT - c
da70: 6f 6c 30 20 2d 20 63 6f 6c 32 20 41 53 20 63 6f  ol0 - col2 AS co
da80: 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l1 FROM tab2 AS 
da90: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 34  cor0..----..-104
daa0: 0d 0a 2d 31 31 37 0d 0a 2d 33 34 0d 0a 0d 0a 71  ..-117..-34....q
dab0: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
dac0: 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
dad0: 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 2a 20 2d 20  + cor0.col1 * - 
dae0: 63 6f 6c 30 20 2d 20 34 33 20 41 53 20 63 6f 6c  col0 - 43 AS col
daf0: 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  2 FROM tab1 AS c
db00: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 38 33  or0..----..-1083
db10: 0d 0a 2d 31 32 31 0d 0a 2d 36 38 33 0d 0a 0d 0a  ..-121..-683....
db20: 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73  onlyif mysql # s
db30: 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c  upport for MySQL
db40: 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d   specific system
db50: 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61   types and synta
db60: 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  x..query I rowso
db70: 72 74 20 6c 61 62 65 6c 2d 33 39 32 0d 0a 53 45  rt label-392..SE
db80: 4c 45 43 54 20 2d 20 28 20 2b 20 63 6f 6c 32 20  LECT - ( + col2 
db90: 29 20 2a 20 39 36 20 2a 20 2b 20 63 6f 6c 30 20  ) * 96 * + col0 
dba0: 2d 20 63 6f 6c 31 20 2a 20 2d 20 43 41 53 54 28  - col1 * - CAST(
dbb0: 20 4e 55 4c 4c 20 41 53 20 53 49 47 4e 45 44 20   NULL AS SIGNED 
dbc0: 29 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d  ) FROM tab2..---
dbd0: 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e  -..NULL..NULL..N
dbe0: 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  ULL....skipif my
dbf0: 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
dc00: 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
dc10: 77 73 6f 72 74 20 6c 61 62 65 6c 2d 33 39 32 0d  wsort label-392.
dc20: 0a 53 45 4c 45 43 54 20 2d 20 28 20 2b 20 63 6f  .SELECT - ( + co
dc30: 6c 32 20 29 20 2a 20 39 36 20 2a 20 2b 20 63 6f  l2 ) * 96 * + co
dc40: 6c 30 20 2d 20 63 6f 6c 31 20 2a 20 2d 20 43 41  l0 - col1 * - CA
dc50: 53 54 20 28 20 4e 55 4c 4c 20 41 53 20 49 4e 54  ST ( NULL AS INT
dc60: 45 47 45 52 20 29 20 46 52 4f 4d 20 74 61 62 32  EGER ) FROM tab2
dc70: 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55  ..----..NULL..NU
dc80: 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 6f 6e 6c 79  LL..NULL....only
dc90: 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44  if mysql # use D
dca0: 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20  IV operator for 
dcb0: 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e  integer division
dcc0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
dcd0: 74 20 6c 61 62 65 6c 2d 33 39 33 0d 0a 53 45 4c  t label-393..SEL
dce0: 45 43 54 20 44 49 53 54 49 4e 43 54 20 34 36 20  ECT DISTINCT 46 
dcf0: 44 49 56 20 63 6f 72 30 2e 63 6f 6c 31 20 41 53  DIV cor0.col1 AS
dd00: 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 2c   col2 FROM tab1,
dd10: 20 74 61 62 32 2c 20 74 61 62 32 20 41 53 20 63   tab2, tab2 AS c
dd20: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 31 0d  or0..----..0..1.
dd30: 0a 32 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  .2....skipif mys
dd40: 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
dd50: 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
dd60: 73 6f 72 74 20 6c 61 62 65 6c 2d 33 39 33 0d 0a  sort label-393..
dd70: 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
dd80: 34 36 20 2f 20 63 6f 72 30 2e 63 6f 6c 31 20 41  46 / cor0.col1 A
dd90: 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31  S col2 FROM tab1
dda0: 2c 20 74 61 62 32 2c 20 74 61 62 32 20 41 53 20  , tab2, tab2 AS 
ddb0: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 31  cor0..----..0..1
ddc0: 0d 0a 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  ..2....query I r
ddd0: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
dde0: 4c 4c 20 2b 20 2d 20 63 6f 6c 31 20 2a 20 28 20  LL + - col1 * ( 
ddf0: 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 29 20 46 52  + cor0.col1 ) FR
de00: 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
de10: 0a 2d 2d 2d 2d 0d 0a 2d 32 38 39 0d 0a 2d 33 34  .----..-289..-34
de20: 38 31 0d 0a 2d 39 36 31 0d 0a 0d 0a 6f 6e 6c 79  81..-961....only
de30: 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44  if mysql # use D
de40: 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20  IV operator for 
de50: 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e  integer division
de60: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
de70: 74 20 6c 61 62 65 6c 2d 33 39 35 0d 0a 53 45 4c  t label-395..SEL
de80: 45 43 54 20 63 6f 6c 30 20 2b 20 39 32 20 44 49  ECT col0 + 92 DI
de90: 56 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 46 52  V + cor0.col1 FR
dea0: 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
deb0: 0a 2d 2d 2d 2d 0d 0a 36 0d 0a 37 33 0d 0a 38 37  .----..6..73..87
dec0: 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
ded0: 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
dee0: 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
def0: 72 74 20 6c 61 62 65 6c 2d 33 39 35 0d 0a 53 45  rt label-395..SE
df00: 4c 45 43 54 20 63 6f 6c 30 20 2b 20 39 32 20 2f  LECT col0 + 92 /
df10: 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 46 52 4f   + cor0.col1 FRO
df20: 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
df30: 2d 2d 2d 2d 0d 0a 36 0d 0a 37 33 0d 0a 38 37 0d  ----..6..73..87.
df40: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
df50: 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
df60: 4e 43 54 20 2b 20 2d 20 63 6f 6c 31 20 2b 20 2d  NCT + - col1 + -
df70: 20 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46 52   col2 AS col1 FR
df80: 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
df90: 0a 2d 2d 2d 2d 0d 0a 2d 31 30 39 0d 0a 2d 36 37  .----..-109..-67
dfa0: 0d 0a 2d 38 30 0d 0a 0d 0a 71 75 65 72 79 20 49  ..-80....query I
dfb0: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
dfc0: 20 2d 20 63 6f 6c 31 20 2d 20 2d 20 63 6f 6c 31   - col1 - - col1
dfd0: 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
dfe0: 62 32 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a  b2..----..0..0..
dff0: 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  0....query I row
e000: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
e010: 54 49 4e 43 54 20 63 6f 6c 30 20 2d 20 63 6f 6c  TINCT col0 - col
e020: 30 20 2a 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61  0 * col2 FROM ta
e030: 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 35 39 0d 0a  b1..----..-159..
e040: 2d 33 35 38 34 0d 0a 2d 37 36 30 30 0d 0a 0d 0a  -3584..-7600....
e050: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
e060: 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f  .SELECT ALL + co
e070: 6c 32 20 2a 20 2d 20 63 6f 6c 31 20 2b 20 2d 20  l2 * - col1 + - 
e080: 30 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61  0 + col1 FROM ta
e090: 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 34 37 35 0d  b2..----..-1475.
e0a0: 0a 2d 36 32 39 0d 0a 2d 38 30 36 0d 0a 0d 0a 71  .-629..-806....q
e0b0: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
e0c0: 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 30 20  SELECT ALL col0 
e0d0: 2d 20 74 61 62 32 2e 63 6f 6c 31 20 2a 20 2b 20  - tab2.col1 * + 
e0e0: 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 0d 0a  col1 FROM tab2..
e0f0: 2d 2d 2d 2d 0d 0a 2d 32 31 30 0d 0a 2d 33 34 30  ----..-210..-340
e100: 33 0d 0a 2d 39 35 34 0d 0a 0d 0a 71 75 65 72 79  3..-954....query
e110: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
e120: 43 54 20 2d 20 63 6f 6c 30 20 2b 20 2b 20 63 6f  CT - col0 + + co
e130: 6c 30 20 2d 20 2d 20 74 61 62 31 2e 63 6f 6c 30  l0 - - tab1.col0
e140: 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
e150: 62 31 0d 0a 2d 2d 2d 2d 0d 0a 33 0d 0a 36 34 0d  b1..----..3..64.
e160: 0a 38 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  .80....onlyif my
e170: 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f  sql # support fo
e180: 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63  r MySQL specific
e190: 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e   system types an
e1a0: 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20  d syntax..query 
e1b0: 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
e1c0: 34 30 32 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  402..SELECT ALL 
e1d0: 2b 20 63 6f 6c 32 20 2a 20 2b 20 74 61 62 31 2e  + col2 * + tab1.
e1e0: 63 6f 6c 30 20 2a 20 2b 20 43 41 53 54 28 20 4e  col0 * + CAST( N
e1f0: 55 4c 4c 20 41 53 20 53 49 47 4e 45 44 20 29 20  ULL AS SIGNED ) 
e200: 2d 20 2b 20 31 36 20 41 53 20 63 6f 6c 30 20 46  - + 16 AS col0 F
e210: 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab1..----..
e220: 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c  NULL..NULL..NULL
e230: 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
e240: 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
e250: 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
e260: 72 74 20 6c 61 62 65 6c 2d 34 30 32 0d 0a 53 45  rt label-402..SE
e270: 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 32 20  LECT ALL + col2 
e280: 2a 20 2b 20 74 61 62 31 2e 63 6f 6c 30 20 2a 20  * + tab1.col0 * 
e290: 2b 20 43 41 53 54 20 28 20 4e 55 4c 4c 20 41 53  + CAST ( NULL AS
e2a0: 20 49 4e 54 45 47 45 52 20 29 20 2d 20 2b 20 31   INTEGER ) - + 1
e2b0: 36 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  6 AS col0 FROM t
e2c0: 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d  ab1..----..NULL.
e2d0: 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71  .NULL..NULL....q
e2e0: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
e2f0: 53 45 4c 45 43 54 20 2d 20 63 6f 72 30 2e 63 6f  SELECT - cor0.co
e300: 6c 32 20 2b 20 2b 20 34 35 20 41 53 20 63 6f 6c  l2 + + 45 AS col
e310: 30 20 46 52 4f 4d 20 74 61 62 30 2c 20 74 61 62  0 FROM tab0, tab
e320: 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
e330: 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e  .9 values hashin
e340: 67 20 74 6f 20 36 62 36 62 35 37 34 30 61 64 34  g to 6b6b5740ad4
e350: 37 38 65 35 30 34 35 63 33 34 37 39 66 38 32 38  78e5045c3479f828
e360: 35 34 66 65 30 0d 0a 0d 0a 71 75 65 72 79 20 49  54fe0....query I
e370: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
e380: 20 2b 20 2d 20 63 6f 72 30 2e 63 6f 6c 30 20 2a   + - cor0.col0 *
e390: 20 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46 52   col0 AS col2 FR
e3a0: 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
e3b0: 0a 2d 2d 2d 2d 0d 0a 2d 34 39 0d 0a 2d 36 30 38  .----..-49..-608
e3c0: 34 0d 0a 2d 36 32 34 31 0d 0a 0d 0a 71 75 65 72  4..-6241....quer
e3d0: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
e3e0: 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 30 20 2b  ECT ALL + col0 +
e3f0: 20 28 20 2d 20 36 31 20 29 20 2a 20 2d 20 63 6f   ( - 61 ) * - co
e400: 6c 32 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  l2 AS col1 FROM 
e410: 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
e420: 2d 2d 0d 0a 31 36 35 34 0d 0a 31 36 36 34 0d 0a  --..1654..1664..
e430: 32 33 39 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20  2397....query I 
e440: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
e450: 2d 20 63 6f 6c 31 20 2a 20 28 20 2b 20 63 6f 6c  - col1 * ( + col
e460: 31 20 29 20 2a 20 2b 20 63 6f 72 30 2e 63 6f 6c  1 ) * + cor0.col
e470: 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  0 FROM tab2 AS c
e480: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 32 38 33  or0..----..-2283
e490: 31 0d 0a 2d 32 37 31 35 31 38 0d 0a 2d 36 37 32  1..-271518..-672
e4a0: 37 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  7....onlyif mysq
e4b0: 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20  l # support for 
e4c0: 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63 20 73  MySQL specific s
e4d0: 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20  ystem types and 
e4e0: 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20  syntax..query I 
e4f0: 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 34 30  rowsort label-40
e500: 37 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  7..SELECT DISTIN
e510: 43 54 20 2d 20 2d 20 63 6f 72 30 2e 63 6f 6c 32  CT - - cor0.col2
e520: 20 2a 20 2b 20 43 41 53 54 28 20 4e 55 4c 4c 20   * + CAST( NULL 
e530: 41 53 20 53 49 47 4e 45 44 20 29 20 46 52 4f 4d  AS SIGNED ) FROM
e540: 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab2 cor0..----
e550: 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66  ..NULL....skipif
e560: 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
e570: 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
e580: 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 34   rowsort label-4
e590: 30 37 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  07..SELECT DISTI
e5a0: 4e 43 54 20 2d 20 2d 20 63 6f 72 30 2e 63 6f 6c  NCT - - cor0.col
e5b0: 32 20 2a 20 2b 20 43 41 53 54 20 28 20 4e 55 4c  2 * + CAST ( NUL
e5c0: 4c 20 41 53 20 49 4e 54 45 47 45 52 20 29 20 46  L AS INTEGER ) F
e5d0: 52 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d  ROM tab2 cor0..-
e5e0: 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75 65  ---..NULL....que
e5f0: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
e600: 4c 45 43 54 20 63 6f 6c 30 20 2b 20 28 20 2d 20  LECT col0 + ( - 
e610: 63 6f 6c 31 20 29 20 41 53 20 63 6f 6c 31 20 46  col1 ) AS col1 F
e620: 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
e630: 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 33 0d 0a 35 34 0d  ..----..-23..54.
e640: 0a 36 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .67....query I r
e650: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
e660: 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c 32 20 2a  ISTINCT - col2 *
e670: 20 35 36 20 46 52 4f 4d 20 74 61 62 30 20 41 53   56 FROM tab0 AS
e680: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 38   cor0..----..-18
e690: 34 38 0d 0a 2d 34 35 39 32 0d 0a 2d 35 36 0d 0a  48..-4592..-56..
e6a0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
e6b0: 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 32 20 2b  t..SELECT col2 +
e6c0: 20 33 39 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d   39 AS col1 FROM
e6d0: 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab0 cor0..----
e6e0: 0d 0a 31 32 31 0d 0a 34 30 0d 0a 37 32 0d 0a 0d  ..121..40..72...
e6f0: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
e700: 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
e710: 54 20 2d 20 2d 20 63 6f 6c 31 20 2b 20 2b 20 63  T - - col1 + + c
e720: 6f 72 30 2e 63 6f 6c 30 20 46 52 4f 4d 20 74 61  or0.col0 FROM ta
e730: 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
e740: 0d 0a 32 39 0d 0a 37 34 0d 0a 39 33 0d 0a 0d 0a  ..29..74..93....
e750: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
e760: 0a 53 45 4c 45 43 54 20 63 6f 6c 31 20 2b 20 63  .SELECT col1 + c
e770: 6f 6c 30 20 2a 20 63 6f 72 30 2e 63 6f 6c 30 20  ol0 * cor0.col0 
e780: 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
e790: 30 0d 0a 2d 2d 2d 2d 0d 0a 36 31 34 33 0d 0a 36  0..----..6143..6
e7a0: 32 35 38 0d 0a 38 30 0d 0a 0d 0a 71 75 65 72 79  258..80....query
e7b0: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
e7c0: 43 54 20 41 4c 4c 20 63 6f 6c 30 20 2b 20 2b 20  CT ALL col0 + + 
e7d0: 28 20 63 6f 6c 32 20 29 20 2d 20 2d 20 63 6f 6c  ( col2 ) - - col
e7e0: 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  2 FROM tab2 AS c
e7f0: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33 30 0d 0a  or0..----..130..
e800: 31 35 35 0d 0a 36 31 0d 0a 0d 0a 6f 6e 6c 79 69  155..61....onlyi
e810: 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49  f mysql # use DI
e820: 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69  V operator for i
e830: 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d  nteger division.
e840: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
e850: 20 6c 61 62 65 6c 2d 34 31 34 0d 0a 53 45 4c 45   label-414..SELE
e860: 43 54 20 2d 20 74 61 62 30 2e 63 6f 6c 30 20 44  CT - tab0.col0 D
e870: 49 56 20 63 6f 6c 31 20 63 6f 6c 32 20 46 52 4f  IV col1 col2 FRO
e880: 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d  M tab0..----..0.
e890: 0a 30 0d 0a 30 0d 0a 0d 0a 73 6b 69 70 69 66 20  .0..0....skipif 
e8a0: 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73  postgresql # Pos
e8b0: 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73  tgreSQL requires
e8c0: 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e   AS when renamin
e8d0: 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73  g output columns
e8e0: 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
e8f0: 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
e900: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
e910: 20 6c 61 62 65 6c 2d 34 31 34 0d 0a 53 45 4c 45   label-414..SELE
e920: 43 54 20 2d 20 74 61 62 30 2e 63 6f 6c 30 20 2f  CT - tab0.col0 /
e930: 20 63 6f 6c 31 20 63 6f 6c 32 20 46 52 4f 4d 20   col1 col2 FROM 
e940: 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30  tab0..----..0..0
e950: 0d 0a 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  ..0....query I r
e960: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
e970: 4c 4c 20 63 6f 6c 32 20 2b 20 39 31 20 46 52 4f  LL col2 + 91 FRO
e980: 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 34  M tab1..----..14
e990: 35 0d 0a 31 34 38 0d 0a 31 38 37 0d 0a 0d 0a 71  5..148..187....q
e9a0: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
e9b0: 53 45 4c 45 43 54 20 63 6f 6c 30 20 2a 20 2b 20  SELECT col0 * + 
e9c0: 37 34 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  74 AS col0 FROM 
e9d0: 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 32 32 32 0d  tab1..----..222.
e9e0: 0a 34 37 33 36 0d 0a 35 39 32 30 0d 0a 0d 0a 71  .4736..5920....q
e9f0: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
ea00: 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c  SELECT ALL + col
ea10: 32 20 2a 20 28 20 28 20 74 61 62 31 2e 63 6f 6c  2 * ( ( tab1.col
ea20: 32 20 29 20 29 20 46 52 4f 4d 20 74 61 62 31 0d  2 ) ) FROM tab1.
ea30: 0a 2d 2d 2d 2d 0d 0a 32 39 31 36 0d 0a 33 32 34  .----..2916..324
ea40: 39 0d 0a 39 32 31 36 0d 0a 0d 0a 71 75 65 72 79  9..9216....query
ea50: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
ea60: 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 30  CT DISTINCT col0
ea70: 20 2a 20 2b 20 31 34 20 41 53 20 63 6f 6c 30 20   * + 14 AS col0 
ea80: 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d  FROM tab1..----.
ea90: 0a 31 31 32 30 0d 0a 34 32 0d 0a 38 39 36 0d 0a  .1120..42..896..
eaa0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
eab0: 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20  t..SELECT ALL - 
eac0: 31 33 20 2d 20 32 31 20 2a 20 2d 20 63 6f 72 30  13 - 21 * - cor0
ead0: 2e 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20  .col2 FROM tab1 
eae0: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
eaf0: 31 32 31 0d 0a 31 31 38 34 0d 0a 32 30 30 33 0d  121..1184..2003.
eb00: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
eb10: 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d  rt..SELECT ALL -
eb20: 20 63 6f 6c 30 20 2a 20 63 6f 6c 31 20 2b 20 2b   col0 * col1 + +
eb30: 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20   col0 FROM tab2 
eb40: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
eb50: 31 32 36 34 0d 0a 2d 32 31 30 0d 0a 2d 34 35 32  1264..-210..-452
eb60: 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  4....query I row
eb70: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63  sort..SELECT + c
eb80: 6f 72 30 2e 63 6f 6c 32 20 2b 20 2d 20 28 20 63  or0.col2 + - ( c
eb90: 6f 6c 31 20 29 20 41 53 20 63 6f 6c 30 20 46 52  ol1 ) AS col0 FR
eba0: 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d  OM tab1 cor0..--
ebb0: 2d 2d 0d 0a 32 38 0d 0a 34 37 0d 0a 38 33 0d 0a  --..28..47..83..
ebc0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
ebd0: 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
ebe0: 43 54 20 2b 20 31 36 20 2d 20 2d 20 63 6f 6c 31  CT + 16 - - col1
ebf0: 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
ec00: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 33 0d 0a 34 37  r0..----..33..47
ec10: 0d 0a 37 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..75....query I 
ec20: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
ec30: 44 49 53 54 49 4e 43 54 20 2b 20 31 32 20 41 53  DISTINCT + 12 AS
ec40: 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20   col2 FROM tab2 
ec50: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
ec60: 32 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  2....onlyif mysq
ec70: 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72  l # use DIV oper
ec80: 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72  ator for integer
ec90: 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79   division..query
eca0: 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
ecb0: 2d 34 32 34 0d 0a 53 45 4c 45 43 54 20 36 36 20  -424..SELECT 66 
ecc0: 2a 20 63 6f 6c 31 20 2b 20 2d 20 63 6f 6c 30 20  * col1 + - col0 
ecd0: 44 49 56 20 2d 20 63 6f 6c 30 20 41 53 20 63 6f  DIV - col0 AS co
ece0: 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l0 FROM tab1 AS 
ecf0: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 37 31 37  cor0..----..1717
ed00: 0d 0a 36 36 31 0d 0a 38 35 39 0d 0a 0d 0a 73 6b  ..661..859....sk
ed10: 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
ed20: 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
ed30: 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
ed40: 65 6c 2d 34 32 34 0d 0a 53 45 4c 45 43 54 20 36  el-424..SELECT 6
ed50: 36 20 2a 20 63 6f 6c 31 20 2b 20 2d 20 63 6f 6c  6 * col1 + - col
ed60: 30 20 2f 20 2d 20 63 6f 6c 30 20 41 53 20 63 6f  0 / - col0 AS co
ed70: 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l0 FROM tab1 AS 
ed80: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 37 31 37  cor0..----..1717
ed90: 0d 0a 36 36 31 0d 0a 38 35 39 0d 0a 0d 0a 71 75  ..661..859....qu
eda0: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
edb0: 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 30 20 2a  ELECT ALL col0 *
edc0: 20 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c 31 20 41   col0 * - col1 A
edd0: 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31  S col0 FROM tab1
ede0: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
edf0: 2d 32 33 34 0d 0a 2d 34 30 39 36 30 0d 0a 2d 38  -234..-40960..-8
ee00: 33 32 30 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20  3200....query I 
ee10: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
ee20: 2b 20 34 35 20 2a 20 2b 20 31 32 20 46 52 4f 4d  + 45 * + 12 FROM
ee30: 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
ee40: 2d 2d 2d 0d 0a 35 34 30 0d 0a 35 34 30 0d 0a 35  ---..540..540..5
ee50: 34 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  40....query I ro
ee60: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
ee70: 53 54 49 4e 43 54 20 2d 20 63 6f 6c 32 20 2a 20  STINCT - col2 * 
ee80: 2b 20 63 6f 6c 32 20 2b 20 63 6f 6c 31 20 2a 20  + col2 + col1 * 
ee90: 63 6f 72 30 2e 63 6f 6c 31 20 46 52 4f 4d 20 74  cor0.col1 FROM t
eea0: 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
eeb0: 2d 0d 0a 2d 32 32 34 30 0d 0a 2d 33 31 34 39 0d  -..-2240..-3149.
eec0: 0a 2d 39 30 34 37 0d 0a 0d 0a 71 75 65 72 79 20  .-9047....query 
eed0: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
eee0: 54 20 44 49 53 54 49 4e 43 54 20 2d 20 39 37 20  T DISTINCT - 97 
eef0: 2a 20 2d 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61  * - col0 FROM ta
ef00: 62 31 0d 0a 2d 2d 2d 2d 0d 0a 32 39 31 0d 0a 36  b1..----..291..6
ef10: 32 30 38 0d 0a 37 37 36 30 0d 0a 0d 0a 6f 6e 6c  208..7760....onl
ef20: 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20  yif mysql # use 
ef30: 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72  DIV operator for
ef40: 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f   integer divisio
ef50: 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  n..query I rowso
ef60: 72 74 20 6c 61 62 65 6c 2d 34 32 39 0d 0a 53 45  rt label-429..SE
ef70: 4c 45 43 54 20 2b 20 43 41 53 54 28 20 63 6f 6c  LECT + CAST( col
ef80: 30 20 41 53 20 53 49 47 4e 45 44 20 29 20 44 49  0 AS SIGNED ) DI
ef90: 56 20 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46  V col2 AS col2 F
efa0: 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
efb0: 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 31 0d 0a 33 35  ..----..0..1..35
efc0: 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
efd0: 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
efe0: 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
eff0: 72 74 20 6c 61 62 65 6c 2d 34 32 39 0d 0a 53 45  rt label-429..SE
f000: 4c 45 43 54 20 2b 20 43 41 53 54 20 28 20 63 6f  LECT + CAST ( co
f010: 6c 30 20 41 53 20 49 4e 54 45 47 45 52 20 29 20  l0 AS INTEGER ) 
f020: 2f 20 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46  / col2 AS col2 F
f030: 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
f040: 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 31 0d 0a 33 35  ..----..0..1..35
f050: 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
f060: 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61   # use DIV opera
f070: 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20  tor for integer 
f080: 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20  division..query 
f090: 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
f0a0: 34 33 30 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f  430..SELECT - co
f0b0: 72 30 2e 63 6f 6c 31 20 44 49 56 20 2d 20 28 20  r0.col1 DIV - ( 
f0c0: 2b 20 63 6f 6c 30 20 29 20 63 6f 6c 32 20 46 52  + col0 ) col2 FR
f0d0: 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
f0e0: 0a 2d 2d 2d 2d 0d 0a 31 0d 0a 32 0d 0a 33 0d 0a  .----..1..2..3..
f0f0: 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65  ..skipif postgre
f100: 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c  sql # PostgreSQL
f110: 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65   requires AS whe
f120: 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75  n renaming outpu
f130: 74 20 63 6f 6c 75 6d 6e 73 0d 0a 73 6b 69 70 69  t columns..skipi
f140: 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
f150: 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
f160: 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
f170: 34 33 30 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f  430..SELECT - co
f180: 72 30 2e 63 6f 6c 31 20 2f 20 2d 20 28 20 2b 20  r0.col1 / - ( + 
f190: 63 6f 6c 30 20 29 20 63 6f 6c 32 20 46 52 4f 4d  col0 ) col2 FROM
f1a0: 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
f1b0: 2d 2d 2d 0d 0a 31 0d 0a 32 0d 0a 33 0d 0a 0d 0a  ---..1..2..3....
f1c0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
f1d0: 0a 53 45 4c 45 43 54 20 2d 20 2b 20 28 20 63 6f  .SELECT - + ( co
f1e0: 6c 32 20 29 20 2a 20 2b 20 63 6f 6c 30 20 2b 20  l2 ) * + col0 + 
f1f0: 33 34 20 2a 20 63 6f 6c 32 20 41 53 20 63 6f 6c  34 * col2 AS col
f200: 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  2 FROM tab2 AS c
f210: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 34 34  or0..----..-1144
f220: 0d 0a 2d 31 37 31 30 0d 0a 37 32 39 0d 0a 0d 0a  ..-1710..729....
f230: 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75  onlyif mysql # u
f240: 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20  se DIV operator 
f250: 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69  for integer divi
f260: 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f  sion..query I ro
f270: 77 73 6f 72 74 20 6c 61 62 65 6c 2d 34 33 32 0d  wsort label-432.
f280: 0a 53 45 4c 45 43 54 20 2b 20 37 34 20 44 49 56  .SELECT + 74 DIV
f290: 20 2d 20 31 36 20 2b 20 63 6f 6c 32 20 46 52 4f   - 16 + col2 FRO
f2a0: 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
f2b0: 2d 2d 2d 2d 0d 0a 35 30 0d 0a 35 33 0d 0a 39 32  ----..50..53..92
f2c0: 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
f2d0: 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
f2e0: 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
f2f0: 72 74 20 6c 61 62 65 6c 2d 34 33 32 0d 0a 53 45  rt label-432..SE
f300: 4c 45 43 54 20 2b 20 37 34 20 2f 20 2d 20 31 36  LECT + 74 / - 16
f310: 20 2b 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62   + col2 FROM tab
f320: 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
f330: 0a 35 30 0d 0a 35 33 0d 0a 39 32 0d 0a 0d 0a 71  .50..53..92....q
f340: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
f350: 53 45 4c 45 43 54 20 2d 20 38 36 20 2a 20 2b 20  SELECT - 86 * + 
f360: 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46 52 4f  col0 AS col0 FRO
f370: 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
f380: 2d 2d 2d 2d 0d 0a 2d 32 35 38 0d 0a 2d 35 35 30  ----..-258..-550
f390: 34 0d 0a 2d 36 38 38 30 0d 0a 0d 0a 6f 6e 6c 79  4..-6880....only
f3a0: 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44  if mysql # use D
f3b0: 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20  IV operator for 
f3c0: 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e  integer division
f3d0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
f3e0: 74 20 6c 61 62 65 6c 2d 34 33 34 0d 0a 53 45 4c  t label-434..SEL
f3f0: 45 43 54 20 2b 20 2b 20 63 6f 6c 30 20 2b 20 2b  ECT + + col0 + +
f400: 20 63 6f 6c 32 20 44 49 56 20 63 6f 6c 31 20 46   col2 DIV col1 F
f410: 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
f420: 0d 0a 2d 2d 2d 2d 0d 0a 37 0d 0a 37 38 0d 0a 38  ..----..7..78..8
f430: 31 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  1....skipif mysq
f440: 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
f450: 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
f460: 6f 72 74 20 6c 61 62 65 6c 2d 34 33 34 0d 0a 53  ort label-434..S
f470: 45 4c 45 43 54 20 2b 20 2b 20 63 6f 6c 30 20 2b  ELECT + + col0 +
f480: 20 2b 20 63 6f 6c 32 20 2f 20 63 6f 6c 31 20 46   + col2 / col1 F
f490: 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
f4a0: 0d 0a 2d 2d 2d 2d 0d 0a 37 0d 0a 37 38 0d 0a 38  ..----..7..78..8
f4b0: 31 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74  1....skipif post
f4c0: 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65  gresql # Postgre
f4d0: 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20  SQL requires AS 
f4e0: 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75  when renaming ou
f4f0: 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75  tput columns..qu
f500: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
f510: 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d  ELECT DISTINCT -
f520: 20 37 35 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   75 col1 FROM ta
f530: 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
f540: 0d 0a 2d 37 35 0d 0a 0d 0a 71 75 65 72 79 20 49  ..-75....query I
f550: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
f560: 20 44 49 53 54 49 4e 43 54 20 2d 20 38 30 20 2a   DISTINCT - 80 *
f570: 20 63 6f 6c 31 20 2b 20 2b 20 63 6f 6c 31 20 2a   col1 + + col1 *
f580: 20 2d 20 36 31 20 41 53 20 63 6f 6c 32 20 46 52   - 61 AS col2 FR
f590: 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
f5a0: 0a 2d 2d 2d 2d 0d 0a 2d 31 34 31 30 0d 0a 2d 31  .----..-1410..-1
f5b0: 38 33 33 0d 0a 2d 33 36 36 36 0d 0a 0d 0a 71 75  833..-3666....qu
f5c0: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
f5d0: 45 4c 45 43 54 20 74 61 62 31 2e 63 6f 6c 31 20  ELECT tab1.col1 
f5e0: 2b 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c 31  + + col0 AS col1
f5f0: 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d   FROM tab1..----
f600: 0d 0a 32 39 0d 0a 37 34 0d 0a 39 33 0d 0a 0d 0a  ..29..74..93....
f610: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
f620: 0a 53 45 4c 45 43 54 20 63 6f 72 30 2e 63 6f 6c  .SELECT cor0.col
f630: 30 20 2a 20 2d 20 63 6f 6c 32 20 41 53 20 63 6f  0 * - col2 AS co
f640: 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l0 FROM tab0 AS 
f650: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 35 0d  cor0..----..-35.
f660: 0a 2d 37 32 39 38 0d 0a 2d 37 39 32 0d 0a 0d 0a  .-7298..-792....
f670: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
f680: 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
f690: 20 2d 20 2d 20 63 6f 6c 31 20 2b 20 2d 20 63 6f   - - col1 + - co
f6a0: 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 63 6f 72  l1 FROM tab2 cor
f6b0: 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 0d 0a 6f 6e  0..----..0....on
f6c0: 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
f6d0: 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
f6e0: 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
f6f0: 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
f700: 6f 72 74 20 6c 61 62 65 6c 2d 34 34 30 0d 0a 53  ort label-440..S
f710: 45 4c 45 43 54 20 41 4c 4c 20 2b 20 2d 20 63 6f  ELECT ALL + - co
f720: 6c 30 20 44 49 56 20 2d 20 63 6f 6c 32 20 2b 20  l0 DIV - col2 + 
f730: 2d 20 63 6f 72 30 2e 63 6f 6c 30 20 2b 20 63 6f  - cor0.col0 + co
f740: 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l0 FROM tab1 AS 
f750: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30  cor0..----..0..0
f760: 0d 0a 31 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  ..1....skipif my
f770: 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
f780: 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
f790: 77 73 6f 72 74 20 6c 61 62 65 6c 2d 34 34 30 0d  wsort label-440.
f7a0: 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 2d 20  .SELECT ALL + - 
f7b0: 63 6f 6c 30 20 2f 20 2d 20 63 6f 6c 32 20 2b 20  col0 / - col2 + 
f7c0: 2d 20 63 6f 72 30 2e 63 6f 6c 30 20 2b 20 63 6f  - cor0.col0 + co
f7d0: 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l0 FROM tab1 AS 
f7e0: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30  cor0..----..0..0
f7f0: 0d 0a 31 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  ..1....onlyif my
f800: 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70  sql # use DIV op
f810: 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67  erator for integ
f820: 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65  er division..que
f830: 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
f840: 65 6c 2d 34 34 31 0d 0a 53 45 4c 45 43 54 20 2b  el-441..SELECT +
f850: 20 33 31 20 44 49 56 20 63 6f 72 30 2e 63 6f 6c   31 DIV cor0.col
f860: 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  0 FROM tab0 AS c
f870: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d  or0..----..0..0.
f880: 0a 31 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  .1....skipif mys
f890: 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
f8a0: 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
f8b0: 73 6f 72 74 20 6c 61 62 65 6c 2d 34 34 31 0d 0a  sort label-441..
f8c0: 53 45 4c 45 43 54 20 2b 20 33 31 20 2f 20 63 6f  SELECT + 31 / co
f8d0: 72 30 2e 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  r0.col0 FROM tab
f8e0: 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
f8f0: 0a 30 0d 0a 30 0d 0a 31 0d 0a 0d 0a 71 75 65 72  .0..0..1....quer
f900: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
f910: 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 2b  ECT DISTINCT + +
f920: 20 63 6f 6c 32 20 2b 20 63 6f 6c 30 20 2a 20 63   col2 + col0 * c
f930: 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol0 FROM tab0 AS
f940: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 32   cor0..----..122
f950: 36 0d 0a 36 30 39 0d 0a 38 30 30 33 0d 0a 0d 0a  6..609..8003....
f960: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
f970: 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 2b 20  .SELECT ALL - + 
f980: 63 6f 6c 31 20 2b 20 63 6f 6c 30 20 2a 20 63 6f  col1 + col0 * co
f990: 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l1 FROM tab0 AS 
f9a0: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 39 37 38  cor0..----..1978
f9b0: 0d 0a 33 32 39 38 0d 0a 38 30 30 38 0d 0a 0d 0a  ..3298..8008....
f9c0: 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71  skipif postgresq
f9d0: 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72  l # PostgreSQL r
f9e0: 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20  equires AS when 
f9f0: 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20  renaming output 
fa00: 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49  columns..query I
fa10: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
fa20: 20 41 4c 4c 20 2d 20 2b 20 63 6f 6c 30 20 2a 20   ALL - + col0 * 
fa30: 2d 20 63 6f 6c 32 20 2b 20 63 6f 6c 32 20 63 6f  - col2 + col2 co
fa40: 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l1 FROM tab1 AS 
fa50: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 31 36 0d  cor0..----..216.
fa60: 0a 33 37 30 35 0d 0a 37 37 37 36 0d 0a 0d 0a 71  .3705..7776....q
fa70: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
fa80: 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
fa90: 2d 20 28 20 63 6f 72 30 2e 63 6f 6c 32 20 29 20  - ( cor0.col2 ) 
faa0: 2d 20 39 39 20 46 52 4f 4d 20 74 61 62 30 2c 20  - 99 FROM tab0, 
fab0: 74 61 62 30 20 63 6f 72 30 2c 20 74 61 62 32 20  tab0 cor0, tab2 
fac0: 41 53 20 63 6f 72 31 2c 20 74 61 62 31 2c 20 74  AS cor1, tab1, t
fad0: 61 62 31 20 41 53 20 63 6f 72 32 0d 0a 2d 2d 2d  ab1 AS cor2..---
fae0: 2d 0d 0a 2d 31 30 30 0d 0a 2d 31 33 32 0d 0a 2d  -..-100..-132..-
faf0: 31 38 31 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f  181....skipif po
fb00: 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67  stgresql # Postg
fb10: 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41  reSQL requires A
fb20: 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20  S when renaming 
fb30: 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a  output columns..
fb40: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
fb50: 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 32 20 2b  .SELECT + col2 +
fb60: 20 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c 30 20 2a   col2 * - col0 *
fb70: 20 63 6f 72 30 2e 63 6f 6c 31 20 63 6f 6c 31 20   cor0.col1 col1 
fb80: 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
fb90: 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 36 34 32 33 0d  0..----..-36423.
fba0: 0a 2d 34 31 35 38 0d 0a 2d 39 39 37 34 34 0d 0a  .-4158..-99744..
fbb0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
fbc0: 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 30  t..SELECT + col0
fbd0: 20 2a 20 2d 20 39 36 20 46 52 4f 4d 20 74 61 62   * - 96 FROM tab
fbe0: 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
fbf0: 0a 2d 32 33 30 34 0d 0a 2d 33 33 36 30 0d 0a 2d  .-2304..-3360..-
fc00: 38 35 34 34 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  8544....onlyif m
fc10: 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66  ysql # support f
fc20: 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69  or MySQL specifi
fc30: 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61  c system types a
fc40: 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79  nd syntax..query
fc50: 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
fc60: 2d 34 34 38 0d 0a 53 45 4c 45 43 54 20 2d 20 31  -448..SELECT - 1
fc70: 37 20 2b 20 63 6f 6c 31 20 2a 20 2d 20 43 41 53  7 + col1 * - CAS
fc80: 54 28 20 4e 55 4c 4c 20 41 53 20 44 45 43 49 4d  T( NULL AS DECIM
fc90: 41 4c 20 29 20 46 52 4f 4d 20 74 61 62 32 20 41  AL ) FROM tab2 A
fca0: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55  S cor0..----..NU
fcb0: 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a  LL..NULL..NULL..
fcc0: 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
fcd0: 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
fce0: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
fcf0: 20 6c 61 62 65 6c 2d 34 34 38 0d 0a 53 45 4c 45   label-448..SELE
fd00: 43 54 20 2d 20 31 37 20 2b 20 63 6f 6c 31 20 2a  CT - 17 + col1 *
fd10: 20 2d 20 43 41 53 54 20 28 20 4e 55 4c 4c 20 41   - CAST ( NULL A
fd20: 53 20 52 45 41 4c 20 29 20 46 52 4f 4d 20 74 61  S REAL ) FROM ta
fd30: 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
fd40: 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55  ..NULL..NULL..NU
fd50: 4c 4c 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  LL....query I ro
fd60: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
fd70: 2b 20 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c 30 20  + col2 * + col0 
fd80: 2b 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61  + + col0 FROM ta
fd90: 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
fda0: 0d 0a 37 30 0d 0a 37 33 38 37 0d 0a 38 31 36 0d  ..70..7387..816.
fdb0: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
fdc0: 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c  rt..SELECT + col
fdd0: 30 20 2a 20 63 6f 6c 31 20 2b 20 38 37 20 41 53  0 * col1 + 87 AS
fde0: 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20   col1 FROM tab2 
fdf0: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
fe00: 34 33 30 0d 0a 33 30 34 0d 0a 34 36 38 39 0d 0a  430..304..4689..
fe10: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
fe20: 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2d 20 63 6f  t..SELECT - - co
fe30: 6c 31 20 2a 20 2b 20 63 6f 6c 31 20 2b 20 63 6f  l1 * + col1 + co
fe40: 6c 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  l0 AS col2 FROM 
fe50: 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
fe60: 2d 2d 0d 0a 31 36 34 0d 0a 32 34 39 0d 0a 36 37  --..164..249..67
fe70: 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  9....query I row
fe80: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 33  sort..SELECT + 3
fe90: 38 20 2a 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20  8 * + col0 FROM 
fea0: 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33 33 30  tab0..----..1330
feb0: 0d 0a 33 33 38 32 0d 0a 39 31 32 0d 0a 0d 0a 71  ..3382..912....q
fec0: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
fed0: 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
fee0: 2b 20 63 6f 6c 31 20 2a 20 63 6f 6c 30 20 2a 20  + col1 * col0 * 
fef0: 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46 52 4f  col0 AS col2 FRO
ff00: 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31  M tab0..----..11
ff10: 38 38 32 35 0d 0a 34 39 35 33 36 0d 0a 37 32 30  8825..49536..720
ff20: 38 31 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  811....query I r
ff30: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
ff40: 49 53 54 49 4e 43 54 20 2d 20 33 39 20 2a 20 63  ISTINCT - 39 * c
ff50: 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 63 6f  ol1 FROM tab2 co
ff60: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32 30 39 0d  r0..----..-1209.
ff70: 0a 2d 32 33 30 31 0d 0a 2d 36 36 33 0d 0a 0d 0a  .-2301..-663....
ff80: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
ff90: 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 28 20  .SELECT ALL + ( 
ffa0: 2b 20 63 6f 6c 30 20 29 20 2a 20 63 6f 6c 31 20  + col0 ) * col1 
ffb0: 2b 20 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46  + col2 AS col2 F
ffc0: 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab2..----..
ffd0: 31 33 38 31 0d 0a 32 34 34 0d 0a 34 36 32 38 0d  1381..244..4628.
ffe0: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
fff0: 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d  rt..SELECT ALL -
10000 20 2d 20 35 20 2a 20 63 6f 72 31 2e 63 6f 6c 31   - 5 * cor1.col1
10010 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
10020 72 30 20 43 52 4f 53 53 20 4a 4f 49 4e 20 74 61  r0 CROSS JOIN ta
10030 62 30 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d  b0 AS cor1..----
10040 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68 69  ..9 values hashi
10050 6e 67 20 74 6f 20 61 33 63 64 30 63 30 62 32 38  ng to a3cd0c0b28
10060 39 36 33 61 32 33 38 30 64 37 30 37 62 63 64 36  963a2380d707bcd6
10070 61 65 64 63 31 61 0d 0a 0d 0a 71 75 65 72 79 20  aedc1a....query 
10080 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
10090 54 20 36 35 20 2b 20 63 6f 6c 32 20 46 52 4f 4d  T 65 + col2 FROM
100a0 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 34 37   tab0..----..147
100b0 0d 0a 36 36 0d 0a 39 38 0d 0a 0d 0a 71 75 65 72  ..66..98....quer
100c0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
100d0 45 43 54 20 2d 20 28 20 63 6f 6c 30 20 29 20 2b  ECT - ( col0 ) +
100e0 20 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46 52   col2 AS col0 FR
100f0 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
10100 0a 2d 2d 2d 2d 0d 0a 2d 34 31 0d 0a 2d 35 32 0d  .----..-41..-52.
10110 0a 32 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  .20....onlyif my
10120 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70  sql # use DIV op
10130 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67  erator for integ
10140 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65  er division..que
10150 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
10160 65 6c 2d 34 35 39 0d 0a 53 45 4c 45 43 54 20 2d  el-459..SELECT -
10170 20 63 6f 6c 30 20 2d 20 63 6f 6c 31 20 44 49 56   col0 - col1 DIV
10180 20 34 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53   41 FROM tab1 AS
10190 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 0d   cor0..----..-3.
101a0 0a 2d 36 34 0d 0a 2d 38 30 0d 0a 0d 0a 73 6b 69  .-64..-80....ski
101b0 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
101c0 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
101d0 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
101e0 6c 2d 34 35 39 0d 0a 53 45 4c 45 43 54 20 2d 20  l-459..SELECT - 
101f0 63 6f 6c 30 20 2d 20 63 6f 6c 31 20 2f 20 34 31  col0 - col1 / 41
10200 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
10210 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 0d 0a 2d 36  r0..----..-3..-6
10220 34 0d 0a 2d 38 30 0d 0a 0d 0a 71 75 65 72 79 20  4..-80....query 
10230 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
10240 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c  T DISTINCT + col
10250 32 20 2a 20 28 20 63 6f 6c 31 20 2a 20 74 61 62  2 * ( col1 * tab
10260 30 2e 63 6f 6c 30 20 2b 20 2d 20 35 36 20 29 20  0.col0 + - 56 ) 
10270 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d  FROM tab0..----.
10280 0a 33 33 33 39 0d 0a 36 35 39 35 32 36 0d 0a 36  .3339..659526..6
10290 36 32 36 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20  6264....query I 
102a0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
102b0 41 4c 4c 20 2d 20 63 6f 6c 30 20 2a 20 2d 20 28  ALL - col0 * - (
102c0 20 2b 20 32 33 20 2a 20 63 6f 72 30 2e 63 6f 6c   + 23 * cor0.col
102d0 30 20 29 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  0 ) AS col0 FROM
102e0 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab2 cor0..----
102f0 0d 0a 31 31 32 37 0d 0a 31 33 39 39 33 32 0d 0a  ..1127..139932..
10300 31 34 33 35 34 33 0d 0a 0d 0a 71 75 65 72 79 20  143543....query 
10310 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
10320 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c  T DISTINCT + col
10330 32 20 2a 20 2b 20 36 36 20 46 52 4f 4d 20 74 61  2 * + 66 FROM ta
10340 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 37 31 36 0d 0a  b2..----..1716..
10350 31 37 38 32 0d 0a 32 35 30 38 0d 0a 0d 0a 6f 6e  1782..2508....on
10360 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70  lyif mysql # sup
10370 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73  port for MySQL s
10380 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20 74  pecific system t
10390 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d  ypes and syntax.
103a0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
103b0 20 6c 61 62 65 6c 2d 34 36 33 0d 0a 53 45 4c 45   label-463..SELE
103c0 43 54 20 43 41 53 54 28 20 2d 20 38 31 20 2b 20  CT CAST( - 81 + 
103d0 63 6f 6c 32 20 41 53 20 53 49 47 4e 45 44 20 29  col2 AS SIGNED )
103e0 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d   FROM tab0..----
103f0 0d 0a 2d 34 38 0d 0a 2d 38 30 0d 0a 31 0d 0a 0d  ..-48..-80..1...
10400 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
10410 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
10420 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
10430 6c 61 62 65 6c 2d 34 36 33 0d 0a 53 45 4c 45 43  label-463..SELEC
10440 54 20 43 41 53 54 20 28 20 2d 20 38 31 20 2b 20  T CAST ( - 81 + 
10450 63 6f 6c 32 20 41 53 20 49 4e 54 45 47 45 52 20  col2 AS INTEGER 
10460 29 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d  ) FROM tab0..---
10470 2d 0d 0a 2d 34 38 0d 0a 2d 38 30 0d 0a 31 0d 0a  -..-48..-80..1..
10480 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
10490 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 33 36  t..SELECT ALL 36
104a0 20 46 52 4f 4d 20 74 61 62 30 2c 20 74 61 62 31   FROM tab0, tab1
104b0 20 41 53 20 63 6f 72 30 2c 20 74 61 62 32 20 41   AS cor0, tab2 A
104c0 53 20 63 6f 72 31 2c 20 74 61 62 32 20 41 53 20  S cor1, tab2 AS 
104d0 63 6f 72 32 0d 0a 2d 2d 2d 2d 0d 0a 38 31 20 76  cor2..----..81 v
104e0 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f  alues hashing to
104f0 20 65 30 39 62 31 39 37 33 36 35 61 30 34 66 61   e09b197365a04fa
10500 62 62 61 61 66 30 37 31 38 64 32 61 65 38 38 63  bbaaf0718d2ae88c
10510 35 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74  5....skipif post
10520 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65  gresql # Postgre
10530 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20  SQL requires AS 
10540 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75  when renaming ou
10550 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75  tput columns..qu
10560 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
10570 45 4c 45 43 54 20 63 6f 6c 32 20 2b 20 63 6f 72  ELECT col2 + cor
10580 30 2e 63 6f 6c 31 20 63 6f 6c 30 20 46 52 4f 4d  0.col1 col0 FROM
10590 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
105a0 2d 2d 2d 0d 0a 35 35 0d 0a 35 38 0d 0a 38 35 0d  ---..55..58..85.
105b0 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
105c0 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74  # use DIV operat
105d0 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64  or for integer d
105e0 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49  ivision..query I
105f0 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 34   rowsort label-4
10600 36 36 0d 0a 53 45 4c 45 43 54 20 2d 20 28 20 2d  66..SELECT - ( -
10610 20 35 37 20 29 20 2a 20 63 6f 6c 32 20 44 49 56   57 ) * col2 DIV
10620 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 0d   col1 FROM tab1.
10630 0a 2d 2d 2d 2d 0d 0a 31 31 38 0d 0a 33 32 34 0d  .----..118..324.
10640 0a 34 32 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  .420....skipif m
10650 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
10660 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
10670 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 34 36 36  owsort label-466
10680 0d 0a 53 45 4c 45 43 54 20 2d 20 28 20 2d 20 35  ..SELECT - ( - 5
10690 37 20 29 20 2a 20 63 6f 6c 32 20 2f 20 63 6f 6c  7 ) * col2 / col
106a0 31 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d  1 FROM tab1..---
106b0 2d 0d 0a 31 31 38 0d 0a 33 32 34 0d 0a 34 32 30  -..118..324..420
106c0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
106d0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
106e0 49 4e 43 54 20 74 61 62 32 2e 63 6f 6c 30 20 2a  INCT tab2.col0 *
106f0 20 2b 20 31 30 20 46 52 4f 4d 20 74 61 62 32 0d   + 10 FROM tab2.
10700 0a 2d 2d 2d 2d 0d 0a 37 30 0d 0a 37 38 30 0d 0a  .----..70..780..
10710 37 39 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  790....query I r
10720 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
10730 49 53 54 49 4e 43 54 20 2d 20 36 33 20 2a 20 63  ISTINCT - 63 * c
10740 6f 6c 30 20 2a 20 2d 20 63 6f 6c 30 20 41 53 20  ol0 * - col0 AS 
10750 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 0d 0a  col2 FROM tab0..
10760 2d 2d 2d 2d 0d 0a 33 36 32 38 38 0d 0a 34 39 39  ----..36288..499
10770 30 32 33 0d 0a 37 37 31 37 35 0d 0a 0d 0a 71 75  023..77175....qu
10780 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
10790 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 28  ELECT DISTINCT (
107a0 20 2d 20 38 35 20 2a 20 63 6f 6c 32 20 2b 20 39   - 85 * col2 + 9
107b0 37 20 29 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d  7 ) FROM tab0..-
107c0 2d 2d 2d 0d 0a 2d 32 37 30 38 0d 0a 2d 36 38 37  ---..-2708..-687
107d0 33 0d 0a 31 32 0d 0a 0d 0a 71 75 65 72 79 20 49  3..12....query I
107e0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
107f0 20 44 49 53 54 49 4e 43 54 20 2b 20 39 39 20 41   DISTINCT + 99 A
10800 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31  S col0 FROM tab1
10810 2c 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d  , tab1 cor0..---
10820 2d 0d 0a 39 39 0d 0a 0d 0a 71 75 65 72 79 20 49  -..99....query I
10830 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
10840 20 2d 20 32 36 20 2a 20 2b 20 34 38 20 46 52 4f   - 26 * + 48 FRO
10850 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
10860 2d 2d 2d 2d 0d 0a 2d 31 32 34 38 0d 0a 2d 31 32  ----..-1248..-12
10870 34 38 0d 0a 2d 31 32 34 38 0d 0a 0d 0a 71 75 65  48..-1248....que
10880 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
10890 4c 45 43 54 20 2b 20 63 6f 72 30 2e 63 6f 6c 30  LECT + cor0.col0
108a0 20 2a 20 32 35 20 41 53 20 63 6f 6c 32 20 46 52   * 25 AS col2 FR
108b0 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
108c0 0a 2d 2d 2d 2d 0d 0a 31 37 35 0d 0a 31 39 35 30  .----..175..1950
108d0 0d 0a 31 39 37 35 0d 0a 0d 0a 71 75 65 72 79 20  ..1975....query 
108e0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
108f0 54 20 44 49 53 54 49 4e 43 54 20 63 6f 72 30 2e  T DISTINCT cor0.
10900 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 2c 20  col1 FROM tab1, 
10910 74 61 62 30 20 41 53 20 63 6f 72 30 20 43 52 4f  tab0 AS cor0 CRO
10920 53 53 20 4a 4f 49 4e 20 74 61 62 30 0d 0a 2d 2d  SS JOIN tab0..--
10930 2d 2d 0d 0a 38 36 0d 0a 39 31 0d 0a 39 37 0d 0a  --..86..91..97..
10940 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
10950 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2b 20 63 6f  t..SELECT - + co
10960 6c 32 20 2a 20 31 32 20 46 52 4f 4d 20 74 61 62  l2 * 12 FROM tab
10970 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
10980 0a 2d 31 31 35 32 0d 0a 2d 36 34 38 0d 0a 2d 36  .-1152..-648..-6
10990 38 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  84....query I ro
109a0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
109b0 36 32 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  62 AS col1 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 36 32 0d 0a 36 32 0d 0a 36 32 0d 0a  --..62..62..62..
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 2d 20 28 20  t..SELECT + - ( 
10a00 2d 20 63 6f 6c 32 20 29 20 2a 20 63 6f 6c 32 20  - col2 ) * col2 
10a10 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
10a20 30 0d 0a 2d 2d 2d 2d 0d 0a 31 0d 0a 31 30 38 39  0..----..1..1089
10a30 0d 0a 36 37 32 34 0d 0a 0d 0a 6f 6e 6c 79 69 66  ..6724....onlyif
10a40 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74   mysql # support
10a50 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69   for MySQL speci
10a60 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73  fic system types
10a70 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65   and syntax..que
10a80 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
10a90 65 6c 2d 34 37 37 0d 0a 53 45 4c 45 43 54 20 41  el-477..SELECT A
10aa0 4c 4c 20 63 6f 6c 30 20 2a 20 63 6f 6c 31 20 2a  LL col0 * col1 *
10ab0 20 43 41 53 54 28 20 4e 55 4c 4c 20 41 53 20 53   CAST( NULL AS S
10ac0 49 47 4e 45 44 20 29 20 2b 20 63 6f 6c 31 20 46  IGNED ) + col1 F
10ad0 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
10ae0 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55  ..----..NULL..NU
10af0 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70  LL..NULL....skip
10b00 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
10b10 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
10b20 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
10b30 2d 34 37 37 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  -477..SELECT ALL
10b40 20 63 6f 6c 30 20 2a 20 63 6f 6c 31 20 2a 20 43   col0 * col1 * C
10b50 41 53 54 20 28 20 4e 55 4c 4c 20 41 53 20 49 4e  AST ( NULL AS IN
10b60 54 45 47 45 52 20 29 20 2b 20 63 6f 6c 31 20 46  TEGER ) + col1 F
10b70 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
10b80 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55  ..----..NULL..NU
10b90 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75 65 72  LL..NULL....quer
10ba0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
10bb0 45 43 54 20 41 4c 4c 20 2b 20 37 20 2b 20 2b 20  ECT ALL + 7 + + 
10bc0 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46 52 4f  col2 AS col1 FRO
10bd0 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab2 cor0..---
10be0 2d 0d 0a 33 33 0d 0a 33 34 0d 0a 34 35 0d 0a 0d  -..33..34..45...
10bf0 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
10c00 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72  use DIV operator
10c10 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76   for integer div
10c20 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72  ision..query I r
10c30 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 34 37 39  owsort label-479
10c40 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 2d  ..SELECT ALL - -
10c50 20 33 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 44   3 + cor0.col1 D
10c60 49 56 20 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20  IV col2 AS col1 
10c70 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a  FROM tab0 cor0..
10c80 2d 2d 2d 2d 0d 0a 31 30 30 0d 0a 34 0d 0a 35 0d  ----..100..4..5.
10c90 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
10ca0 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
10cb0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
10cc0 74 20 6c 61 62 65 6c 2d 34 37 39 0d 0a 53 45 4c  t label-479..SEL
10cd0 45 43 54 20 41 4c 4c 20 2d 20 2d 20 33 20 2b 20  ECT ALL - - 3 + 
10ce0 63 6f 72 30 2e 63 6f 6c 31 20 2f 20 63 6f 6c 32  cor0.col1 / col2
10cf0 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
10d00 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  b0 cor0..----..1
10d10 30 30 0d 0a 34 0d 0a 35 0d 0a 0d 0a 71 75 65 72  00..4..5....quer
10d20 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
10d30 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 31  ECT DISTINCT - 1
10d40 30 20 2a 20 63 6f 6c 30 20 41 53 20 63 6f 6c 32  0 * col0 AS col2
10d50 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
10d60 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 30 0d 0a 2d  r0..----..-30..-
10d70 36 34 30 0d 0a 2d 38 30 30 0d 0a 0d 0a 6f 6e 6c  640..-800....onl
10d80 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20  yif mysql # use 
10d90 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72  DIV operator for
10da0 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f   integer divisio
10db0 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  n..query I rowso
10dc0 72 74 20 6c 61 62 65 6c 2d 34 38 31 0d 0a 53 45  rt label-481..SE
10dd0 4c 45 43 54 20 41 4c 4c 20 2b 20 2d 20 63 6f 72  LECT ALL + - cor
10de0 30 2e 63 6f 6c 32 20 2b 20 2b 20 63 6f 6c 32 20  0.col2 + + col2 
10df0 44 49 56 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20  DIV + cor0.col2 
10e00 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
10e10 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
10e20 0a 2d 35 33 0d 0a 2d 35 36 0d 0a 2d 39 35 0d 0a  .-53..-56..-95..
10e30 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
10e40 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
10e50 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
10e60 20 6c 61 62 65 6c 2d 34 38 31 0d 0a 53 45 4c 45   label-481..SELE
10e70 43 54 20 41 4c 4c 20 2b 20 2d 20 63 6f 72 30 2e  CT ALL + - cor0.
10e80 63 6f 6c 32 20 2b 20 2b 20 63 6f 6c 32 20 2f 20  col2 + + col2 / 
10e90 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 41 53 20 63  + cor0.col2 AS c
10ea0 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol2 FROM tab1 AS
10eb0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 33   cor0..----..-53
10ec0 0d 0a 2d 35 36 0d 0a 2d 39 35 0d 0a 0d 0a 71 75  ..-56..-95....qu
10ed0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
10ee0 45 4c 45 43 54 20 2d 20 63 6f 6c 30 20 2b 20 39  ELECT - col0 + 9
10ef0 36 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  6 FROM tab0 AS c
10f00 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 36 31 0d 0a 37  or0..----..61..7
10f10 0d 0a 37 32 0d 0a 0d 0a 73 6b 69 70 69 66 20 70  ..72....skipif p
10f20 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74  ostgresql # Post
10f30 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20  greSQL requires 
10f40 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67  AS when renaming
10f50 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d   output columns.
10f60 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
10f70 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 30 20  ..SELECT - col0 
10f80 2a 20 2b 20 28 20 33 35 20 29 20 63 6f 6c 31 20  * + ( 35 ) col1 
10f90 46 52 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a  FROM tab2 cor0..
10fa0 2d 2d 2d 2d 0d 0a 2d 32 34 35 0d 0a 2d 32 37 33  ----..-245..-273
10fb0 30 0d 0a 2d 32 37 36 35 0d 0a 0d 0a 71 75 65 72  0..-2765....quer
10fc0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
10fd0 45 43 54 20 2d 20 2d 20 63 6f 6c 32 20 2b 20 2d  ECT - - col2 + -
10fe0 20 63 6f 6c 32 20 2a 20 2b 20 35 33 20 41 53 20   col2 * + 53 AS 
10ff0 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41  col2 FROM tab0 A
11000 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
11010 37 31 36 0d 0a 2d 34 32 36 34 0d 0a 2d 35 32 0d  716..-4264..-52.
11020 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
11030 72 74 0d 0a 53 45 4c 45 43 54 20 74 61 62 30 2e  rt..SELECT tab0.
11040 63 6f 6c 30 20 2a 20 32 39 20 46 52 4f 4d 20 74  col0 * 29 FROM t
11050 61 62 30 2c 20 74 61 62 32 2c 20 74 61 62 32 20  ab0, tab2, tab2 
11060 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32  AS cor0..----..2
11070 37 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67  7 values hashing
11080 20 74 6f 20 36 65 30 37 61 34 38 32 33 37 35 65   to 6e07a482375e
11090 66 34 36 66 61 63 65 30 36 31 63 37 63 32 38 32  f46face061c7c282
110a0 34 66 39 62 0d 0a 0d 0a 71 75 65 72 79 20 49 20  4f9b....query I 
110b0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
110c0 41 4c 4c 20 2b 20 63 6f 6c 30 20 2b 20 28 20 2b  ALL + col0 + ( +
110d0 20 63 6f 6c 32 20 29 20 46 52 4f 4d 20 74 61 62   col2 ) FROM tab
110e0 30 0d 0a 2d 2d 2d 2d 0d 0a 31 37 31 0d 0a 33 36  0..----..171..36
110f0 0d 0a 35 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..57....query I 
11100 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
11110 41 4c 4c 20 2b 20 74 61 62 31 2e 63 6f 6c 31 20  ALL + tab1.col1 
11120 2a 20 2b 20 28 20 35 30 20 29 20 2b 20 63 6f 6c  * + ( 50 ) + col
11130 31 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d  1 FROM tab1..---
11140 2d 0d 0a 31 33 32 36 0d 0a 35 31 30 0d 0a 36 36  -..1326..510..66
11150 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  3....query I row
11160 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
11170 20 63 6f 6c 31 20 2b 20 35 31 20 41 53 20 63 6f   col1 + 51 AS co
11180 6c 32 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d  l2 FROM tab1..--
11190 2d 2d 0d 0a 36 31 0d 0a 36 34 0d 0a 37 37 0d 0a  --..61..64..77..
111a0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
111b0 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
111c0 43 54 20 63 6f 6c 30 20 2b 20 2d 20 28 20 33 33  CT col0 + - ( 33
111d0 20 29 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20   ) AS col1 FROM 
111e0 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 36 0d  tab2..----..-26.
111f0 0a 34 35 0d 0a 34 36 0d 0a 0d 0a 71 75 65 72 79  .45..46....query
11200 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
11210 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 32  CT DISTINCT col2
11220 20 2a 20 2b 20 33 39 20 2b 20 36 38 20 41 53 20   * + 39 + 68 AS 
11230 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 0d 0a  col1 FROM tab2..
11240 2d 2d 2d 2d 0d 0a 31 30 38 32 0d 0a 31 31 32 31  ----..1082..1121
11250 0d 0a 31 35 35 30 0d 0a 0d 0a 71 75 65 72 79 20  ..1550....query 
11260 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
11270 54 20 2d 20 32 34 20 41 53 20 63 6f 6c 31 20 46  T - 24 AS col1 F
11280 52 4f 4d 20 74 61 62 30 2c 20 74 61 62 30 20 41  ROM tab0, tab0 A
11290 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20  S cor0..----..9 
112a0 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74  values hashing t
112b0 6f 20 37 39 37 64 30 66 37 63 31 34 35 66 38 61  o 797d0f7c145f8a
112c0 63 36 32 33 39 32 34 34 34 38 63 37 31 34 62 62  c623924448c714bb
112d0 63 63 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  cc....query I ro
112e0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
112f0 53 54 49 4e 43 54 20 2b 20 63 6f 6c 32 20 2a 20  STINCT + col2 * 
11300 2b 20 32 31 20 46 52 4f 4d 20 74 61 62 32 20 63  + 21 FROM tab2 c
11310 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 35 34 36 0d 0a  or0..----..546..
11320 35 36 37 0d 0a 37 39 38 0d 0a 0d 0a 71 75 65 72  567..798....quer
11330 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
11340 45 43 54 20 2b 20 2b 20 63 6f 72 30 2e 63 6f 6c  ECT + + cor0.col
11350 30 20 2a 20 37 39 20 2b 20 2d 20 38 34 20 41 53  0 * 79 + - 84 AS
11360 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20   col2 FROM tab0 
11370 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 38 31 32  cor0..----..1812
11380 0d 0a 32 36 38 31 0d 0a 36 39 34 37 0d 0a 0d 0a  ..2681..6947....
11390 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
113a0 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 37 35  .SELECT ALL + 75
113b0 20 46 52 4f 4d 20 74 61 62 32 2c 20 74 61 62 32   FROM tab2, tab2
113c0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
113d0 39 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67  9 values hashing
113e0 20 74 6f 20 32 32 30 34 32 62 66 64 34 64 37 38   to 22042bfd4d78
113f0 37 34 31 35 34 35 37 61 34 32 62 62 39 33 64 34  7415457a42bb93d4
11400 38 65 65 61 0d 0a 0d 0a 71 75 65 72 79 20 49 20  8eea....query I 
11410 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
11420 41 4c 4c 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20  ALL + cor0.col0 
11430 2a 20 2d 20 28 20 63 6f 72 30 2e 63 6f 6c 31 20  * - ( cor0.col1 
11440 29 20 2d 20 63 6f 6c 31 20 41 53 20 63 6f 6c 32  ) - col1 AS col2
11450 20 46 52 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d   FROM tab2 cor0.
11460 0a 2d 2d 2d 2d 0d 0a 2d 31 33 36 30 0d 0a 2d 32  .----..-1360..-2
11470 34 38 0d 0a 2d 34 36 36 31 0d 0a 0d 0a 6f 6e 6c  48..-4661....onl
11480 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70  yif mysql # supp
11490 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70  ort for MySQL sp
114a0 65 63 69 66 69 63 20 73 79 73 74 65 6d 20 74 79  ecific system ty
114b0 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a  pes and syntax..
114c0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
114d0 6c 61 62 65 6c 2d 34 39 36 0d 0a 53 45 4c 45 43  label-496..SELEC
114e0 54 20 41 4c 4c 20 2d 20 63 6f 6c 30 20 2b 20 2b  T ALL - col0 + +
114f0 20 43 41 53 54 28 20 2d 20 63 6f 6c 30 20 41 53   CAST( - col0 AS
11500 20 53 49 47 4e 45 44 20 29 20 46 52 4f 4d 20 74   SIGNED ) FROM t
11510 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab1 cor0..----..
11520 2d 31 32 38 0d 0a 2d 31 36 30 0d 0a 2d 36 0d 0a  -128..-160..-6..
11530 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
11540 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
11550 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
11560 20 6c 61 62 65 6c 2d 34 39 36 0d 0a 53 45 4c 45   label-496..SELE
11570 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 30 20 2b 20  CT ALL - col0 + 
11580 2b 20 43 41 53 54 20 28 20 2d 20 63 6f 6c 30 20  + CAST ( - col0 
11590 41 53 20 49 4e 54 45 47 45 52 20 29 20 46 52 4f  AS INTEGER ) FRO
115a0 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab1 cor0..---
115b0 2d 0d 0a 2d 31 32 38 0d 0a 2d 31 36 30 0d 0a 2d  -..-128..-160..-
115c0 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  6....query I row
115d0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2b  sort..SELECT - +
115e0 20 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c 30 20 2b   col2 * + col0 +
115f0 20 32 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20   2 AS col0 FROM 
11600 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
11610 2d 2d 0d 0a 2d 31 36 30 0d 0a 2d 33 36 34 36 0d  --..-160..-3646.
11620 0a 2d 37 36 37 38 0d 0a 0d 0a 71 75 65 72 79 20  .-7678....query 
11630 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
11640 54 20 41 4c 4c 20 2d 20 28 20 63 6f 6c 31 20 29  T ALL - ( col1 )
11650 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62   + col1 FROM tab
11660 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
11670 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a 6f 6e 6c 79  .0..0..0....only
11680 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f  if mysql # suppo
11690 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65  rt for MySQL spe
116a0 63 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70  cific system typ
116b0 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71  es and syntax..q
116c0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
116d0 61 62 65 6c 2d 34 39 39 0d 0a 53 45 4c 45 43 54  abel-499..SELECT
116e0 20 44 49 53 54 49 4e 43 54 20 2d 20 2d 20 43 41   DISTINCT - - CA
116f0 53 54 28 20 4e 55 4c 4c 20 41 53 20 53 49 47 4e  ST( NULL AS SIGN
11700 45 44 20 29 20 2b 20 2d 20 63 6f 6c 30 20 2a 20  ED ) + - col0 * 
11710 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30  + col1 FROM tab0
11720 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c   cor0..----..NUL
11730 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  L....skipif mysq
11740 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
11750 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
11760 6f 72 74 20 6c 61 62 65 6c 2d 34 39 39 0d 0a 53  ort label-499..S
11770 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d  ELECT DISTINCT -
11780 20 2d 20 43 41 53 54 20 28 20 4e 55 4c 4c 20 41   - CAST ( NULL A
11790 53 20 49 4e 54 45 47 45 52 20 29 20 2b 20 2d 20  S INTEGER ) + - 
117a0 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c 31 20 46 52  col0 * + col1 FR
117b0 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d  OM tab0 cor0..--
117c0 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75 65 72  --..NULL....quer
117d0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
117e0 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 31 20 2a  ECT ALL - col1 *
117f0 20 2d 20 28 20 63 6f 6c 32 20 29 20 41 53 20 63   - ( col2 ) AS c
11800 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol2 FROM tab0 AS
11810 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 38 33   cor0..----..283
11820 38 0d 0a 37 34 36 32 0d 0a 39 37 0d 0a 0d 0a 6f  8..7462..97....o
11830 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73  nlyif mysql # us
11840 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66  e DIV operator f
11850 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73  or integer divis
11860 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ion..query I row
11870 73 6f 72 74 20 6c 61 62 65 6c 2d 35 30 31 0d 0a  sort label-501..
11880 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
11890 63 6f 6c 32 20 44 49 56 20 63 6f 6c 32 20 41 53  col2 DIV col2 AS
118a0 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20   col2 FROM tab1 
118b0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 0d 0a 0d  cor0..----..1...
118c0 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
118d0 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
118e0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
118f0 6c 61 62 65 6c 2d 35 30 31 0d 0a 53 45 4c 45 43  label-501..SELEC
11900 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 32 20  T DISTINCT col2 
11910 2f 20 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46  / col2 AS col2 F
11920 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d  ROM tab1 cor0..-
11930 2d 2d 2d 0d 0a 31 0d 0a 0d 0a 71 75 65 72 79 20  ---..1....query 
11940 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
11950 54 20 2d 20 2b 20 63 6f 6c 32 20 2a 20 38 20 41  T - + col2 * 8 A
11960 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31  S col0 FROM tab1
11970 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
11980 2d 34 33 32 0d 0a 2d 34 35 36 0d 0a 2d 37 36 38  -432..-456..-768
11990 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
119a0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
119b0 2d 20 63 6f 6c 30 20 2a 20 63 6f 6c 32 20 2b 20  - col0 * col2 + 
119c0 2d 20 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46  - col0 AS col2 F
119d0 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
119e0 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 39 36 0d 0a 2d 32  ..----..-196..-2
119f0 31 30 36 0d 0a 2d 33 30 38 31 0d 0a 0d 0a 71 75  106..-3081....qu
11a00 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
11a10 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d  ELECT DISTINCT -
11a20 20 2d 20 37 31 20 2a 20 2d 20 37 20 46 52 4f 4d   - 71 * - 7 FROM
11a30 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab0 cor0..----
11a40 0d 0a 2d 34 39 37 0d 0a 0d 0a 73 6b 69 70 69 66  ..-497....skipif
11a50 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f   postgresql # Po
11a60 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65  stgreSQL require
11a70 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69  s AS when renami
11a80 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e  ng output column
11a90 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  s..query I rowso
11aa0 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63  rt..SELECT ALL c
11ab0 6f 6c 32 20 2b 20 2d 20 37 35 20 63 6f 6c 31 20  ol2 + - 75 col1 
11ac0 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
11ad0 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 38 0d 0a 2d 32  0..----..-18..-2
11ae0 31 0d 0a 32 31 0d 0a 0d 0a 71 75 65 72 79 20 49  1..21....query I
11af0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
11b00 20 63 6f 6c 31 20 2b 20 2b 20 32 39 20 2a 20 2d   col1 + + 29 * -
11b10 20 74 61 62 32 2e 63 6f 6c 30 20 41 53 20 63 6f   tab2.col0 AS co
11b20 6c 32 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d  l2 FROM tab2..--
11b30 2d 2d 0d 0a 2d 31 37 32 0d 0a 2d 32 32 30 33 0d  --..-172..-2203.
11b40 0a 2d 32 32 37 34 0d 0a 0d 0a 71 75 65 72 79 20  .-2274....query 
11b50 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
11b60 54 20 41 4c 4c 20 63 6f 6c 31 20 2a 20 2d 20 33  T ALL col1 * - 3
11b70 32 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d  2 FROM tab0..---
11b80 2d 0d 0a 2d 32 37 35 32 0d 0a 2d 32 39 31 32 0d  -..-2752..-2912.
11b90 0a 2d 33 31 30 34 0d 0a 0d 0a 71 75 65 72 79 20  .-3104....query 
11ba0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
11bb0 54 20 44 49 53 54 49 4e 43 54 20 2b 20 35 37 20  T DISTINCT + 57 
11bc0 2a 20 63 6f 72 30 2e 63 6f 6c 31 20 46 52 4f 4d  * cor0.col1 FROM
11bd0 20 74 61 62 31 2c 20 74 61 62 31 20 41 53 20 63   tab1, tab1 AS c
11be0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 34 38 32 0d  or0..----..1482.
11bf0 0a 35 37 30 0d 0a 37 34 31 0d 0a 0d 0a 71 75 65  .570..741....que
11c00 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
11c10 4c 45 43 54 20 2b 20 39 31 20 46 52 4f 4d 20 74  LECT + 91 FROM t
11c20 61 62 31 20 41 53 20 63 6f 72 30 20 43 52 4f 53  ab1 AS cor0 CROS
11c30 53 20 4a 4f 49 4e 20 74 61 62 32 20 41 53 20 63  S JOIN tab2 AS c
11c40 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c  or1..----..9 val
11c50 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 35  ues hashing to 5
11c60 37 34 38 36 32 37 65 66 35 66 64 38 36 61 32 31  748627ef5fd86a21
11c70 63 64 35 35 39 66 64 32 37 38 64 37 32 37 37 0d  cd559fd278d7277.
11c80 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
11c90 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79  # support for My
11ca0 53 51 4c 20 73 70 65 63 69 66 69 63 20 73 79 73  SQL specific sys
11cb0 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79  tem types and sy
11cc0 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f  ntax..query I ro
11cd0 77 73 6f 72 74 20 6c 61 62 65 6c 2d 35 31 30 0d  wsort label-510.
11ce0 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
11cf0 20 39 38 20 2b 20 2d 20 74 61 62 32 2e 63 6f 6c   98 + - tab2.col
11d00 31 20 2a 20 43 41 53 54 28 20 4e 55 4c 4c 20 41  1 * CAST( NULL A
11d10 53 20 53 49 47 4e 45 44 20 29 20 46 52 4f 4d 20  S SIGNED ) FROM 
11d20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c  tab2..----..NULL
11d30 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
11d40 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
11d50 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
11d60 72 74 20 6c 61 62 65 6c 2d 35 31 30 0d 0a 53 45  rt label-510..SE
11d70 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 39 38  LECT DISTINCT 98
11d80 20 2b 20 2d 20 74 61 62 32 2e 63 6f 6c 31 20 2a   + - tab2.col1 *
11d90 20 43 41 53 54 20 28 20 4e 55 4c 4c 20 41 53 20   CAST ( NULL AS 
11da0 49 4e 54 45 47 45 52 20 29 20 46 52 4f 4d 20 74  INTEGER ) FROM t
11db0 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d  ab2..----..NULL.
11dc0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
11dd0 72 74 0d 0a 53 45 4c 45 43 54 20 35 31 20 46 52  rt..SELECT 51 FR
11de0 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 20  OM tab1 AS cor0 
11df0 43 52 4f 53 53 20 4a 4f 49 4e 20 74 61 62 31 20  CROSS JOIN tab1 
11e00 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61  cor1..----..9 va
11e10 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20  lues hashing to 
11e20 64 38 62 66 30 61 30 35 63 39 63 34 64 32 61 39  d8bf0a05c9c4d2a9
11e30 33 38 31 32 64 31 30 36 62 61 61 65 34 37 35 32  3812d106baae4752
11e40 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
11e50 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
11e60 49 4e 43 54 20 2b 20 38 30 20 2a 20 2b 20 63 6f  INCT + 80 * + co
11e70 72 30 2e 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20  r0.col0 AS col0 
11e80 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a  FROM tab1 cor0..
11e90 2d 2d 2d 2d 0d 0a 32 34 30 0d 0a 35 31 32 30 0d  ----..240..5120.
11ea0 0a 36 34 30 30 0d 0a 0d 0a 71 75 65 72 79 20 49  .6400....query I
11eb0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
11ec0 20 2b 20 35 35 20 2a 20 63 6f 6c 30 20 41 53 20   + 55 * col0 AS 
11ed0 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41  col2 FROM tab2 A
11ee0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 38  S cor0..----..38
11ef0 35 0d 0a 34 32 39 30 0d 0a 34 33 34 35 0d 0a 0d  5..4290..4345...
11f00 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
11f10 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 28 20 63  ..SELECT ALL ( c
11f20 6f 6c 31 20 29 20 41 53 20 63 6f 6c 32 20 46 52  ol1 ) AS col2 FR
11f30 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
11f40 0a 2d 2d 2d 2d 0d 0a 31 37 0d 0a 33 31 0d 0a 35  .----..17..31..5
11f50 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  9....query I row
11f60 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63  sort..SELECT - c
11f70 6f 6c 30 20 2b 20 2d 20 63 6f 6c 31 20 2a 20 2b  ol0 + - col1 * +
11f80 20 28 20 2d 20 63 6f 72 30 2e 63 6f 6c 30 20 2a   ( - cor0.col0 *
11f90 20 63 6f 6c 30 20 2b 20 63 6f 6c 32 20 29 20 46   col0 + col2 ) F
11fa0 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
11fb0 0d 0a 2d 2d 2d 2d 0d 0a 31 30 35 33 37 32 0d 0a  ..----..105372..
11fc0 33 35 37 33 34 34 0d 0a 36 37 35 0d 0a 0d 0a 6f  357344..675....o
11fd0 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73  nlyif mysql # us
11fe0 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66  e DIV operator f
11ff0 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73  or integer divis
12000 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ion..query I row
12010 73 6f 72 74 20 6c 61 62 65 6c 2d 35 31 36 0d 0a  sort label-516..
12020 53 45 4c 45 43 54 20 2d 20 2d 20 63 6f 6c 30 20  SELECT - - col0 
12030 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 44 49 56 20  + cor0.col0 DIV 
12040 2d 20 34 38 20 41 53 20 63 6f 6c 30 20 46 52 4f  - 48 AS col0 FRO
12050 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab2 cor0..---
12060 2d 0d 0a 37 0d 0a 37 37 0d 0a 37 38 0d 0a 0d 0a  -..7..77..78....
12070 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
12080 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
12090 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
120a0 61 62 65 6c 2d 35 31 36 0d 0a 53 45 4c 45 43 54  abel-516..SELECT
120b0 20 2d 20 2d 20 63 6f 6c 30 20 2b 20 63 6f 72 30   - - col0 + cor0
120c0 2e 63 6f 6c 30 20 2f 20 2d 20 34 38 20 41 53 20  .col0 / - 48 AS 
120d0 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 63  col0 FROM tab2 c
120e0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 37 0d 0a 37 37  or0..----..7..77
120f0 0d 0a 37 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..78....query I 
12100 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
12110 44 49 53 54 49 4e 43 54 20 63 6f 6c 31 20 2a 20  DISTINCT col1 * 
12120 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31  + col1 FROM tab1
12130 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 30   cor0..----..100
12140 0d 0a 31 36 39 0d 0a 36 37 36 0d 0a 0d 0a 71 75  ..169..676....qu
12150 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
12160 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b  ELECT DISTINCT +
12170 20 28 20 2d 20 63 6f 72 30 2e 63 6f 6c 30 20 29   ( - cor0.col0 )
12180 20 2a 20 33 30 20 46 52 4f 4d 20 74 61 62 30 20   * 30 FROM tab0 
12190 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
121a0 31 30 35 30 0d 0a 2d 32 36 37 30 0d 0a 2d 37 32  1050..-2670..-72
121b0 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  0....onlyif mysq
121c0 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72  l # use DIV oper
121d0 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72  ator for integer
121e0 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79   division..query
121f0 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
12200 2d 35 31 39 0d 0a 53 45 4c 45 43 54 20 63 6f 6c  -519..SELECT col
12210 32 20 44 49 56 20 2d 20 63 6f 72 30 2e 63 6f 6c  2 DIV - cor0.col
12220 31 20 2b 20 2d 20 63 6f 6c 32 20 46 52 4f 4d 20  1 + - col2 FROM 
12230 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
12240 2d 2d 0d 0a 2d 31 0d 0a 2d 33 33 0d 0a 2d 38 32  --..-1..-33..-82
12250 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
12260 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
12270 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
12280 72 74 20 6c 61 62 65 6c 2d 35 31 39 0d 0a 53 45  rt label-519..SE
12290 4c 45 43 54 20 63 6f 6c 32 20 2f 20 2d 20 63 6f  LECT col2 / - co
122a0 72 30 2e 63 6f 6c 31 20 2b 20 2d 20 63 6f 6c 32  r0.col1 + - col2
122b0 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
122c0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 2d 33  r0..----..-1..-3
122d0 33 0d 0a 2d 38 32 0d 0a 0d 0a 6f 6e 6c 79 69 66  3..-82....onlyif
122e0 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56   mysql # use DIV
122f0 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e   operator for in
12300 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a  teger division..
12310 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
12320 6c 61 62 65 6c 2d 35 32 30 0d 0a 53 45 4c 45 43  label-520..SELEC
12330 54 20 2d 20 2b 20 63 6f 6c 32 20 44 49 56 20 39  T - + col2 DIV 9
12340 34 20 2b 20 63 6f 6c 31 20 44 49 56 20 63 6f 72  4 + col1 DIV cor
12350 30 2e 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31  0.col0 FROM tab1
12360 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
12370 2d 31 0d 0a 30 0d 0a 38 0d 0a 0d 0a 73 6b 69 70  -1..0..8....skip
12380 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
12390 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
123a0 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
123b0 2d 35 32 30 0d 0a 53 45 4c 45 43 54 20 2d 20 2b  -520..SELECT - +
123c0 20 63 6f 6c 32 20 2f 20 39 34 20 2b 20 63 6f 6c   col2 / 94 + col
123d0 31 20 2f 20 63 6f 72 30 2e 63 6f 6c 30 20 46 52  1 / cor0.col0 FR
123e0 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
123f0 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 30 0d 0a 38 0d  .----..-1..0..8.
12400 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
12410 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74  # use DIV operat
12420 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64  or for integer d
12430 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49  ivision..query I
12440 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 35   rowsort label-5
12450 32 31 0d 0a 53 45 4c 45 43 54 20 31 37 20 44 49  21..SELECT 17 DI
12460 56 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 41 53  V + cor0.col1 AS
12470 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 2c   col1 FROM tab1,
12480 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab0 cor0..----
12490 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68 69  ..9 values hashi
124a0 6e 67 20 74 6f 20 38 62 37 35 31 33 36 62 32 62  ng to 8b75136b2b
124b0 35 31 63 37 37 33 34 35 63 30 33 38 30 34 65 63  51c77345c03804ec
124c0 31 63 64 61 35 63 0d 0a 0d 0a 73 6b 69 70 69 66  1cda5c....skipif
124d0 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
124e0 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
124f0 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 35   rowsort label-5
12500 32 31 0d 0a 53 45 4c 45 43 54 20 31 37 20 2f 20  21..SELECT 17 / 
12510 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 41 53 20 63  + cor0.col1 AS c
12520 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 2c 20 74  ol1 FROM tab1, t
12530 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab0 cor0..----..
12540 39 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67  9 values hashing
12550 20 74 6f 20 38 62 37 35 31 33 36 62 32 62 35 31   to 8b75136b2b51
12560 63 37 37 33 34 35 63 30 33 38 30 34 65 63 31 63  c77345c03804ec1c
12570 64 61 35 63 0d 0a 0d 0a 71 75 65 72 79 20 49 20  da5c....query I 
12580 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
12590 41 4c 4c 20 2d 20 63 6f 6c 31 20 2a 20 28 20 2b  ALL - col1 * ( +
125a0 20 63 6f 6c 32 20 29 20 41 53 20 63 6f 6c 32 20   col2 ) AS col2 
125b0 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
125c0 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32 34 38 0d 0a  0..----..-1248..
125d0 2d 31 34 30 34 0d 0a 2d 35 37 30 0d 0a 0d 0a 71  -1404..-570....q
125e0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
125f0 53 45 4c 45 43 54 20 2d 20 2b 20 63 6f 6c 30 20  SELECT - + col0 
12600 2a 20 63 6f 72 30 2e 63 6f 6c 31 20 2b 20 2d 20  * cor0.col1 + - 
12610 36 38 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74  68 + col0 FROM t
12620 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
12630 2d 0d 0a 2d 31 33 33 32 0d 0a 2d 32 37 38 0d 0a  -..-1332..-278..
12640 2d 34 35 39 32 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  -4592....onlyif 
12650 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20  mysql # use DIV 
12660 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74  operator for int
12670 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71  eger division..q
12680 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
12690 61 62 65 6c 2d 35 32 34 0d 0a 53 45 4c 45 43 54  abel-524..SELECT
126a0 20 44 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c 32   DISTINCT + col2
126b0 20 44 49 56 20 63 6f 6c 31 20 41 53 20 63 6f 6c   DIV col1 AS col
126c0 30 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30  0 FROM tab0 cor0
126d0 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 0d 0a 73 6b 69  ..----..0....ski
126e0 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
126f0 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
12700 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
12710 6c 2d 35 32 34 0d 0a 53 45 4c 45 43 54 20 44 49  l-524..SELECT DI
12720 53 54 49 4e 43 54 20 2b 20 63 6f 6c 32 20 2f 20  STINCT + col2 / 
12730 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52 4f  col1 AS col0 FRO
12740 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab0 cor0..---
12750 2d 0d 0a 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20  -..0....query I 
12760 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
12770 44 49 53 54 49 4e 43 54 20 2d 20 39 20 2a 20 2d  DISTINCT - 9 * -
12780 20 63 6f 6c 31 20 2b 20 28 20 2d 20 63 6f 6c 30   col1 + ( - col0
12790 20 2b 20 63 6f 6c 31 20 29 20 2a 20 2b 20 36 30   + col1 ) * + 60
127a0 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
127b0 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 31 35 30 0d  b1..----..-3150.
127c0 0a 2d 33 39 30 33 0d 0a 31 36 31 34 0d 0a 0d 0a  .-3903..1614....
127d0 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73  onlyif mysql # s
127e0 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c  upport for MySQL
127f0 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d   specific system
12800 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61   types and synta
12810 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  x..query I rowso
12820 72 74 20 6c 61 62 65 6c 2d 35 32 36 0d 0a 53 45  rt label-526..SE
12830 4c 45 43 54 20 2d 20 2b 20 63 6f 6c 31 20 2b 20  LECT - + col1 + 
12840 2b 20 43 41 53 54 28 20 2b 20 63 6f 6c 31 20 41  + CAST( + col1 A
12850 53 20 53 49 47 4e 45 44 20 29 20 2a 20 2d 20 63  S SIGNED ) * - c
12860 6f 6c 32 20 2a 20 63 6f 6c 32 20 46 52 4f 4d 20  ol2 * col2 FROM 
12870 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
12880 2d 2d 0d 0a 2d 31 39 34 0d 0a 2d 36 31 31 39 37  --..-194..-61197
12890 35 0d 0a 2d 39 33 37 34 30 0d 0a 0d 0a 73 6b 69  5..-93740....ski
128a0 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
128b0 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
128c0 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
128d0 6c 2d 35 32 36 0d 0a 53 45 4c 45 43 54 20 2d 20  l-526..SELECT - 
128e0 2b 20 63 6f 6c 31 20 2b 20 2b 20 43 41 53 54 20  + col1 + + CAST 
128f0 28 20 2b 20 63 6f 6c 31 20 41 53 20 49 4e 54 45  ( + col1 AS INTE
12900 47 45 52 20 29 20 2a 20 2d 20 63 6f 6c 32 20 2a  GER ) * - col2 *
12910 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20   col2 FROM tab0 
12920 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
12930 31 39 34 0d 0a 2d 36 31 31 39 37 35 0d 0a 2d 39  194..-611975..-9
12940 33 37 34 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20  3740....query I 
12950 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
12960 44 49 53 54 49 4e 43 54 20 36 30 20 2a 20 2d 20  DISTINCT 60 * - 
12970 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46 52 4f  col1 AS col2 FRO
12980 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
12990 2d 2d 2d 2d 0d 0a 2d 31 30 32 30 0d 0a 2d 31 38  ----..-1020..-18
129a0 36 30 0d 0a 2d 33 35 34 30 0d 0a 0d 0a 71 75 65  60..-3540....que
129b0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
129c0 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 30 20 2a 20  LECT ALL col0 * 
129d0 63 6f 6c 32 20 2b 20 63 6f 6c 32 20 41 53 20 63  col2 + col2 AS c
129e0 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 63 6f  ol1 FROM tab2 co
129f0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 30 35 34 0d 0a  r0..----..2054..
12a00 32 31 36 0d 0a 33 30 34 30 0d 0a 0d 0a 71 75 65  216..3040....que
12a10 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
12a20 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20  LECT DISTINCT - 
12a30 2b 20 63 6f 6c 31 20 2b 20 2d 20 63 6f 6c 31 20  + col1 + - col1 
12a40 2a 20 2d 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61  * - col0 FROM ta
12a50 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
12a60 0d 0a 31 39 37 38 0d 0a 33 32 39 38 0d 0a 38 30  ..1978..3298..80
12a70 30 38 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73  08....skipif pos
12a80 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72  tgresql # Postgr
12a90 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53  eSQL requires AS
12aa0 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f   when renaming o
12ab0 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71  utput columns..q
12ac0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
12ad0 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f 72  SELECT ALL - cor
12ae0 30 2e 63 6f 6c 30 20 2a 20 2d 20 31 35 20 63 6f  0.col0 * - 15 co
12af0 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l0 FROM tab2 AS 
12b00 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 35 0d  cor0..----..105.
12b10 0a 31 31 37 30 0d 0a 31 31 38 35 0d 0a 0d 0a 71  .1170..1185....q
12b20 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
12b30 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
12b40 63 6f 72 30 2e 63 6f 6c 31 20 46 52 4f 4d 20 74  cor0.col1 FROM t
12b50 61 62 32 2c 20 74 61 62 32 20 41 53 20 63 6f 72  ab2, tab2 AS cor
12b60 30 2c 20 74 61 62 32 20 41 53 20 63 6f 72 31 2c  0, tab2 AS cor1,
12b70 20 74 61 62 31 20 41 53 20 63 6f 72 32 0d 0a 2d   tab1 AS cor2..-
12b80 2d 2d 2d 0d 0a 31 37 0d 0a 33 31 0d 0a 35 39 0d  ---..17..31..59.
12b90 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
12ba0 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 34 38 20  rt..SELECT - 48 
12bb0 2a 20 2b 20 34 30 20 2a 20 2d 20 63 6f 6c 32 20  * + 40 * - col2 
12bc0 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a  FROM tab0 cor0..
12bd0 2d 2d 2d 2d 0d 0a 31 35 37 34 34 30 0d 0a 31 39  ----..157440..19
12be0 32 30 0d 0a 36 33 33 36 30 0d 0a 0d 0a 71 75 65  20..63360....que
12bf0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
12c00 4c 45 43 54 20 41 4c 4c 20 28 20 34 32 20 29 20  LECT ALL ( 42 ) 
12c10 2a 20 2d 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61  * - col1 FROM ta
12c20 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
12c30 0d 0a 2d 31 33 30 32 0d 0a 2d 32 34 37 38 0d 0a  ..-1302..-2478..
12c40 2d 37 31 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20  -714....query I 
12c50 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
12c60 44 49 53 54 49 4e 43 54 20 36 20 2a 20 63 6f 6c  DISTINCT 6 * col
12c70 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  0 FROM tab2 AS c
12c80 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 34 32 0d 0a 34  or0..----..42..4
12c90 36 38 0d 0a 34 37 34 0d 0a 0d 0a 71 75 65 72 79  68..474....query
12ca0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
12cb0 43 54 20 2b 20 35 32 20 2b 20 2b 20 63 6f 6c 30  CT + 52 + + col0
12cc0 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
12cd0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 34 31 0d 0a 37  r0..----..141..7
12ce0 36 0d 0a 38 37 0d 0a 0d 0a 71 75 65 72 79 20 49  6..87....query I
12cf0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
12d00 20 63 6f 6c 31 20 2d 20 63 6f 6c 31 20 41 53 20   col1 - col1 AS 
12d10 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 63  col2 FROM tab2 c
12d20 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d  or0..----..0..0.
12d30 0a 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  .0....query I ro
12d40 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
12d50 53 54 49 4e 43 54 20 2d 20 63 6f 6c 30 20 2a 20  STINCT - col0 * 
12d60 28 20 2b 20 63 6f 6c 30 20 29 20 2b 20 35 39 20  ( + col0 ) + 59 
12d70 2d 20 2d 20 39 33 20 2a 20 63 6f 6c 31 20 41 53  - - 93 * col1 AS
12d80 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 0d   col2 FROM tab0.
12d90 0a 2d 2d 2d 2d 0d 0a 36 30 31 0d 0a 37 34 38 31  .----..601..7481
12da0 0d 0a 37 38 35 35 0d 0a 0d 0a 71 75 65 72 79 20  ..7855....query 
12db0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
12dc0 54 20 2b 20 63 6f 6c 30 20 2a 20 2b 20 74 61 62  T + col0 * + tab
12dd0 31 2e 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46  1.col2 AS col0 F
12de0 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab1..----..
12df0 31 36 32 0d 0a 33 36 34 38 0d 0a 37 36 38 30 0d  162..3648..7680.
12e00 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
12e10 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
12e20 4e 43 54 20 63 6f 6c 31 20 2d 20 63 6f 6c 32 20  NCT col1 - col2 
12e30 2a 20 74 61 62 30 2e 63 6f 6c 31 20 2a 20 63 6f  * tab0.col1 * co
12e40 6c 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d  l1 FROM tab0..--
12e50 2d 2d 0d 0a 2d 32 34 33 39 38 32 0d 0a 2d 36 37  --..-243982..-67
12e60 38 39 35 31 0d 0a 2d 39 33 31 32 0d 0a 0d 0a 71  8951..-9312....q
12e70 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
12e80 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
12e90 36 33 20 2a 20 2b 20 63 6f 6c 30 20 2a 20 2d 20  63 * + col0 * - 
12ea0 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41  col0 FROM tab2 A
12eb0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33  S cor0..----..-3
12ec0 30 38 37 0d 0a 2d 33 38 33 32 39 32 0d 0a 2d 33  087..-383292..-3
12ed0 39 33 31 38 33 0d 0a 0d 0a 71 75 65 72 79 20 49  93183....query I
12ee0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
12ef0 20 2d 20 33 36 20 2d 20 63 6f 72 30 2e 63 6f 6c   - 36 - cor0.col
12f00 31 20 2a 20 2d 20 28 20 2d 20 63 6f 6c 32 20 2b  1 * - ( - col2 +
12f10 20 63 6f 6c 32 20 29 20 41 53 20 63 6f 6c 31 20   col2 ) AS col1 
12f20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
12f30 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 36 0d 0a 2d 33  0..----..-36..-3
12f40 36 0d 0a 2d 33 36 0d 0a 0d 0a 71 75 65 72 79 20  6..-36....query 
12f50 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
12f60 54 20 41 4c 4c 20 2d 20 63 6f 6c 30 20 2b 20 63  T ALL - col0 + c
12f70 6f 72 30 2e 63 6f 6c 32 20 41 53 20 63 6f 6c 31  or0.col2 AS col1
12f80 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
12f90 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 31 0d 0a 2d  r0..----..-41..-
12fa0 35 32 0d 0a 32 30 0d 0a 0d 0a 71 75 65 72 79 20  52..20....query 
12fb0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
12fc0 54 20 44 49 53 54 49 4e 43 54 20 2b 20 33 20 2a  T DISTINCT + 3 *
12fd0 20 2b 20 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c 30   + col0 + + col0
12fe0 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
12ff0 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
13000 0d 0a 31 34 30 0d 0a 33 35 36 0d 0a 39 36 0d 0a  ..140..356..96..
13010 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
13020 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f   use DIV operato
13030 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69  r for integer di
13040 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20  vision..query I 
13050 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 35 34  rowsort label-54
13060 34 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 31  4..SELECT + col1
13070 20 44 49 56 20 2d 20 63 6f 6c 32 20 41 53 20 63   DIV - col2 AS c
13080 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol2 FROM tab1 AS
13090 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a   cor0..----..0..
130a0 30 0d 0a 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  0..0....skipif m
130b0 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
130c0 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
130d0 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 35 34 34  owsort label-544
130e0 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 31 20  ..SELECT + col1 
130f0 2f 20 2d 20 63 6f 6c 32 20 41 53 20 63 6f 6c 32  / - col2 AS col2
13100 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
13110 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a  r0..----..0..0..
13120 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  0....query I row
13130 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
13140 20 2b 20 2b 20 35 31 20 41 53 20 63 6f 6c 32 20   + + 51 AS col2 
13150 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a  FROM tab1 cor0..
13160 2d 2d 2d 2d 0d 0a 35 31 0d 0a 35 31 0d 0a 35 31  ----..51..51..51
13170 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
13180 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 31  ort..SELECT col1
13190 20 2d 20 2d 20 63 6f 6c 30 20 2a 20 2d 20 63 6f   - - col0 * - co
131a0 6c 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  l2 AS col2 FROM 
131b0 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
131c0 2d 2d 0d 0a 2d 31 35 38 0d 0a 2d 31 39 36 39 0d  --..-158..-1969.
131d0 0a 2d 32 39 38 35 0d 0a 0d 0a 71 75 65 72 79 20  .-2985....query 
131e0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
131f0 54 20 2d 20 63 6f 6c 32 20 2a 20 63 6f 6c 30 20  T - col2 * col0 
13200 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 2a 20 2b 20  + cor0.col2 * + 
13210 38 36 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  86 FROM tab1 AS 
13220 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 35 34  cor0..----..1254
13230 0d 0a 34 34 38 32 0d 0a 35 37 36 0d 0a 0d 0a 71  ..4482..576....q
13240 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
13250 53 45 4c 45 43 54 20 35 30 20 2a 20 63 6f 6c 31  SELECT 50 * col1
13260 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
13270 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 33 30 30 0d 0a  b1..----..1300..
13280 35 30 30 0d 0a 36 35 30 0d 0a 0d 0a 71 75 65 72  500..650....quer
13290 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
132a0 45 43 54 20 74 61 62 32 2e 63 6f 6c 32 20 2a 20  ECT tab2.col2 * 
132b0 2d 20 63 6f 6c 30 20 2d 20 63 6f 6c 30 20 41 53  - col0 - col0 AS
132c0 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 0d   col2 FROM tab2.
132d0 0a 2d 2d 2d 2d 0d 0a 2d 31 39 36 0d 0a 2d 32 31  .----..-196..-21
132e0 30 36 0d 0a 2d 33 30 38 31 0d 0a 0d 0a 71 75 65  06..-3081....que
132f0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
13300 4c 45 43 54 20 28 20 2b 20 63 6f 6c 32 20 2a 20  LECT ( + col2 * 
13310 2d 20 74 61 62 32 2e 63 6f 6c 30 20 29 20 46 52  - tab2.col0 ) FR
13320 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d  OM tab2..----..-
13330 31 38 39 0d 0a 2d 32 30 32 38 0d 0a 2d 33 30 30  189..-2028..-300
13340 32 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  2....onlyif mysq
13350 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72  l # use DIV oper
13360 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72  ator for integer
13370 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79   division..query
13380 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
13390 2d 35 35 31 0d 0a 53 45 4c 45 43 54 20 31 31 20  -551..SELECT 11 
133a0 44 49 56 20 74 61 62 31 2e 63 6f 6c 32 20 46 52  DIV tab1.col2 FR
133b0 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 30  OM tab1..----..0
133c0 0d 0a 30 0d 0a 30 0d 0a 0d 0a 73 6b 69 70 69 66  ..0..0....skipif
133d0 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
133e0 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
133f0 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 35   rowsort label-5
13400 35 31 0d 0a 53 45 4c 45 43 54 20 31 31 20 2f 20  51..SELECT 11 / 
13410 74 61 62 31 2e 63 6f 6c 32 20 46 52 4f 4d 20 74  tab1.col2 FROM t
13420 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d  ab1..----..0..0.
13430 0a 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  .0....onlyif mys
13440 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72  ql # support for
13450 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63 20   MySQL specific 
13460 73 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64  system types and
13470 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49   syntax..query I
13480 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 35   rowsort label-5
13490 35 32 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  52..SELECT DISTI
134a0 4e 43 54 20 2d 20 43 41 53 54 28 20 2d 20 35 39  NCT - CAST( - 59
134b0 20 41 53 20 53 49 47 4e 45 44 20 29 20 41 53 20   AS SIGNED ) AS 
134c0 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 0d 0a  col0 FROM tab1..
134d0 2d 2d 2d 2d 0d 0a 35 39 0d 0a 0d 0a 73 6b 69 70  ----..59....skip
134e0 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
134f0 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
13500 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
13510 2d 35 35 32 0d 0a 53 45 4c 45 43 54 20 44 49 53  -552..SELECT DIS
13520 54 49 4e 43 54 20 2d 20 43 41 53 54 20 28 20 2d  TINCT - CAST ( -
13530 20 35 39 20 41 53 20 49 4e 54 45 47 45 52 20 29   59 AS INTEGER )
13540 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
13550 62 31 0d 0a 2d 2d 2d 2d 0d 0a 35 39 0d 0a 0d 0a  b1..----..59....
13560 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
13570 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 31  .SELECT ALL col1
13580 20 2a 20 63 6f 6c 32 20 2b 20 74 61 62 32 2e 63   * col2 + tab2.c
13590 6f 6c 31 20 2a 20 63 6f 6c 31 20 46 52 4f 4d 20  ol1 * col1 FROM 
135a0 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 37 39 38  tab2..----..1798
135b0 0d 0a 35 30 31 35 0d 0a 39 33 35 0d 0a 0d 0a 71  ..5015..935....q
135c0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
135d0 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
135e0 2d 20 39 31 20 41 53 20 63 6f 6c 30 20 46 52 4f  - 91 AS col0 FRO
135f0 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 39  M tab1..----..-9
13600 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  1....query I row
13610 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
13620 20 2b 20 31 37 20 2b 20 2b 20 63 6f 6c 32 20 46   + 17 + + col2 F
13630 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab1..----..
13640 31 31 33 0d 0a 37 31 0d 0a 37 34 0d 0a 0d 0a 71  113..71..74....q
13650 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
13660 53 45 4c 45 43 54 20 2d 20 2d 20 36 35 20 46 52  SELECT - - 65 FR
13670 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
13680 0a 2d 2d 2d 2d 0d 0a 36 35 0d 0a 36 35 0d 0a 36  .----..65..65..6
13690 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  5....query I row
136a0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 35 39 20  sort..SELECT 59 
136b0 2a 20 2d 20 63 6f 6c 32 20 41 53 20 63 6f 6c 32  * - col2 AS col2
136c0 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d   FROM tab1..----
136d0 0d 0a 2d 33 31 38 36 0d 0a 2d 33 33 36 33 0d 0a  ..-3186..-3363..
136e0 2d 35 36 36 34 0d 0a 0d 0a 71 75 65 72 79 20 49  -5664....query I
136f0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
13700 20 2b 20 63 6f 6c 30 20 2b 20 2d 20 28 20 63 6f   + col0 + - ( co
13710 6c 32 20 29 20 2a 20 2b 20 74 61 62 30 2e 63 6f  l2 ) * + tab0.co
13720 6c 32 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d  l2 FROM tab0..--
13730 2d 2d 0d 0a 2d 31 30 36 35 0d 0a 2d 36 36 33 35  --..-1065..-6635
13740 0d 0a 33 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..34....query I 
13750 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
13760 2b 20 28 20 31 32 20 29 20 2a 20 2d 20 74 61 62  + ( 12 ) * - tab
13770 31 2e 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46  1.col2 AS col1 F
13780 52 4f 4d 20 74 61 62 31 2c 20 74 61 62 32 20 41  ROM tab1, tab2 A
13790 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20  S cor0..----..9 
137a0 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74  values hashing t
137b0 6f 20 66 31 38 61 39 35 39 34 65 36 30 31 61 35  o f18a9594e601a5
137c0 32 35 34 37 63 37 65 65 33 65 61 30 36 66 37 65  2547c7ee3ea06f7e
137d0 66 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  f6....query I ro
137e0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
137f0 39 34 20 46 52 4f 4d 20 74 61 62 30 2c 20 74 61  94 FROM tab0, ta
13800 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
13810 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68 69  ..9 values hashi
13820 6e 67 20 74 6f 20 62 30 66 66 62 37 35 32 37 66  ng to b0ffb7527f
13830 34 66 62 66 34 34 66 33 30 39 34 35 65 31 63 63  4fbf44f30945e1cc
13840 62 35 38 63 32 34 0d 0a 0d 0a 6f 6e 6c 79 69 66  b58c24....onlyif
13850 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74   mysql # support
13860 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69   for MySQL speci
13870 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73  fic system types
13880 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65   and syntax..que
13890 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
138a0 65 6c 2d 35 36 31 0d 0a 53 45 4c 45 43 54 20 2b  el-561..SELECT +
138b0 20 74 61 62 30 2e 63 6f 6c 30 20 2f 20 43 41 53   tab0.col0 / CAS
138c0 54 28 20 4e 55 4c 4c 20 41 53 20 53 49 47 4e 45  T( NULL AS SIGNE
138d0 44 20 29 20 2b 20 63 6f 6c 32 20 46 52 4f 4d 20  D ) + col2 FROM 
138e0 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c  tab0..----..NULL
138f0 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a  ..NULL..NULL....
13900 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
13910 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
13920 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
13930 61 62 65 6c 2d 35 36 31 0d 0a 53 45 4c 45 43 54  abel-561..SELECT
13940 20 2b 20 74 61 62 30 2e 63 6f 6c 30 20 2f 20 43   + tab0.col0 / C
13950 41 53 54 20 28 20 4e 55 4c 4c 20 41 53 20 49 4e  AST ( NULL AS IN
13960 54 45 47 45 52 20 29 20 2b 20 63 6f 6c 32 20 46  TEGER ) + col2 F
13970 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab0..----..
13980 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c  NULL..NULL..NULL
13990 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
139a0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 31 32  ort..SELECT + 12
139b0 20 46 52 4f 4d 20 74 61 62 31 2c 20 74 61 62 31   FROM tab1, tab1
139c0 20 41 53 20 63 6f 72 30 2c 20 74 61 62 31 20 63   AS cor0, tab1 c
139d0 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61  or1..----..27 va
139e0 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20  lues hashing to 
139f0 37 30 32 34 37 38 63 35 33 63 61 66 32 66 37 65  702478c53caf2f7e
13a00 62 62 39 66 66 66 39 36 64 38 30 30 66 35 61 36  bb9fff96d800f5a6
13a10 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
13a20 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
13a30 63 6f 6c 30 20 2a 20 2d 20 28 20 2b 20 63 6f 6c  col0 * - ( + col
13a40 31 20 29 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d  1 ) FROM tab0..-
13a50 2d 2d 2d 0d 0a 2d 32 30 36 34 0d 0a 2d 33 33 39  ---..-2064..-339
13a60 35 0d 0a 2d 38 30 39 39 0d 0a 0d 0a 71 75 65 72  5..-8099....quer
13a70 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
13a80 45 43 54 20 63 6f 6c 31 20 2a 20 2d 20 38 30 20  ECT col1 * - 80 
13a90 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
13aa0 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 34 30 0d 0a  1..----..-1040..
13ab0 2d 32 30 38 30 0d 0a 2d 38 30 30 0d 0a 0d 0a 71  -2080..-800....q
13ac0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
13ad0 53 45 4c 45 43 54 20 2d 20 63 6f 6c 31 20 2a 20  SELECT - col1 * 
13ae0 37 36 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  76 AS col1 FROM 
13af0 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32 39  tab2..----..-129
13b00 32 0d 0a 2d 32 33 35 36 0d 0a 2d 34 34 38 34 0d  2..-2356..-4484.
13b10 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
13b20 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b  rt..SELECT ALL +
13b30 20 2d 20 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c 31   - col2 * - col1
13b40 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
13b50 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
13b60 0d 0a 31 35 33 34 0d 0a 36 34 36 0d 0a 38 33 37  ..1534..646..837
13b70 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
13b80 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61   # use DIV opera
13b90 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20  tor for integer 
13ba0 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20  division..query 
13bb0 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
13bc0 35 36 37 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  567..SELECT DIST
13bd0 49 4e 43 54 20 2b 20 63 6f 6c 30 20 44 49 56 20  INCT + col0 DIV 
13be0 2d 20 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46  - col2 AS col1 F
13bf0 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
13c00 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 30 0d 0a 0d  ..----..-1..0...
13c10 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
13c20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
13c30 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
13c40 6c 61 62 65 6c 2d 35 36 37 0d 0a 53 45 4c 45 43  label-567..SELEC
13c50 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c  T DISTINCT + col
13c60 30 20 2f 20 2d 20 63 6f 6c 32 20 41 53 20 63 6f  0 / - col2 AS co
13c70 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l1 FROM tab1 AS 
13c80 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a  cor0..----..-1..
13c90 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  0....query I row
13ca0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63  sort..SELECT - c
13cb0 6f 72 30 2e 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c  or0.col2 * + col
13cc0 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  0 FROM tab0 AS c
13cd0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 35 0d 0a  or0..----..-35..
13ce0 2d 37 32 39 38 0d 0a 2d 37 39 32 0d 0a 0d 0a 73  -7298..-792....s
13cf0 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c  kipif postgresql
13d00 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65   # PostgreSQL re
13d10 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72  quires AS when r
13d20 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63  enaming output c
13d30 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20  olumns..query I 
13d40 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
13d50 44 49 53 54 49 4e 43 54 20 2b 20 28 20 2b 20 63  DISTINCT + ( + c
13d60 6f 6c 32 20 29 20 2b 20 63 6f 6c 31 20 63 6f 6c  ol2 ) + col1 col
13d70 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  0 FROM tab0 AS c
13d80 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 39 0d 0a  or0..----..119..
13d90 31 37 33 0d 0a 39 38 0d 0a 0d 0a 73 6b 69 70 69  173..98....skipi
13da0 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50  f postgresql # P
13db0 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72  ostgreSQL requir
13dc0 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d  es AS when renam
13dd0 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d  ing output colum
13de0 6e 73 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ns..skipif mysql
13df0 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
13e00 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
13e10 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 43 41 53  rt..SELECT + CAS
13e20 54 20 28 20 2b 20 28 20 63 6f 6c 32 20 29 20 41  T ( + ( col2 ) A
13e30 53 20 52 45 41 4c 20 29 20 63 6f 6c 32 20 46 52  S REAL ) col2 FR
13e40 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
13e50 0a 2d 2d 2d 2d 0d 0a 32 36 0d 0a 32 37 0d 0a 33  .----..26..27..3
13e60 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  8....query I row
13e70 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
13e80 54 49 4e 43 54 20 2b 20 28 20 2b 20 32 31 20 29  TINCT + ( + 21 )
13e90 20 2d 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c   - + col1 AS col
13ea0 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  0 FROM tab1 AS c
13eb0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 0d 0a 31  or0..----..-5..1
13ec0 31 0d 0a 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20  1..8....query I 
13ed0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
13ee0 44 49 53 54 49 4e 43 54 20 2d 20 38 31 20 41 53  DISTINCT - 81 AS
13ef0 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 2c   col1 FROM tab0,
13f00 20 74 61 62 32 20 41 53 20 63 6f 72 30 2c 20 74   tab2 AS cor0, t
13f10 61 62 32 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d  ab2 AS cor1..---
13f20 2d 0d 0a 2d 38 31 0d 0a 0d 0a 6f 6e 6c 79 69 66  -..-81....onlyif
13f30 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56   mysql # use DIV
13f40 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e   operator for in
13f50 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a  teger division..
13f60 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
13f70 6c 61 62 65 6c 2d 35 37 33 0d 0a 53 45 4c 45 43  label-573..SELEC
13f80 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c  T DISTINCT - col
13f90 31 20 44 49 56 20 2d 20 34 32 20 46 52 4f 4d 20  1 DIV - 42 FROM 
13fa0 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 31  tab2..----..0..1
13fb0 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
13fc0 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
13fd0 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
13fe0 72 74 20 6c 61 62 65 6c 2d 35 37 33 0d 0a 53 45  rt label-573..SE
13ff0 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20  LECT DISTINCT - 
14000 63 6f 6c 31 20 2f 20 2d 20 34 32 20 46 52 4f 4d  col1 / - 42 FROM
14010 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a   tab2..----..0..
14020 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  1....query I row
14030 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
14040 54 49 4e 43 54 20 2b 20 63 6f 6c 31 20 2a 20 32  TINCT + col1 * 2
14050 36 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d  6 FROM tab1..---
14060 2d 0d 0a 32 36 30 0d 0a 33 33 38 0d 0a 36 37 36  -..260..338..676
14070 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67  ....skipif postg
14080 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53  resql # PostgreS
14090 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77  QL requires AS w
140a0 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74  hen renaming out
140b0 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65  put columns..que
140c0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
140d0 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f 72 30 2e  LECT ALL + cor0.
140e0 63 6f 6c 32 20 63 6f 6c 32 20 46 52 4f 4d 20 74  col2 col2 FROM t
140f0 61 62 32 2c 20 74 61 62 30 20 41 53 20 63 6f 72  ab2, tab0 AS cor
14100 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65  0..----..9 value
14110 73 20 68 61 73 68 69 6e 67 20 74 6f 20 63 38 66  s hashing to c8f
14120 39 66 61 39 65 66 30 66 38 37 30 32 62 64 33 38  9fa9ef0f8702bd38
14130 32 65 38 32 31 33 37 38 61 39 36 64 38 0d 0a 0d  2e821378a96d8...
14140 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73  .skipif postgres
14150 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20  ql # PostgreSQL 
14160 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e  requires AS when
14170 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74   renaming output
14180 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20   columns..query 
14190 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
141a0 54 20 2b 20 2b 20 63 6f 6c 31 20 2a 20 2d 20 63  T + + col1 * - c
141b0 6f 6c 30 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61  ol0 col2 FROM ta
141c0 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
141d0 0d 0a 2d 31 33 34 33 0d 0a 2d 32 31 37 0d 0a 2d  ..-1343..-217..-
141e0 34 36 30 32 0d 0a 0d 0a 73 6b 69 70 69 66 20 70  4602....skipif p
141f0 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74  ostgresql # Post
14200 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20  greSQL requires 
14210 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67  AS when renaming
14220 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d   output columns.
14230 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
14240 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63  ..SELECT ALL - c
14250 6f 6c 32 20 2b 20 2d 20 36 33 20 2a 20 2d 20 63  ol2 + - 63 * - c
14260 6f 6c 30 20 2a 20 35 34 20 2b 20 2b 20 34 38 20  ol0 * 54 + + 48 
14270 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41  col1 FROM tab2 A
14280 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 33  S cor0..----..23
14290 38 33 35 0d 0a 32 36 35 33 37 38 0d 0a 32 36 38  835..265378..268
142a0 37 36 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  768....query I r
142b0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
142c0 20 2b 20 36 32 20 2b 20 63 6f 72 30 2e 63 6f 6c   + 62 + cor0.col
142d0 32 20 2a 20 2b 20 63 6f 6c 32 20 46 52 4f 4d 20  2 * + col2 FROM 
142e0 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
142f0 2d 2d 0d 0a 32 38 35 34 0d 0a 33 31 38 37 0d 0a  --..2854..3187..
14300 39 31 35 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20  9154....query I 
14310 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
14320 41 4c 4c 20 2b 20 31 34 20 2a 20 63 6f 6c 31 20  ALL + 14 * col1 
14330 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
14340 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 30 34 0d 0a 31  0..----..1204..1
14350 32 37 34 0d 0a 31 33 35 38 0d 0a 0d 0a 73 6b 69  274..1358....ski
14360 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23  pif postgresql #
14370 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75   PostgreSQL requ
14380 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e  ires AS when ren
14390 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c  aming output col
143a0 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f  umns..query I ro
143b0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
143c0 53 54 49 4e 43 54 20 28 20 2d 20 63 6f 6c 31 20  STINCT ( - col1 
143d0 29 20 2a 20 63 6f 6c 30 20 2d 20 63 6f 6c 32 20  ) * col0 - col2 
143e0 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41  col0 FROM tab0 A
143f0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32  S cor0..----..-2
14400 30 39 37 0d 0a 2d 33 33 39 36 0d 0a 2d 38 31 38  097..-3396..-818
14410 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  1....query I row
14420 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63  sort..SELECT - c
14430 6f 6c 30 20 2d 20 2b 20 28 20 2d 20 63 6f 6c 30  ol0 - + ( - col0
14440 20 29 20 2a 20 63 6f 6c 31 20 46 52 4f 4d 20 74   ) * col1 FROM t
14450 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
14460 2d 0d 0a 31 32 36 34 0d 0a 32 31 30 0d 0a 34 35  -..1264..210..45
14470 32 34 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  24....onlyif mys
14480 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65  ql # use DIV ope
14490 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65  rator for intege
144a0 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72  r division..quer
144b0 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
144c0 6c 2d 35 38 32 0d 0a 53 45 4c 45 43 54 20 2b 20  l-582..SELECT + 
144d0 2d 20 28 20 63 6f 6c 31 20 29 20 2a 20 63 6f 6c  - ( col1 ) * col
144e0 31 20 44 49 56 20 2b 20 63 6f 6c 30 20 41 53 20  1 DIV + col0 AS 
144f0 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41  col1 FROM tab0 A
14500 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32  S cor0..----..-2
14510 36 38 0d 0a 2d 33 30 38 0d 0a 2d 39 33 0d 0a 0d  68..-308..-93...
14520 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
14530 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
14540 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
14550 6c 61 62 65 6c 2d 35 38 32 0d 0a 53 45 4c 45 43  label-582..SELEC
14560 54 20 2b 20 2d 20 28 20 63 6f 6c 31 20 29 20 2a  T + - ( col1 ) *
14570 20 63 6f 6c 31 20 2f 20 2b 20 63 6f 6c 30 20 41   col1 / + col0 A
14580 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30  S col1 FROM tab0
14590 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
145a0 2d 32 36 38 0d 0a 2d 33 30 38 0d 0a 2d 39 33 0d  -268..-308..-93.
145b0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
145c0 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
145d0 4e 43 54 20 63 6f 6c 32 20 2a 20 2b 20 31 32 20  NCT col2 * + 12 
145e0 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
145f0 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
14600 0a 33 31 32 0d 0a 33 32 34 0d 0a 34 35 36 0d 0a  .312..324..456..
14610 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
14620 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2d 20 63 6f  t..SELECT + - co
14630 72 30 2e 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c 30  r0.col1 * - col0
14640 20 2b 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74   + + col1 FROM t
14650 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
14660 2d 0d 0a 32 31 35 30 0d 0a 33 34 39 32 0d 0a 38  -..2150..3492..8
14670 31 39 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  190....onlyif my
14680 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f  sql # support fo
14690 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63  r MySQL specific
146a0 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e   system types an
146b0 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20  d syntax..query 
146c0 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
146d0 35 38 35 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  585..SELECT ALL 
146e0 2d 20 43 41 53 54 28 20 4e 55 4c 4c 20 41 53 20  - CAST( NULL AS 
146f0 44 45 43 49 4d 41 4c 20 29 20 46 52 4f 4d 20 74  DECIMAL ) FROM t
14700 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab2 cor0..----..
14710 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c  NULL..NULL..NULL
14720 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
14730 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
14740 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
14750 72 74 20 6c 61 62 65 6c 2d 35 38 35 0d 0a 53 45  rt label-585..SE
14760 4c 45 43 54 20 41 4c 4c 20 2d 20 43 41 53 54 20  LECT ALL - CAST 
14770 28 20 4e 55 4c 4c 20 41 53 20 52 45 41 4c 20 29  ( NULL AS REAL )
14780 20 46 52 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d   FROM tab2 cor0.
14790 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c  .----..NULL..NUL
147a0 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 6f 6e 6c 79 69  L..NULL....onlyi
147b0 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49  f mysql # use DI
147c0 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69  V operator for i
147d0 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d  nteger division.
147e0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
147f0 20 6c 61 62 65 6c 2d 35 38 36 0d 0a 53 45 4c 45   label-586..SELE
14800 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 32 20 44 49  CT ALL + col2 DI
14810 56 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61  V + col0 FROM ta
14820 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
14830 0d 0a 30 0d 0a 30 0d 0a 31 0d 0a 0d 0a 73 6b 69  ..0..0..1....ski
14840 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
14850 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
14860 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
14870 6c 2d 35 38 36 0d 0a 53 45 4c 45 43 54 20 41 4c  l-586..SELECT AL
14880 4c 20 2b 20 63 6f 6c 32 20 2f 20 2b 20 63 6f 6c  L + col2 / + col
14890 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  0 FROM tab0 AS c
148a0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d  or0..----..0..0.
148b0 0a 31 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  .1....onlyif mys
148c0 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72  ql # support for
148d0 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63 20   MySQL specific 
148e0 73 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64  system types and
148f0 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49   syntax..query I
14900 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 35   rowsort label-5
14910 38 37 0d 0a 53 45 4c 45 43 54 20 43 41 53 54 28  87..SELECT CAST(
14920 20 4e 55 4c 4c 20 41 53 20 53 49 47 4e 45 44 20   NULL AS SIGNED 
14930 29 20 2a 20 63 6f 72 30 2e 63 6f 6c 31 20 46 52  ) * cor0.col1 FR
14940 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
14950 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c  .----..NULL..NUL
14960 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69  L..NULL....skipi
14970 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
14980 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
14990 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
149a0 35 38 37 0d 0a 53 45 4c 45 43 54 20 43 41 53 54  587..SELECT CAST
149b0 20 28 20 4e 55 4c 4c 20 41 53 20 49 4e 54 45 47   ( NULL AS INTEG
149c0 45 52 20 29 20 2a 20 63 6f 72 30 2e 63 6f 6c 31  ER ) * cor0.col1
149d0 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
149e0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a  r0..----..NULL..
149f0 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75  NULL..NULL....qu
14a00 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
14a10 45 4c 45 43 54 20 2b 20 34 35 20 2a 20 63 6f 6c  ELECT + 45 * col
14a20 32 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  2 AS col1 FROM t
14a30 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
14a40 2d 0d 0a 31 31 37 30 0d 0a 31 32 31 35 0d 0a 31  -..1170..1215..1
14a50 37 31 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  710....query I r
14a60 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
14a70 20 31 33 20 2b 20 2b 20 63 6f 6c 31 20 46 52 4f   13 + + col1 FRO
14a80 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
14a90 2d 2d 2d 2d 0d 0a 31 38 0d 0a 34 0d 0a 34 36 0d  ----..18..4..46.
14aa0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
14ab0 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2d 20 35  rt..SELECT + - 5
14ac0 35 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  5 FROM tab2 AS c
14ad0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 35 0d 0a  or0..----..-55..
14ae0 2d 35 35 0d 0a 2d 35 35 0d 0a 0d 0a 71 75 65 72  -55..-55....quer
14af0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
14b00 45 43 54 20 2d 20 31 20 2b 20 63 6f 72 30 2e 63  ECT - 1 + cor0.c
14b10 6f 6c 30 20 2a 20 63 6f 72 30 2e 63 6f 6c 30 20  ol0 * cor0.col0 
14b20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
14b30 30 0d 0a 2d 2d 2d 2d 0d 0a 34 30 39 35 0d 0a 36  0..----..4095..6
14b40 33 39 39 0d 0a 38 0d 0a 0d 0a 71 75 65 72 79 20  399..8....query 
14b50 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
14b60 54 20 41 4c 4c 20 2b 20 63 6f 6c 32 20 2b 20 63  T ALL + col2 + c
14b70 6f 6c 32 20 2a 20 63 6f 72 30 2e 63 6f 6c 32 20  ol2 * cor0.col2 
14b80 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
14b90 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
14ba0 0a 31 31 32 32 0d 0a 32 0d 0a 36 38 30 36 0d 0a  .1122..2..6806..
14bb0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
14bc0 74 0d 0a 53 45 4c 45 43 54 20 28 20 33 35 20 29  t..SELECT ( 35 )
14bd0 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
14be0 62 31 0d 0a 2d 2d 2d 2d 0d 0a 33 35 0d 0a 33 35  b1..----..35..35
14bf0 0d 0a 33 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..35....query I 
14c00 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
14c10 44 49 53 54 49 4e 43 54 20 2d 20 28 20 63 6f 6c  DISTINCT - ( col
14c20 30 20 2b 20 2b 20 63 6f 6c 30 20 29 20 41 53 20  0 + + col0 ) AS 
14c30 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 0d 0a  col0 FROM tab2..
14c40 2d 2d 2d 2d 0d 0a 2d 31 34 0d 0a 2d 31 35 36 0d  ----..-14..-156.
14c50 0a 2d 31 35 38 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  .-158....onlyif 
14c60 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20  mysql # use DIV 
14c70 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74  operator for int
14c80 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71  eger division..q
14c90 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
14ca0 61 62 65 6c 2d 35 39 35 0d 0a 53 45 4c 45 43 54  abel-595..SELECT
14cb0 20 2d 20 63 6f 6c 32 20 2b 20 63 6f 6c 32 20 44   - col2 + col2 D
14cc0 49 56 20 2d 20 63 6f 6c 32 20 46 52 4f 4d 20 74  IV - col2 FROM t
14cd0 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
14ce0 2d 0d 0a 2d 32 0d 0a 2d 33 34 0d 0a 2d 38 33 0d  -..-2..-34..-83.
14cf0 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
14d00 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
14d10 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
14d20 74 20 6c 61 62 65 6c 2d 35 39 35 0d 0a 53 45 4c  t label-595..SEL
14d30 45 43 54 20 2d 20 63 6f 6c 32 20 2b 20 63 6f 6c  ECT - col2 + col
14d40 32 20 2f 20 2d 20 63 6f 6c 32 20 46 52 4f 4d 20  2 / - col2 FROM 
14d50 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
14d60 2d 2d 0d 0a 2d 32 0d 0a 2d 33 34 0d 0a 2d 38 33  --..-2..-34..-83
14d70 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
14d80 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
14d90 49 4e 43 54 20 2b 20 31 33 20 41 53 20 63 6f 6c  INCT + 13 AS col
14da0 30 20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30  0 FROM tab1 cor0
14db0 0d 0a 2d 2d 2d 2d 0d 0a 31 33 0d 0a 0d 0a 71 75  ..----..13....qu
14dc0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
14dd0 45 4c 45 43 54 20 2b 20 63 6f 6c 31 20 2b 20 2b  ELECT + col1 + +
14de0 20 28 20 2b 20 63 6f 6c 32 20 29 20 41 53 20 63   ( + col2 ) AS c
14df0 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol0 FROM tab1 AS
14e00 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 39   cor0..----..109
14e10 0d 0a 36 37 0d 0a 38 30 0d 0a 0d 0a 71 75 65 72  ..67..80....quer
14e20 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
14e30 45 43 54 20 41 4c 4c 20 2d 20 33 31 20 41 53 20  ECT ALL - 31 AS 
14e40 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 2c 20  col0 FROM tab0, 
14e50 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
14e60 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73  --..9 values has
14e70 68 69 6e 67 20 74 6f 20 66 34 62 30 35 32 30 36  hing to f4b05206
14e80 65 65 32 66 63 30 63 66 38 30 30 37 64 39 63 33  ee2fc0cf8007d9c3
14e90 35 31 34 38 38 35 66 61 0d 0a 0d 0a 71 75 65 72  514885fa....quer
14ea0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
14eb0 45 43 54 20 38 33 20 2d 20 2b 20 74 61 62 31 2e  ECT 83 - + tab1.
14ec0 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c 31 20 46 52  col0 * - col1 FR
14ed0 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31  OM tab1..----..1
14ee0 31 32 33 0d 0a 31 36 31 0d 0a 37 32 33 0d 0a 0d  123..161..723...
14ef0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
14f00 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
14f10 54 20 36 38 20 2b 20 63 6f 6c 30 20 46 52 4f 4d  T 68 + col0 FROM
14f20 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 34 36   tab2..----..146
14f30 0d 0a 31 34 37 0d 0a 37 35 0d 0a 0d 0a 6f 6e 6c  ..147..75....onl
14f40 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70  yif mysql # supp
14f50 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70  ort for MySQL sp
14f60 65 63 69 66 69 63 20 73 79 73 74 65 6d 20 74 79  ecific system ty
14f70 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a  pes and syntax..
14f80 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
14f90 6c 61 62 65 6c 2d 36 30 31 0d 0a 53 45 4c 45 43  label-601..SELEC
14fa0 54 20 43 41 53 54 28 20 63 6f 72 30 2e 63 6f 6c  T CAST( cor0.col
14fb0 32 20 41 53 20 53 49 47 4e 45 44 20 29 20 41 53  2 AS SIGNED ) AS
14fc0 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20   col0 FROM tab0 
14fd0 63 6f 72 30 20 43 52 4f 53 53 20 4a 4f 49 4e 20  cor0 CROSS JOIN 
14fe0 74 61 62 31 20 41 53 20 63 6f 72 31 0d 0a 2d 2d  tab1 AS cor1..--
14ff0 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73  --..9 values has
15000 68 69 6e 67 20 74 6f 20 63 38 66 39 66 61 39 65  hing to c8f9fa9e
15010 66 30 66 38 37 30 32 62 64 33 38 32 65 38 32 31  f0f8702bd382e821
15020 33 37 38 61 39 36 64 38 0d 0a 0d 0a 73 6b 69 70  378a96d8....skip
15030 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
15040 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
15050 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
15060 2d 36 30 31 0d 0a 53 45 4c 45 43 54 20 43 41 53  -601..SELECT CAS
15070 54 20 28 20 63 6f 72 30 2e 63 6f 6c 32 20 41 53  T ( cor0.col2 AS
15080 20 49 4e 54 45 47 45 52 20 29 20 41 53 20 63 6f   INTEGER ) AS co
15090 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72  l0 FROM tab0 cor
150a0 30 20 43 52 4f 53 53 20 4a 4f 49 4e 20 74 61 62  0 CROSS JOIN tab
150b0 31 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d  1 AS cor1..----.
150c0 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e  .9 values hashin
150d0 67 20 74 6f 20 63 38 66 39 66 61 39 65 66 30 66  g to c8f9fa9ef0f
150e0 38 37 30 32 62 64 33 38 32 65 38 32 31 33 37 38  8702bd382e821378
150f0 61 39 36 64 38 0d 0a 0d 0a 71 75 65 72 79 20 49  a96d8....query I
15100 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
15110 20 2d 20 38 20 41 53 20 63 6f 6c 31 20 46 52 4f   - 8 AS col1 FRO
15120 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 38  M tab1..----..-8
15130 0d 0a 2d 38 0d 0a 2d 38 0d 0a 0d 0a 71 75 65 72  ..-8..-8....quer
15140 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
15150 45 43 54 20 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c  ECT col0 * - col
15160 31 20 2a 20 63 6f 6c 30 20 41 53 20 63 6f 6c 31  1 * col0 AS col1
15170 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
15180 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 33 34 0d 0a  r0..----..-234..
15190 2d 34 30 39 36 30 0d 0a 2d 38 33 32 30 30 0d 0a  -40960..-83200..
151a0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
151b0 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20  t..SELECT ALL - 
151c0 2b 20 63 6f 6c 31 20 2b 20 32 32 20 2a 20 2d 20  + col1 + 22 * - 
151d0 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46 52 4f  col1 AS col1 FRO
151e0 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
151f0 2d 2d 2d 2d 0d 0a 2d 31 39 37 38 0d 0a 2d 32 30  ----..-1978..-20
15200 39 33 0d 0a 2d 32 32 33 31 0d 0a 0d 0a 71 75 65  93..-2231....que
15210 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
15220 4c 45 43 54 20 63 6f 6c 30 20 2a 20 2b 20 28 20  LECT col0 * + ( 
15230 32 20 29 20 46 52 4f 4d 20 74 61 62 30 20 41 53  2 ) FROM tab0 AS
15240 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 37 38   cor0..----..178
15250 0d 0a 34 38 0d 0a 37 30 0d 0a 0d 0a 71 75 65 72  ..48..70....quer
15260 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
15270 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 2b  ECT DISTINCT - +
15280 20 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c 31 20 41   col2 * - col1 A
15290 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31  S col2 FROM tab1
152a0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
152b0 31 32 34 38 0d 0a 31 34 30 34 0d 0a 35 37 30 0d  1248..1404..570.
152c0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
152d0 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c  rt..SELECT - col
152e0 31 20 2b 20 2d 20 32 37 20 46 52 4f 4d 20 74 61  1 + - 27 FROM ta
152f0 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
15300 0d 0a 2d 31 31 33 0d 0a 2d 31 31 38 0d 0a 2d 31  ..-113..-118..-1
15310 32 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  24....query I ro
15320 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
15330 53 54 49 4e 43 54 20 2b 20 63 6f 6c 31 20 2a 20  STINCT + col1 * 
15340 2d 20 63 6f 6c 31 20 2b 20 2b 20 63 6f 6c 32 20  - col1 + + col2 
15350 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
15360 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 33 0d 0a 2d 36  0..----..-43..-6
15370 32 32 0d 0a 2d 37 33 0d 0a 0d 0a 71 75 65 72 79  22..-73....query
15380 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
15390 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 30 20 2a 20  CT ALL + col0 * 
153a0 2b 20 28 20 2b 20 37 30 20 29 20 46 52 4f 4d 20  + ( + 70 ) FROM 
153b0 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab1 cor0..----.
153c0 0a 32 31 30 0d 0a 34 34 38 30 0d 0a 35 36 30 30  .210..4480..5600
153d0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
153e0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
153f0 49 4e 43 54 20 2b 20 63 6f 6c 31 20 2a 20 35 33  INCT + col1 * 53
15400 20 2d 20 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20   - col2 AS col2 
15410 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
15420 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33 32 34 0d 0a 34  0..----..1324..4
15430 37 33 0d 0a 35 39 33 0d 0a 0d 0a 71 75 65 72 79  73..593....query
15440 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
15450 43 54 20 2b 20 63 6f 6c 31 20 2a 20 2b 20 63 6f  CT + col1 * + co
15460 6c 32 20 2b 20 35 35 20 2a 20 2b 20 63 6f 6c 32  l2 + 55 * + col2
15470 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
15480 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 39 37 32 0d  r0..----..11972.
15490 0a 31 35 32 0d 0a 34 36 35 33 0d 0a 0d 0a 71 75  .152..4653....qu
154a0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
154b0 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f 72 30  ELECT ALL - cor0
154c0 2e 63 6f 6c 31 20 2a 20 2d 20 32 32 20 2b 20 63  .col1 * - 22 + c
154d0 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  ol0 AS col1 FROM
154e0 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab1 cor0..----
154f0 0d 0a 32 38 34 0d 0a 33 36 36 0d 0a 35 37 35 0d  ..284..366..575.
15500 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
15510 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79  # support for My
15520 53 51 4c 20 73 70 65 63 69 66 69 63 20 73 79 73  SQL specific sys
15530 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79  tem types and sy
15540 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f  ntax..query I ro
15550 77 73 6f 72 74 20 6c 61 62 65 6c 2d 36 31 33 0d  wsort label-613.
15560 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 2d 20  .SELECT ALL - - 
15570 63 6f 6c 31 20 2a 20 2b 20 43 41 53 54 28 20 4e  col1 * + CAST( N
15580 55 4c 4c 20 41 53 20 53 49 47 4e 45 44 20 29 20  ULL AS SIGNED ) 
15590 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
155a0 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e  0..----..NULL..N
155b0 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69  ULL..NULL....ski
155c0 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
155d0 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
155e0 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
155f0 6c 2d 36 31 33 0d 0a 53 45 4c 45 43 54 20 41 4c  l-613..SELECT AL
15600 4c 20 2d 20 2d 20 63 6f 6c 31 20 2a 20 2b 20 43  L - - col1 * + C
15610 41 53 54 20 28 20 4e 55 4c 4c 20 41 53 20 49 4e  AST ( NULL AS IN
15620 54 45 47 45 52 20 29 20 46 52 4f 4d 20 74 61 62  TEGER ) FROM tab
15630 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
15640 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c  .NULL..NULL..NUL
15650 4c 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  L....query I row
15660 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
15670 54 49 4e 43 54 20 2d 20 63 6f 6c 32 20 2b 20 2d  TINCT - col2 + -
15680 20 63 6f 6c 32 20 2b 20 2d 20 63 6f 6c 32 20 41   col2 + - col2 A
15690 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30  S col2 FROM tab0
156a0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
156b0 2d 32 34 36 0d 0a 2d 33 0d 0a 2d 39 39 0d 0a 0d  -246..-3..-99...
156c0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
156d0 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 31 20  ..SELECT + col1 
156e0 2a 20 28 20 2d 20 38 32 20 29 20 46 52 4f 4d 20  * ( - 82 ) FROM 
156f0 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
15700 2d 2d 0d 0a 2d 31 30 36 36 0d 0a 2d 32 31 33 32  --..-1066..-2132
15710 0d 0a 2d 38 32 30 0d 0a 0d 0a 73 6b 69 70 69 66  ..-820....skipif
15720 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f   postgresql # Po
15730 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65  stgreSQL require
15740 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69  s AS when renami
15750 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e  ng output column
15760 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  s..query I rowso
15770 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c  rt..SELECT - col
15780 30 20 2a 20 2b 20 34 34 20 63 6f 6c 32 20 46 52  0 * + 44 col2 FR
15790 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
157a0 0a 2d 2d 2d 2d 0d 0a 2d 31 30 35 36 0d 0a 2d 31  .----..-1056..-1
157b0 35 34 30 0d 0a 2d 33 39 31 36 0d 0a 0d 0a 71 75  540..-3916....qu
157c0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
157d0 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d  ELECT DISTINCT -
157e0 20 63 6f 6c 32 20 2d 20 63 6f 6c 31 20 2a 20 2b   col2 - col1 * +
157f0 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20   col2 FROM tab1 
15800 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
15810 31 33 34 34 0d 0a 2d 31 34 35 38 0d 0a 2d 36 32  1344..-1458..-62
15820 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  7....query I row
15830 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
15840 20 63 6f 6c 32 20 2a 20 74 61 62 31 2e 63 6f 6c   col2 * tab1.col
15850 32 20 2b 20 2b 20 63 6f 6c 32 20 46 52 4f 4d 20  2 + + col2 FROM 
15860 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 32 39 37 30  tab1..----..2970
15870 0d 0a 33 33 30 36 0d 0a 39 33 31 32 0d 0a 0d 0a  ..3306..9312....
15880 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
15890 0a 53 45 4c 45 43 54 20 2d 20 63 6f 72 30 2e 63  .SELECT - cor0.c
158a0 6f 6c 30 20 2a 20 2b 20 36 31 20 41 53 20 63 6f  ol0 * + 61 AS co
158b0 6c 30 20 46 52 4f 4d 20 74 61 62 30 2c 20 74 61  l0 FROM tab0, ta
158c0 62 31 2c 20 74 61 62 31 20 63 6f 72 30 2c 20 74  b1, tab1 cor0, t
158d0 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 38 31 20 76 61  ab2..----..81 va
158e0 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20  lues hashing to 
158f0 37 38 63 32 61 34 65 66 33 37 66 39 37 61 63 64  78c2a4ef37f97acd
15900 33 66 34 30 62 64 39 62 35 34 66 63 31 38 33 32  3f40bd9b54fc1832
15910 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
15920 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
15930 63 6f 6c 31 20 2a 20 63 6f 6c 31 20 2b 20 2d 20  col1 * col1 + - 
15940 36 35 20 2a 20 2d 20 36 38 20 46 52 4f 4d 20 74  65 * - 68 FROM t
15950 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 38 31 36  ab0..----..11816
15960 0d 0a 31 32 37 30 31 0d 0a 31 33 38 32 39 0d 0a  ..12701..13829..
15970 0d 0a 71 75 65 72 79 20 49 49 49 49 49 49 49 49  ..query IIIIIIII
15980 49 49 49 49 49 49 49 20 72 6f 77 73 6f 72 74 0d  IIIIIII rowsort.
15990 0a 53 45 4c 45 43 54 20 2a 20 46 52 4f 4d 20 74  .SELECT * FROM t
159a0 61 62 31 20 63 6f 72 30 20 43 52 4f 53 53 20 4a  ab1 cor0 CROSS J
159b0 4f 49 4e 20 74 61 62 31 2c 20 74 61 62 31 20 63  OIN tab1, tab1 c
159c0 6f 72 31 2c 20 74 61 62 30 2c 20 74 61 62 31 20  or1, tab0, tab1 
159d0 41 53 20 63 6f 72 32 0d 0a 2d 2d 2d 2d 0d 0a 33  AS cor2..----..3
159e0 36 34 35 20 76 61 6c 75 65 73 20 68 61 73 68 69  645 values hashi
159f0 6e 67 20 74 6f 20 39 61 34 30 32 61 64 32 36 36  ng to 9a402ad266
15a00 39 34 36 35 66 62 32 38 34 34 34 35 63 34 39 39  9465fb284445c499
15a10 61 34 38 66 32 63 0d 0a 0d 0a 71 75 65 72 79 20  a48f2c....query 
15a20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
15a30 54 20 41 4c 4c 20 2d 20 63 6f 6c 32 20 2b 20 2b  T ALL - col2 + +
15a40 20 63 6f 72 30 2e 63 6f 6c 32 20 2a 20 37 20 2a   cor0.col2 * 7 *
15a50 20 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46 52   col2 AS col2 FR
15a60 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
15a70 0a 2d 2d 2d 2d 0d 0a 34 36 39 38 36 0d 0a 36 0d  .----..46986..6.
15a80 0a 37 35 39 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  .7590....onlyif 
15a90 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20  mysql # support 
15aa0 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66  for MySQL specif
15ab0 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20  ic system types 
15ac0 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72  and syntax..quer
15ad0 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
15ae0 6c 2d 36 32 33 0d 0a 53 45 4c 45 43 54 20 41 4c  l-623..SELECT AL
15af0 4c 20 2d 20 63 6f 6c 32 20 2b 20 63 6f 6c 32 20  L - col2 + col2 
15b00 2b 20 2b 20 28 20 2d 20 63 6f 6c 30 20 29 20 2a  + + ( - col0 ) *
15b10 20 43 41 53 54 28 20 63 6f 6c 30 20 41 53 20 53   CAST( col0 AS S
15b20 49 47 4e 45 44 20 29 20 46 52 4f 4d 20 74 61 62  IGNED ) FROM tab
15b30 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 34  1 cor0..----..-4
15b40 30 39 36 0d 0a 2d 36 34 30 30 0d 0a 2d 39 0d 0a  096..-6400..-9..
15b50 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
15b60 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
15b70 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
15b80 20 6c 61 62 65 6c 2d 36 32 33 0d 0a 53 45 4c 45   label-623..SELE
15b90 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 32 20 2b 20  CT ALL - col2 + 
15ba0 63 6f 6c 32 20 2b 20 2b 20 28 20 2d 20 63 6f 6c  col2 + + ( - col
15bb0 30 20 29 20 2a 20 43 41 53 54 20 28 20 63 6f 6c  0 ) * CAST ( col
15bc0 30 20 41 53 20 49 4e 54 45 47 45 52 20 29 20 46  0 AS INTEGER ) F
15bd0 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d  ROM tab1 cor0..-
15be0 2d 2d 2d 0d 0a 2d 34 30 39 36 0d 0a 2d 36 34 30  ---..-4096..-640
15bf0 30 0d 0a 2d 39 0d 0a 0d 0a 71 75 65 72 79 20 49  0..-9....query I
15c00 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
15c10 20 63 6f 72 30 2e 63 6f 6c 31 20 2a 20 2b 20 34   cor0.col1 * + 4
15c20 38 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  8 AS col1 FROM t
15c30 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
15c40 2d 0d 0a 34 31 32 38 0d 0a 34 33 36 38 0d 0a 34  -..4128..4368..4
15c50 36 35 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  656....query I r
15c60 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
15c70 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c 31 20 2b  ISTINCT - col1 +
15c80 20 2d 20 32 37 20 41 53 20 63 6f 6c 31 20 46 52   - 27 AS col1 FR
15c90 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
15ca0 0a 2d 2d 2d 2d 0d 0a 2d 33 37 0d 0a 2d 34 30 0d  .----..-37..-40.
15cb0 0a 2d 35 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .-53....query I 
15cc0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
15cd0 41 4c 4c 20 2b 20 63 6f 6c 31 20 2b 20 2d 20 63  ALL + col1 + - c
15ce0 6f 6c 31 20 2a 20 63 6f 72 30 2e 63 6f 6c 31 20  ol1 * cor0.col1 
15cf0 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
15d00 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 37 33 31 30 0d 0a  0..----..-7310..
15d10 2d 38 31 39 30 0d 0a 2d 39 33 31 32 0d 0a 0d 0a  -8190..-9312....
15d20 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71  skipif postgresq
15d30 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72  l # PostgreSQL r
15d40 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20  equires AS when 
15d50 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20  renaming output 
15d60 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49  columns..query I
15d70 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
15d80 20 2d 20 28 20 63 6f 72 30 2e 63 6f 6c 31 20 29   - ( cor0.col1 )
15d90 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 2c   col1 FROM tab2,
15da0 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
15db0 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61  ---..9 values ha
15dc0 73 68 69 6e 67 20 74 6f 20 62 32 33 34 37 39 38  shing to b234798
15dd0 64 34 37 30 36 33 31 34 62 61 31 34 65 61 61 64  d4706314ba14eaad
15de0 35 33 39 64 30 61 61 38 38 0d 0a 0d 0a 71 75 65  539d0aa88....que
15df0 72 79 20 49 49 49 49 49 49 49 49 49 49 49 49 49  ry IIIIIIIIIIIII
15e00 49 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45  II rowsort..SELE
15e10 43 54 20 41 4c 4c 20 2a 20 46 52 4f 4d 20 74 61  CT ALL * FROM ta
15e20 62 32 20 41 53 20 63 6f 72 30 20 43 52 4f 53 53  b2 AS cor0 CROSS
15e30 20 4a 4f 49 4e 20 74 61 62 30 2c 20 74 61 62 31   JOIN tab0, tab1
15e40 20 63 6f 72 31 2c 20 74 61 62 30 20 41 53 20 63   cor1, tab0 AS c
15e50 6f 72 32 2c 20 74 61 62 30 20 41 53 20 63 6f 72  or2, tab0 AS cor
15e60 33 0d 0a 2d 2d 2d 2d 0d 0a 33 36 34 35 20 76 61  3..----..3645 va
15e70 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20  lues hashing to 
15e80 38 36 32 66 62 61 39 61 63 38 35 66 64 66 32 63  862fba9ac85fdf2c
15e90 65 63 38 38 61 30 62 65 63 30 38 30 38 62 37 65  ec88a0bec0808b7e
15ea0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
15eb0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
15ec0 2d 20 35 32 20 2d 20 2d 20 63 6f 6c 32 20 46 52  - 52 - - col2 FR
15ed0 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 32  OM tab1..----..2
15ee0 0d 0a 34 34 0d 0a 35 0d 0a 0d 0a 71 75 65 72 79  ..44..5....query
15ef0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
15f00 43 54 20 2d 20 28 20 2b 20 63 6f 6c 32 20 29 20  CT - ( + col2 ) 
15f10 2b 20 2b 20 28 20 31 37 20 29 20 41 53 20 63 6f  + + ( 17 ) AS co
15f20 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l1 FROM tab1 AS 
15f30 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 37 0d  cor0..----..-37.
15f40 0a 2d 34 30 0d 0a 2d 37 39 0d 0a 0d 0a 71 75 65  .-40..-79....que
15f50 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
15f60 4c 45 43 54 20 63 6f 6c 31 20 2d 20 2d 20 36 33  LECT col1 - - 63
15f70 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
15f80 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
15f90 0d 0a 37 33 0d 0a 37 36 0d 0a 38 39 0d 0a 0d 0a  ..73..76..89....
15fa0 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75  onlyif mysql # u
15fb0 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20  se DIV operator 
15fc0 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69  for integer divi
15fd0 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f  sion..query I ro
15fe0 77 73 6f 72 74 20 6c 61 62 65 6c 2d 36 33 32 0d  wsort label-632.
15ff0 0a 53 45 4c 45 43 54 20 2b 20 2d 20 63 6f 6c 32  .SELECT + - col2
16000 20 44 49 56 20 38 30 20 46 52 4f 4d 20 74 61 62   DIV 80 FROM tab
16010 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
16020 0a 2d 31 0d 0a 30 0d 0a 30 0d 0a 0d 0a 73 6b 69  .-1..0..0....ski
16030 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
16040 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
16050 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
16060 6c 2d 36 33 32 0d 0a 53 45 4c 45 43 54 20 2b 20  l-632..SELECT + 
16070 2d 20 63 6f 6c 32 20 2f 20 38 30 20 46 52 4f 4d  - col2 / 80 FROM
16080 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
16090 2d 2d 2d 0d 0a 2d 31 0d 0a 30 0d 0a 30 0d 0a 0d  ---..-1..0..0...
160a0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
160b0 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 32 20 2a 20  ..SELECT col2 * 
160c0 33 33 20 2b 20 2d 20 63 6f 6c 32 20 2d 20 63 6f  33 + - col2 - co
160d0 6c 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  l2 AS col2 FROM 
160e0 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
160f0 2d 2d 0d 0a 31 36 37 34 0d 0a 31 37 36 37 0d 0a  --..1674..1767..
16100 32 39 37 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20  2976....query I 
16110 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
16120 2d 20 2b 20 63 6f 6c 31 20 2b 20 63 6f 6c 32 20  - + col1 + col2 
16130 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a  FROM tab0 cor0..
16140 2d 2d 2d 2d 0d 0a 2d 35 33 0d 0a 2d 39 0d 0a 2d  ----..-53..-9..-
16150 39 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  96....query I ro
16160 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
16170 53 54 49 4e 43 54 20 2b 20 63 6f 6c 32 20 2b 20  STINCT + col2 + 
16180 63 6f 6c 32 20 2a 20 63 6f 6c 32 20 41 53 20 63  col2 * col2 AS c
16190 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol2 FROM tab0 AS
161a0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 32   cor0..----..112
161b0 32 0d 0a 32 0d 0a 36 38 30 36 0d 0a 0d 0a 71 75  2..2..6806....qu
161c0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
161d0 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d  ELECT DISTINCT -
161e0 20 74 61 62 32 2e 63 6f 6c 30 20 46 52 4f 4d 20   tab2.col0 FROM 
161f0 74 61 62 32 2c 20 74 61 62 31 2c 20 74 61 62 32  tab2, tab1, tab2
16200 20 63 6f 72 30 2c 20 74 61 62 31 20 41 53 20 63   cor0, tab1 AS c
16210 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 37 0d 0a 2d  or1..----..-7..-
16220 37 38 0d 0a 2d 37 39 0d 0a 0d 0a 6f 6e 6c 79 69  78..-79....onlyi
16230 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49  f mysql # use DI
16240 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69  V operator for i
16250 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d  nteger division.
16260 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
16270 20 6c 61 62 65 6c 2d 36 33 37 0d 0a 53 45 4c 45   label-637..SELE
16280 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 31 20 44 49  CT ALL + col1 DI
16290 56 20 2b 20 63 6f 6c 30 20 2d 20 2b 20 63 6f 6c  V + col0 - + col
162a0 30 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32  0 col1 FROM tab2
162b0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
162c0 2d 33 0d 0a 2d 37 38 0d 0a 2d 37 39 0d 0a 0d 0a  -3..-78..-79....
162d0 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71  skipif postgresq
162e0 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72  l # PostgreSQL r
162f0 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20  equires AS when 
16300 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20  renaming output 
16310 63 6f 6c 75 6d 6e 73 0d 0a 73 6b 69 70 69 66 20  columns..skipif 
16320 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
16330 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
16340 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 36 33  rowsort label-63
16350 37 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20  7..SELECT ALL + 
16360 63 6f 6c 31 20 2f 20 2b 20 63 6f 6c 30 20 2d 20  col1 / + col0 - 
16370 2b 20 63 6f 6c 30 20 63 6f 6c 31 20 46 52 4f 4d  + col0 col1 FROM
16380 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
16390 2d 2d 2d 0d 0a 2d 33 0d 0a 2d 37 38 0d 0a 2d 37  ---..-3..-78..-7
163a0 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  9....query I row
163b0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63  sort..SELECT + c
163c0 6f 72 30 2e 63 6f 6c 32 20 2d 20 63 6f 6c 31 20  or0.col2 - col1 
163d0 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
163e0 30 0d 0a 2d 2d 2d 2d 0d 0a 32 38 0d 0a 34 37 0d  0..----..28..47.
163f0 0a 38 33 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f  .83....skipif po
16400 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67  stgresql # Postg
16410 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41  reSQL requires A
16420 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20  S when renaming 
16430 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a  output columns..
16440 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
16450 0a 53 45 4c 45 43 54 20 2b 20 63 6f 72 30 2e 63  .SELECT + cor0.c
16460 6f 6c 30 20 2a 20 63 6f 6c 32 20 63 6f 6c 31 20  ol0 * col2 col1 
16470 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a  FROM tab0 cor0..
16480 2d 2d 2d 2d 0d 0a 33 35 0d 0a 37 32 39 38 0d 0a  ----..35..7298..
16490 37 39 32 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  792....onlyif my
164a0 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f  sql # support fo
164b0 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63  r MySQL specific
164c0 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e   system types an
164d0 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20  d syntax..query 
164e0 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
164f0 36 34 30 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f  640..SELECT - co
16500 6c 32 20 2b 20 63 6f 6c 31 20 2a 20 2b 20 43 41  l2 + col1 * + CA
16510 53 54 28 20 2d 20 63 6f 6c 30 20 41 53 20 53 49  ST( - col0 AS SI
16520 47 4e 45 44 20 29 20 46 52 4f 4d 20 74 61 62 30  GNED ) FROM tab0
16530 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
16540 2d 32 30 39 37 0d 0a 2d 33 33 39 36 0d 0a 2d 38  -2097..-3396..-8
16550 31 38 31 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  181....skipif my
16560 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
16570 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
16580 77 73 6f 72 74 20 6c 61 62 65 6c 2d 36 34 30 0d  wsort label-640.
16590 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 32 20 2b  .SELECT - col2 +
165a0 20 63 6f 6c 31 20 2a 20 2b 20 43 41 53 54 20 28   col1 * + CAST (
165b0 20 2d 20 63 6f 6c 30 20 41 53 20 49 4e 54 45 47   - col0 AS INTEG
165c0 45 52 20 29 20 46 52 4f 4d 20 74 61 62 30 20 41  ER ) FROM tab0 A
165d0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32  S cor0..----..-2
165e0 30 39 37 0d 0a 2d 33 33 39 36 0d 0a 2d 38 31 38  097..-3396..-818
165f0 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  1....query I row
16600 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
16610 54 49 4e 43 54 20 2d 20 2d 20 63 6f 6c 30 20 2d  TINCT - - col0 -
16620 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20   col0 FROM tab0 
16630 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30  AS cor0..----..0
16640 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
16650 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f  ort..SELECT - co
16660 6c 30 20 2a 20 63 6f 72 30 2e 63 6f 6c 32 20 2b  l0 * cor0.col2 +
16670 20 36 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53   60 FROM tab2 AS
16680 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32   cor0..----..-12
16690 39 0d 0a 2d 31 39 36 38 0d 0a 2d 32 39 34 32 0d  9..-1968..-2942.
166a0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
166b0 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c  rt..SELECT + col
166c0 30 20 2a 20 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c  0 * col0 + + col
166d0 31 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  1 AS col0 FROM t
166e0 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
166f0 2d 0d 0a 31 33 32 32 0d 0a 36 36 32 0d 0a 38 30  -..1322..662..80
16700 31 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  12....query I ro
16710 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
16720 53 54 49 4e 43 54 20 2d 20 63 6f 6c 30 20 2b 20  STINCT - col0 + 
16730 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46 52 4f  col2 AS col1 FRO
16740 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab1 cor0..---
16750 2d 0d 0a 2d 37 0d 0a 31 36 0d 0a 35 31 0d 0a 0d  -..-7..16..51...
16760 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
16770 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 2d  ..SELECT ALL - -
16780 20 63 6f 6c 30 20 2d 20 63 6f 6c 32 20 2a 20 2d   col0 - col2 * -
16790 20 36 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20   6 AS col1 FROM 
167a0 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
167b0 2d 2d 0d 0a 32 32 32 0d 0a 34 31 0d 0a 35 38 31  --..222..41..581
167c0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
167d0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
167e0 2d 20 63 6f 72 30 2e 63 6f 6c 30 20 46 52 4f 4d  - cor0.col0 FROM
167f0 20 74 61 62 31 20 41 53 20 63 6f 72 30 20 43 52   tab1 AS cor0 CR
16800 4f 53 53 20 4a 4f 49 4e 20 74 61 62 30 2c 20 74  OSS JOIN tab0, t
16810 61 62 32 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d  ab2 AS cor1..---
16820 2d 0d 0a 32 37 20 76 61 6c 75 65 73 20 68 61 73  -..27 values has
16830 68 69 6e 67 20 74 6f 20 37 32 39 63 31 65 64 64  hing to 729c1edd
16840 61 39 33 33 32 33 39 38 32 39 39 66 33 39 63 64  a9332398299f39cd
16850 31 37 34 65 64 38 34 30 0d 0a 0d 0a 71 75 65 72  174ed840....quer
16860 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
16870 45 43 54 20 41 4c 4c 20 63 6f 6c 32 20 2b 20 2d  ECT ALL col2 + -
16880 20 63 6f 6c 31 20 2a 20 63 6f 6c 31 20 2d 20 2d   col1 * col1 - -
16890 20 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46 52   col0 AS col2 FR
168a0 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  OM tab0..----..-
168b0 37 33 33 39 0d 0a 2d 38 31 31 30 0d 0a 2d 39 33  7339..-8110..-93
168c0 37 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  73....query I ro
168d0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 34 36  wsort..SELECT 46
168e0 20 46 52 4f 4d 20 74 61 62 32 2c 20 74 61 62 31   FROM tab2, tab1
168f0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76   cor0..----..9 v
16900 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f  alues hashing to
16910 20 33 31 38 31 38 63 39 64 34 64 33 32 35 65 62   31818c9d4d325eb
16920 32 34 38 37 33 35 63 39 37 63 62 31 64 63 65 33  248735c97cb1dce3
16930 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  9....query I row
16940 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
16950 54 49 4e 43 54 20 2b 20 63 6f 6c 30 20 2a 20 2d  TINCT + col0 * -
16960 20 35 30 20 46 52 4f 4d 20 74 61 62 32 20 63 6f   50 FROM tab2 co
16970 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 35 30 0d 0a  r0..----..-350..
16980 2d 33 39 30 30 0d 0a 2d 33 39 35 30 0d 0a 0d 0a  -3900..-3950....
16990 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
169a0 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f  .SELECT ALL - co
169b0 6c 30 20 2a 20 36 20 41 53 20 63 6f 6c 30 20 46  l0 * 6 AS col0 F
169c0 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
169d0 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 32 0d 0a 2d 34 36  ..----..-42..-46
169e0 38 0d 0a 2d 34 37 34 0d 0a 0d 0a 71 75 65 72 79  8..-474....query
169f0 20 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49   IIIIIIIIIIIIIII
16a00 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
16a10 20 44 49 53 54 49 4e 43 54 20 2a 20 46 52 4f 4d   DISTINCT * FROM
16a20 20 74 61 62 31 20 41 53 20 63 6f 72 30 20 43 52   tab1 AS cor0 CR
16a30 4f 53 53 20 4a 4f 49 4e 20 74 61 62 31 2c 20 74  OSS JOIN tab1, t
16a40 61 62 30 20 41 53 20 63 6f 72 31 2c 20 74 61 62  ab0 AS cor1, tab
16a50 30 2c 20 74 61 62 32 20 63 6f 72 32 0d 0a 2d 2d  0, tab2 cor2..--
16a60 2d 2d 0d 0a 33 36 34 35 20 76 61 6c 75 65 73 20  --..3645 values 
16a70 68 61 73 68 69 6e 67 20 74 6f 20 37 31 31 38 30  hashing to 71180
16a80 66 39 66 33 65 66 61 64 66 30 65 65 33 61 37 66  f9f3efadf0ee3a7f
16a90 65 63 39 36 37 38 32 30 38 61 64 0d 0a 0d 0a 71  ec9678208ad....q
16aa0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
16ab0 53 45 4c 45 43 54 20 2b 20 36 34 20 2a 20 63 6f  SELECT + 64 * co
16ac0 6c 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  l0 AS col1 FROM 
16ad0 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 35 33 36  tab0..----..1536
16ae0 0d 0a 32 32 34 30 0d 0a 35 36 39 36 0d 0a 0d 0a  ..2240..5696....
16af0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
16b00 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
16b10 20 2b 20 74 61 62 31 2e 63 6f 6c 32 20 2a 20 63   + tab1.col2 * c
16b20 6f 6c 31 20 2a 20 63 6f 6c 31 20 46 52 4f 4d 20  ol1 * col1 FROM 
16b30 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 36 32 32  tab1..----..1622
16b40 34 0d 0a 33 36 35 30 34 0d 0a 35 37 30 30 0d 0a  4..36504..5700..
16b50 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
16b60 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
16b70 43 54 20 34 31 20 2b 20 28 20 63 6f 72 30 2e 63  CT 41 + ( cor0.c
16b80 6f 6c 31 20 29 20 46 52 4f 4d 20 74 61 62 30 20  ol1 ) FROM tab0 
16b90 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
16ba0 32 37 0d 0a 31 33 32 0d 0a 31 33 38 0d 0a 0d 0a  27..132..138....
16bb0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
16bc0 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
16bd0 20 2d 20 63 6f 6c 32 20 2b 20 31 35 20 2a 20 63   - col2 + 15 * c
16be0 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol0 FROM tab2 AS
16bf0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 34   cor0..----..114
16c00 34 0d 0a 31 31 34 37 0d 0a 37 38 0d 0a 0d 0a 73  4..1147..78....s
16c10 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c  kipif postgresql
16c20 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65   # PostgreSQL re
16c30 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72  quires AS when r
16c40 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63  enaming output c
16c50 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20  olumns..query I 
16c60 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
16c70 2b 20 28 20 2b 20 35 37 20 29 20 2a 20 63 6f 6c  + ( + 57 ) * col
16c80 31 20 2b 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20  1 + + cor0.col0 
16c90 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41  col1 FROM tab0 A
16ca0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 34 39  S cor0..----..49
16cb0 32 36 0d 0a 35 32 37 36 0d 0a 35 35 36 34 0d 0a  26..5276..5564..
16cc0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
16cd0 74 0d 0a 53 45 4c 45 43 54 20 2b 20 32 36 20 2b  t..SELECT + 26 +
16ce0 20 2b 20 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c 30   + col2 * + col0
16cf0 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
16d00 72 30 0d 0a 2d 2d 2d 2d 0d 0a 36 31 0d 0a 37 33  r0..----..61..73
16d10 32 34 0d 0a 38 31 38 0d 0a 0d 0a 6f 6e 6c 79 69  24..818....onlyi
16d20 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72  f mysql # suppor
16d30 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63  t for MySQL spec
16d40 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65  ific system type
16d50 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75  s and syntax..qu
16d60 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
16d70 62 65 6c 2d 36 35 38 0d 0a 53 45 4c 45 43 54 20  bel-658..SELECT 
16d80 43 41 53 54 28 20 4e 55 4c 4c 20 41 53 20 44 45  CAST( NULL AS DE
16d90 43 49 4d 41 4c 20 29 20 2b 20 63 6f 6c 32 20 2f  CIMAL ) + col2 /
16da0 20 2d 20 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20   - col1 AS col0 
16db0 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d  FROM tab0..----.
16dc0 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c  .NULL..NULL..NUL
16dd0 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  L....skipif mysq
16de0 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
16df0 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
16e00 6f 72 74 20 6c 61 62 65 6c 2d 36 35 38 0d 0a 53  ort label-658..S
16e10 45 4c 45 43 54 20 43 41 53 54 20 28 20 4e 55 4c  ELECT CAST ( NUL
16e20 4c 20 41 53 20 52 45 41 4c 20 29 20 2b 20 63 6f  L AS REAL ) + co
16e30 6c 32 20 2f 20 2d 20 63 6f 6c 31 20 41 53 20 63  l2 / - col1 AS c
16e40 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d  ol0 FROM tab0..-
16e50 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d  ---..NULL..NULL.
16e60 0a 4e 55 4c 4c 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  .NULL....onlyif 
16e70 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20  mysql # use DIV 
16e80 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74  operator for int
16e90 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71  eger division..q
16ea0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
16eb0 61 62 65 6c 2d 36 35 39 0d 0a 53 45 4c 45 43 54  abel-659..SELECT
16ec0 20 44 49 53 54 49 4e 43 54 20 2d 20 28 20 63 6f   DISTINCT - ( co
16ed0 6c 31 20 29 20 2b 20 63 6f 6c 32 20 2a 20 63 6f  l1 ) + col2 * co
16ee0 6c 31 20 44 49 56 20 2d 20 63 6f 6c 31 20 46 52  l1 DIV - col1 FR
16ef0 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  OM tab0..----..-
16f00 31 31 39 0d 0a 2d 31 37 33 0d 0a 2d 39 38 0d 0a  119..-173..-98..
16f10 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
16f20 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
16f30 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
16f40 20 6c 61 62 65 6c 2d 36 35 39 0d 0a 53 45 4c 45   label-659..SELE
16f50 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 28 20  CT DISTINCT - ( 
16f60 63 6f 6c 31 20 29 20 2b 20 63 6f 6c 32 20 2a 20  col1 ) + col2 * 
16f70 63 6f 6c 31 20 2f 20 2d 20 63 6f 6c 31 20 46 52  col1 / - col1 FR
16f80 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  OM tab0..----..-
16f90 31 31 39 0d 0a 2d 31 37 33 0d 0a 2d 39 38 0d 0a  119..-173..-98..
16fa0 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65  ..skipif postgre
16fb0 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c  sql # PostgreSQL
16fc0 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65   requires AS whe
16fd0 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75  n renaming outpu
16fe0 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79  t columns..query
16ff0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
17000 43 54 20 63 6f 6c 31 20 2a 20 2b 20 28 20 2d 20  CT col1 * + ( - 
17010 63 6f 6c 31 20 29 20 63 6f 6c 32 20 46 52 4f 4d  col1 ) col2 FROM
17020 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 38   tab2..----..-28
17030 39 0d 0a 2d 33 34 38 31 0d 0a 2d 39 36 31 0d 0a  9..-3481..-961..
17040 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
17050 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
17060 43 54 20 2d 20 63 6f 6c 30 20 2a 20 2b 20 63 6f  CT - col0 * + co
17070 6c 30 20 2a 20 63 6f 6c 30 20 41 53 20 63 6f 6c  l0 * col0 AS col
17080 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d  1 FROM tab0..---
17090 2d 0d 0a 2d 31 33 38 32 34 0d 0a 2d 34 32 38 37  -..-13824..-4287
170a0 35 0d 0a 2d 37 30 34 39 36 39 0d 0a 0d 0a 71 75  5..-704969....qu
170b0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
170c0 45 4c 45 43 54 20 63 6f 6c 31 20 2b 20 33 35 20  ELECT col1 + 35 
170d0 2b 20 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46  + col2 AS col2 F
170e0 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab2..----..
170f0 31 32 30 0d 0a 39 30 0d 0a 39 33 0d 0a 0d 0a 71  120..90..93....q
17100 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
17110 53 45 4c 45 43 54 20 34 33 20 46 52 4f 4d 20 74  SELECT 43 FROM t
17120 61 62 32 2c 20 74 61 62 32 20 63 6f 72 30 0d 0a  ab2, tab2 cor0..
17130 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68  ----..9 values h
17140 61 73 68 69 6e 67 20 74 6f 20 31 39 39 31 30 35  ashing to 199105
17150 36 31 39 30 34 39 32 37 31 31 34 37 39 35 36 64  619049271147956d
17160 65 35 32 65 37 66 35 65 64 34 0d 0a 0d 0a 71 75  e52e7f5ed4....qu
17170 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
17180 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 30 20 2b  ELECT ALL col0 +
17190 20 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46 52   col0 AS col1 FR
171a0 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d  OM tab2 cor0..--
171b0 2d 2d 0d 0a 31 34 0d 0a 31 35 36 0d 0a 31 35 38  --..14..156..158
171c0 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67  ....skipif postg
171d0 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53  resql # PostgreS
171e0 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77  QL requires AS w
171f0 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74  hen renaming out
17200 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65  put columns..que
17210 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
17220 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20  LECT DISTINCT - 
17230 2b 20 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c 30 20  + col0 + - col0 
17240 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41  col1 FROM tab2 A
17250 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
17260 34 0d 0a 2d 31 35 36 0d 0a 2d 31 35 38 0d 0a 0d  4..-156..-158...
17270 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
17280 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51  support for MySQ
17290 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65  L specific syste
172a0 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74  m types and synt
172b0 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ax..query I rows
172c0 6f 72 74 20 6c 61 62 65 6c 2d 36 36 36 0d 0a 53  ort label-666..S
172d0 45 4c 45 43 54 20 2b 20 43 41 53 54 28 20 28 20  ELECT + CAST( ( 
172e0 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 2d 20 2b 20  - cor0.col2 - + 
172f0 63 6f 6c 32 20 29 20 41 53 20 53 49 47 4e 45 44  col2 ) AS SIGNED
17300 20 29 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 2d   ) + cor0.col2 -
17310 20 2b 20 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20   + col2 AS col0 
17320 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
17330 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 32 0d 0a 2d 35  0..----..-52..-5
17340 34 0d 0a 2d 37 36 0d 0a 0d 0a 73 6b 69 70 69 66  4..-76....skipif
17350 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
17360 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
17370 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 36   rowsort label-6
17380 36 36 0d 0a 53 45 4c 45 43 54 20 2b 20 43 41 53  66..SELECT + CAS
17390 54 20 28 20 28 20 2d 20 63 6f 72 30 2e 63 6f 6c  T ( ( - cor0.col
173a0 32 20 2d 20 2b 20 63 6f 6c 32 20 29 20 41 53 20  2 - + col2 ) AS 
173b0 49 4e 54 45 47 45 52 20 29 20 2b 20 63 6f 72 30  INTEGER ) + cor0
173c0 2e 63 6f 6c 32 20 2d 20 2b 20 63 6f 6c 32 20 41  .col2 - + col2 A
173d0 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32  S col0 FROM tab2
173e0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
173f0 2d 35 32 0d 0a 2d 35 34 0d 0a 2d 37 36 0d 0a 0d  -52..-54..-76...
17400 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
17410 0d 0a 53 45 4c 45 43 54 20 2b 20 2d 20 63 6f 6c  ..SELECT + - col
17420 30 20 2b 20 2d 20 63 6f 6c 32 20 2a 20 2d 20 63  0 + - col2 * - c
17430 6f 6c 32 20 2a 20 2d 20 63 6f 6c 32 20 46 52 4f  ol2 * - col2 FRO
17440 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
17450 2d 2d 2d 2d 0d 0a 2d 33 35 39 36 31 0d 0a 2d 33  ----..-35961..-3
17460 36 0d 0a 2d 35 35 31 34 35 37 0d 0a 0d 0a 71 75  6..-551457....qu
17470 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
17480 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b  ELECT DISTINCT +
17490 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 2b 20 2b   + cor0.col0 + +
174a0 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20   col1 FROM tab0 
174b0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
174c0 31 30 0d 0a 31 33 32 0d 0a 31 38 30 0d 0a 0d 0a  10..132..180....
174d0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
174e0 0a 53 45 4c 45 43 54 20 2b 20 35 36 20 2a 20 2b  .SELECT + 56 * +
174f0 20 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c 32 20 41   col0 + + col2 A
17500 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30  S col0 FROM tab0
17510 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33 37   cor0..----..137
17520 37 0d 0a 31 39 36 31 0d 0a 35 30 36 36 0d 0a 0d  7..1961..5066...
17530 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
17540 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72  use DIV operator
17550 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76   for integer div
17560 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72  ision..query I r
17570 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 36 37 30  owsort label-670
17580 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63  ..SELECT ALL - c
17590 6f 6c 31 20 44 49 56 20 63 6f 6c 30 20 2d 20 2b  ol1 DIV col0 - +
175a0 20 63 6f 72 30 2e 63 6f 6c 30 20 44 49 56 20 2d   cor0.col0 DIV -
175b0 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20   col1 FROM tab0 
175c0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
175d0 31 0d 0a 2d 32 0d 0a 2d 33 0d 0a 0d 0a 73 6b 69  1..-2..-3....ski
175e0 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
175f0 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
17600 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
17610 6c 2d 36 37 30 0d 0a 53 45 4c 45 43 54 20 41 4c  l-670..SELECT AL
17620 4c 20 2d 20 63 6f 6c 31 20 2f 20 63 6f 6c 30 20  L - col1 / col0 
17630 2d 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 2f 20  - + cor0.col0 / 
17640 2d 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30  - col1 FROM tab0
17650 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
17660 2d 31 0d 0a 2d 32 0d 0a 2d 33 0d 0a 0d 0a 71 75  -1..-2..-3....qu
17670 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
17680 45 4c 45 43 54 20 28 20 2b 20 63 6f 6c 30 20 29  ELECT ( + col0 )
17690 20 2a 20 63 6f 72 30 2e 63 6f 6c 31 20 2b 20 63   * cor0.col1 + c
176a0 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol0 FROM tab2 AS
176b0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 34 32   cor0..----..142
176c0 32 0d 0a 32 32 34 0d 0a 34 36 38 30 0d 0a 0d 0a  2..224..4680....
176d0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
176e0 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f  .SELECT ALL + co
176f0 6c 32 20 2a 20 2b 20 63 6f 6c 30 20 2b 20 2b 20  l2 * + col0 + + 
17700 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 63  col1 FROM tab2 c
17710 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 30 38 37 0d  or0..----..2087.
17720 0a 32 32 30 0d 0a 33 30 31 39 0d 0a 0d 0a 71 75  .220..3019....qu
17730 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
17740 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f 72 30  ELECT ALL - cor0
17750 2e 63 6f 6c 32 20 2b 20 2b 20 38 37 20 2b 20 2d  .col2 + + 87 + -
17760 20 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c 31 20 2a   col2 * - col1 *
17770 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20   + col0 AS col0 
17780 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
17790 30 0d 0a 2d 2d 2d 2d 0d 0a 33 34 38 31 0d 0a 36  0..----..3481..6
177a0 36 34 31 32 33 0d 0a 36 38 31 36 36 0d 0a 0d 0a  64123..68166....
177b0 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71  skipif postgresq
177c0 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72  l # PostgreSQL r
177d0 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20  equires AS when 
177e0 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20  renaming output 
177f0 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49  columns..query I
17800 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
17810 20 63 6f 6c 32 20 2a 20 63 6f 6c 31 20 2b 20 63   col2 * col1 + c
17820 6f 6c 32 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61  ol2 col2 FROM ta
17830 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 35 36 30 0d 0a  b2..----..1560..
17840 36 38 34 0d 0a 38 36 34 0d 0a 0d 0a 73 6b 69 70  684..864....skip
17850 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20  if postgresql # 
17860 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69  PostgreSQL requi
17870 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61  res AS when rena
17880 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75  ming output colu
17890 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  mns..query I row
178a0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
178b0 54 49 4e 43 54 20 2d 20 28 20 2d 20 63 6f 6c 31  TINCT - ( - col1
178c0 20 29 20 2a 20 28 20 63 6f 6c 30 20 29 20 63 6f   ) * ( col0 ) co
178d0 6c 30 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d  l0 FROM tab1..--
178e0 2d 2d 0d 0a 31 30 34 30 0d 0a 36 34 30 0d 0a 37  --..1040..640..7
178f0 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  8....query I row
17900 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
17910 20 2d 20 36 39 20 2a 20 2b 20 63 6f 6c 30 20 46   - 69 * + col0 F
17920 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab0..----..
17930 2d 31 36 35 36 0d 0a 2d 32 34 31 35 0d 0a 2d 36  -1656..-2415..-6
17940 31 34 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  141....query I r
17950 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
17960 20 63 6f 6c 32 20 2a 20 63 6f 6c 32 20 2b 20 2b   col2 * col2 + +
17970 20 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c 30 20 41   col2 * - col0 A
17980 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31  S col0 FROM tab1
17990 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 36 38 39 36 0d 0a  ..----..-16896..
179a0 2d 33 30 37 38 0d 0a 2d 36 38 39 37 0d 0a 0d 0a  -3078..-6897....
179b0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
179c0 0a 53 45 4c 45 43 54 20 2d 20 28 20 63 6f 6c 30  .SELECT - ( col0
179d0 20 2a 20 2d 20 74 61 62 31 2e 63 6f 6c 31 20 29   * - tab1.col1 )
179e0 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
179f0 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 30 34 30 0d 0a  b1..----..1040..
17a00 36 34 30 0d 0a 37 38 0d 0a 0d 0a 6f 6e 6c 79 69  640..78....onlyi
17a10 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49  f mysql # use DI
17a20 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69  V operator for i
17a30 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d  nteger division.
17a40 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
17a50 20 6c 61 62 65 6c 2d 36 37 39 0d 0a 53 45 4c 45   label-679..SELE
17a60 43 54 20 2b 20 2d 20 32 38 20 44 49 56 20 63 6f  CT + - 28 DIV co
17a70 6c 31 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  l1 AS col0 FROM 
17a80 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
17a90 2d 2d 0d 0a 2d 31 0d 0a 30 0d 0a 30 0d 0a 0d 0a  --..-1..0..0....
17aa0 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
17ab0 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
17ac0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
17ad0 61 62 65 6c 2d 36 37 39 0d 0a 53 45 4c 45 43 54  abel-679..SELECT
17ae0 20 2b 20 2d 20 32 38 20 2f 20 63 6f 6c 31 20 41   + - 28 / col1 A
17af0 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32  S col0 FROM tab2
17b00 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
17b10 2d 31 0d 0a 30 0d 0a 30 0d 0a 0d 0a 73 6b 69 70  -1..0..0....skip
17b20 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20  if postgresql # 
17b30 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69  PostgreSQL requi
17b40 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61  res AS when rena
17b50 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75  ming output colu
17b60 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  mns..query I row
17b70 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
17b80 54 49 4e 43 54 20 2b 20 2b 20 33 38 20 2b 20 2b  TINCT + + 38 + +
17b90 20 63 6f 6c 31 20 63 6f 6c 32 20 46 52 4f 4d 20   col1 col2 FROM 
17ba0 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab1 cor0..----.
17bb0 0a 34 38 0d 0a 35 31 0d 0a 36 34 0d 0a 0d 0a 71  .48..51..64....q
17bc0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
17bd0 53 45 4c 45 43 54 20 2b 20 63 6f 6c 31 20 2b 20  SELECT + col1 + 
17be0 63 6f 6c 32 20 2a 20 28 20 2d 20 63 6f 6c 32 20  col2 * ( - col2 
17bf0 29 20 2b 20 2b 20 63 6f 6c 32 20 46 52 4f 4d 20  ) + + col2 FROM 
17c00 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
17c10 2d 2d 0d 0a 2d 32 38 33 36 0d 0a 2d 33 31 38 32  --..-2836..-3182
17c20 0d 0a 2d 39 31 30 37 0d 0a 0d 0a 6f 6e 6c 79 69  ..-9107....onlyi
17c30 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49  f mysql # use DI
17c40 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69  V operator for i
17c50 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d  nteger division.
17c60 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
17c70 20 6c 61 62 65 6c 2d 36 38 32 0d 0a 53 45 4c 45   label-682..SELE
17c80 43 54 20 2b 20 63 6f 6c 30 20 2a 20 43 41 53 54  CT + col0 * CAST
17c90 28 20 2d 20 63 6f 6c 31 20 41 53 20 53 49 47 4e  ( - col1 AS SIGN
17ca0 45 44 20 29 20 44 49 56 20 2b 20 63 6f 72 30 2e  ED ) DIV + cor0.
17cb0 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41  col1 FROM tab0 A
17cc0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32  S cor0..----..-2
17cd0 34 0d 0a 2d 33 35 0d 0a 2d 38 39 0d 0a 0d 0a 73  4..-35..-89....s
17ce0 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
17cf0 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
17d00 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
17d10 62 65 6c 2d 36 38 32 0d 0a 53 45 4c 45 43 54 20  bel-682..SELECT 
17d20 2b 20 63 6f 6c 30 20 2a 20 43 41 53 54 20 28 20  + col0 * CAST ( 
17d30 2d 20 63 6f 6c 31 20 41 53 20 49 4e 54 45 47 45  - col1 AS INTEGE
17d40 52 20 29 20 2f 20 2b 20 63 6f 72 30 2e 63 6f 6c  R ) / + cor0.col
17d50 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  1 FROM tab0 AS c
17d60 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 34 0d 0a  or0..----..-24..
17d70 2d 33 35 0d 0a 2d 38 39 0d 0a 0d 0a 71 75 65 72  -35..-89....quer
17d80 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
17d90 45 43 54 20 2b 20 63 6f 6c 32 20 2b 20 38 30 20  ECT + col2 + 80 
17da0 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
17db0 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 33 0d 0a 31 36  0..----..113..16
17dc0 32 0d 0a 38 31 0d 0a 0d 0a 71 75 65 72 79 20 49  2..81....query I
17dd0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
17de0 20 41 4c 4c 20 2b 20 63 6f 6c 32 20 2b 20 2d 20   ALL + col2 + - 
17df0 28 20 63 6f 6c 32 20 29 20 46 52 4f 4d 20 74 61  ( col2 ) FROM ta
17e00 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
17e10 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a 6f 6e 6c  ..0..0..0....onl
17e20 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20  yif mysql # use 
17e30 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72  DIV operator for
17e40 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f   integer divisio
17e50 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  n..query I rowso
17e60 72 74 20 6c 61 62 65 6c 2d 36 38 35 0d 0a 53 45  rt label-685..SE
17e70 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20  LECT DISTINCT + 
17e80 2b 20 63 6f 6c 30 20 44 49 56 20 33 34 20 46 52  + col0 DIV 34 FR
17e90 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d  OM tab2 cor0..--
17ea0 2d 2d 0d 0a 30 0d 0a 32 0d 0a 0d 0a 73 6b 69 70  --..0..2....skip
17eb0 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
17ec0 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
17ed0 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
17ee0 2d 36 38 35 0d 0a 53 45 4c 45 43 54 20 44 49 53  -685..SELECT DIS
17ef0 54 49 4e 43 54 20 2b 20 2b 20 63 6f 6c 30 20 2f  TINCT + + col0 /
17f00 20 33 34 20 46 52 4f 4d 20 74 61 62 32 20 63 6f   34 FROM tab2 co
17f10 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 32 0d 0a  r0..----..0..2..
17f20 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
17f30 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 30  t..SELECT + col0
17f40 20 2a 20 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20   * col2 AS col2 
17f50 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a  FROM tab1 cor0..
17f60 2d 2d 2d 2d 0d 0a 31 36 32 0d 0a 33 36 34 38 0d  ----..162..3648.
17f70 0a 37 36 38 30 0d 0a 0d 0a 71 75 65 72 79 20 49  .7680....query I
17f80 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
17f90 20 2d 20 2b 20 63 6f 6c 31 20 2a 20 34 33 20 46   - + col1 * 43 F
17fa0 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
17fb0 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 33 33 0d 0a 2d  ..----..-1333..-
17fc0 32 35 33 37 0d 0a 2d 37 33 31 0d 0a 0d 0a 6f 6e  2537..-731....on
17fd0 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
17fe0 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
17ff0 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
18000 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
18010 6f 72 74 20 6c 61 62 65 6c 2d 36 38 38 0d 0a 53  ort label-688..S
18020 45 4c 45 43 54 20 2d 20 63 6f 6c 30 20 2a 20 39  ELECT - col0 * 9
18030 34 20 44 49 56 20 35 38 20 46 52 4f 4d 20 74 61  4 DIV 58 FROM ta
18040 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
18050 0d 0a 2d 31 34 34 0d 0a 2d 33 38 0d 0a 2d 35 36  ..-144..-38..-56
18060 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
18070 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
18080 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
18090 72 74 20 6c 61 62 65 6c 2d 36 38 38 0d 0a 53 45  rt label-688..SE
180a0 4c 45 43 54 20 2d 20 63 6f 6c 30 20 2a 20 39 34  LECT - col0 * 94
180b0 20 2f 20 35 38 20 46 52 4f 4d 20 74 61 62 30 20   / 58 FROM tab0 
180c0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
180d0 31 34 34 0d 0a 2d 33 38 0d 0a 2d 35 36 0d 0a 0d  144..-38..-56...
180e0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
180f0 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
18100 54 20 63 6f 6c 31 20 2b 20 2b 20 38 20 2a 20 63  T col1 + + 8 * c
18110 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  ol2 AS col0 FROM
18120 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
18130 2d 2d 2d 0d 0a 32 34 37 0d 0a 32 36 37 0d 0a 33  ---..247..267..3
18140 32 31 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  21....onlyif mys
18150 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65  ql # use DIV ope
18160 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65  rator for intege
18170 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72  r division..quer
18180 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
18190 6c 2d 36 39 30 0d 0a 53 45 4c 45 43 54 20 41 4c  l-690..SELECT AL
181a0 4c 20 2d 20 2d 20 63 6f 6c 32 20 2b 20 2b 20 63  L - - col2 + + c
181b0 6f 6c 31 20 44 49 56 20 2b 20 63 6f 72 30 2e 63  ol1 DIV + cor0.c
181c0 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 63 6f  ol2 FROM tab1 co
181d0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 35 34 0d 0a 35 37  r0..----..54..57
181e0 0d 0a 39 36 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  ..96....skipif m
181f0 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
18200 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
18210 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 36 39 30  owsort label-690
18220 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 2d  ..SELECT ALL - -
18230 20 63 6f 6c 32 20 2b 20 2b 20 63 6f 6c 31 20 2f   col2 + + col1 /
18240 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 46 52 4f   + cor0.col2 FRO
18250 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab1 cor0..---
18260 2d 0d 0a 35 34 0d 0a 35 37 0d 0a 39 36 0d 0a 0d  -..54..57..96...
18270 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
18280 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51  support for MySQ
18290 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65  L specific syste
182a0 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74  m types and synt
182b0 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ax..query I rows
182c0 6f 72 74 20 6c 61 62 65 6c 2d 36 39 31 0d 0a 53  ort label-691..S
182d0 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b  ELECT DISTINCT +
182e0 20 2b 20 63 6f 6c 30 20 2a 20 2d 20 43 41 53 54   + col0 * - CAST
182f0 28 20 32 38 20 41 53 20 53 49 47 4e 45 44 20 29  ( 28 AS SIGNED )
18300 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
18310 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 37 39 32 0d  r0..----..-1792.
18320 0a 2d 32 32 34 30 0d 0a 2d 38 34 0d 0a 0d 0a 73  .-2240..-84....s
18330 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
18340 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
18350 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
18360 62 65 6c 2d 36 39 31 0d 0a 53 45 4c 45 43 54 20  bel-691..SELECT 
18370 44 49 53 54 49 4e 43 54 20 2b 20 2b 20 63 6f 6c  DISTINCT + + col
18380 30 20 2a 20 2d 20 43 41 53 54 20 28 20 32 38 20  0 * - CAST ( 28 
18390 41 53 20 49 4e 54 45 47 45 52 20 29 20 46 52 4f  AS INTEGER ) FRO
183a0 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
183b0 2d 2d 2d 2d 0d 0a 2d 31 37 39 32 0d 0a 2d 32 32  ----..-1792..-22
183c0 34 30 0d 0a 2d 38 34 0d 0a 0d 0a 71 75 65 72 79  40..-84....query
183d0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
183e0 43 54 20 44 49 53 54 49 4e 43 54 20 74 61 62 32  CT DISTINCT tab2
183f0 2e 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c 32 20 2a  .col0 * + col2 *
18400 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20   + col0 AS col2 
18410 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d  FROM tab2..----.
18420 0a 31 33 32 33 0d 0a 31 35 38 31 38 34 0d 0a 32  .1323..158184..2
18430 33 37 31 35 38 0d 0a 0d 0a 71 75 65 72 79 20 49  37158....query I
18440 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
18450 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 30 20 2a   DISTINCT col0 *
18460 20 63 6f 6c 30 20 2a 20 63 6f 72 30 2e 63 6f 6c   col0 * cor0.col
18470 30 20 46 52 4f 4d 20 74 61 62 32 20 63 6f 72 30  0 FROM tab2 cor0
18480 0d 0a 2d 2d 2d 2d 0d 0a 33 34 33 0d 0a 34 37 34  ..----..343..474
18490 35 35 32 0d 0a 34 39 33 30 33 39 0d 0a 0d 0a 71  552..493039....q
184a0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
184b0 53 45 4c 45 43 54 20 63 6f 6c 31 20 2a 20 2d 20  SELECT col1 * - 
184c0 38 37 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  87 AS col0 FROM 
184d0 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
184e0 2d 2d 0d 0a 2d 31 34 37 39 0d 0a 2d 32 36 39 37  --..-1479..-2697
184f0 0d 0a 2d 35 31 33 33 0d 0a 0d 0a 71 75 65 72 79  ..-5133....query
18500 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
18510 43 54 20 41 4c 4c 20 2d 20 33 34 20 41 53 20 63  CT ALL - 34 AS c
18520 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 2c 20 74  ol2 FROM tab0, t
18530 61 62 32 2c 20 74 61 62 32 20 41 53 20 63 6f 72  ab2, tab2 AS cor
18540 30 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75  0..----..27 valu
18550 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 35 62  es hashing to 5b
18560 38 38 33 33 31 65 34 30 64 61 34 37 39 36 63 63  88331e40da4796cc
18570 34 38 32 36 63 34 34 32 61 61 34 35 66 37 0d 0a  4826c442aa45f7..
18580 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
18590 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20  t..SELECT ALL + 
185a0 2b 20 63 6f 6c 32 20 2d 20 2d 20 63 6f 6c 31 20  + col2 - - col1 
185b0 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
185c0 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 39 0d 0a 31 37  0..----..119..17
185d0 33 0d 0a 39 38 0d 0a 0d 0a 71 75 65 72 79 20 49  3..98....query I
185e0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
185f0 20 63 6f 72 30 2e 63 6f 6c 32 20 2b 20 63 6f 6c   cor0.col2 + col
18600 31 20 2a 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61  1 * col1 FROM ta
18610 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33  b2 cor0..----..3
18620 32 37 0d 0a 33 35 30 37 0d 0a 39 38 38 0d 0a 0d  27..3507..988...
18630 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
18640 0d 0a 53 45 4c 45 43 54 20 2d 20 2d 20 63 6f 6c  ..SELECT - - col
18650 32 20 2a 20 63 6f 6c 32 20 2a 20 63 6f 6c 32 20  2 * col2 * col2 
18660 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
18670 30 0d 0a 2d 2d 2d 2d 0d 0a 31 37 35 37 36 0d 0a  0..----..17576..
18680 31 39 36 38 33 0d 0a 35 34 38 37 32 0d 0a 0d 0a  19683..54872....
18690 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75  onlyif mysql # u
186a0 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20  se DIV operator 
186b0 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69  for integer divi
186c0 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f  sion..query I ro
186d0 77 73 6f 72 74 20 6c 61 62 65 6c 2d 36 39 39 0d  wsort label-699.
186e0 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f  .SELECT ALL - co
186f0 6c 30 20 2a 20 74 61 62 30 2e 63 6f 6c 30 20 44  l0 * tab0.col0 D
18700 49 56 20 2b 20 63 6f 6c 32 20 46 52 4f 4d 20 74  IV + col2 FROM t
18710 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32 32 35  ab0..----..-1225
18720 0d 0a 2d 31 37 0d 0a 2d 39 36 0d 0a 0d 0a 73 6b  ..-17..-96....sk
18730 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
18740 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
18750 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
18760 65 6c 2d 36 39 39 0d 0a 53 45 4c 45 43 54 20 41  el-699..SELECT A
18770 4c 4c 20 2d 20 63 6f 6c 30 20 2a 20 74 61 62 30  LL - col0 * tab0
18780 2e 63 6f 6c 30 20 2f 20 2b 20 63 6f 6c 32 20 46  .col0 / + col2 F
18790 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab0..----..
187a0 2d 31 32 32 35 0d 0a 2d 31 37 0d 0a 2d 39 36 0d  -1225..-17..-96.
187b0 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
187c0 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74  # use DIV operat
187d0 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64  or for integer d
187e0 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49  ivision..query I
187f0 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 37   rowsort label-7
18800 30 30 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63  00..SELECT ALL c
18810 6f 6c 30 20 2a 20 63 6f 6c 32 20 44 49 56 20 2d  ol0 * col2 DIV -
18820 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 0d   col2 FROM tab1.
18830 0a 2d 2d 2d 2d 0d 0a 2d 33 0d 0a 2d 36 34 0d 0a  .----..-3..-64..
18840 2d 38 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  -80....skipif my
18850 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
18860 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
18870 77 73 6f 72 74 20 6c 61 62 65 6c 2d 37 30 30 0d  wsort label-700.
18880 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 30  .SELECT ALL col0
18890 20 2a 20 63 6f 6c 32 20 2f 20 2d 20 63 6f 6c 32   * col2 / - col2
188a0 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d   FROM tab1..----
188b0 0d 0a 2d 33 0d 0a 2d 36 34 0d 0a 2d 38 30 0d 0a  ..-3..-64..-80..
188c0 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65  ..skipif postgre
188d0 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c  sql # PostgreSQL
188e0 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65   requires AS whe
188f0 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75  n renaming outpu
18900 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79  t columns..query
18910 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
18920 43 54 20 41 4c 4c 20 2d 20 63 6f 72 30 2e 63 6f  CT ALL - cor0.co
18930 6c 31 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  l1 col2 FROM tab
18940 30 2c 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  0, tab2 AS cor0.
18950 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20  .----..9 values 
18960 68 61 73 68 69 6e 67 20 74 6f 20 63 63 61 61 35  hashing to ccaa5
18970 64 64 33 33 38 38 64 39 65 65 30 66 65 61 36 37  dd3388d9ee0fea67
18980 36 66 61 33 35 32 39 39 66 65 35 0d 0a 0d 0a 6f  6fa35299fe5....o
18990 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73  nlyif mysql # us
189a0 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66  e DIV operator f
189b0 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73  or integer divis
189c0 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ion..query I row
189d0 73 6f 72 74 20 6c 61 62 65 6c 2d 37 30 32 0d 0a  sort label-702..
189e0 53 45 4c 45 43 54 20 2b 20 33 30 20 2a 20 63 6f  SELECT + 30 * co
189f0 6c 30 20 2a 20 63 6f 6c 31 20 2b 20 63 6f 6c 31  l0 * col1 + col1
18a00 20 44 49 56 20 2d 20 63 6f 6c 30 20 46 52 4f 4d   DIV - col0 FROM
18a10 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
18a20 2d 2d 2d 0d 0a 31 30 31 38 34 38 0d 0a 32 34 32  ---..101848..242
18a30 39 36 39 0d 0a 36 31 39 31 37 0d 0a 0d 0a 73 6b  969..61917....sk
18a40 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
18a50 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
18a60 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
18a70 65 6c 2d 37 30 32 0d 0a 53 45 4c 45 43 54 20 2b  el-702..SELECT +
18a80 20 33 30 20 2a 20 63 6f 6c 30 20 2a 20 63 6f 6c   30 * col0 * col
18a90 31 20 2b 20 63 6f 6c 31 20 2f 20 2d 20 63 6f 6c  1 + col1 / - col
18aa0 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  0 FROM tab0 AS c
18ab0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 31 38 34  or0..----..10184
18ac0 38 0d 0a 32 34 32 39 36 39 0d 0a 36 31 39 31 37  8..242969..61917
18ad0 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
18ae0 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61   # use DIV opera
18af0 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20  tor for integer 
18b00 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20  division..query 
18b10 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
18b20 37 30 33 0d 0a 53 45 4c 45 43 54 20 2d 20 32 39  703..SELECT - 29
18b30 20 44 49 56 20 63 6f 6c 32 20 2b 20 63 6f 6c 32   DIV col2 + col2
18b40 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
18b50 72 30 0d 0a 2d 2d 2d 2d 0d 0a 35 34 0d 0a 35 37  r0..----..54..57
18b60 0d 0a 39 36 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  ..96....skipif m
18b70 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
18b80 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
18b90 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 37 30 33  owsort label-703
18ba0 0d 0a 53 45 4c 45 43 54 20 2d 20 32 39 20 2f 20  ..SELECT - 29 / 
18bb0 63 6f 6c 32 20 2b 20 63 6f 6c 32 20 46 52 4f 4d  col2 + col2 FROM
18bc0 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
18bd0 2d 2d 2d 0d 0a 35 34 0d 0a 35 37 0d 0a 39 36 0d  ---..54..57..96.
18be0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
18bf0 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 30 20  rt..SELECT col0 
18c00 2a 20 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c 32 20  * col0 + - col2 
18c10 2a 20 63 6f 6c 31 20 2a 20 63 6f 6c 32 20 46 52  * col1 * col2 FR
18c20 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
18c30 0a 2d 2d 2d 2d 0d 0a 2d 36 30 33 39 36 33 0d 0a  .----..-603963..
18c40 2d 39 33 30 37 38 0d 0a 31 31 32 38 0d 0a 0d 0a  -93078..1128....
18c50 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
18c60 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
18c70 20 2d 20 28 20 2b 20 63 6f 6c 32 20 29 20 2b 20   - ( + col2 ) + 
18c80 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 63  col1 FROM tab1 c
18c90 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 38 0d 0a  or0..----..-28..
18ca0 2d 34 37 0d 0a 2d 38 33 0d 0a 0d 0a 71 75 65 72  -47..-83....quer
18cb0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
18cc0 45 43 54 20 2d 20 38 31 20 2b 20 63 6f 6c 31 20  ECT - 81 + col1 
18cd0 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
18ce0 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 0d 0a 31 36 0d  0..----..10..16.
18cf0 0a 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  .5....query I ro
18d00 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
18d10 4c 20 2b 20 63 6f 6c 32 20 2b 20 63 6f 6c 31 20  L + col2 + col1 
18d20 2a 20 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46  * col0 AS col1 F
18d30 52 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d  ROM tab2 cor0..-
18d40 2d 2d 2d 0d 0a 31 33 38 31 0d 0a 32 34 34 0d 0a  ---..1381..244..
18d50 34 36 32 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20  4628....query I 
18d60 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
18d70 2d 20 2b 20 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c  - + col0 * + col
18d80 30 20 2a 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20  0 * + col0 FROM 
18d90 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab0 cor0..----.
18da0 0a 2d 31 33 38 32 34 0d 0a 2d 34 32 38 37 35 0d  .-13824..-42875.
18db0 0a 2d 37 30 34 39 36 39 0d 0a 0d 0a 71 75 65 72  .-704969....quer
18dc0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
18dd0 45 43 54 20 63 6f 6c 30 20 2a 20 63 6f 6c 30 20  ECT col0 * col0 
18de0 2b 20 2d 20 63 6f 6c 31 20 2a 20 63 6f 6c 32 20  + - col1 * col2 
18df0 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
18e00 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 32 36 32 0d 0a  0..----..-2262..
18e10 31 31 32 38 0d 0a 34 35 39 0d 0a 0d 0a 71 75 65  1128..459....que
18e20 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
18e30 4c 45 43 54 20 2d 20 38 35 20 2a 20 2b 20 63 6f  LECT - 85 * + co
18e40 72 30 2e 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  r0.col1 FROM tab
18e50 32 2c 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  2, tab0 AS cor0.
18e60 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20  .----..9 values 
18e70 68 61 73 68 69 6e 67 20 74 6f 20 61 35 64 31 36  hashing to a5d16
18e80 35 34 32 37 66 64 31 36 37 37 62 30 30 62 33 65  5427fd1677b00b3e
18e90 39 39 65 31 66 35 62 61 35 64 62 0d 0a 0d 0a 73  99e1f5ba5db....s
18ea0 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c  kipif postgresql
18eb0 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65   # PostgreSQL re
18ec0 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72  quires AS when r
18ed0 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63  enaming output c
18ee0 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20  olumns..query I 
18ef0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
18f00 36 20 2b 20 63 6f 6c 32 20 63 6f 6c 32 20 46 52  6 + col2 col2 FR
18f10 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31  OM tab1..----..1
18f20 30 32 0d 0a 36 30 0d 0a 36 33 0d 0a 0d 0a 71 75  02..60..63....qu
18f30 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
18f40 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 63  ELECT DISTINCT c
18f50 6f 6c 30 20 2a 20 2d 20 63 6f 6c 32 20 2a 20 63  ol0 * - col2 * c
18f60 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  ol2 AS col0 FROM
18f70 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
18f80 2d 2d 2d 0d 0a 2d 32 36 31 33 36 0d 0a 2d 33 35  ---..-26136..-35
18f90 0d 0a 2d 35 39 38 34 33 36 0d 0a 0d 0a 71 75 65  ..-598436....que
18fa0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
18fb0 4c 45 43 54 20 41 4c 4c 20 2d 20 32 38 20 2a 20  LECT ALL - 28 * 
18fc0 2b 20 63 6f 6c 32 20 2b 20 63 6f 6c 30 20 46 52  + col2 + col0 FR
18fd0 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
18fe0 0a 2d 2d 2d 2d 0d 0a 2d 36 35 30 0d 0a 2d 37 34  .----..-650..-74
18ff0 39 0d 0a 2d 39 38 35 0d 0a 0d 0a 71 75 65 72 79  9..-985....query
19000 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
19010 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f  CT DISTINCT - co
19020 6c 32 20 2d 20 2b 20 63 6f 72 30 2e 63 6f 6c 30  l2 - + cor0.col0
19030 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
19040 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  b1 cor0..----..-
19050 31 32 31 0d 0a 2d 31 37 36 0d 0a 2d 35 37 0d 0a  121..-176..-57..
19060 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
19070 74 0d 0a 53 45 4c 45 43 54 20 2b 20 35 31 20 2b  t..SELECT + 51 +
19080 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 46 52 4f   - cor0.col2 FRO
19090 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab0 cor0..---
190a0 2d 0d 0a 2d 33 31 0d 0a 31 38 0d 0a 35 30 0d 0a  -..-31..18..50..
190b0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
190c0 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
190d0 43 54 20 2b 20 63 6f 6c 30 20 2d 20 2d 20 63 6f  CT + col0 - - co
190e0 6c 31 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  l1 AS col1 FROM 
190f0 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
19100 2d 2d 0d 0a 31 31 30 0d 0a 31 33 32 0d 0a 31 38  --..110..132..18
19110 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  0....query I row
19120 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2d  sort..SELECT - -
19130 20 63 6f 6c 31 20 2a 20 63 6f 6c 31 20 2b 20 2b   col1 * col1 + +
19140 20 63 6f 6c 32 20 2a 20 63 6f 6c 30 20 41 53 20   col2 * col0 AS 
19150 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41  col1 FROM tab1 A
19160 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 37  S cor0..----..37
19170 34 38 0d 0a 37 38 34 39 0d 0a 38 33 38 0d 0a 0d  48..7849..838...
19180 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
19190 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 32 20 2a 20  ..SELECT col2 * 
191a0 2d 20 63 6f 6c 32 20 2a 20 63 6f 6c 31 20 2b 20  - col2 * col1 + 
191b0 2b 20 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c 31 20  + col2 * - col1 
191c0 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
191d0 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
191e0 0a 2d 32 33 34 33 36 0d 0a 2d 32 35 31 39 34 0d  .-23436..-25194.
191f0 0a 2d 34 31 34 31 38 0d 0a 0d 0a 6f 6e 6c 79 69  .-41418....onlyi
19200 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49  f mysql # use DI
19210 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69  V operator for i
19220 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d  nteger division.
19230 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
19240 20 6c 61 62 65 6c 2d 37 31 39 0d 0a 53 45 4c 45   label-719..SELE
19250 43 54 20 41 4c 4c 20 2d 20 36 32 20 44 49 56 20  CT ALL - 62 DIV 
19260 2b 20 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46  + col2 AS col0 F
19270 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab1..----..
19280 2d 31 0d 0a 2d 31 0d 0a 30 0d 0a 0d 0a 73 6b 69  -1..-1..0....ski
19290 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
192a0 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
192b0 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
192c0 6c 2d 37 31 39 0d 0a 53 45 4c 45 43 54 20 41 4c  l-719..SELECT AL
192d0 4c 20 2d 20 36 32 20 2f 20 2b 20 63 6f 6c 32 20  L - 62 / + col2 
192e0 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
192f0 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 2d 31 0d  1..----..-1..-1.
19300 0a 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  .0....query I ro
19310 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
19320 38 31 20 2d 20 2d 20 28 20 2b 20 74 61 62 31 2e  81 - - ( + tab1.
19330 63 6f 6c 30 20 29 20 41 53 20 63 6f 6c 32 20 46  col0 ) AS col2 F
19340 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab1..----..
19350 2d 31 0d 0a 2d 31 37 0d 0a 2d 37 38 0d 0a 0d 0a  -1..-17..-78....
19360 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
19370 0a 53 45 4c 45 43 54 20 38 30 20 2d 20 2d 20 63  .SELECT 80 - - c
19380 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d  ol1 FROM tab2..-
19390 2d 2d 2d 0d 0a 31 31 31 0d 0a 31 33 39 0d 0a 39  ---..111..139..9
193a0 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  7....query I row
193b0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63  sort..SELECT + c
193c0 6f 6c 31 20 2b 20 2b 20 63 6f 6c 32 20 2a 20 2b  ol1 + + col2 * +
193d0 20 63 6f 6c 31 20 2b 20 63 6f 6c 30 20 2a 20 63   col1 + col0 * c
193e0 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol1 FROM tab1 AS
193f0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 32   cor0..----..122
19400 30 0d 0a 31 35 30 38 0d 0a 32 33 30 31 0d 0a 0d  0..1508..2301...
19410 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
19420 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 31 20 2a 20  ..SELECT col1 * 
19430 63 6f 6c 31 20 2a 20 28 20 2b 20 39 33 20 29 20  col1 * ( + 93 ) 
19440 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
19450 30 0d 0a 2d 2d 2d 2d 0d 0a 32 36 38 37 37 0d 0a  0..----..26877..
19460 33 32 33 37 33 33 0d 0a 38 39 33 37 33 0d 0a 0d  323733..89373...
19470 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
19480 0d 0a 53 45 4c 45 43 54 20 2d 20 2b 20 32 34 20  ..SELECT - + 24 
19490 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
194a0 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32  0 cor0..----..-2
194b0 34 0d 0a 2d 32 34 0d 0a 2d 32 34 0d 0a 0d 0a 71  4..-24..-24....q
194c0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
194d0 53 45 4c 45 43 54 20 41 4c 4c 20 38 32 20 2a 20  SELECT ALL 82 * 
194e0 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41  col2 FROM tab2 A
194f0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 31  S cor0..----..21
19500 33 32 0d 0a 32 32 31 34 0d 0a 33 31 31 36 0d 0a  32..2214..3116..
19510 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65  ..skipif postgre
19520 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c  sql # PostgreSQL
19530 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65   requires AS whe
19540 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75  n renaming outpu
19550 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79  t columns..query
19560 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
19570 43 54 20 41 4c 4c 20 63 6f 6c 30 20 2a 20 63 6f  CT ALL col0 * co
19580 6c 32 20 2b 20 2b 20 63 6f 6c 30 20 63 6f 6c 31  l2 + + col0 col1
19590 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
195a0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 37 30 0d 0a 37 33  r0..----..70..73
195b0 38 37 0d 0a 38 31 36 0d 0a 0d 0a 71 75 65 72 79  87..816....query
195c0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
195d0 43 54 20 41 4c 4c 20 2b 20 31 30 20 2a 20 63 6f  CT ALL + 10 * co
195e0 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l2 FROM tab0 AS 
195f0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 0d 0a  cor0..----..10..
19600 33 33 30 0d 0a 38 32 30 0d 0a 0d 0a 71 75 65 72  330..820....quer
19610 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
19620 45 43 54 20 2d 20 2b 20 38 33 20 46 52 4f 4d 20  ECT - + 83 FROM 
19630 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab0 cor0..----.
19640 0a 2d 38 33 0d 0a 2d 38 33 0d 0a 2d 38 33 0d 0a  .-83..-83..-83..
19650 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
19660 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
19670 43 54 20 2d 20 2d 20 39 32 20 46 52 4f 4d 20 74  CT - - 92 FROM t
19680 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab1 cor0..----..
19690 39 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  92....query I ro
196a0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
196b0 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c 31 20 2a 20  col0 + - col1 * 
196c0 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 41 53 20 63  + cor0.col0 AS c
196d0 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol1 FROM tab2 AS
196e0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32   cor0..----..-12
196f0 36 34 0d 0a 2d 32 31 30 0d 0a 2d 34 35 32 34 0d  64..-210..-4524.
19700 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
19710 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 31 37 20  rt..SELECT - 17 
19720 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
19730 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
19740 0a 2d 31 37 0d 0a 2d 31 37 0d 0a 2d 31 37 0d 0a  .-17..-17..-17..
19750 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
19760 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2d 20 34 20  t..SELECT - - 4 
19770 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
19780 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
19790 0a 34 0d 0a 34 0d 0a 34 0d 0a 0d 0a 71 75 65 72  .4..4..4....quer
197a0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
197b0 45 43 54 20 2d 20 2b 20 37 37 20 2a 20 63 6f 6c  ECT - + 77 * col
197c0 31 20 2a 20 2b 20 33 20 46 52 4f 4d 20 74 61 62  1 * + 3 FROM tab
197d0 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
197e0 0a 2d 31 33 36 32 39 0d 0a 2d 33 39 32 37 0d 0a  .-13629..-3927..
197f0 2d 37 31 36 31 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  -7161....onlyif 
19800 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20  mysql # support 
19810 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66  for MySQL specif
19820 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20  ic system types 
19830 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72  and syntax..quer
19840 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
19850 6c 2d 37 33 34 0d 0a 53 45 4c 45 43 54 20 63 6f  l-734..SELECT co
19860 6c 31 20 2b 20 2d 20 43 41 53 54 28 20 2b 20 37  l1 + - CAST( + 7
19870 30 20 41 53 20 53 49 47 4e 45 44 20 29 20 2a 20  0 AS SIGNED ) * 
19880 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41  col1 FROM tab2 A
19890 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
198a0 31 37 33 0d 0a 2d 32 31 33 39 0d 0a 2d 34 30 37  173..-2139..-407
198b0 31 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  1....skipif mysq
198c0 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
198d0 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
198e0 6f 72 74 20 6c 61 62 65 6c 2d 37 33 34 0d 0a 53  ort label-734..S
198f0 45 4c 45 43 54 20 63 6f 6c 31 20 2b 20 2d 20 43  ELECT col1 + - C
19900 41 53 54 20 28 20 2b 20 37 30 20 41 53 20 49 4e  AST ( + 70 AS IN
19910 54 45 47 45 52 20 29 20 2a 20 63 6f 6c 31 20 46  TEGER ) * col1 F
19920 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
19930 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 37 33 0d 0a 2d  ..----..-1173..-
19940 32 31 33 39 0d 0a 2d 34 30 37 31 0d 0a 0d 0a 71  2139..-4071....q
19950 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
19960 53 45 4c 45 43 54 20 2b 20 63 6f 72 30 2e 63 6f  SELECT + cor0.co
19970 6c 32 20 2a 20 63 6f 6c 31 20 2a 20 38 38 20 2d  l2 * col1 * 88 -
19980 20 2d 20 63 6f 72 30 2e 63 6f 6c 31 20 2a 20 2d   - cor0.col1 * -
19990 20 63 6f 6c 32 20 2a 20 39 38 20 46 52 4f 4d 20   col2 * 98 FROM 
199a0 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
199b0 2d 2d 0d 0a 2d 31 32 34 38 30 0d 0a 2d 31 34 30  --..-12480..-140
199c0 34 30 0d 0a 2d 35 37 30 30 0d 0a 0d 0a 73 6b 69  40..-5700....ski
199d0 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23  pif postgresql #
199e0 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75   PostgreSQL requ
199f0 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e  ires AS when ren
19a00 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c  aming output col
19a10 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f  umns..query I ro
19a20 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
19a30 63 6f 6c 32 20 2b 20 2d 20 63 6f 6c 30 20 63 6f  col2 + - col0 co
19a40 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l1 FROM tab1 AS 
19a50 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32 31  cor0..----..-121
19a60 0d 0a 2d 31 37 36 0d 0a 2d 35 37 0d 0a 0d 0a 71  ..-176..-57....q
19a70 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
19a80 53 45 4c 45 43 54 20 2d 20 2d 20 63 6f 6c 32 20  SELECT - - col2 
19a90 2b 20 2d 20 36 33 20 46 52 4f 4d 20 74 61 62 31  + - 63 FROM tab1
19aa0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
19ab0 2d 36 0d 0a 2d 39 0d 0a 33 33 0d 0a 0d 0a 71 75  -6..-9..33....qu
19ac0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
19ad0 45 4c 45 43 54 20 2b 20 63 6f 6c 32 20 2a 20 2d  ELECT + col2 * -
19ae0 20 36 33 20 2d 20 2b 20 63 6f 72 30 2e 63 6f 6c   63 - + cor0.col
19af0 30 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  0 AS col0 FROM t
19b00 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
19b10 2d 0d 0a 2d 31 37 30 38 0d 0a 2d 31 37 31 36 0d  -..-1708..-1716.
19b20 0a 2d 32 34 37 33 0d 0a 0d 0a 71 75 65 72 79 20  .-2473....query 
19b30 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
19b40 54 20 63 6f 6c 31 20 2b 20 2b 20 38 33 20 46 52  T col1 + + 83 FR
19b50 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
19b60 0a 2d 2d 2d 2d 0d 0a 31 30 39 0d 0a 39 33 0d 0a  .----..109..93..
19b70 39 36 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73  96....skipif pos
19b80 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72  tgresql # Postgr
19b90 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53  eSQL requires AS
19ba0 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f   when renaming o
19bb0 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71  utput columns..q
19bc0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
19bd0 53 45 4c 45 43 54 20 63 6f 6c 30 20 2a 20 2b 20  SELECT col0 * + 
19be0 36 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31  6 col2 FROM tab1
19bf0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
19c00 31 38 0d 0a 33 38 34 0d 0a 34 38 30 0d 0a 0d 0a  18..384..480....
19c10 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75  onlyif mysql # u
19c20 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20  se DIV operator 
19c30 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69  for integer divi
19c40 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f  sion..query I ro
19c50 77 73 6f 72 74 20 6c 61 62 65 6c 2d 37 34 31 0d  wsort label-741.
19c60 0a 53 45 4c 45 43 54 20 2b 20 2d 20 63 6f 6c 30  .SELECT + - col0
19c70 20 44 49 56 20 2d 20 63 6f 6c 32 20 41 53 20 63   DIV - col2 AS c
19c80 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol1 FROM tab1 AS
19c90 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a   cor0..----..0..
19ca0 30 0d 0a 31 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  0..1....skipif m
19cb0 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
19cc0 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
19cd0 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 37 34 31  owsort label-741
19ce0 0d 0a 53 45 4c 45 43 54 20 2b 20 2d 20 63 6f 6c  ..SELECT + - col
19cf0 30 20 2f 20 2d 20 63 6f 6c 32 20 41 53 20 63 6f  0 / - col2 AS co
19d00 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l1 FROM tab1 AS 
19d10 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30  cor0..----..0..0
19d20 0d 0a 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  ..1....query I r
19d30 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
19d40 49 53 54 49 4e 43 54 20 33 39 20 2b 20 63 6f 72  ISTINCT 39 + cor
19d50 30 2e 63 6f 6c 30 20 2a 20 38 37 20 41 53 20 63  0.col0 * 87 AS c
19d60 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol1 FROM tab2 AS
19d70 20 63 6f 72 30 20 43 52 4f 53 53 20 4a 4f 49 4e   cor0 CROSS JOIN
19d80 20 74 61 62 31 20 41 53 20 63 6f 72 31 0d 0a 2d   tab1 AS cor1..-
19d90 2d 2d 2d 0d 0a 36 34 38 0d 0a 36 38 32 35 0d 0a  ---..648..6825..
19da0 36 39 31 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20  6912....query I 
19db0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
19dc0 41 4c 4c 20 2b 20 2b 20 63 6f 6c 31 20 2a 20 63  ALL + + col1 * c
19dd0 6f 6c 30 20 2b 20 2b 20 63 6f 6c 32 20 2a 20 2d  ol0 + + col2 * -
19de0 20 28 20 2b 20 63 6f 6c 32 20 29 20 2d 20 63 6f   ( + col2 ) - co
19df0 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72  l1 FROM tab1 cor
19e00 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 36 31 39 0d 0a  0..----..-2619..
19e10 2d 32 38 36 34 0d 0a 2d 38 31 38 39 0d 0a 0d 0a  -2864..-8189....
19e20 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
19e30 0a 53 45 4c 45 43 54 20 41 4c 4c 20 28 20 2d 20  .SELECT ALL ( - 
19e40 39 20 29 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20  9 ) + col0 FROM 
19e50 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
19e60 2d 2d 0d 0a 2d 36 0d 0a 35 35 0d 0a 37 31 0d 0a  --..-6..55..71..
19e70 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
19e80 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 33 37  t..SELECT ALL 37
19e90 20 2a 20 2d 20 28 20 2b 20 63 6f 6c 31 20 29 20   * - ( + col1 ) 
19ea0 2b 20 38 30 20 46 52 4f 4d 20 74 61 62 31 20 41  + 80 FROM tab1 A
19eb0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32  S cor0..----..-2
19ec0 39 30 0d 0a 2d 34 30 31 0d 0a 2d 38 38 32 0d 0a  90..-401..-882..
19ed0 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
19ee0 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f   use DIV operato
19ef0 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69  r for integer di
19f00 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20  vision..query I 
19f10 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 37 34  rowsort label-74
19f20 36 0d 0a 53 45 4c 45 43 54 20 63 6f 72 30 2e 63  6..SELECT cor0.c
19f30 6f 6c 30 20 2b 20 63 6f 6c 32 20 2b 20 2d 20 63  ol0 + col2 + - c
19f40 6f 6c 30 20 44 49 56 20 33 35 20 41 53 20 63 6f  ol0 DIV 35 AS co
19f50 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l0 FROM tab0 AS 
19f60 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 36 39 0d  cor0..----..169.
19f70 0a 33 35 0d 0a 35 37 0d 0a 0d 0a 73 6b 69 70 69  .35..57....skipi
19f80 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
19f90 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
19fa0 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
19fb0 37 34 36 0d 0a 53 45 4c 45 43 54 20 63 6f 72 30  746..SELECT cor0
19fc0 2e 63 6f 6c 30 20 2b 20 63 6f 6c 32 20 2b 20 2d  .col0 + col2 + -
19fd0 20 63 6f 6c 30 20 2f 20 33 35 20 41 53 20 63 6f   col0 / 35 AS co
19fe0 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l0 FROM tab0 AS 
19ff0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 36 39 0d  cor0..----..169.
1a000 0a 33 35 0d 0a 35 37 0d 0a 0d 0a 71 75 65 72 79  .35..57....query
1a010 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
1a020 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 30 20  CT DISTINCT + 0 
1a030 2a 20 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c 30 20  * col1 * + col0 
1a040 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
1a050 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
1a060 0a 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  .0....onlyif mys
1a070 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72  ql # support for
1a080 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63 20   MySQL specific 
1a090 73 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64  system types and
1a0a0 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49   syntax..query I
1a0b0 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 37   rowsort label-7
1a0c0 34 38 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  48..SELECT DISTI
1a0d0 4e 43 54 20 2d 20 43 41 53 54 28 20 4e 55 4c 4c  NCT - CAST( NULL
1a0e0 20 41 53 20 53 49 47 4e 45 44 20 29 20 2a 20 28   AS SIGNED ) * (
1a0f0 20 2d 20 63 6f 6c 32 20 2a 20 63 6f 6c 30 20 29   - col2 * col0 )
1a100 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
1a110 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
1a120 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66  ..NULL....skipif
1a130 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
1a140 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
1a150 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 37   rowsort label-7
1a160 34 38 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  48..SELECT DISTI
1a170 4e 43 54 20 2d 20 43 41 53 54 20 28 20 4e 55 4c  NCT - CAST ( NUL
1a180 4c 20 41 53 20 49 4e 54 45 47 45 52 20 29 20 2a  L AS INTEGER ) *
1a190 20 28 20 2d 20 63 6f 6c 32 20 2a 20 63 6f 6c 30   ( - col2 * col0
1a1a0 20 29 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20   ) AS col1 FROM 
1a1b0 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
1a1c0 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75 65 72  --..NULL....quer
1a1d0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
1a1e0 45 43 54 20 2b 20 63 6f 6c 31 20 2b 20 35 32 20  ECT + col1 + 52 
1a1f0 2a 20 2b 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61  * + col2 FROM ta
1a200 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 34 31 31 0d 0a  b2..----..1411..
1a210 31 34 33 35 0d 0a 31 39 39 33 0d 0a 0d 0a 71 75  1435..1993....qu
1a220 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
1a230 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b  ELECT DISTINCT +
1a240 20 2b 20 28 20 63 6f 6c 31 20 29 20 2b 20 63 6f   + ( col1 ) + co
1a250 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l1 FROM tab2 AS 
1a260 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 38 0d  cor0..----..118.
1a270 0a 33 34 0d 0a 36 32 0d 0a 0d 0a 71 75 65 72 79  .34..62....query
1a280 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
1a290 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 37 39  CT DISTINCT - 79
1a2a0 20 2b 20 33 35 20 46 52 4f 4d 20 74 61 62 30 20   + 35 FROM tab0 
1a2b0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
1a2c0 34 34 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73  44....skipif pos
1a2d0 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72  tgresql # Postgr
1a2e0 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53  eSQL requires AS
1a2f0 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f   when renaming o
1a300 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71  utput columns..q
1a310 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
1a320 53 45 4c 45 43 54 20 2b 20 63 6f 72 31 2e 63 6f  SELECT + cor1.co
1a330 6c 30 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  l0 col0 FROM tab
1a340 30 2c 20 74 61 62 32 20 41 53 20 63 6f 72 30 2c  0, tab2 AS cor0,
1a350 20 74 61 62 30 20 41 53 20 63 6f 72 31 0d 0a 2d   tab0 AS cor1..-
1a360 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75 65 73 20 68  ---..27 values h
1a370 61 73 68 69 6e 67 20 74 6f 20 39 66 63 31 64 63  ashing to 9fc1dc
1a380 64 37 36 66 65 61 66 34 33 65 35 63 35 64 63 30  d76feaf43e5c5dc0
1a390 36 30 61 30 32 30 31 34 63 64 0d 0a 0d 0a 71 75  60a02014cd....qu
1a3a0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
1a3b0 45 4c 45 43 54 20 2d 20 2d 20 63 6f 6c 32 20 2b  ELECT - - col2 +
1a3c0 20 2d 20 28 20 63 6f 6c 31 20 2a 20 63 6f 72 30   - ( col1 * cor0
1a3d0 2e 63 6f 6c 30 20 2b 20 63 6f 6c 31 20 2a 20 63  .col0 + col1 * c
1a3e0 6f 6c 30 20 29 20 46 52 4f 4d 20 74 61 62 30 20  ol0 ) FROM tab0 
1a3f0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
1a400 31 36 31 31 36 0d 0a 2d 34 30 39 35 0d 0a 2d 36  16116..-4095..-6
1a410 37 38 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  789....query I r
1a420 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
1a430 4c 4c 20 28 20 63 6f 6c 30 20 29 20 2b 20 2d 20  LL ( col0 ) + - 
1a440 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46 52 4f  col1 AS col1 FRO
1a450 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
1a460 2d 2d 2d 2d 0d 0a 2d 32 33 0d 0a 35 34 0d 0a 36  ----..-23..54..6
1a470 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  7....query I row
1a480 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
1a490 54 49 4e 43 54 20 2b 20 34 32 20 46 52 4f 4d 20  TINCT + 42 FROM 
1a4a0 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
1a4b0 2d 2d 0d 0a 34 32 0d 0a 0d 0a 71 75 65 72 79 20  --..42....query 
1a4c0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
1a4d0 54 20 2b 20 37 30 20 2d 20 2b 20 63 6f 6c 31 20  T + 70 - + col1 
1a4e0 2a 20 2b 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61  * + col2 FROM ta
1a4f0 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
1a500 0d 0a 2d 31 34 36 34 0d 0a 2d 35 37 36 0d 0a 2d  ..-1464..-576..-
1a510 37 36 37 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  767....skipif my
1a520 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
1a530 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
1a540 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
1a550 4c 20 28 20 2d 20 31 34 20 29 20 2a 20 63 6f 6c  L ( - 14 ) * col
1a560 32 20 2a 20 43 41 53 54 20 28 20 2d 20 39 38 20  2 * CAST ( - 98 
1a570 41 53 20 52 45 41 4c 20 29 20 41 53 20 63 6f 6c  AS REAL ) AS col
1a580 30 20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30  0 FROM tab1 cor0
1a590 0d 0a 2d 2d 2d 2d 0d 0a 31 33 31 37 31 32 0d 0a  ..----..131712..
1a5a0 37 34 30 38 38 0d 0a 37 38 32 30 34 0d 0a 0d 0a  74088..78204....
1a5b0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
1a5c0 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
1a5d0 20 2b 20 28 20 33 33 20 29 20 2b 20 2d 20 63 6f   + ( 33 ) + - co
1a5e0 6c 31 20 2a 20 28 20 2d 20 63 6f 6c 32 20 29 20  l1 * ( - col2 ) 
1a5f0 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d  FROM tab2..----.
1a600 0a 31 35 36 37 0d 0a 36 37 39 0d 0a 38 37 30 0d  .1567..679..870.
1a610 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
1a620 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74  # use DIV operat
1a630 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64  or for integer d
1a640 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49  ivision..query I
1a650 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 37   rowsort label-7
1a660 35 39 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d  59..SELECT ALL -
1a670 20 28 20 2d 20 63 6f 6c 31 20 29 20 44 49 56 20   ( - col1 ) DIV 
1a680 37 35 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  75 FROM tab1 AS 
1a690 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30  cor0..----..0..0
1a6a0 0d 0a 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  ..0....skipif my
1a6b0 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
1a6c0 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
1a6d0 77 73 6f 72 74 20 6c 61 62 65 6c 2d 37 35 39 0d  wsort label-759.
1a6e0 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 28 20  .SELECT ALL - ( 
1a6f0 2d 20 63 6f 6c 31 20 29 20 2f 20 37 35 20 46 52  - col1 ) / 75 FR
1a700 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
1a710 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a  .----..0..0..0..
1a720 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65  ..skipif postgre
1a730 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c  sql # PostgreSQL
1a740 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65   requires AS whe
1a750 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75  n renaming outpu
1a760 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79  t columns..query
1a770 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
1a780 43 54 20 34 30 20 63 6f 6c 31 20 46 52 4f 4d 20  CT 40 col1 FROM 
1a790 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab2 cor0..----.
1a7a0 0a 34 30 0d 0a 34 30 0d 0a 34 30 0d 0a 0d 0a 6f  .40..40..40....o
1a7b0 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75  nlyif mysql # su
1a7c0 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20  pport for MySQL 
1a7d0 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20  specific system 
1a7e0 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78  types and syntax
1a7f0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1a800 74 20 6c 61 62 65 6c 2d 37 36 31 0d 0a 53 45 4c  t label-761..SEL
1a810 45 43 54 20 43 41 53 54 28 20 4e 55 4c 4c 20 41  ECT CAST( NULL A
1a820 53 20 53 49 47 4e 45 44 20 29 20 2b 20 37 20 63  S SIGNED ) + 7 c
1a830 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d  ol2 FROM tab2..-
1a840 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d  ---..NULL..NULL.
1a850 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20  .NULL....skipif 
1a860 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73  postgresql # Pos
1a870 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73  tgreSQL requires
1a880 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e   AS when renamin
1a890 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73  g output columns
1a8a0 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
1a8b0 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
1a8c0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1a8d0 20 6c 61 62 65 6c 2d 37 36 31 0d 0a 53 45 4c 45   label-761..SELE
1a8e0 43 54 20 43 41 53 54 20 28 20 4e 55 4c 4c 20 41  CT CAST ( NULL A
1a8f0 53 20 49 4e 54 45 47 45 52 20 29 20 2b 20 37 20  S INTEGER ) + 7 
1a900 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 0d 0a  col2 FROM tab2..
1a910 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c  ----..NULL..NULL
1a920 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 6f 6e 6c 79 69 66  ..NULL....onlyif
1a930 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74   mysql # support
1a940 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69   for MySQL speci
1a950 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73  fic system types
1a960 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65   and syntax..que
1a970 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
1a980 65 6c 2d 37 36 32 0d 0a 53 45 4c 45 43 54 20 41  el-762..SELECT A
1a990 4c 4c 20 63 6f 6c 31 20 2b 20 43 41 53 54 28 20  LL col1 + CAST( 
1a9a0 4e 55 4c 4c 20 41 53 20 53 49 47 4e 45 44 20 29  NULL AS SIGNED )
1a9b0 20 2a 20 36 38 20 2a 20 2d 20 63 6f 72 30 2e 63   * 68 * - cor0.c
1a9c0 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol1 FROM tab0 AS
1a9d0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c   cor0..----..NUL
1a9e0 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d  L..NULL..NULL...
1a9f0 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
1aa00 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
1aa10 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
1aa20 6c 61 62 65 6c 2d 37 36 32 0d 0a 53 45 4c 45 43  label-762..SELEC
1aa30 54 20 41 4c 4c 20 63 6f 6c 31 20 2b 20 43 41 53  T ALL col1 + CAS
1aa40 54 20 28 20 4e 55 4c 4c 20 41 53 20 49 4e 54 45  T ( NULL AS INTE
1aa50 47 45 52 20 29 20 2a 20 36 38 20 2a 20 2d 20 63  GER ) * 68 * - c
1aa60 6f 72 30 2e 63 6f 6c 31 20 46 52 4f 4d 20 74 61  or0.col1 FROM ta
1aa70 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
1aa80 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55  ..NULL..NULL..NU
1aa90 4c 4c 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  LL....query I ro
1aaa0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
1aab0 53 54 49 4e 43 54 20 36 35 20 41 53 20 63 6f 6c  STINCT 65 AS col
1aac0 32 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d  2 FROM tab2..---
1aad0 2d 0d 0a 36 35 0d 0a 0d 0a 73 6b 69 70 69 66 20  -..65....skipif 
1aae0 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73  postgresql # Pos
1aaf0 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73  tgreSQL requires
1ab00 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e   AS when renamin
1ab10 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73  g output columns
1ab20 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1ab30 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2b 20 63 6f  t..SELECT - + co
1ab40 72 30 2e 63 6f 6c 30 20 2a 20 63 6f 6c 31 20 2a  r0.col0 * col1 *
1ab50 20 2b 20 32 31 20 2b 20 2b 20 63 6f 6c 31 20 63   + 21 + + col1 c
1ab60 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol1 FROM tab0 AS
1ab70 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 36   cor0..----..-16
1ab80 39 39 38 38 0d 0a 2d 34 33 32 35 38 0d 0a 2d 37  9988..-43258..-7
1ab90 31 31 39 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20  1198....query I 
1aba0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
1abb0 44 49 53 54 49 4e 43 54 20 63 6f 6c 31 20 2a 20  DISTINCT col1 * 
1abc0 37 38 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  78 FROM tab0 AS 
1abd0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 36 37 30 38  cor0..----..6708
1abe0 0d 0a 37 30 39 38 0d 0a 37 35 36 36 0d 0a 0d 0a  ..7098..7566....
1abf0 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75  onlyif mysql # u
1ac00 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20  se DIV operator 
1ac10 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69  for integer divi
1ac20 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f  sion..query I ro
1ac30 77 73 6f 72 74 20 6c 61 62 65 6c 2d 37 36 36 0d  wsort label-766.
1ac40 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
1ac50 20 2d 20 63 6f 6c 30 20 44 49 56 20 2d 20 28 20   - col0 DIV - ( 
1ac60 2d 20 63 6f 6c 31 20 2b 20 63 6f 6c 32 20 29 20  - col1 + col2 ) 
1ac70 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41  col0 FROM tab2 A
1ac80 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
1ac90 0d 0a 2d 32 0d 0a 33 0d 0a 0d 0a 73 6b 69 70 69  ..-2..3....skipi
1aca0 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50  f postgresql # P
1acb0 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72  ostgreSQL requir
1acc0 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d  es AS when renam
1acd0 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d  ing output colum
1ace0 6e 73 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ns..skipif mysql
1acf0 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
1ad00 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
1ad10 72 74 20 6c 61 62 65 6c 2d 37 36 36 0d 0a 53 45  rt label-766..SE
1ad20 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20  LECT DISTINCT - 
1ad30 63 6f 6c 30 20 2f 20 2d 20 28 20 2d 20 63 6f 6c  col0 / - ( - col
1ad40 31 20 2b 20 63 6f 6c 32 20 29 20 63 6f 6c 30 20  1 + col2 ) col0 
1ad50 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
1ad60 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 2d 32 0d  0..----..-1..-2.
1ad70 0a 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  .3....query I ro
1ad80 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f  wsort..SELECT co
1ad90 6c 30 20 2a 20 38 20 46 52 4f 4d 20 74 61 62 30  l0 * 8 FROM tab0
1ada0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
1adb0 31 39 32 0d 0a 32 38 30 0d 0a 37 31 32 0d 0a 0d  192..280..712...
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 63 6f 6c 32 20 2b 20  ..SELECT col2 + 
1ade0 2d 20 28 20 2d 20 34 30 20 29 20 46 52 4f 4d 20  - ( - 40 ) FROM 
1adf0 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 32 0d  tab0..----..122.
1ae00 0a 34 31 0d 0a 37 33 0d 0a 0d 0a 73 6b 69 70 69  .41..73....skipi
1ae10 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50  f postgresql # P
1ae20 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72  ostgreSQL requir
1ae30 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d  es AS when renam
1ae40 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d  ing output colum
1ae50 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ns..query I rows
1ae60 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 28 20  ort..SELECT + ( 
1ae70 2d 20 74 61 62 30 2e 63 6f 6c 32 20 29 20 63 6f  - tab0.col2 ) co
1ae80 6c 31 20 46 52 4f 4d 20 74 61 62 30 2c 20 74 61  l1 FROM tab0, ta
1ae90 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
1aea0 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68 69  ..9 values hashi
1aeb0 6e 67 20 74 6f 20 62 35 61 34 31 30 32 31 30 37  ng to b5a4102107
1aec0 65 35 65 62 64 32 36 65 33 34 31 35 33 38 66 34  e5ebd26e341538f4
1aed0 66 65 64 65 31 65 0d 0a 0d 0a 71 75 65 72 79 20  fede1e....query 
1aee0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
1aef0 54 20 41 4c 4c 20 36 36 20 46 52 4f 4d 20 74 61  T ALL 66 FROM ta
1af00 62 30 2c 20 74 61 62 31 20 41 53 20 63 6f 72 30  b0, tab1 AS cor0
1af10 2c 20 74 61 62 32 20 41 53 20 63 6f 72 31 0d 0a  , tab2 AS cor1..
1af20 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75 65 73 20  ----..27 values 
1af30 68 61 73 68 69 6e 67 20 74 6f 20 38 39 37 62 36  hashing to 897b6
1af40 31 32 32 61 63 39 38 33 34 30 62 37 38 39 30 35  122ac98340b78905
1af50 66 33 39 64 38 31 38 39 37 66 63 0d 0a 0d 0a 6f  f39d81897fc....o
1af60 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73  nlyif mysql # us
1af70 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66  e DIV operator f
1af80 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73  or integer divis
1af90 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ion..query I row
1afa0 73 6f 72 74 20 6c 61 62 65 6c 2d 37 37 31 0d 0a  sort label-771..
1afb0 53 45 4c 45 43 54 20 63 6f 6c 30 20 2b 20 2b 20  SELECT col0 + + 
1afc0 63 6f 6c 32 20 44 49 56 20 63 6f 6c 31 20 2b 20  col2 DIV col1 + 
1afd0 63 6f 6c 31 20 2a 20 74 61 62 31 2e 63 6f 6c 30  col1 * tab1.col0
1afe0 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d   FROM tab1..----
1aff0 0d 0a 31 31 32 37 0d 0a 37 30 39 0d 0a 38 33 0d  ..1127..709..83.
1b000 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
1b010 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
1b020 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1b030 74 20 6c 61 62 65 6c 2d 37 37 31 0d 0a 53 45 4c  t label-771..SEL
1b040 45 43 54 20 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c  ECT col0 + + col
1b050 32 20 2f 20 63 6f 6c 31 20 2b 20 63 6f 6c 31 20  2 / col1 + col1 
1b060 2a 20 74 61 62 31 2e 63 6f 6c 30 20 46 52 4f 4d  * tab1.col0 FROM
1b070 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 31 32   tab1..----..112
1b080 37 0d 0a 37 30 39 0d 0a 38 33 0d 0a 0d 0a 71 75  7..709..83....qu
1b090 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
1b0a0 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 63  ELECT DISTINCT c
1b0b0 6f 6c 31 20 2a 20 63 6f 6c 32 20 2d 20 2b 20 31  ol1 * col2 - + 1
1b0c0 33 20 2a 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61  3 * col0 FROM ta
1b0d0 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 36 32 0d 0a  b1..----..-262..
1b0e0 31 33 36 35 0d 0a 32 30 38 0d 0a 0d 0a 71 75 65  1365..208....que
1b0f0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
1b100 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20  LECT DISTINCT - 
1b110 38 32 20 46 52 4f 4d 20 74 61 62 30 2c 20 74 61  82 FROM tab0, ta
1b120 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
1b130 0d 0a 2d 38 32 0d 0a 0d 0a 71 75 65 72 79 20 49  ..-82....query I
1b140 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
1b150 20 2b 20 74 61 62 30 2e 63 6f 6c 31 20 2a 20 28   + tab0.col1 * (
1b160 20 2b 20 63 6f 6c 30 20 29 20 2b 20 63 6f 6c 31   + col0 ) + col1
1b170 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
1b180 62 30 0d 0a 2d 2d 2d 2d 0d 0a 32 31 35 30 0d 0a  b0..----..2150..
1b190 33 34 39 32 0d 0a 38 31 39 30 0d 0a 0d 0a 71 75  3492..8190....qu
1b1a0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
1b1b0 45 4c 45 43 54 20 2b 20 2d 20 63 6f 72 30 2e 63  ELECT + - cor0.c
1b1c0 6f 6c 32 20 2b 20 2b 20 63 6f 6c 30 20 2a 20 2d  ol2 + + col0 * -
1b1d0 20 28 20 2d 20 63 6f 6c 31 20 2b 20 2d 20 63 6f   ( - col1 + - co
1b1e0 6c 31 20 29 20 46 52 4f 4d 20 74 61 62 30 20 41  l1 ) FROM tab0 A
1b1f0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 36  S cor0..----..16
1b200 31 31 36 0d 0a 34 30 39 35 0d 0a 36 37 38 39 0d  116..4095..6789.
1b210 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
1b220 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
1b230 4e 43 54 20 2d 20 2d 20 63 6f 6c 30 20 2b 20 28  NCT - - col0 + (
1b240 20 63 6f 72 30 2e 63 6f 6c 31 20 29 20 2b 20 2d   cor0.col1 ) + -
1b250 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20   col1 FROM tab0 
1b260 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32  AS cor0..----..2
1b270 34 0d 0a 33 35 0d 0a 38 39 0d 0a 0d 0a 73 6b 69  4..35..89....ski
1b280 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23  pif postgresql #
1b290 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75   PostgreSQL requ
1b2a0 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e  ires AS when ren
1b2b0 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c  aming output col
1b2c0 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f  umns..query I ro
1b2d0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
1b2e0 4c 20 2b 20 39 20 63 6f 6c 31 20 46 52 4f 4d 20  L + 9 col1 FROM 
1b2f0 74 61 62 31 2c 20 74 61 62 31 20 41 53 20 63 6f  tab1, tab1 AS co
1b300 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75  r0..----..9 valu
1b310 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 30 33  es hashing to 03
1b320 62 39 33 62 35 33 31 30 37 65 33 36 63 66 37 64  b93b53107e36cf7d
1b330 35 32 34 65 34 38 63 35 30 39 62 31 37 62 0d 0a  524e48c509b17b..
1b340 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
1b350 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53   support for MyS
1b360 51 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74  QL specific syst
1b370 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e  em types and syn
1b380 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  tax..query I row
1b390 73 6f 72 74 20 6c 61 62 65 6c 2d 37 37 38 0d 0a  sort label-778..
1b3a0 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 30 20  SELECT ALL col0 
1b3b0 2d 20 2b 20 43 41 53 54 28 20 4e 55 4c 4c 20 41  - + CAST( NULL A
1b3c0 53 20 53 49 47 4e 45 44 20 29 20 46 52 4f 4d 20  S SIGNED ) FROM 
1b3d0 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab2 cor0..----.
1b3e0 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c  .NULL..NULL..NUL
1b3f0 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  L....skipif mysq
1b400 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
1b410 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
1b420 6f 72 74 20 6c 61 62 65 6c 2d 37 37 38 0d 0a 53  ort label-778..S
1b430 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 30 20 2d  ELECT ALL col0 -
1b440 20 2b 20 43 41 53 54 20 28 20 4e 55 4c 4c 20 41   + CAST ( NULL A
1b450 53 20 49 4e 54 45 47 45 52 20 29 20 46 52 4f 4d  S INTEGER ) FROM
1b460 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab2 cor0..----
1b470 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55  ..NULL..NULL..NU
1b480 4c 4c 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  LL....query I ro
1b490 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
1b4a0 53 54 49 4e 43 54 20 2b 20 63 6f 6c 31 20 2b 20  STINCT + col1 + 
1b4b0 2d 20 35 20 2a 20 34 34 20 41 53 20 63 6f 6c 30  - 5 * 44 AS col0
1b4c0 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
1b4d0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 36 31 0d 0a  r0..----..-161..
1b4e0 2d 31 38 39 0d 0a 2d 32 30 33 0d 0a 0d 0a 71 75  -189..-203....qu
1b4f0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
1b500 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 30  ELECT ALL + col0
1b510 20 2b 20 2b 20 63 6f 6c 31 20 2a 20 63 6f 6c 30   + + col1 * col0
1b520 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
1b530 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 32 30 0d 0a  r0..----..1120..
1b540 37 30 34 0d 0a 38 31 0d 0a 0d 0a 71 75 65 72 79  704..81....query
1b550 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
1b560 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 32  CT DISTINCT col2
1b570 20 2b 20 2b 20 36 30 20 2a 20 2d 20 63 6f 6c 31   + + 60 * - col1
1b580 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
1b590 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
1b5a0 0d 0a 2d 31 35 30 36 0d 0a 2d 35 34 33 0d 0a 2d  ..-1506..-543..-
1b5b0 36 38 34 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  684....onlyif my
1b5c0 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70  sql # use DIV op
1b5d0 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67  erator for integ
1b5e0 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65  er division..que
1b5f0 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
1b600 65 6c 2d 37 38 32 0d 0a 53 45 4c 45 43 54 20 44  el-782..SELECT D
1b610 49 53 54 49 4e 43 54 20 2b 20 2b 20 63 6f 6c 31  ISTINCT + + col1
1b620 20 44 49 56 20 2b 20 63 6f 72 30 2e 63 6f 6c 30   DIV + cor0.col0
1b630 20 2b 20 31 34 20 41 53 20 63 6f 6c 31 20 46 52   + 14 AS col1 FR
1b640 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
1b650 0a 2d 2d 2d 2d 0d 0a 31 34 0d 0a 31 38 0d 0a 0d  .----..14..18...
1b660 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
1b670 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
1b680 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
1b690 6c 61 62 65 6c 2d 37 38 32 0d 0a 53 45 4c 45 43  label-782..SELEC
1b6a0 54 20 44 49 53 54 49 4e 43 54 20 2b 20 2b 20 63  T DISTINCT + + c
1b6b0 6f 6c 31 20 2f 20 2b 20 63 6f 72 30 2e 63 6f 6c  ol1 / + cor0.col
1b6c0 30 20 2b 20 31 34 20 41 53 20 63 6f 6c 31 20 46  0 + 14 AS col1 F
1b6d0 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
1b6e0 0d 0a 2d 2d 2d 2d 0d 0a 31 34 0d 0a 31 38 0d 0a  ..----..14..18..
1b6f0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1b700 74 0d 0a 53 45 4c 45 43 54 20 63 6f 72 30 2e 63  t..SELECT cor0.c
1b710 6f 6c 32 20 2a 20 2b 20 63 6f 6c 31 20 41 53 20  ol2 * + col1 AS 
1b720 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41  col0 FROM tab0 A
1b730 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 38  S cor0..----..28
1b740 33 38 0d 0a 37 34 36 32 0d 0a 39 37 0d 0a 0d 0a  38..7462..97....
1b750 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75  onlyif mysql # u
1b760 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20  se DIV operator 
1b770 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69  for integer divi
1b780 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f  sion..query I ro
1b790 77 73 6f 72 74 20 6c 61 62 65 6c 2d 37 38 34 0d  wsort label-784.
1b7a0 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
1b7b0 20 63 6f 6c 32 20 2b 20 2b 20 38 36 20 2a 20 2b   col2 + + 86 * +
1b7c0 20 63 6f 6c 30 20 44 49 56 20 2d 20 63 6f 6c 30   col0 DIV - col0
1b7d0 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
1b7e0 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
1b7f0 0d 0a 2d 32 39 0d 0a 2d 33 32 0d 0a 31 30 0d 0a  ..-29..-32..10..
1b800 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
1b810 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
1b820 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1b830 20 6c 61 62 65 6c 2d 37 38 34 0d 0a 53 45 4c 45   label-784..SELE
1b840 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 32  CT DISTINCT col2
1b850 20 2b 20 2b 20 38 36 20 2a 20 2b 20 63 6f 6c 30   + + 86 * + col0
1b860 20 2f 20 2d 20 63 6f 6c 30 20 41 53 20 63 6f 6c   / - col0 AS col
1b870 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  1 FROM tab1 AS c
1b880 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 39 0d 0a  or0..----..-29..
1b890 2d 33 32 0d 0a 31 30 0d 0a 0d 0a 71 75 65 72 79  -32..10....query
1b8a0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
1b8b0 43 54 20 63 6f 6c 30 20 2a 20 2d 20 28 20 2b 20  CT col0 * - ( + 
1b8c0 63 6f 6c 31 20 29 20 46 52 4f 4d 20 74 61 62 30  col1 ) FROM tab0
1b8d0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
1b8e0 2d 32 30 36 34 0d 0a 2d 33 33 39 35 0d 0a 2d 38  -2064..-3395..-8
1b8f0 30 39 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  099....query I r
1b900 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
1b910 20 63 6f 6c 31 20 2b 20 2d 20 63 6f 6c 31 20 2a   col1 + - col1 *
1b920 20 2d 20 63 6f 6c 32 20 2a 20 63 6f 6c 31 20 46   - col2 * col1 F
1b930 52 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d  ROM tab2 cor0..-
1b940 2d 2d 2d 0d 0a 31 30 39 39 39 0d 0a 32 35 39 37  ---..10999..2597
1b950 38 0d 0a 39 30 35 36 35 0d 0a 0d 0a 6f 6e 6c 79  8..90565....only
1b960 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44  if mysql # use D
1b970 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20  IV operator for 
1b980 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e  integer division
1b990 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1b9a0 74 20 6c 61 62 65 6c 2d 37 38 37 0d 0a 53 45 4c  t label-787..SEL
1b9b0 45 43 54 20 63 6f 6c 32 20 2b 20 63 6f 6c 30 20  ECT col2 + col0 
1b9c0 44 49 56 20 34 39 20 41 53 20 63 6f 6c 32 20 46  DIV 49 AS col2 F
1b9d0 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
1b9e0 0d 0a 2d 2d 2d 2d 0d 0a 32 37 0d 0a 32 37 0d 0a  ..----..27..27..
1b9f0 33 39 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  39....skipif mys
1ba00 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
1ba10 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
1ba20 73 6f 72 74 20 6c 61 62 65 6c 2d 37 38 37 0d 0a  sort label-787..
1ba30 53 45 4c 45 43 54 20 63 6f 6c 32 20 2b 20 63 6f  SELECT col2 + co
1ba40 6c 30 20 2f 20 34 39 20 41 53 20 63 6f 6c 32 20  l0 / 49 AS col2 
1ba50 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
1ba60 30 0d 0a 2d 2d 2d 2d 0d 0a 32 37 0d 0a 32 37 0d  0..----..27..27.
1ba70 0a 33 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .39....query I r
1ba80 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 33  owsort..SELECT 3
1ba90 30 20 2b 20 63 6f 6c 30 20 2a 20 63 6f 6c 30 20  0 + col0 * col0 
1baa0 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d  FROM tab1..----.
1bab0 0a 33 39 0d 0a 34 31 32 36 0d 0a 36 34 33 30 0d  .39..4126..6430.
1bac0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
1bad0 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d  rt..SELECT ALL -
1bae0 20 32 35 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d   25 AS col2 FROM
1baf0 20 74 61 62 32 20 41 53 20 63 6f 72 30 20 43 52   tab2 AS cor0 CR
1bb00 4f 53 53 20 4a 4f 49 4e 20 74 61 62 30 20 41 53  OSS JOIN tab0 AS
1bb10 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76   cor1..----..9 v
1bb20 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f  alues hashing to
1bb30 20 34 30 61 63 38 66 64 30 30 30 62 32 65 34 39   40ac8fd000b2e49
1bb40 33 31 37 61 65 64 32 34 31 31 30 37 37 38 33 39  317aed2411077839
1bb50 65 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  e....query I row
1bb60 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
1bb70 20 39 33 20 46 52 4f 4d 20 74 61 62 30 2c 20 74   93 FROM tab0, t
1bb80 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
1bb90 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68  -..9 values hash
1bba0 69 6e 67 20 74 6f 20 65 36 34 31 30 35 64 66 61  ing to e64105dfa
1bbb0 61 39 66 62 64 32 30 31 61 64 62 62 31 66 33 66  a9fbd201adbb1f3f
1bbc0 36 39 36 38 62 64 65 0d 0a 0d 0a 6f 6e 6c 79 69  6968bde....onlyi
1bbd0 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72  f mysql # suppor
1bbe0 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63  t for MySQL spec
1bbf0 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65  ific system type
1bc00 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75  s and syntax..qu
1bc10 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
1bc20 62 65 6c 2d 37 39 31 0d 0a 53 45 4c 45 43 54 20  bel-791..SELECT 
1bc30 44 49 53 54 49 4e 43 54 20 2d 20 43 41 53 54 28  DISTINCT - CAST(
1bc40 20 4e 55 4c 4c 20 41 53 20 53 49 47 4e 45 44 20   NULL AS SIGNED 
1bc50 29 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  ) AS col0 FROM t
1bc60 61 62 31 2c 20 74 61 62 32 20 41 53 20 63 6f 72  ab1, tab2 AS cor
1bc70 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 0d  0..----..NULL...
1bc80 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
1bc90 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
1bca0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
1bcb0 6c 61 62 65 6c 2d 37 39 31 0d 0a 53 45 4c 45 43  label-791..SELEC
1bcc0 54 20 44 49 53 54 49 4e 43 54 20 2d 20 43 41 53  T DISTINCT - CAS
1bcd0 54 20 28 20 4e 55 4c 4c 20 41 53 20 49 4e 54 45  T ( NULL AS INTE
1bce0 47 45 52 20 29 20 41 53 20 63 6f 6c 30 20 46 52  GER ) AS col0 FR
1bcf0 4f 4d 20 74 61 62 31 2c 20 74 61 62 32 20 41 53  OM tab1, tab2 AS
1bd00 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c   cor0..----..NUL
1bd10 4c 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  L....query I row
1bd20 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
1bd30 54 49 4e 43 54 20 32 35 20 2b 20 2b 20 74 61 62  TINCT 25 + + tab
1bd40 32 2e 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32  2.col1 FROM tab2
1bd50 0d 0a 2d 2d 2d 2d 0d 0a 34 32 0d 0a 35 36 0d 0a  ..----..42..56..
1bd60 38 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  84....query I ro
1bd70 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
1bd80 4c 20 2d 20 74 61 62 30 2e 63 6f 6c 32 20 2b 20  L - tab0.col2 + 
1bd90 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c 30 20 46 52  col2 * + col0 FR
1bda0 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 33  OM tab0..----..3
1bdb0 34 0d 0a 37 32 31 36 0d 0a 37 35 39 0d 0a 0d 0a  4..7216..759....
1bdc0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
1bdd0 0a 53 45 4c 45 43 54 20 63 6f 6c 32 20 2b 20 28  .SELECT col2 + (
1bde0 20 2d 20 63 6f 6c 30 20 29 20 2a 20 36 33 20 2b   - col0 ) * 63 +
1bdf0 20 32 30 20 2a 20 2d 20 63 6f 6c 30 20 2a 20 2d   20 * - col0 * -
1be00 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 0d   col0 FROM tab2.
1be10 0a 2d 2d 2d 2d 0d 0a 31 31 36 37 39 32 0d 0a 31  .----..116792..1
1be20 31 39 38 38 31 0d 0a 35 36 36 0d 0a 0d 0a 71 75  19881..566....qu
1be30 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
1be40 45 4c 45 43 54 20 2d 20 2d 20 63 6f 72 31 2e 63  ELECT - - cor1.c
1be50 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol1 FROM tab1 AS
1be60 20 63 6f 72 30 20 43 52 4f 53 53 20 4a 4f 49 4e   cor0 CROSS JOIN
1be70 20 74 61 62 32 20 41 53 20 63 6f 72 31 0d 0a 2d   tab2 AS cor1..-
1be80 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61  ---..9 values ha
1be90 73 68 69 6e 67 20 74 6f 20 63 36 31 64 32 37 61  shing to c61d27a
1bea0 30 30 32 32 65 36 64 30 32 32 33 37 31 64 63 35  0022e6d022371dc5
1beb0 38 38 31 39 61 62 32 37 32 0d 0a 0d 0a 71 75 65  8819ab272....que
1bec0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
1bed0 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20  LECT DISTINCT + 
1bee0 28 20 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c 30 20  ( col2 * + col0 
1bef0 29 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c 31  ) + col0 AS col1
1bf00 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d   FROM tab0..----
1bf10 0d 0a 37 30 0d 0a 37 33 38 37 0d 0a 38 31 36 0d  ..70..7387..816.
1bf20 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
1bf30 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 36 31 20  rt..SELECT + 61 
1bf40 2b 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31  + col2 FROM tab1
1bf50 0d 0a 2d 2d 2d 2d 0d 0a 31 31 35 0d 0a 31 31 38  ..----..115..118
1bf60 0d 0a 31 35 37 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  ..157....onlyif 
1bf70 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20  mysql # use DIV 
1bf80 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74  operator for int
1bf90 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71  eger division..q
1bfa0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
1bfb0 61 62 65 6c 2d 37 39 38 0d 0a 53 45 4c 45 43 54  abel-798..SELECT
1bfc0 20 2b 20 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c 30   + col0 + + col0
1bfd0 20 44 49 56 20 28 20 31 32 20 2b 20 74 61 62 32   DIV ( 12 + tab2
1bfe0 2e 63 6f 6c 31 20 29 20 46 52 4f 4d 20 74 61 62  .col1 ) FROM tab
1bff0 32 0d 0a 2d 2d 2d 2d 0d 0a 37 0d 0a 37 39 0d 0a  2..----..7..79..
1c000 38 31 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  81....skipif mys
1c010 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
1c020 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
1c030 73 6f 72 74 20 6c 61 62 65 6c 2d 37 39 38 0d 0a  sort label-798..
1c040 53 45 4c 45 43 54 20 2b 20 63 6f 6c 30 20 2b 20  SELECT + col0 + 
1c050 2b 20 63 6f 6c 30 20 2f 20 28 20 31 32 20 2b 20  + col0 / ( 12 + 
1c060 74 61 62 32 2e 63 6f 6c 31 20 29 20 46 52 4f 4d  tab2.col1 ) FROM
1c070 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 37 0d 0a   tab2..----..7..
1c080 37 39 0d 0a 38 31 0d 0a 0d 0a 73 6b 69 70 69 66  79..81....skipif
1c090 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f   postgresql # Po
1c0a0 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65  stgreSQL require
1c0b0 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69  s AS when renami
1c0c0 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e  ng output column
1c0d0 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  s..query I rowso
1c0e0 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
1c0f0 4e 43 54 20 2d 20 36 35 20 63 6f 6c 32 20 46 52  NCT - 65 col2 FR
1c100 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  OM tab0..----..-
1c110 36 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  65....query I ro
1c120 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
1c130 53 54 49 4e 43 54 20 32 35 20 2a 20 63 6f 6c 31  STINCT 25 * col1
1c140 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
1c150 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
1c160 0d 0a 32 31 35 30 0d 0a 32 32 37 35 0d 0a 32 34  ..2150..2275..24
1c170 32 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  25....query I ro
1c180 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
1c190 4c 20 2b 20 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c  L + col1 * - col
1c1a0 30 20 2b 20 33 20 46 52 4f 4d 20 74 61 62 32 20  0 + 3 FROM tab2 
1c1b0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
1c1c0 31 33 34 30 0d 0a 2d 32 31 34 0d 0a 2d 34 35 39  1340..-214..-459
1c1d0 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  9....query I row
1c1e0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c  sort..SELECT col
1c1f0 32 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 2a 20  2 + cor0.col1 * 
1c200 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52 4f  col1 AS col0 FRO
1c210 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
1c220 2d 2d 2d 2d 0d 0a 33 32 37 0d 0a 33 35 30 37 0d  ----..327..3507.
1c230 0a 39 38 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .988....query I 
1c240 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
1c250 44 49 53 54 49 4e 43 54 20 2d 20 31 37 20 2d 20  DISTINCT - 17 - 
1c260 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46 52 4f  col2 AS col1 FRO
1c270 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
1c280 2d 2d 2d 2d 0d 0a 2d 31 31 33 0d 0a 2d 37 31 0d  ----..-113..-71.
1c290 0a 2d 37 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .-74....query I 
1c2a0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
1c2b0 36 39 20 2a 20 2b 20 63 6f 6c 31 20 2b 20 63 6f  69 * + col1 + co
1c2c0 6c 31 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  l1 AS col2 FROM 
1c2d0 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
1c2e0 2d 2d 0d 0a 31 38 32 30 0d 0a 37 30 30 0d 0a 39  --..1820..700..9
1c2f0 31 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  10....onlyif mys
1c300 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65  ql # use DIV ope
1c310 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65  rator for intege
1c320 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72  r division..quer
1c330 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
1c340 6c 2d 38 30 35 0d 0a 53 45 4c 45 43 54 20 2b 20  l-805..SELECT + 
1c350 31 32 20 2a 20 63 6f 6c 30 20 2b 20 63 6f 6c 31  12 * col0 + col1
1c360 20 44 49 56 20 2d 20 63 6f 6c 32 20 41 53 20 63   DIV - col2 AS c
1c370 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol1 FROM tab0 AS
1c380 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 36   cor0..----..106
1c390 37 0d 0a 32 38 36 0d 0a 33 32 33 0d 0a 0d 0a 73  7..286..323....s
1c3a0 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
1c3b0 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
1c3c0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
1c3d0 62 65 6c 2d 38 30 35 0d 0a 53 45 4c 45 43 54 20  bel-805..SELECT 
1c3e0 2b 20 31 32 20 2a 20 63 6f 6c 30 20 2b 20 63 6f  + 12 * col0 + co
1c3f0 6c 31 20 2f 20 2d 20 63 6f 6c 32 20 41 53 20 63  l1 / - col2 AS c
1c400 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol1 FROM tab0 AS
1c410 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 36   cor0..----..106
1c420 37 0d 0a 32 38 36 0d 0a 33 32 33 0d 0a 0d 0a 71  7..286..323....q
1c430 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
1c440 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
1c450 63 6f 6c 30 20 2a 20 2d 20 63 6f 72 30 2e 63 6f  col0 * - cor0.co
1c460 6c 30 20 2b 20 2d 20 28 20 63 6f 6c 30 20 29 20  l0 + - ( col0 ) 
1c470 2a 20 2d 20 63 6f 72 30 2e 63 6f 6c 30 20 41 53  * - cor0.col0 AS
1c480 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20   col1 FROM tab1 
1c490 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30  AS cor0..----..0
1c4a0 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
1c4b0 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d   # support for M
1c4c0 79 53 51 4c 20 73 70 65 63 69 66 69 63 20 73 79  ySQL specific sy
1c4d0 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73  stem types and s
1c4e0 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72  yntax..query I r
1c4f0 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 38 30 37  owsort label-807
1c500 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 43 41 53  ..SELECT ALL CAS
1c510 54 28 20 4e 55 4c 4c 20 41 53 20 53 49 47 4e 45  T( NULL AS SIGNE
1c520 44 20 29 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  D ) AS col0 FROM
1c530 20 74 61 62 32 2c 20 74 61 62 31 20 63 6f 72 30   tab2, tab1 cor0
1c540 2c 20 74 61 62 32 20 41 53 20 63 6f 72 31 0d 0a  , tab2 AS cor1..
1c550 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75 65 73 20  ----..27 values 
1c560 68 61 73 68 69 6e 67 20 74 6f 20 31 36 62 65 38  hashing to 16be8
1c570 38 36 38 61 31 65 36 66 34 65 38 38 35 30 35 30  868a1e6f4e885050
1c580 39 66 39 33 32 37 61 66 65 39 30 0d 0a 0d 0a 73  9f9327afe90....s
1c590 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
1c5a0 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
1c5b0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
1c5c0 62 65 6c 2d 38 30 37 0d 0a 53 45 4c 45 43 54 20  bel-807..SELECT 
1c5d0 41 4c 4c 20 43 41 53 54 20 28 20 4e 55 4c 4c 20  ALL CAST ( NULL 
1c5e0 41 53 20 49 4e 54 45 47 45 52 20 29 20 41 53 20  AS INTEGER ) AS 
1c5f0 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 2c 20  col0 FROM tab2, 
1c600 74 61 62 31 20 63 6f 72 30 2c 20 74 61 62 32 20  tab1 cor0, tab2 
1c610 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 32  AS cor1..----..2
1c620 37 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67  7 values hashing
1c630 20 74 6f 20 31 36 62 65 38 38 36 38 61 31 65 36   to 16be8868a1e6
1c640 66 34 65 38 38 35 30 35 30 39 66 39 33 32 37 61  f4e8850509f9327a
1c650 66 65 39 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20  fe90....query I 
1c660 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
1c670 28 20 63 6f 6c 31 20 29 20 2a 20 2b 20 63 6f 6c  ( col1 ) * + col
1c680 32 20 2b 20 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c  2 + col2 * + col
1c690 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  2 AS col2 FROM t
1c6a0 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 34 31 38 36  ab0..----..14186
1c6b0 0d 0a 33 39 32 37 0d 0a 39 38 0d 0a 0d 0a 73 6b  ..3927..98....sk
1c6c0 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20  ipif postgresql 
1c6d0 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71  # PostgreSQL req
1c6e0 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65  uires AS when re
1c6f0 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f  naming output co
1c700 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72  lumns..query I r
1c710 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
1c720 20 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c 31 20 63   col0 * - col1 c
1c730 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 63 6f  ol1 FROM tab2 co
1c740 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33 34 33 0d 0a  r0..----..1343..
1c750 32 31 37 0d 0a 34 36 30 32 0d 0a 0d 0a 6f 6e 6c  217..4602....onl
1c760 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20  yif mysql # use 
1c770 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72  DIV operator for
1c780 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f   integer divisio
1c790 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  n..query I rowso
1c7a0 72 74 20 6c 61 62 65 6c 2d 38 31 30 0d 0a 53 45  rt label-810..SE
1c7b0 4c 45 43 54 20 2d 20 2b 20 63 6f 6c 32 20 2a 20  LECT - + col2 * 
1c7c0 2d 20 31 38 20 2b 20 63 6f 6c 32 20 44 49 56 20  - 18 + col2 DIV 
1c7d0 63 6f 6c 32 20 2b 20 2d 20 43 41 53 54 28 20 2b  col2 + - CAST( +
1c7e0 20 38 31 20 41 53 20 53 49 47 4e 45 44 20 29 20   81 AS SIGNED ) 
1c7f0 2a 20 2d 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61  * - col0 FROM ta
1c800 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
1c810 0d 0a 32 35 33 39 0d 0a 32 38 35 34 0d 0a 38 36  ..2539..2854..86
1c820 38 36 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  86....skipif mys
1c830 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
1c840 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
1c850 73 6f 72 74 20 6c 61 62 65 6c 2d 38 31 30 0d 0a  sort label-810..
1c860 53 45 4c 45 43 54 20 2d 20 2b 20 63 6f 6c 32 20  SELECT - + col2 
1c870 2a 20 2d 20 31 38 20 2b 20 63 6f 6c 32 20 2f 20  * - 18 + col2 / 
1c880 63 6f 6c 32 20 2b 20 2d 20 43 41 53 54 20 28 20  col2 + - CAST ( 
1c890 2b 20 38 31 20 41 53 20 49 4e 54 45 47 45 52 20  + 81 AS INTEGER 
1c8a0 29 20 2a 20 2d 20 63 6f 6c 30 20 46 52 4f 4d 20  ) * - col0 FROM 
1c8b0 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
1c8c0 2d 2d 0d 0a 32 35 33 39 0d 0a 32 38 35 34 0d 0a  --..2539..2854..
1c8d0 38 36 38 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20  8686....query I 
1c8e0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
1c8f0 44 49 53 54 49 4e 43 54 20 2b 20 37 34 20 2a 20  DISTINCT + 74 * 
1c900 2d 20 63 6f 72 30 2e 63 6f 6c 31 20 41 53 20 63  - cor0.col1 AS c
1c910 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 2c 20 74  ol2 FROM tab2, t
1c920 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab1 cor0..----..
1c930 2d 31 39 32 34 0d 0a 2d 37 34 30 0d 0a 2d 39 36  -1924..-740..-96
1c940 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  2....query I row
1c950 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 74 61 62  sort..SELECT tab
1c960 30 2e 63 6f 6c 31 20 2b 20 2d 20 36 34 20 41 53  0.col1 + - 64 AS
1c970 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 0d   col2 FROM tab0.
1c980 0a 2d 2d 2d 2d 0d 0a 32 32 0d 0a 32 37 0d 0a 33  .----..22..27..3
1c990 33 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  3....onlyif mysq
1c9a0 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20  l # support for 
1c9b0 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63 20 73  MySQL specific s
1c9c0 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20  ystem types and 
1c9d0 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20  syntax..query I 
1c9e0 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 38 31  rowsort label-81
1c9f0 33 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  3..SELECT DISTIN
1ca00 43 54 20 2b 20 63 6f 6c 31 20 2a 20 2d 20 43 41  CT + col1 * - CA
1ca10 53 54 28 20 4e 55 4c 4c 20 41 53 20 53 49 47 4e  ST( NULL AS SIGN
1ca20 45 44 20 29 20 46 52 4f 4d 20 74 61 62 30 20 63  ED ) FROM tab0 c
1ca30 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d  or0..----..NULL.
1ca40 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
1ca50 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
1ca60 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1ca70 74 20 6c 61 62 65 6c 2d 38 31 33 0d 0a 53 45 4c  t label-813..SEL
1ca80 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63  ECT DISTINCT + c
1ca90 6f 6c 31 20 2a 20 2d 20 43 41 53 54 20 28 20 4e  ol1 * - CAST ( N
1caa0 55 4c 4c 20 41 53 20 49 4e 54 45 47 45 52 20 29  ULL AS INTEGER )
1cab0 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d   FROM tab0 cor0.
1cac0 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71  .----..NULL....q
1cad0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
1cae0 53 45 4c 45 43 54 20 63 6f 6c 32 20 2a 20 63 6f  SELECT col2 * co
1caf0 6c 32 20 2b 20 2b 20 63 6f 6c 30 20 46 52 4f 4d  l2 + + col0 FROM
1cb00 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
1cb10 2d 2d 2d 0d 0a 31 31 31 33 0d 0a 33 36 0d 0a 36  ---..1113..36..6
1cb20 38 31 33 0d 0a 0d 0a 71 75 65 72 79 20 49 49 49  813....query III
1cb30 49 49 49 49 49 49 49 49 49 49 49 49 20 72 6f 77  IIIIIIIIIIII row
1cb40 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2a 20 46  sort..SELECT * F
1cb50 52 4f 4d 20 74 61 62 31 2c 20 74 61 62 31 20 63  ROM tab1, tab1 c
1cb60 6f 72 30 2c 20 74 61 62 32 20 63 6f 72 31 2c 20  or0, tab2 cor1, 
1cb70 74 61 62 30 2c 20 74 61 62 30 20 41 53 20 63 6f  tab0, tab0 AS co
1cb80 72 32 0d 0a 2d 2d 2d 2d 0d 0a 33 36 34 35 20 76  r2..----..3645 v
1cb90 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f  alues hashing to
1cba0 20 61 35 36 37 37 63 35 30 62 32 33 66 37 30 32   a5677c50b23f702
1cbb0 38 37 64 66 33 35 63 32 33 38 38 61 31 63 39 62  87df35c2388a1c9b
1cbc0 66 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  f....query I row
1cbd0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c  sort..SELECT col
1cbe0 31 20 2b 20 28 20 2b 20 63 6f 6c 32 20 29 20 46  1 + ( + col2 ) F
1cbf0 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
1cc00 0d 0a 2d 2d 2d 2d 0d 0a 35 35 0d 0a 35 38 0d 0a  ..----..55..58..
1cc10 38 35 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  85....onlyif mys
1cc20 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65  ql # use DIV ope
1cc30 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65  rator for intege
1cc40 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72  r division..quer
1cc50 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
1cc60 6c 2d 38 31 37 0d 0a 53 45 4c 45 43 54 20 41 4c  l-817..SELECT AL
1cc70 4c 20 2d 20 2b 20 35 38 20 44 49 56 20 2d 20 63  L - + 58 DIV - c
1cc80 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  ol0 AS col0 FROM
1cc90 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
1cca0 2d 2d 2d 0d 0a 30 0d 0a 31 0d 0a 32 0d 0a 0d 0a  ---..0..1..2....
1ccb0 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
1ccc0 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
1ccd0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
1cce0 61 62 65 6c 2d 38 31 37 0d 0a 53 45 4c 45 43 54  abel-817..SELECT
1ccf0 20 41 4c 4c 20 2d 20 2b 20 35 38 20 2f 20 2d 20   ALL - + 58 / - 
1cd00 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46 52 4f  col0 AS col0 FRO
1cd10 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
1cd20 2d 2d 2d 2d 0d 0a 30 0d 0a 31 0d 0a 32 0d 0a 0d  ----..0..1..2...
1cd30 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1cd40 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
1cd50 54 20 2d 20 39 32 20 2b 20 63 6f 6c 32 20 41 53  T - 92 + col2 AS
1cd60 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20   col2 FROM tab1 
1cd70 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
1cd80 33 35 0d 0a 2d 33 38 0d 0a 34 0d 0a 0d 0a 71 75  35..-38..4....qu
1cd90 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
1cda0 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 74  ELECT DISTINCT t
1cdb0 61 62 31 2e 63 6f 6c 32 20 2a 20 38 36 20 46 52  ab1.col2 * 86 FR
1cdc0 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 34  OM tab1..----..4
1cdd0 36 34 34 0d 0a 34 39 30 32 0d 0a 38 32 35 36 0d  644..4902..8256.
1cde0 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
1cdf0 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74  # use DIV operat
1ce00 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64  or for integer d
1ce10 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49  ivision..query I
1ce20 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 38   rowsort label-8
1ce30 32 30 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  20..SELECT DISTI
1ce40 4e 43 54 20 2b 20 37 35 20 44 49 56 20 32 32 20  NCT + 75 DIV 22 
1ce50 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d  FROM tab2..----.
1ce60 0a 33 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  .3....skipif mys
1ce70 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
1ce80 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
1ce90 73 6f 72 74 20 6c 61 62 65 6c 2d 38 32 30 0d 0a  sort label-820..
1cea0 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
1ceb0 2b 20 37 35 20 2f 20 32 32 20 46 52 4f 4d 20 74  + 75 / 22 FROM t
1cec0 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 33 0d 0a 0d 0a  ab2..----..3....
1ced0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
1cee0 0a 53 45 4c 45 43 54 20 2b 20 38 31 20 2a 20 74  .SELECT + 81 * t
1cef0 61 62 30 2e 63 6f 6c 32 20 41 53 20 63 6f 6c 30  ab0.col2 AS col0
1cf00 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d   FROM tab0..----
1cf10 0d 0a 32 36 37 33 0d 0a 36 36 34 32 0d 0a 38 31  ..2673..6642..81
1cf20 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
1cf30 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 38 38  ort..SELECT + 88
1cf40 20 2a 20 28 20 2d 20 63 6f 6c 32 20 29 20 41 53   * ( - col2 ) AS
1cf50 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 0d   col2 FROM tab2.
1cf60 0a 2d 2d 2d 2d 0d 0a 2d 32 32 38 38 0d 0a 2d 32  .----..-2288..-2
1cf70 33 37 36 0d 0a 2d 33 33 34 34 0d 0a 0d 0a 6f 6e  376..-3344....on
1cf80 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
1cf90 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
1cfa0 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
1cfb0 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
1cfc0 6f 72 74 20 6c 61 62 65 6c 2d 38 32 33 0d 0a 53  ort label-823..S
1cfd0 45 4c 45 43 54 20 2d 20 35 33 20 2b 20 63 6f 6c  ELECT - 53 + col
1cfe0 31 20 44 49 56 20 63 6f 6c 31 20 46 52 4f 4d 20  1 DIV col1 FROM 
1cff0 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
1d000 2d 2d 0d 0a 2d 35 32 0d 0a 2d 35 32 0d 0a 2d 35  --..-52..-52..-5
1d010 32 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  2....skipif mysq
1d020 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
1d030 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
1d040 6f 72 74 20 6c 61 62 65 6c 2d 38 32 33 0d 0a 53  ort label-823..S
1d050 45 4c 45 43 54 20 2d 20 35 33 20 2b 20 63 6f 6c  ELECT - 53 + col
1d060 31 20 2f 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61  1 / col1 FROM ta
1d070 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
1d080 0d 0a 2d 35 32 0d 0a 2d 35 32 0d 0a 2d 35 32 0d  ..-52..-52..-52.
1d090 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
1d0a0 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c  rt..SELECT + col
1d0b0 30 20 2b 20 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c  0 + col2 * - col
1d0c0 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  2 AS col2 FROM t
1d0d0 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab1 cor0..----..
1d0e0 2d 32 39 31 33 0d 0a 2d 33 31 38 35 0d 0a 2d 39  -2913..-3185..-9
1d0f0 31 33 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  136....query I r
1d100 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
1d110 20 2b 20 63 6f 6c 32 20 2a 20 63 6f 6c 31 20 2a   + col2 * col1 *
1d120 20 63 6f 6c 32 20 2b 20 63 6f 6c 32 20 41 53 20   col2 + col2 AS 
1d130 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41  col1 FROM tab2 A
1d140 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 32  S cor0..----..22
1d150 36 32 36 0d 0a 32 34 35 38 36 0d 0a 33 39 39 31  626..24586..3991
1d160 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  0....query I row
1d170 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 34 31 20  sort..SELECT 41 
1d180 2b 20 2d 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61  + - col2 FROM ta
1d190 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
1d1a0 0d 0a 2d 34 31 0d 0a 34 30 0d 0a 38 0d 0a 0d 0a  ..-41..40..8....
1d1b0 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75  onlyif mysql # u
1d1c0 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20  se DIV operator 
1d1d0 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69  for integer divi
1d1e0 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f  sion..query I ro
1d1f0 77 73 6f 72 74 20 6c 61 62 65 6c 2d 38 32 37 0d  wsort label-827.
1d200 0a 53 45 4c 45 43 54 20 2b 20 2d 20 35 36 20 44  .SELECT + - 56 D
1d210 49 56 20 2d 20 63 6f 6c 30 20 46 52 4f 4d 20 74  IV - col0 FROM t
1d220 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab1 cor0..----..
1d230 30 0d 0a 30 0d 0a 31 38 0d 0a 0d 0a 73 6b 69 70  0..0..18....skip
1d240 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
1d250 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
1d260 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
1d270 2d 38 32 37 0d 0a 53 45 4c 45 43 54 20 2b 20 2d  -827..SELECT + -
1d280 20 35 36 20 2f 20 2d 20 63 6f 6c 30 20 46 52 4f   56 / - col0 FRO
1d290 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab1 cor0..---
1d2a0 2d 0d 0a 30 0d 0a 30 0d 0a 31 38 0d 0a 0d 0a 71  -..0..0..18....q
1d2b0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
1d2c0 53 45 4c 45 43 54 20 2b 20 2b 20 63 6f 72 30 2e  SELECT + + cor0.
1d2d0 63 6f 6c 32 20 2a 20 63 6f 6c 30 20 2b 20 2d 20  col2 * col0 + - 
1d2e0 33 39 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  39 FROM tab0 AS 
1d2f0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 0d 0a  cor0..----..-4..
1d300 37 32 35 39 0d 0a 37 35 33 0d 0a 0d 0a 71 75 65  7259..753....que
1d310 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
1d320 4c 45 43 54 20 63 6f 6c 30 20 2a 20 63 6f 72 30  LECT col0 * cor0
1d330 2e 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c 30 20 46  .col1 * - col0 F
1d340 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
1d350 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 38 38 32 35 0d  ..----..-118825.
1d360 0a 2d 34 39 35 33 36 0d 0a 2d 37 32 30 38 31 31  .-49536..-720811
1d370 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
1d380 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f  ort..SELECT + co
1d390 6c 30 20 2a 20 63 6f 6c 30 20 2a 20 37 37 20 41  l0 * col0 * 77 A
1d3a0 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32  S col2 FROM tab2
1d3b0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
1d3c0 33 37 37 33 0d 0a 34 36 38 34 36 38 0d 0a 34 38  3773..468468..48
1d3d0 30 35 35 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20  0557....query I 
1d3e0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
1d3f0 2d 20 2d 20 28 20 63 6f 6c 30 20 29 20 2b 20 2d  - - ( col0 ) + -
1d400 20 35 38 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d   58 AS col2 FROM
1d410 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
1d420 2d 2d 2d 0d 0a 2d 32 33 0d 0a 2d 33 34 0d 0a 33  ---..-23..-34..3
1d430 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  1....query I row
1d440 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
1d450 54 49 4e 43 54 20 63 6f 6c 30 20 2b 20 2d 20 28  TINCT col0 + - (
1d460 20 2d 20 63 6f 6c 31 20 29 20 2a 20 63 6f 6c 32   - col1 ) * col2
1d470 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
1d480 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33 32 38 0d 0a  r0..----..1328..
1d490 31 34 30 37 0d 0a 36 33 34 0d 0a 0d 0a 71 75 65  1407..634....que
1d4a0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
1d4b0 4c 45 43 54 20 63 6f 72 30 2e 63 6f 6c 30 20 2b  LECT cor0.col0 +
1d4c0 20 37 20 2a 20 63 6f 6c 32 20 46 52 4f 4d 20 74   7 * col2 FROM t
1d4d0 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
1d4e0 2d 0d 0a 31 39 36 0d 0a 32 36 30 0d 0a 33 34 35  -..196..260..345
1d4f0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
1d500 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
1d510 2b 20 2b 20 28 20 63 6f 6c 30 20 29 20 2d 20 63  + + ( col0 ) - c
1d520 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol1 FROM tab1 AS
1d530 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 33   cor0..----..-23
1d540 0d 0a 35 34 0d 0a 36 37 0d 0a 0d 0a 6f 6e 6c 79  ..54..67....only
1d550 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44  if mysql # use D
1d560 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20  IV operator for 
1d570 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e  integer division
1d580 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1d590 74 20 6c 61 62 65 6c 2d 38 33 35 0d 0a 53 45 4c  t label-835..SEL
1d5a0 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63  ECT DISTINCT + c
1d5b0 6f 6c 30 20 2b 20 2d 20 63 6f 6c 31 20 44 49 56  ol0 + - col1 DIV
1d5c0 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 2d 20 2d   + cor0.col0 - -
1d5d0 20 31 39 20 2a 20 2b 20 36 37 20 41 53 20 63 6f   19 * + 67 AS co
1d5e0 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 63 6f 72  l1 FROM tab2 cor
1d5f0 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 37 36 0d 0a 31  0..----..1276..1
1d600 33 35 31 0d 0a 31 33 35 32 0d 0a 0d 0a 73 6b 69  351..1352....ski
1d610 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
1d620 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
1d630 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
1d640 6c 2d 38 33 35 0d 0a 53 45 4c 45 43 54 20 44 49  l-835..SELECT DI
1d650 53 54 49 4e 43 54 20 2b 20 63 6f 6c 30 20 2b 20  STINCT + col0 + 
1d660 2d 20 63 6f 6c 31 20 2f 20 2b 20 63 6f 72 30 2e  - col1 / + cor0.
1d670 63 6f 6c 30 20 2d 20 2d 20 31 39 20 2a 20 2b 20  col0 - - 19 * + 
1d680 36 37 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  67 AS col1 FROM 
1d690 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab2 cor0..----.
1d6a0 0a 31 32 37 36 0d 0a 31 33 35 31 0d 0a 31 33 35  .1276..1351..135
1d6b0 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  2....query I row
1d6c0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
1d6d0 54 49 4e 43 54 20 2b 20 28 20 63 6f 6c 31 20 29  TINCT + ( col1 )
1d6e0 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20   + col0 AS col0 
1d6f0 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
1d700 30 0d 0a 2d 2d 2d 2d 0d 0a 32 39 0d 0a 37 34 0d  0..----..29..74.
1d710 0a 39 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .93....query I r
1d720 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
1d730 4c 4c 20 2d 20 39 30 20 2a 20 63 6f 72 30 2e 63  LL - 90 * cor0.c
1d740 6f 6c 31 20 2b 20 2b 20 63 6f 6c 31 20 2a 20 2b  ol1 + + col1 * +
1d750 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20   col2 FROM tab2 
1d760 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
1d770 31 39 35 33 0d 0a 2d 33 37 37 36 0d 0a 2d 38 38  1953..-3776..-88
1d780 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  4....query I row
1d790 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
1d7a0 20 63 6f 6c 32 20 2a 20 38 20 2b 20 2d 20 63 6f   col2 * 8 + - co
1d7b0 6c 32 20 2a 20 2d 20 39 33 20 2a 20 63 6f 6c 30  l2 * - 93 * col0
1d7c0 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d   FROM tab1..----
1d7d0 0d 0a 31 35 34 39 38 0d 0a 33 33 39 37 32 30 0d  ..15498..339720.
1d7e0 0a 37 31 35 30 30 38 0d 0a 0d 0a 71 75 65 72 79  .715008....query
1d7f0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
1d800 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 34 35  CT DISTINCT + 45
1d810 20 46 52 4f 4d 20 74 61 62 31 2c 20 74 61 62 30   FROM tab1, tab0
1d820 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
1d830 34 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  45....query I ro
1d840 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
1d850 39 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  9 AS col1 FROM t
1d860 61 62 31 2c 20 74 61 62 32 20 41 53 20 63 6f 72  ab1, tab2 AS cor
1d870 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65  0..----..9 value
1d880 73 20 68 61 73 68 69 6e 67 20 74 6f 20 63 61 66  s hashing to caf
1d890 32 38 36 35 37 62 65 62 34 33 30 34 39 37 34 30  28657beb43049740
1d8a0 66 65 62 65 31 66 61 39 64 65 64 35 61 0d 0a 0d  febe1fa9ded5a...
1d8b0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1d8c0 0d 0a 53 45 4c 45 43 54 20 2b 20 28 20 2d 20 63  ..SELECT + ( - c
1d8d0 6f 6c 31 20 2a 20 63 6f 6c 30 20 29 20 41 53 20  ol1 * col0 ) AS 
1d8e0 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 0d 0a  col1 FROM tab2..
1d8f0 2d 2d 2d 2d 0d 0a 2d 31 33 34 33 0d 0a 2d 32 31  ----..-1343..-21
1d900 37 0d 0a 2d 34 36 30 32 0d 0a 0d 0a 71 75 65 72  7..-4602....quer
1d910 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
1d920 45 43 54 20 2b 20 2d 20 28 20 36 32 20 29 20 2b  ECT + - ( 62 ) +
1d930 20 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46 52   col1 AS col2 FR
1d940 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
1d950 0a 2d 2d 2d 2d 0d 0a 2d 33 0d 0a 2d 33 31 0d 0a  .----..-3..-31..
1d960 2d 34 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  -45....query I r
1d970 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
1d980 20 63 6f 6c 32 20 2a 20 2b 20 37 33 20 2b 20 63   col2 * + 73 + c
1d990 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol2 FROM tab2 AS
1d9a0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 38   cor0..----..-18
1d9b0 37 32 0d 0a 2d 31 39 34 34 0d 0a 2d 32 37 33 36  72..-1944..-2736
1d9c0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
1d9d0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
1d9e0 2d 20 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c 31 20  - col1 * + col1 
1d9f0 2a 20 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46  * col1 AS col2 F
1da00 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab1..----..
1da10 2d 31 30 30 30 0d 0a 2d 31 37 35 37 36 0d 0a 2d  -1000..-17576..-
1da20 32 31 39 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20  2197....query I 
1da30 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
1da40 44 49 53 54 49 4e 43 54 20 31 20 2a 20 63 6f 6c  DISTINCT 1 * col
1da50 32 20 2a 20 28 20 2b 20 74 61 62 32 2e 63 6f 6c  2 * ( + tab2.col
1da60 31 20 29 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  1 ) AS col0 FROM
1da70 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 35 33   tab2..----..153
1da80 34 0d 0a 36 34 36 0d 0a 38 33 37 0d 0a 0d 0a 6f  4..646..837....o
1da90 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75  nlyif mysql # su
1daa0 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20  pport for MySQL 
1dab0 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20  specific system 
1dac0 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78  types and syntax
1dad0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1dae0 74 20 6c 61 62 65 6c 2d 38 34 36 0d 0a 53 45 4c  t label-846..SEL
1daf0 45 43 54 20 63 6f 6c 31 20 2a 20 2b 20 43 41 53  ECT col1 * + CAS
1db00 54 28 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 41  T( + cor0.col1 A
1db10 53 20 53 49 47 4e 45 44 20 29 20 2a 20 63 6f 6c  S SIGNED ) * col
1db20 30 20 2d 20 63 6f 72 30 2e 63 6f 6c 30 20 46 52  0 - cor0.col0 FR
1db30 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
1db40 0a 2d 2d 2d 2d 0d 0a 32 32 37 35 32 0d 0a 32 37  .----..22752..27
1db50 31 34 34 30 0d 0a 36 37 32 30 0d 0a 0d 0a 73 6b  1440..6720....sk
1db60 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
1db70 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
1db80 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
1db90 65 6c 2d 38 34 36 0d 0a 53 45 4c 45 43 54 20 63  el-846..SELECT c
1dba0 6f 6c 31 20 2a 20 2b 20 43 41 53 54 20 28 20 2b  ol1 * + CAST ( +
1dbb0 20 63 6f 72 30 2e 63 6f 6c 31 20 41 53 20 49 4e   cor0.col1 AS IN
1dbc0 54 45 47 45 52 20 29 20 2a 20 63 6f 6c 30 20 2d  TEGER ) * col0 -
1dbd0 20 63 6f 72 30 2e 63 6f 6c 30 20 46 52 4f 4d 20   cor0.col0 FROM 
1dbe0 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
1dbf0 2d 2d 0d 0a 32 32 37 35 32 0d 0a 32 37 31 34 34  --..22752..27144
1dc00 30 0d 0a 36 37 32 30 0d 0a 0d 0a 71 75 65 72 79  0..6720....query
1dc10 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
1dc20 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63 6f  CT DISTINCT + co
1dc30 6c 30 20 2b 20 2b 20 39 33 20 41 53 20 63 6f 6c  l0 + + 93 AS col
1dc40 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  2 FROM tab1 AS c
1dc50 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 35 37 0d 0a  or0..----..157..
1dc60 31 37 33 0d 0a 39 36 0d 0a 0d 0a 71 75 65 72 79  173..96....query
1dc70 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
1dc80 43 54 20 41 4c 4c 20 63 6f 6c 32 20 2d 20 36 20  CT ALL col2 - 6 
1dc90 2a 20 2d 20 37 32 20 46 52 4f 4d 20 74 61 62 31  * - 72 FROM tab1
1dca0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
1dcb0 34 38 36 0d 0a 34 38 39 0d 0a 35 32 38 0d 0a 0d  486..489..528...
1dcc0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1dcd0 0d 0a 53 45 4c 45 43 54 20 2b 20 74 61 62 31 2e  ..SELECT + tab1.
1dce0 63 6f 6c 30 20 2a 20 2b 20 74 61 62 31 2e 63 6f  col0 * + tab1.co
1dcf0 6c 30 20 2a 20 2d 20 34 35 20 2b 20 2d 20 63 6f  l0 * - 45 + - co
1dd00 6c 32 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d  l2 FROM tab1..--
1dd10 2d 2d 0d 0a 2d 31 38 34 33 37 37 0d 0a 2d 32 38  --..-184377..-28
1dd20 38 30 39 36 0d 0a 2d 34 35 39 0d 0a 0d 0a 71 75  8096..-459....qu
1dd30 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
1dd40 45 4c 45 43 54 20 2d 20 74 61 62 31 2e 63 6f 6c  ELECT - tab1.col
1dd50 31 20 2a 20 31 38 20 2a 20 2d 20 63 6f 6c 32 20  1 * 18 * - col2 
1dd60 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
1dd70 31 0d 0a 2d 2d 2d 2d 0d 0a 31 30 32 36 30 0d 0a  1..----..10260..
1dd80 32 32 34 36 34 0d 0a 32 35 32 37 32 0d 0a 0d 0a  22464..25272....
1dd90 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75  onlyif mysql # u
1dda0 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20  se DIV operator 
1ddb0 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69  for integer divi
1ddc0 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f  sion..query I ro
1ddd0 77 73 6f 72 74 20 6c 61 62 65 6c 2d 38 35 31 0d  wsort label-851.
1dde0 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 31 20 44  .SELECT + col1 D
1ddf0 49 56 20 2b 20 63 6f 6c 30 20 2b 20 2d 20 63 6f  IV + col0 + - co
1de00 6c 30 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  l0 col1 FROM tab
1de10 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
1de20 0a 2d 33 0d 0a 2d 37 38 0d 0a 2d 37 39 0d 0a 0d  .-3..-78..-79...
1de30 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73  .skipif postgres
1de40 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20  ql # PostgreSQL 
1de50 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e  requires AS when
1de60 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74   renaming output
1de70 20 63 6f 6c 75 6d 6e 73 0d 0a 73 6b 69 70 69 66   columns..skipif
1de80 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
1de90 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
1dea0 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 38   rowsort label-8
1deb0 35 31 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c  51..SELECT + col
1dec0 31 20 2f 20 2b 20 63 6f 6c 30 20 2b 20 2d 20 63  1 / + col0 + - c
1ded0 6f 6c 30 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61  ol0 col1 FROM ta
1dee0 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
1def0 0d 0a 2d 33 0d 0a 2d 37 38 0d 0a 2d 37 39 0d 0a  ..-3..-78..-79..
1df00 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65  ..skipif postgre
1df10 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c  sql # PostgreSQL
1df20 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65   requires AS whe
1df30 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75  n renaming outpu
1df40 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79  t columns..query
1df50 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
1df60 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 35 38  CT DISTINCT - 58
1df70 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20   col1 FROM tab0 
1df80 41 53 20 63 6f 72 30 20 43 52 4f 53 53 20 4a 4f  AS cor0 CROSS JO
1df90 49 4e 20 74 61 62 32 2c 20 74 61 62 31 20 41 53  IN tab2, tab1 AS
1dfa0 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 38   cor1..----..-58
1dfb0 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
1dfc0 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61   # use DIV opera
1dfd0 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20  tor for integer 
1dfe0 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20  division..query 
1dff0 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
1e000 38 35 33 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 32  853..SELECT col2
1e010 20 44 49 56 20 63 6f 72 30 2e 63 6f 6c 31 20 2d   DIV cor0.col1 -
1e020 20 2d 20 34 32 20 41 53 20 63 6f 6c 31 20 46 52   - 42 AS col1 FR
1e030 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d  OM tab2 cor0..--
1e040 2d 2d 0d 0a 34 32 0d 0a 34 32 0d 0a 34 34 0d 0a  --..42..42..44..
1e050 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
1e060 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
1e070 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1e080 20 6c 61 62 65 6c 2d 38 35 33 0d 0a 53 45 4c 45   label-853..SELE
1e090 43 54 20 63 6f 6c 32 20 2f 20 63 6f 72 30 2e 63  CT col2 / cor0.c
1e0a0 6f 6c 31 20 2d 20 2d 20 34 32 20 41 53 20 63 6f  ol1 - - 42 AS co
1e0b0 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 63 6f 72  l1 FROM tab2 cor
1e0c0 30 0d 0a 2d 2d 2d 2d 0d 0a 34 32 0d 0a 34 32 0d  0..----..42..42.
1e0d0 0a 34 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .44....query I r
1e0e0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
1e0f0 49 53 54 49 4e 43 54 20 63 6f 6c 31 20 2a 20 2d  ISTINCT col1 * -
1e100 20 28 20 2b 20 63 6f 6c 30 20 29 20 2a 20 63 6f   ( + col0 ) * co
1e110 6c 30 20 2b 20 2d 20 35 39 20 46 52 4f 4d 20 74  l0 + - 59 FROM t
1e120 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
1e130 2d 0d 0a 2d 32 39 33 0d 0a 2d 34 31 30 31 39 0d  -..-293..-41019.
1e140 0a 2d 38 33 32 35 39 0d 0a 0d 0a 71 75 65 72 79  .-83259....query
1e150 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
1e160 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 2d 20  CT DISTINCT - - 
1e170 63 6f 6c 32 20 2d 20 36 38 20 46 52 4f 4d 20 74  col2 - 68 FROM t
1e180 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
1e190 2d 0d 0a 2d 31 31 0d 0a 2d 31 34 0d 0a 32 38 0d  -..-11..-14..28.
1e1a0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
1e1b0 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d  rt..SELECT ALL -
1e1c0 20 63 6f 6c 31 20 2a 20 2d 20 31 38 20 2b 20 2d   col1 * - 18 + -
1e1d0 20 36 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53   60 FROM tab2 AS
1e1e0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 30   cor0..----..100
1e1f0 32 0d 0a 32 34 36 0d 0a 34 39 38 0d 0a 0d 0a 71  2..246..498....q
1e200 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
1e210 53 45 4c 45 43 54 20 2d 20 2b 20 63 6f 6c 30 20  SELECT - + col0 
1e220 2a 20 63 6f 6c 31 20 2b 20 2d 20 36 34 20 41 53  * col1 + - 64 AS
1e230 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20   col2 FROM tab0 
1e240 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
1e250 32 31 32 38 0d 0a 2d 33 34 35 39 0d 0a 2d 38 31  2128..-3459..-81
1e260 36 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  63....query I ro
1e270 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
1e280 63 6f 6c 31 20 2b 20 39 38 20 41 53 20 63 6f 6c  col1 + 98 AS col
1e290 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  2 FROM tab2 AS c
1e2a0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 39 0d 0a 36  or0..----..39..6
1e2b0 37 0d 0a 38 31 0d 0a 0d 0a 71 75 65 72 79 20 49  7..81....query I
1e2c0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
1e2d0 20 44 49 53 54 49 4e 43 54 20 63 6f 72 30 2e 63   DISTINCT cor0.c
1e2e0 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  ol2 AS col1 FROM
1e2f0 20 74 61 62 32 2c 20 74 61 62 32 20 41 53 20 63   tab2, tab2 AS c
1e300 6f 72 30 2c 20 74 61 62 32 20 41 53 20 63 6f 72  or0, tab2 AS cor
1e310 31 0d 0a 2d 2d 2d 2d 0d 0a 32 36 0d 0a 32 37 0d  1..----..26..27.
1e320 0a 33 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .38....query I r
1e330 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
1e340 4c 4c 20 2d 20 63 6f 6c 31 20 2b 20 2d 20 63 6f  LL - col1 + - co
1e350 6c 32 20 2b 20 28 20 63 6f 6c 30 20 29 20 41 53  l2 + ( col0 ) AS
1e360 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 0d   col2 FROM tab0.
1e370 0a 2d 2d 2d 2d 0d 0a 2d 36 33 0d 0a 2d 38 34 0d  .----..-63..-84.
1e380 0a 2d 39 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .-95....query I 
1e390 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
1e3a0 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c 32 20  DISTINCT - col2 
1e3b0 2a 20 2b 20 74 61 62 30 2e 63 6f 6c 30 20 2a 20  * + tab0.col0 * 
1e3c0 39 37 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74  97 + col1 FROM t
1e3d0 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 32 39 38  ab0..----..-3298
1e3e0 0d 0a 2d 37 30 37 38 31 35 0d 0a 2d 37 36 37 33  ..-707815..-7673
1e3f0 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  8....query I row
1e400 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
1e410 54 49 4e 43 54 20 2d 20 63 6f 6c 32 20 2d 20 63  TINCT - col2 - c
1e420 6f 6c 32 20 2a 20 2d 20 28 20 2b 20 63 6f 6c 32  ol2 * - ( + col2
1e430 20 2b 20 33 30 20 29 20 46 52 4f 4d 20 74 61 62   + 30 ) FROM tab
1e440 30 0d 0a 2d 2d 2d 2d 0d 0a 32 30 34 36 0d 0a 33  0..----..2046..3
1e450 30 0d 0a 39 31 30 32 0d 0a 0d 0a 73 6b 69 70 69  0..9102....skipi
1e460 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50  f postgresql # P
1e470 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72  ostgreSQL requir
1e480 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d  es AS when renam
1e490 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d  ing output colum
1e4a0 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ns..query I rows
1e4b0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
1e4c0 49 4e 43 54 20 2d 20 74 61 62 31 2e 63 6f 6c 30  INCT - tab1.col0
1e4d0 20 2a 20 2b 20 63 6f 6c 30 20 2b 20 2d 20 63 6f   * + col0 + - co
1e4e0 6c 32 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  l2 col2 FROM tab
1e4f0 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 31 35 33 0d 0a  1..----..-4153..
1e500 2d 36 33 0d 0a 2d 36 34 39 36 0d 0a 0d 0a 71 75  -63..-6496....qu
1e510 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
1e520 45 4c 45 43 54 20 2d 20 63 6f 6c 30 20 2b 20 2b  ELECT - col0 + +
1e530 20 31 31 20 2a 20 63 6f 6c 30 20 2b 20 63 6f 6c   11 * col0 + col
1e540 32 20 2a 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20  2 * + col0 FROM 
1e550 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 39 32 0d  tab1..----..192.
1e560 0a 34 32 38 38 0d 0a 38 34 38 30 0d 0a 0d 0a 71  .4288..8480....q
1e570 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
1e580 53 45 4c 45 43 54 20 2b 20 74 61 62 30 2e 63 6f  SELECT + tab0.co
1e590 6c 30 20 2a 20 2b 20 63 6f 6c 30 20 41 53 20 63  l0 * + col0 AS c
1e5a0 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d  ol2 FROM tab0..-
1e5b0 2d 2d 2d 0d 0a 31 32 32 35 0d 0a 35 37 36 0d 0a  ---..1225..576..
1e5c0 37 39 32 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20  7921....query I 
1e5d0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
1e5e0 41 4c 4c 20 2d 20 2b 20 63 6f 6c 31 20 2a 20 37  ALL - + col1 * 7
1e5f0 31 20 2a 20 63 6f 6c 32 20 41 53 20 63 6f 6c 30  1 * col2 AS col0
1e600 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
1e610 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 30 31 34 39  r0..----..-20149
1e620 38 0d 0a 2d 35 32 39 38 30 32 0d 0a 2d 36 38 38  8..-529802..-688
1e630 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  7....query I row
1e640 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
1e650 54 49 4e 43 54 20 2b 20 63 6f 6c 31 20 2a 20 28  TINCT + col1 * (
1e660 20 2d 20 63 6f 6c 31 20 29 20 41 53 20 63 6f 6c   - col1 ) AS col
1e670 30 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30  0 FROM tab0 cor0
1e680 0d 0a 2d 2d 2d 2d 0d 0a 2d 37 33 39 36 0d 0a 2d  ..----..-7396..-
1e690 38 32 38 31 0d 0a 2d 39 34 30 39 0d 0a 0d 0a 71  8281..-9409....q
1e6a0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
1e6b0 53 45 4c 45 43 54 20 63 6f 72 30 2e 63 6f 6c 31  SELECT cor0.col1
1e6c0 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
1e6d0 62 32 2c 20 74 61 62 30 20 41 53 20 63 6f 72 30  b2, tab0 AS cor0
1e6e0 2c 20 74 61 62 32 20 41 53 20 63 6f 72 31 2c 20  , tab2 AS cor1, 
1e6f0 74 61 62 31 20 41 53 20 63 6f 72 32 0d 0a 2d 2d  tab1 AS cor2..--
1e700 2d 2d 0d 0a 38 31 20 76 61 6c 75 65 73 20 68 61  --..81 values ha
1e710 73 68 69 6e 67 20 74 6f 20 38 63 39 64 62 35 30  shing to 8c9db50
1e720 31 61 36 30 34 65 61 36 36 65 33 62 35 65 35 35  1a604ea66e3b5e55
1e730 39 38 66 33 66 32 61 39 31 0d 0a 0d 0a 71 75 65  98f3f2a91....que
1e740 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
1e750 4c 45 43 54 20 31 36 20 2a 20 37 32 20 46 52 4f  LECT 16 * 72 FRO
1e760 4d 20 74 61 62 32 2c 20 74 61 62 31 20 41 53 20  M tab2, tab1 AS 
1e770 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61  cor0..----..9 va
1e780 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20  lues hashing to 
1e790 63 30 66 62 64 35 38 39 66 66 62 36 61 32 33 62  c0fbd589ffb6a23b
1e7a0 33 64 30 36 61 34 65 36 65 38 64 62 32 31 33 39  3d06a4e6e8db2139
1e7b0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
1e7c0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f  ort..SELECT - co
1e7d0 6c 32 20 2b 20 2d 20 63 6f 6c 31 20 2a 20 63 6f  l2 + - col1 * co
1e7e0 6c 30 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  l0 AS col0 FROM 
1e7f0 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
1e800 2d 2d 0d 0a 2d 31 31 33 36 0d 0a 2d 31 33 32 0d  --..-1136..-132.
1e810 0a 2d 36 39 37 0d 0a 0d 0a 71 75 65 72 79 20 49  .-697....query I
1e820 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
1e830 20 44 49 53 54 49 4e 43 54 20 2d 20 28 20 2b 20   DISTINCT - ( + 
1e840 63 6f 6c 31 20 29 20 2a 20 2b 20 63 6f 6c 30 20  col1 ) * + col0 
1e850 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
1e860 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 34 33 0d 0a  0..----..-1343..
1e870 2d 32 31 37 0d 0a 2d 34 36 30 32 0d 0a 0d 0a 71  -217..-4602....q
1e880 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
1e890 53 45 4c 45 43 54 20 2b 20 2d 20 28 20 63 6f 72  SELECT + - ( cor
1e8a0 30 2e 63 6f 6c 32 20 29 20 2b 20 63 6f 6c 30 20  0.col2 ) + col0 
1e8b0 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
1e8c0 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 36 0d 0a 2d 35  0..----..-16..-5
1e8d0 31 0d 0a 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20  1..7....query I 
1e8e0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
1e8f0 44 49 53 54 49 4e 43 54 20 2b 20 28 20 2b 20 63  DISTINCT + ( + c
1e900 6f 6c 32 20 29 20 2a 20 63 6f 72 30 2e 63 6f 6c  ol2 ) * cor0.col
1e910 30 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30  0 FROM tab0 cor0
1e920 0d 0a 2d 2d 2d 2d 0d 0a 33 35 0d 0a 37 32 39 38  ..----..35..7298
1e930 0d 0a 37 39 32 0d 0a 0d 0a 71 75 65 72 79 20 49  ..792....query I
1e940 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
1e950 20 41 4c 4c 20 2b 20 2d 20 63 6f 6c 30 20 2a 20   ALL + - col0 * 
1e960 63 6f 6c 31 20 2a 20 63 6f 6c 32 20 46 52 4f 4d  col1 * col2 FROM
1e970 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
1e980 2d 2d 2d 0d 0a 2d 33 36 34 38 30 0d 0a 2d 34 32  ---..-36480..-42
1e990 31 32 0d 0a 2d 39 39 38 34 30 0d 0a 0d 0a 6f 6e  12..-99840....on
1e9a0 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
1e9b0 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
1e9c0 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
1e9d0 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
1e9e0 6f 72 74 20 6c 61 62 65 6c 2d 38 37 35 0d 0a 53  ort label-875..S
1e9f0 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b  ELECT DISTINCT +
1ea00 20 32 31 20 44 49 56 20 63 6f 72 30 2e 63 6f 6c   21 DIV cor0.col
1ea10 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  0 FROM tab2 AS c
1ea20 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 33 0d  or0..----..0..3.
1ea30 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
1ea40 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
1ea50 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1ea60 74 20 6c 61 62 65 6c 2d 38 37 35 0d 0a 53 45 4c  t label-875..SEL
1ea70 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 32  ECT DISTINCT + 2
1ea80 31 20 2f 20 63 6f 72 30 2e 63 6f 6c 30 20 46 52  1 / cor0.col0 FR
1ea90 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
1eaa0 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 33 0d 0a 0d 0a 71  .----..0..3....q
1eab0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
1eac0 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 72 30 2e  SELECT ALL cor0.
1ead0 63 6f 6c 31 20 2d 20 2d 20 28 20 63 6f 72 30 2e  col1 - - ( cor0.
1eae0 63 6f 6c 32 20 2b 20 63 6f 6c 31 20 29 20 46 52  col2 + col1 ) FR
1eaf0 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d  OM tab1 cor0..--
1eb00 2d 2d 0d 0a 31 30 36 0d 0a 31 32 32 0d 0a 37 37  --..106..122..77
1eb10 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
1eb20 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 28 20  ort..SELECT - ( 
1eb30 63 6f 6c 30 20 29 20 2b 20 2d 20 63 6f 6c 31 20  col0 ) + - col1 
1eb40 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
1eb50 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 30 0d 0a 2d  0..----..-110..-
1eb60 31 33 32 0d 0a 2d 31 38 30 0d 0a 0d 0a 6f 6e 6c  132..-180....onl
1eb70 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20  yif mysql # use 
1eb80 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72  DIV operator for
1eb90 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f   integer divisio
1eba0 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  n..query I rowso
1ebb0 72 74 20 6c 61 62 65 6c 2d 38 37 38 0d 0a 53 45  rt label-878..SE
1ebc0 4c 45 43 54 20 2d 20 2d 20 63 6f 6c 30 20 2b 20  LECT - - col0 + 
1ebd0 2b 20 63 6f 6c 31 20 44 49 56 20 2d 20 63 6f 6c  + col1 DIV - col
1ebe0 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  2 FROM tab0 AS c
1ebf0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 36 32 0d 0a  or0..----..-62..
1ec00 32 32 0d 0a 38 38 0d 0a 0d 0a 73 6b 69 70 69 66  22..88....skipif
1ec10 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
1ec20 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
1ec30 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 38   rowsort label-8
1ec40 37 38 0d 0a 53 45 4c 45 43 54 20 2d 20 2d 20 63  78..SELECT - - c
1ec50 6f 6c 30 20 2b 20 2b 20 63 6f 6c 31 20 2f 20 2d  ol0 + + col1 / -
1ec60 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20   col2 FROM tab0 
1ec70 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
1ec80 36 32 0d 0a 32 32 0d 0a 38 38 0d 0a 0d 0a 71 75  62..22..88....qu
1ec90 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
1eca0 45 4c 45 43 54 20 2d 20 33 39 20 2a 20 2b 20 63  ELECT - 39 * + c
1ecb0 6f 6c 31 20 2b 20 2d 20 63 6f 6c 32 20 46 52 4f  ol1 + - col2 FRO
1ecc0 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
1ecd0 2d 2d 2d 2d 0d 0a 2d 31 30 36 38 0d 0a 2d 34 34  ----..-1068..-44
1ece0 37 0d 0a 2d 36 30 33 0d 0a 0d 0a 6f 6e 6c 79 69  7..-603....onlyi
1ecf0 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49  f mysql # use DI
1ed00 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69  V operator for i
1ed10 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d  nteger division.
1ed20 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1ed30 20 6c 61 62 65 6c 2d 38 38 30 0d 0a 53 45 4c 45   label-880..SELE
1ed40 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 32 20 2a 20  CT ALL - col2 * 
1ed50 63 6f 6c 32 20 44 49 56 20 2d 20 63 6f 6c 31 20  col2 DIV - col1 
1ed60 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a  FROM tab0 cor0..
1ed70 2d 2d 2d 2d 0d 0a 30 0d 0a 31 32 0d 0a 37 33 0d  ----..0..12..73.
1ed80 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
1ed90 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
1eda0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1edb0 74 20 6c 61 62 65 6c 2d 38 38 30 0d 0a 53 45 4c  t label-880..SEL
1edc0 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 32 20 2a  ECT ALL - col2 *
1edd0 20 63 6f 6c 32 20 2f 20 2d 20 63 6f 6c 31 20 46   col2 / - col1 F
1ede0 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d  ROM tab0 cor0..-
1edf0 2d 2d 2d 0d 0a 30 0d 0a 31 32 0d 0a 37 33 0d 0a  ---..0..12..73..
1ee00 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1ee10 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20  t..SELECT ALL + 
1ee20 63 6f 72 30 2e 63 6f 6c 31 20 2a 20 2b 20 63 6f  cor0.col1 * + co
1ee30 6c 32 20 2a 20 63 6f 6c 32 20 46 52 4f 4d 20 74  l2 * col2 FROM t
1ee40 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
1ee50 2d 0d 0a 36 31 31 38 38 34 0d 0a 39 33 36 35 34  -..611884..93654
1ee60 0d 0a 39 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..97....query I 
1ee70 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
1ee80 44 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c 30 20  DISTINCT + col0 
1ee90 2a 20 2d 20 39 36 20 46 52 4f 4d 20 74 61 62 31  * - 96 FROM tab1
1eea0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
1eeb0 2d 32 38 38 0d 0a 2d 36 31 34 34 0d 0a 2d 37 36  -288..-6144..-76
1eec0 38 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  80....query I ro
1eed0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
1eee0 4c 20 2b 20 2b 20 28 20 63 6f 6c 30 20 29 20 2b  L + + ( col0 ) +
1eef0 20 63 6f 6c 31 20 2d 20 63 6f 6c 31 20 46 52 4f   col1 - col1 FRO
1ef00 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
1ef10 2d 2d 2d 2d 0d 0a 32 34 0d 0a 33 35 0d 0a 38 39  ----..24..35..89
1ef20 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
1ef30 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d   # support for M
1ef40 79 53 51 4c 20 73 70 65 63 69 66 69 63 20 73 79  ySQL specific sy
1ef50 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73  stem types and s
1ef60 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72  yntax..query I r
1ef70 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 38 38 34  owsort label-884
1ef80 0d 0a 53 45 4c 45 43 54 20 2d 20 2b 20 43 41 53  ..SELECT - + CAS
1ef90 54 28 20 4e 55 4c 4c 20 41 53 20 53 49 47 4e 45  T( NULL AS SIGNE
1efa0 44 20 29 20 2d 20 2b 20 63 6f 6c 32 20 41 53 20  D ) - + col2 AS 
1efb0 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41  col2 FROM tab2 A
1efc0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55  S cor0..----..NU
1efd0 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a  LL..NULL..NULL..
1efe0 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
1eff0 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
1f000 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1f010 20 6c 61 62 65 6c 2d 38 38 34 0d 0a 53 45 4c 45   label-884..SELE
1f020 43 54 20 2d 20 2b 20 43 41 53 54 20 28 20 4e 55  CT - + CAST ( NU
1f030 4c 4c 20 41 53 20 49 4e 54 45 47 45 52 20 29 20  LL AS INTEGER ) 
1f040 2d 20 2b 20 63 6f 6c 32 20 41 53 20 63 6f 6c 32  - + col2 AS col2
1f050 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
1f060 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a  r0..----..NULL..
1f070 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75  NULL..NULL....qu
1f080 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
1f090 45 4c 45 43 54 20 2b 20 63 6f 6c 32 20 2b 20 2b  ELECT + col2 + +
1f0a0 20 35 38 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d   58 FROM tab1..-
1f0b0 2d 2d 2d 0d 0a 31 31 32 0d 0a 31 31 35 0d 0a 31  ---..112..115..1
1f0c0 35 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  54....query I ro
1f0d0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
1f0e0 53 54 49 4e 43 54 20 2d 20 63 6f 6c 31 20 2b 20  STINCT - col1 + 
1f0f0 63 6f 6c 31 20 2d 20 35 32 20 2a 20 63 6f 6c 32  col1 - 52 * col2
1f100 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d   FROM tab2..----
1f110 0d 0a 2d 31 33 35 32 0d 0a 2d 31 34 30 34 0d 0a  ..-1352..-1404..
1f120 2d 31 39 37 36 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  -1976....onlyif 
1f130 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20  mysql # use DIV 
1f140 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74  operator for int
1f150 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71  eger division..q
1f160 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
1f170 61 62 65 6c 2d 38 38 37 0d 0a 53 45 4c 45 43 54  abel-887..SELECT
1f180 20 2d 20 74 61 62 32 2e 63 6f 6c 31 20 44 49 56   - tab2.col1 DIV
1f190 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62   + col1 FROM tab
1f1a0 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 2d 31 0d  2..----..-1..-1.
1f1b0 0a 2d 31 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  .-1....skipif my
1f1c0 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
1f1d0 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
1f1e0 77 73 6f 72 74 20 6c 61 62 65 6c 2d 38 38 37 0d  wsort label-887.
1f1f0 0a 53 45 4c 45 43 54 20 2d 20 74 61 62 32 2e 63  .SELECT - tab2.c
1f200 6f 6c 31 20 2f 20 2b 20 63 6f 6c 31 20 46 52 4f  ol1 / + col1 FRO
1f210 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  M tab2..----..-1
1f220 0d 0a 2d 31 0d 0a 2d 31 0d 0a 0d 0a 71 75 65 72  ..-1..-1....quer
1f230 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
1f240 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 37  ECT DISTINCT - 7
1f250 34 20 2b 20 2b 20 39 38 20 41 53 20 63 6f 6c 30  4 + + 98 AS col0
1f260 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
1f270 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 34 0d 0a 0d 0a  r0..----..24....
1f280 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
1f290 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
1f2a0 20 2d 20 34 32 20 2a 20 2d 20 63 6f 6c 31 20 2a   - 42 * - col1 *
1f2b0 20 2b 20 63 6f 6c 30 20 2b 20 2b 20 38 37 20 46   + col0 + + 87 F
1f2c0 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
1f2d0 0d 0a 2d 2d 2d 2d 0d 0a 31 34 32 36 37 37 0d 0a  ..----..142677..
1f2e0 33 34 30 32 34 35 0d 0a 38 36 37 37 35 0d 0a 0d  340245..86775...
1f2f0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1f300 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63  ..SELECT ALL - c
1f310 6f 72 30 2e 63 6f 6c 31 20 2d 20 2b 20 31 36 20  or0.col1 - + 16 
1f320 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
1f330 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
1f340 0a 2d 32 36 0d 0a 2d 32 39 0d 0a 2d 34 32 0d 0a  .-26..-29..-42..
1f350 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
1f360 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f   use DIV operato
1f370 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69  r for integer di
1f380 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20  vision..query I 
1f390 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 38 39  rowsort label-89
1f3a0 31 0d 0a 53 45 4c 45 43 54 20 2d 20 32 31 20 44  1..SELECT - 21 D
1f3b0 49 56 20 2b 20 63 6f 6c 32 20 2b 20 2b 20 63 6f  IV + col2 + + co
1f3c0 6c 32 20 2a 20 33 35 20 46 52 4f 4d 20 74 61 62  l2 * 35 FROM tab
1f3d0 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
1f3e0 0a 31 31 35 35 0d 0a 31 34 0d 0a 32 38 37 30 0d  .1155..14..2870.
1f3f0 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
1f400 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
1f410 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1f420 74 20 6c 61 62 65 6c 2d 38 39 31 0d 0a 53 45 4c  t label-891..SEL
1f430 45 43 54 20 2d 20 32 31 20 2f 20 2b 20 63 6f 6c  ECT - 21 / + col
1f440 32 20 2b 20 2b 20 63 6f 6c 32 20 2a 20 33 35 20  2 + + col2 * 35 
1f450 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
1f460 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 35 35 0d 0a 31  0..----..1155..1
1f470 34 0d 0a 32 38 37 30 0d 0a 0d 0a 71 75 65 72 79  4..2870....query
1f480 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
1f490 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 2d 20  CT DISTINCT - - 
1f4a0 28 20 2b 20 38 34 20 29 20 2b 20 2d 20 63 6f 6c  ( + 84 ) + - col
1f4b0 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  0 FROM tab2 AS c
1f4c0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 35 0d 0a 36 0d  or0..----..5..6.
1f4d0 0a 37 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .77....query I r
1f4e0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
1f4f0 49 53 54 49 4e 43 54 20 2b 20 37 37 20 2a 20 2d  ISTINCT + 77 * -
1f500 20 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46 52   col0 AS col1 FR
1f510 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
1f520 0a 2d 2d 2d 2d 0d 0a 2d 31 38 34 38 0d 0a 2d 32  .----..-1848..-2
1f530 36 39 35 0d 0a 2d 36 38 35 33 0d 0a 0d 0a 73 6b  695..-6853....sk
1f540 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20  ipif postgresql 
1f550 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71  # PostgreSQL req
1f560 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65  uires AS when re
1f570 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f  naming output co
1f580 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72  lumns..query I r
1f590 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
1f5a0 49 53 54 49 4e 43 54 20 63 6f 6c 31 20 2a 20 2d  ISTINCT col1 * -
1f5b0 20 63 6f 6c 31 20 2a 20 28 20 63 6f 72 30 2e 63   col1 * ( cor0.c
1f5c0 6f 6c 32 20 29 20 63 6f 6c 30 20 46 52 4f 4d 20  ol2 ) col0 FROM 
1f5d0 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
1f5e0 2d 2d 0d 0a 2d 31 30 39 38 32 0d 0a 2d 32 35 39  --..-10982..-259
1f5f0 34 37 0d 0a 2d 39 30 35 30 36 0d 0a 0d 0a 71 75  47..-90506....qu
1f600 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
1f610 45 4c 45 43 54 20 2b 20 35 32 20 2a 20 2d 20 63  ELECT + 52 * - c
1f620 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  ol2 AS col0 FROM
1f630 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab2 cor0..----
1f640 0d 0a 2d 31 33 35 32 0d 0a 2d 31 34 30 34 0d 0a  ..-1352..-1404..
1f650 2d 31 39 37 36 0d 0a 0d 0a 71 75 65 72 79 20 49  -1976....query I
1f660 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
1f670 20 44 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c 31   DISTINCT + col1
1f680 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20   + col0 AS col0 
1f690 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a  FROM tab1 cor0..
1f6a0 2d 2d 2d 2d 0d 0a 32 39 0d 0a 37 34 0d 0a 39 33  ----..29..74..93
1f6b0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
1f6c0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 37 37  ort..SELECT - 77
1f6d0 20 2a 20 63 6f 6c 32 20 2b 20 2b 20 63 6f 72 30   * col2 + + cor0
1f6e0 2e 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20  .col2 FROM tab0 
1f6f0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
1f700 32 35 30 38 0d 0a 2d 36 32 33 32 0d 0a 2d 37 36  2508..-6232..-76
1f710 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
1f720 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
1f730 2b 20 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c 32 20  + col0 * - col2 
1f740 2a 20 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46  * col0 AS col2 F
1f750 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
1f760 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 32 33 0d 0a 2d  ..----..-1323..-
1f770 31 35 38 31 38 34 0d 0a 2d 32 33 37 31 35 38 0d  158184..-237158.
1f780 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
1f790 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
1f7a0 4e 43 54 20 2b 20 63 6f 6c 32 20 2b 20 2b 20 63  NCT + col2 + + c
1f7b0 6f 6c 32 20 2a 20 2b 20 63 6f 72 30 2e 63 6f 6c  ol2 * + cor0.col
1f7c0 30 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  0 AS col0 FROM t
1f7d0 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
1f7e0 2d 0d 0a 33 36 0d 0a 37 33 38 30 0d 0a 38 32 35  -..36..7380..825
1f7f0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
1f800 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
1f810 49 4e 43 54 20 2b 20 63 6f 6c 32 20 2a 20 2b 20  INCT + col2 * + 
1f820 63 6f 6c 31 20 2a 20 2d 20 28 20 2b 20 63 6f 6c  col1 * - ( + col
1f830 31 20 29 20 46 52 4f 4d 20 74 61 62 32 20 41 53  1 ) FROM tab2 AS
1f840 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30   cor0..----..-10
1f850 39 38 32 0d 0a 2d 32 35 39 34 37 0d 0a 2d 39 30  982..-25947..-90
1f860 35 30 36 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  506....onlyif my
1f870 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70  sql # use DIV op
1f880 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67  erator for integ
1f890 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65  er division..que
1f8a0 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
1f8b0 65 6c 2d 39 30 31 0d 0a 53 45 4c 45 43 54 20 2d  el-901..SELECT -
1f8c0 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 44 49 56   + cor0.col2 DIV
1f8d0 20 2d 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20   - col0 AS col0 
1f8e0 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
1f8f0 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 31 0d 0a 31  0..----..0..1..1
1f900 38 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  8....skipif mysq
1f910 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
1f920 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
1f930 6f 72 74 20 6c 61 62 65 6c 2d 39 30 31 0d 0a 53  ort label-901..S
1f940 45 4c 45 43 54 20 2d 20 2b 20 63 6f 72 30 2e 63  ELECT - + cor0.c
1f950 6f 6c 32 20 2f 20 2d 20 63 6f 6c 30 20 41 53 20  ol2 / - col0 AS 
1f960 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41  col0 FROM tab1 A
1f970 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d  S cor0..----..0.
1f980 0a 31 0d 0a 31 38 0d 0a 0d 0a 71 75 65 72 79 20  .1..18....query 
1f990 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
1f9a0 54 20 41 4c 4c 20 34 38 20 2b 20 2b 20 63 6f 6c  T ALL 48 + + col
1f9b0 31 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  1 AS col2 FROM t
1f9c0 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab1 cor0..----..
1f9d0 35 38 0d 0a 36 31 0d 0a 37 34 0d 0a 0d 0a 6f 6e  58..61..74....on
1f9e0 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70  lyif mysql # sup
1f9f0 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73  port for MySQL s
1fa00 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20 74  pecific system t
1fa10 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d  ypes and syntax.
1fa20 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1fa30 20 6c 61 62 65 6c 2d 39 30 33 0d 0a 53 45 4c 45   label-903..SELE
1fa40 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 31  CT DISTINCT col1
1fa50 20 2a 20 63 6f 6c 31 20 2a 20 43 41 53 54 28 20   * col1 * CAST( 
1fa60 2b 20 63 6f 6c 32 20 41 53 20 53 49 47 4e 45 44  + col2 AS SIGNED
1fa70 20 29 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20   ) AS col2 FROM 
1fa80 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab0 cor0..----.
1fa90 0a 32 34 34 30 36 38 0d 0a 36 37 39 30 34 32 0d  .244068..679042.
1faa0 0a 39 34 30 39 0d 0a 0d 0a 73 6b 69 70 69 66 20  .9409....skipif 
1fab0 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
1fac0 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
1fad0 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 39 30  rowsort label-90
1fae0 33 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  3..SELECT DISTIN
1faf0 43 54 20 63 6f 6c 31 20 2a 20 63 6f 6c 31 20 2a  CT col1 * col1 *
1fb00 20 43 41 53 54 20 28 20 2b 20 63 6f 6c 32 20 41   CAST ( + col2 A
1fb10 53 20 49 4e 54 45 47 45 52 20 29 20 41 53 20 63  S INTEGER ) AS c
1fb20 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 63 6f  ol2 FROM tab0 co
1fb30 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 34 34 30 36 38  r0..----..244068
1fb40 0d 0a 36 37 39 30 34 32 0d 0a 39 34 30 39 0d 0a  ..679042..9409..
1fb50 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1fb60 74 0d 0a 53 45 4c 45 43 54 20 2d 20 33 33 20 2a  t..SELECT - 33 *
1fb70 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 41 53 20   - cor0.col2 AS 
1fb80 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41  col2 FROM tab0 A
1fb90 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30  S cor0..----..10
1fba0 38 39 0d 0a 32 37 30 36 0d 0a 33 33 0d 0a 0d 0a  89..2706..33....
1fbb0 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75  onlyif mysql # u
1fbc0 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20  se DIV operator 
1fbd0 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69  for integer divi
1fbe0 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f  sion..query I ro
1fbf0 77 73 6f 72 74 20 6c 61 62 65 6c 2d 39 30 35 0d  wsort label-905.
1fc00 0a 53 45 4c 45 43 54 20 63 6f 6c 30 20 2b 20 2b  .SELECT col0 + +
1fc10 20 63 6f 6c 30 20 44 49 56 20 2d 20 63 6f 72 30   col0 DIV - cor0
1fc20 2e 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20  .col0 FROM tab2 
1fc30 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 36 0d 0a 37  cor0..----..6..7
1fc40 37 0d 0a 37 38 0d 0a 0d 0a 73 6b 69 70 69 66 20  7..78....skipif 
1fc50 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
1fc60 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
1fc70 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 39 30  rowsort label-90
1fc80 35 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 30 20 2b  5..SELECT col0 +
1fc90 20 2b 20 63 6f 6c 30 20 2f 20 2d 20 63 6f 72 30   + col0 / - cor0
1fca0 2e 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20  .col0 FROM tab2 
1fcb0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 36 0d 0a 37  cor0..----..6..7
1fcc0 37 0d 0a 37 38 0d 0a 0d 0a 71 75 65 72 79 20 49  7..78....query I
1fcd0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
1fce0 20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c 32   DISTINCT - col2
1fcf0 20 2a 20 28 20 28 20 63 6f 6c 31 20 29 20 29 20   * ( ( col1 ) ) 
1fd00 2a 20 2d 20 63 6f 6c 30 20 41 53 20 63 6f 6c 32  * - col0 AS col2
1fd10 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
1fd20 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 33 39 35 0d 0a  r0..----..3395..
1fd30 36 36 34 31 31 38 0d 0a 36 38 31 31 32 0d 0a 0d  664118..68112...
1fd40 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1fd50 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
1fd60 54 20 2d 20 35 36 20 46 52 4f 4d 20 74 61 62 30  T - 56 FROM tab0
1fd70 2c 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  , tab1 AS cor0..
1fd80 2d 2d 2d 2d 0d 0a 2d 35 36 0d 0a 0d 0a 71 75 65  ----..-56....que
1fd90 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
1fda0 4c 45 43 54 20 41 4c 4c 20 63 6f 72 30 2e 63 6f  LECT ALL cor0.co
1fdb0 6c 32 20 2b 20 2b 20 39 37 20 46 52 4f 4d 20 74  l2 + + 97 FROM t
1fdc0 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
1fdd0 2d 0d 0a 31 35 31 0d 0a 31 35 34 0d 0a 31 39 33  -..151..154..193
1fde0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
1fdf0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
1fe00 2b 20 30 20 46 52 4f 4d 20 74 61 62 32 2c 20 74  + 0 FROM tab2, t
1fe10 61 62 30 20 41 53 20 63 6f 72 30 2c 20 74 61 62  ab0 AS cor0, tab
1fe20 32 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d  2 AS cor1..----.
1fe30 0a 32 37 20 76 61 6c 75 65 73 20 68 61 73 68 69  .27 values hashi
1fe40 6e 67 20 74 6f 20 65 32 35 36 38 62 30 31 64 64  ng to e2568b01dd
1fe50 34 31 31 62 35 61 32 30 36 30 36 38 36 39 37 64  411b5a206068697d
1fe60 30 65 64 30 64 32 0d 0a 0d 0a 71 75 65 72 79 20  0ed0d2....query 
1fe70 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
1fe80 54 20 63 6f 72 30 2e 63 6f 6c 31 20 2a 20 2d 20  T cor0.col1 * - 
1fe90 34 34 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  44 AS col0 FROM 
1fea0 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
1feb0 2d 2d 0d 0a 2d 33 37 38 34 0d 0a 2d 34 30 30 34  --..-3784..-4004
1fec0 0d 0a 2d 34 32 36 38 0d 0a 0d 0a 71 75 65 72 79  ..-4268....query
1fed0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
1fee0 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 2b 20  CT DISTINCT - + 
1fef0 63 6f 6c 30 20 2a 20 2d 20 63 6f 72 30 2e 63 6f  col0 * - cor0.co
1ff00 6c 32 20 2a 20 2b 20 36 35 20 46 52 4f 4d 20 74  l2 * + 65 FROM t
1ff10 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
1ff20 2d 0d 0a 31 32 32 38 35 0d 0a 31 33 31 38 32 30  -..12285..131820
1ff30 0d 0a 31 39 35 31 33 30 0d 0a 0d 0a 71 75 65 72  ..195130....quer
1ff40 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
1ff50 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 2b  ECT DISTINCT + +
1ff60 20 63 6f 6c 30 20 2a 20 34 38 20 41 53 20 63 6f   col0 * 48 AS co
1ff70 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72  l2 FROM tab0 cor
1ff80 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 35 32 0d 0a 31  0..----..1152..1
1ff90 36 38 30 0d 0a 34 32 37 32 0d 0a 0d 0a 71 75 65  680..4272....que
1ffa0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
1ffb0 4c 45 43 54 20 41 4c 4c 20 2d 20 38 34 20 2b 20  LECT ALL - 84 + 
1ffc0 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46 52 4f  col0 AS col1 FRO
1ffd0 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab0 cor0..---
1ffe0 2d 0d 0a 2d 34 39 0d 0a 2d 36 30 0d 0a 35 0d 0a  -..-49..-60..5..
1fff0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
20000 74 0d 0a 53 45 4c 45 43 54 20 2d 20 28 20 2b 20  t..SELECT - ( + 
20010 63 6f 6c 31 20 29 20 2a 20 2b 20 63 6f 6c 32 20  col1 ) * + col2 
20020 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
20030 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
20040 0a 2d 31 35 33 34 0d 0a 2d 36 34 36 0d 0a 2d 38  .-1534..-646..-8
20050 33 37 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  37....onlyif mys
20060 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65  ql # use DIV ope
20070 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65  rator for intege
20080 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72  r division..quer
20090 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
200a0 6c 2d 39 31 35 0d 0a 53 45 4c 45 43 54 20 44 49  l-915..SELECT DI
200b0 53 54 49 4e 43 54 20 63 6f 6c 30 20 2a 20 2d 20  STINCT col0 * - 
200c0 32 34 20 2b 20 2b 20 63 6f 6c 32 20 2a 20 39 32  24 + + col2 * 92
200d0 20 44 49 56 20 2d 20 28 20 63 6f 6c 30 20 29 20   DIV - ( col0 ) 
200e0 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
200f0 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
20100 0a 2d 31 36 31 37 0d 0a 2d 31 37 32 38 0d 0a 2d  .-1617..-1728..-
20110 32 30 33 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  2030....skipif m
20120 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
20130 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
20140 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 39 31 35  owsort label-915
20150 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
20160 54 20 63 6f 6c 30 20 2a 20 2d 20 32 34 20 2b 20  T col0 * - 24 + 
20170 2b 20 63 6f 6c 32 20 2a 20 39 32 20 2f 20 2d 20  + col2 * 92 / - 
20180 28 20 63 6f 6c 30 20 29 20 41 53 20 63 6f 6c 30  ( col0 ) AS col0
20190 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
201a0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 36 31 37 0d  r0..----..-1617.
201b0 0a 2d 31 37 32 38 0d 0a 2d 32 30 33 30 0d 0a 0d  .-1728..-2030...
201c0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
201d0 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 38  ..SELECT ALL + 8
201e0 37 20 2b 20 63 6f 6c 32 20 41 53 20 63 6f 6c 32  7 + col2 AS col2
201f0 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
20200 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 33 0d 0a 31  r0..----..113..1
20210 31 34 0d 0a 31 32 35 0d 0a 0d 0a 71 75 65 72 79  14..125....query
20220 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
20230 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 2d 20  CT DISTINCT + - 
20240 37 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  7 FROM tab2 AS c
20250 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 37 0d 0a 0d  or0..----..-7...
20260 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
20270 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51  support for MySQ
20280 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65  L specific syste
20290 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74  m types and synt
202a0 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ax..query I rows
202b0 6f 72 74 20 6c 61 62 65 6c 2d 39 31 38 0d 0a 53  ort label-918..S
202c0 45 4c 45 43 54 20 2d 20 43 41 53 54 28 20 4e 55  ELECT - CAST( NU
202d0 4c 4c 20 41 53 20 53 49 47 4e 45 44 20 29 20 2b  LL AS SIGNED ) +
202e0 20 2b 20 63 6f 6c 31 20 2f 20 2b 20 63 6f 6c 30   + col1 / + col0
202f0 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
20300 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a  r0..----..NULL..
20310 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b  NULL..NULL....sk
20320 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
20330 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
20340 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
20350 65 6c 2d 39 31 38 0d 0a 53 45 4c 45 43 54 20 2d  el-918..SELECT -
20360 20 43 41 53 54 20 28 20 4e 55 4c 4c 20 41 53 20   CAST ( NULL AS 
20370 49 4e 54 45 47 45 52 20 29 20 2b 20 2b 20 63 6f  INTEGER ) + + co
20380 6c 31 20 2f 20 2b 20 63 6f 6c 30 20 46 52 4f 4d  l1 / + col0 FROM
20390 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
203a0 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d  ---..NULL..NULL.
203b0 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20  .NULL....skipif 
203c0 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73  postgresql # Pos
203d0 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73  tgreSQL requires
203e0 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e   AS when renamin
203f0 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73  g output columns
20400 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
20410 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 38 37  t..SELECT ALL 87
20420 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 2c   col0 FROM tab2,
20430 20 74 61 62 31 20 41 53 20 63 6f 72 30 2c 20 74   tab1 AS cor0, t
20440 61 62 30 2c 20 74 61 62 32 20 41 53 20 63 6f 72  ab0, tab2 AS cor
20450 31 0d 0a 2d 2d 2d 2d 0d 0a 38 31 20 76 61 6c 75  1..----..81 valu
20460 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 39 36  es hashing to 96
20470 39 66 33 31 61 65 37 37 39 38 36 36 36 34 34 37  9f31ae7798666447
20480 36 33 65 38 61 30 37 66 31 65 63 35 30 31 0d 0a  63e8a07f1ec501..
20490 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
204a0 74 0d 0a 53 45 4c 45 43 54 20 2d 20 28 20 63 6f  t..SELECT - ( co
204b0 6c 32 20 29 20 2a 20 2d 20 63 6f 6c 32 20 2b 20  l2 ) * - col2 + 
204c0 2b 20 32 39 20 2b 20 33 35 20 46 52 4f 4d 20 74  + 29 + 35 FROM t
204d0 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
204e0 2d 0d 0a 32 39 38 30 0d 0a 33 33 31 33 0d 0a 39  -..2980..3313..9
204f0 32 38 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  280....query I r
20500 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
20510 20 33 34 20 2a 20 63 6f 6c 31 20 41 53 20 63 6f   34 * col1 AS co
20520 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l1 FROM tab1 AS 
20530 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 34 30 0d  cor0..----..340.
20540 0a 34 34 32 0d 0a 38 38 34 0d 0a 0d 0a 71 75 65  .442..884....que
20550 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
20560 4c 45 43 54 20 2d 20 2b 20 28 20 28 20 63 6f 72  LECT - + ( ( cor
20570 30 2e 63 6f 6c 31 20 29 20 29 20 41 53 20 63 6f  0.col1 ) ) AS co
20580 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l2 FROM tab2 AS 
20590 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 37 0d  cor0..----..-17.
205a0 0a 2d 33 31 0d 0a 2d 35 39 0d 0a 0d 0a 71 75 65  .-31..-59....que
205b0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
205c0 4c 45 43 54 20 41 4c 4c 20 28 20 2d 20 39 38 20  LECT ALL ( - 98 
205d0 29 20 2a 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20  ) * + col1 FROM 
205e0 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
205f0 2d 2d 0d 0a 2d 38 34 32 38 0d 0a 2d 38 39 31 38  --..-8428..-8918
20600 0d 0a 2d 39 35 30 36 0d 0a 0d 0a 71 75 65 72 79  ..-9506....query
20610 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
20620 43 54 20 32 38 20 2a 20 28 20 63 6f 6c 31 20 29  CT 28 * ( col1 )
20630 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
20640 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 34 30 38 0d 0a  r0..----..2408..
20650 32 35 34 38 0d 0a 32 37 31 36 0d 0a 0d 0a 73 6b  2548..2716....sk
20660 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20  ipif postgresql 
20670 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71  # PostgreSQL req
20680 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65  uires AS when re
20690 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f  naming output co
206a0 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72  lumns..query I r
206b0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
206c0 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c 30 20 2a  ISTINCT - col0 *
206d0 20 63 6f 6c 31 20 63 6f 6c 32 20 46 52 4f 4d 20   col1 col2 FROM 
206e0 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab2 cor0..----.
206f0 0a 2d 31 33 34 33 0d 0a 2d 32 31 37 0d 0a 2d 34  .-1343..-217..-4
20700 36 30 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  602....query I r
20710 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
20720 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c 30 20 2a  ISTINCT - col0 *
20730 20 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46 52   col1 AS col1 FR
20740 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
20750 0a 2d 2d 2d 2d 0d 0a 2d 31 33 34 33 0d 0a 2d 32  .----..-1343..-2
20760 31 37 0d 0a 2d 34 36 30 32 0d 0a 0d 0a 71 75 65  17..-4602....que
20770 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
20780 4c 45 43 54 20 41 4c 4c 20 2b 20 28 20 32 36 20  LECT ALL + ( 26 
20790 29 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  ) FROM tab0 AS c
207a0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 36 0d 0a 32  or0..----..26..2
207b0 36 0d 0a 32 36 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  6..26....onlyif 
207c0 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20  mysql # use DIV 
207d0 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74  operator for int
207e0 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71  eger division..q
207f0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
20800 61 62 65 6c 2d 39 32 38 0d 0a 53 45 4c 45 43 54  abel-928..SELECT
20810 20 2d 20 32 20 44 49 56 20 2d 20 32 35 20 63 6f   - 2 DIV - 25 co
20820 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l1 FROM tab1 AS 
20830 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30  cor0..----..0..0
20840 0d 0a 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f  ..0....skipif po
20850 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67  stgresql # Postg
20860 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41  reSQL requires A
20870 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20  S when renaming 
20880 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a  output columns..
20890 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
208a0 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
208b0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
208c0 61 62 65 6c 2d 39 32 38 0d 0a 53 45 4c 45 43 54  abel-928..SELECT
208d0 20 2d 20 32 20 2f 20 2d 20 32 35 20 63 6f 6c 31   - 2 / - 25 col1
208e0 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
208f0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a  r0..----..0..0..
20900 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74  0....skipif post
20910 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65  gresql # Postgre
20920 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20  SQL requires AS 
20930 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75  when renaming ou
20940 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75  tput columns..qu
20950 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
20960 45 4c 45 43 54 20 2b 20 63 6f 6c 31 20 2b 20 2d  ELECT + col1 + -
20970 20 63 6f 6c 31 20 2a 20 63 6f 6c 31 20 2b 20 38   col1 * col1 + 8
20980 34 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32  4 col1 FROM tab2
20990 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
209a0 2d 31 38 38 0d 0a 2d 33 33 33 38 0d 0a 2d 38 34  -188..-3338..-84
209b0 36 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74  6....skipif post
209c0 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65  gresql # Postgre
209d0 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20  SQL requires AS 
209e0 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75  when renaming ou
209f0 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75  tput columns..qu
20a00 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
20a10 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 32  ELECT ALL - col2
20a20 20 2b 20 63 6f 6c 32 20 63 6f 6c 32 20 46 52 4f   + col2 col2 FRO
20a30 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
20a40 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d  ----..0..0..0...
20a50 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
20a60 0d 0a 53 45 4c 45 43 54 20 2d 20 38 32 20 46 52  ..SELECT - 82 FR
20a70 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
20a80 0a 2d 2d 2d 2d 0d 0a 2d 38 32 0d 0a 2d 38 32 0d  .----..-82..-82.
20a90 0a 2d 38 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .-82....query I 
20aa0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
20ab0 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c 31 20  DISTINCT - col1 
20ac0 2d 20 2b 20 39 35 20 2a 20 2b 20 38 38 20 2a 20  - + 95 * + 88 * 
20ad0 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32  + col0 FROM tab2
20ae0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
20af0 2d 35 38 35 35 31 0d 0a 2d 36 35 32 31 33 39 0d  -58551..-652139.
20b00 0a 2d 36 36 30 34 35 37 0d 0a 0d 0a 71 75 65 72  .-660457....quer
20b10 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
20b20 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 31 20 2a  ECT ALL - col1 *
20b30 20 2d 20 28 20 2d 20 63 6f 6c 32 20 29 20 2b 20   - ( - col2 ) + 
20b40 63 6f 6c 32 20 2b 20 63 6f 6c 30 20 46 52 4f 4d  col2 + col0 FROM
20b50 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
20b60 2d 2d 2d 0d 0a 2d 31 30 37 32 0d 0a 2d 31 33 34  ---..-1072..-134
20b70 37 0d 0a 2d 34 34 39 0d 0a 0d 0a 71 75 65 72 79  7..-449....query
20b80 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
20b90 43 54 20 63 6f 72 31 2e 63 6f 6c 31 20 2a 20 2d  CT cor1.col1 * -
20ba0 20 63 6f 72 31 2e 63 6f 6c 32 20 41 53 20 63 6f   cor1.col2 AS co
20bb0 6c 32 20 46 52 4f 4d 20 74 61 62 31 2c 20 74 61  l2 FROM tab1, ta
20bc0 62 32 20 41 53 20 63 6f 72 30 2c 20 74 61 62 31  b2 AS cor0, tab1
20bd0 20 41 53 20 63 6f 72 31 2c 20 74 61 62 32 20 41   AS cor1, tab2 A
20be0 53 20 63 6f 72 32 0d 0a 2d 2d 2d 2d 0d 0a 38 31  S cor2..----..81
20bf0 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20   values hashing 
20c00 74 6f 20 61 61 65 32 62 65 64 61 65 36 36 66 30  to aae2bedae66f0
20c10 65 64 36 30 35 33 30 37 33 35 36 32 65 38 30 34  ed6053073562e804
20c20 36 35 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  653....query I r
20c30 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63  owsort..SELECT c
20c40 6f 6c 32 20 2b 20 2d 20 28 20 37 39 20 29 20 46  ol2 + - ( 79 ) F
20c50 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
20c60 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 31 0d 0a 2d 35 32  ..----..-41..-52
20c70 0d 0a 2d 35 33 0d 0a 0d 0a 71 75 65 72 79 20 49  ..-53....query I
20c80 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
20c90 20 44 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c 30   DISTINCT + col0
20ca0 20 2a 20 2b 20 34 36 20 41 53 20 63 6f 6c 32 20   * + 46 AS col2 
20cb0 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a  FROM tab0 cor0..
20cc0 2d 2d 2d 2d 0d 0a 31 31 30 34 0d 0a 31 36 31 30  ----..1104..1610
20cd0 0d 0a 34 30 39 34 0d 0a 0d 0a 71 75 65 72 79 20  ..4094....query 
20ce0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
20cf0 54 20 41 4c 4c 20 2d 20 2d 20 63 6f 6c 31 20 2b  T ALL - - col1 +
20d00 20 2d 20 38 39 20 2b 20 2b 20 37 35 20 41 53 20   - 89 + + 75 AS 
20d10 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41  col1 FROM tab2 A
20d20 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 37  S cor0..----..17
20d30 0d 0a 33 0d 0a 34 35 0d 0a 0d 0a 73 6b 69 70 69  ..3..45....skipi
20d40 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50  f postgresql # P
20d50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72  ostgreSQL requir
20d60 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d  es AS when renam
20d70 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d  ing output colum
20d80 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ns..query I rows
20d90 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
20da0 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c 32 20 2b 20  col2 * + col2 + 
20db0 33 34 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  34 col0 FROM tab
20dc0 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
20dd0 0a 32 39 35 30 0d 0a 33 32 38 33 0d 0a 39 32 35  .2950..3283..925
20de0 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  0....query I row
20df0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c  sort..SELECT col
20e00 30 20 2b 20 33 33 20 2a 20 63 6f 6c 30 20 41 53  0 + 33 * col0 AS
20e10 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20   col0 FROM tab2 
20e20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32  AS cor0..----..2
20e30 33 38 0d 0a 32 36 35 32 0d 0a 32 36 38 36 0d 0a  38..2652..2686..
20e40 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
20e50 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20  t..SELECT ALL + 
20e60 2b 20 63 6f 6c 30 20 2b 20 34 36 20 46 52 4f 4d  + col0 + 46 FROM
20e70 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
20e80 2d 2d 2d 0d 0a 31 31 30 0d 0a 31 32 36 0d 0a 34  ---..110..126..4
20e90 39 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  9....onlyif mysq
20ea0 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72  l # use DIV oper
20eb0 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72  ator for integer
20ec0 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79   division..query
20ed0 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
20ee0 2d 39 34 31 0d 0a 53 45 4c 45 43 54 20 36 30 20  -941..SELECT 60 
20ef0 44 49 56 20 37 36 20 41 53 20 63 6f 6c 31 20 46  DIV 76 AS col1 F
20f00 52 4f 4d 20 74 61 62 32 20 63 6f 72 30 20 43 52  ROM tab2 cor0 CR
20f10 4f 53 53 20 4a 4f 49 4e 20 74 61 62 32 20 41 53  OSS JOIN tab2 AS
20f20 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76   cor1..----..9 v
20f30 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f  alues hashing to
20f40 20 38 62 37 35 31 33 36 62 32 62 35 31 63 37 37   8b75136b2b51c77
20f50 33 34 35 63 30 33 38 30 34 65 63 31 63 64 61 35  345c03804ec1cda5
20f60 63 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  c....skipif mysq
20f70 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
20f80 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
20f90 6f 72 74 20 6c 61 62 65 6c 2d 39 34 31 0d 0a 53  ort label-941..S
20fa0 45 4c 45 43 54 20 36 30 20 2f 20 37 36 20 41 53  ELECT 60 / 76 AS
20fb0 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20   col1 FROM tab2 
20fc0 63 6f 72 30 20 43 52 4f 53 53 20 4a 4f 49 4e 20  cor0 CROSS JOIN 
20fd0 74 61 62 32 20 41 53 20 63 6f 72 31 0d 0a 2d 2d  tab2 AS cor1..--
20fe0 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73  --..9 values has
20ff0 68 69 6e 67 20 74 6f 20 38 62 37 35 31 33 36 62  hing to 8b75136b
21000 32 62 35 31 63 37 37 33 34 35 63 30 33 38 30 34  2b51c77345c03804
21010 65 63 31 63 64 61 35 63 0d 0a 0d 0a 71 75 65 72  ec1cda5c....quer
21020 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
21030 45 43 54 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20  ECT + cor0.col2 
21040 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
21050 31 20 41 53 20 63 6f 72 30 20 43 52 4f 53 53 20  1 AS cor0 CROSS 
21060 4a 4f 49 4e 20 74 61 62 32 20 41 53 20 63 6f 72  JOIN tab2 AS cor
21070 31 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65  1..----..9 value
21080 73 20 68 61 73 68 69 6e 67 20 74 6f 20 38 30 63  s hashing to 80c
21090 61 30 61 31 63 63 33 33 37 61 37 37 31 34 61 38  a0a1cc337a7714a8
210a0 39 39 30 61 37 36 34 63 66 64 62 31 37 0d 0a 0d  990a764cfdb17...
210b0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
210c0 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 74  ..SELECT ALL - t
210d0 61 62 32 2e 63 6f 6c 31 20 41 53 20 63 6f 6c 30  ab2.col1 AS col0
210e0 20 46 52 4f 4d 20 74 61 62 32 2c 20 74 61 62 31   FROM tab2, tab1
210f0 2c 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  , tab2 AS cor0..
21100 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75 65 73 20  ----..27 values 
21110 68 61 73 68 69 6e 67 20 74 6f 20 36 65 30 62 37  hashing to 6e0b7
21120 64 35 38 33 62 63 32 63 35 33 38 34 32 31 36 36  d583bc2c53842166
21130 64 33 65 36 62 61 32 64 36 64 32 0d 0a 0d 0a 73  d3e6ba2d6d2....s
21140 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c  kipif postgresql
21150 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65   # PostgreSQL re
21160 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72  quires AS when r
21170 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63  enaming output c
21180 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20  olumns..query I 
21190 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
211a0 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 2b 20 31 31  + cor0.col0 + 11
211b0 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20   col1 FROM tab2 
211c0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
211d0 38 0d 0a 38 39 0d 0a 39 30 0d 0a 0d 0a 71 75 65  8..89..90....que
211e0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
211f0 4c 45 43 54 20 63 6f 6c 31 20 2a 20 2b 20 63 6f  LECT col1 * + co
21200 72 30 2e 63 6f 6c 32 20 2b 20 63 6f 6c 32 20 41  r0.col2 + col2 A
21210 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31  S col2 FROM tab1
21220 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
21230 31 33 34 34 0d 0a 31 34 35 38 0d 0a 36 32 37 0d  1344..1458..627.
21240 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
21250 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
21260 4e 43 54 20 2d 20 63 6f 6c 31 20 2b 20 63 6f 6c  NCT - col1 + col
21270 30 20 2a 20 2b 20 63 6f 6c 32 20 2a 20 2b 20 63  0 * + col2 * + c
21280 6f 72 30 2e 63 6f 6c 31 20 41 53 20 63 6f 6c 32  or0.col1 AS col2
21290 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
212a0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 32 39 38 0d 0a  r0..----..3298..
212b0 36 36 34 30 32 37 0d 0a 36 38 30 32 36 0d 0a 0d  664027..68026...
212c0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
212d0 0d 0a 53 45 4c 45 43 54 20 74 61 62 31 2e 63 6f  ..SELECT tab1.co
212e0 6c 32 20 2a 20 2b 20 31 36 20 46 52 4f 4d 20 74  l2 * + 16 FROM t
212f0 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 35 33 36 0d  ab1..----..1536.
21300 0a 38 36 34 0d 0a 39 31 32 0d 0a 0d 0a 71 75 65  .864..912....que
21310 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
21320 4c 45 43 54 20 63 6f 6c 32 20 2a 20 2b 20 38 39  LECT col2 * + 89
21330 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d   FROM tab1..----
21340 0d 0a 34 38 30 36 0d 0a 35 30 37 33 0d 0a 38 35  ..4806..5073..85
21350 34 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  44....query I ro
21360 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
21370 28 20 2d 20 63 6f 6c 31 20 29 20 2a 20 63 6f 6c  ( - col1 ) * col
21380 30 20 2b 20 2d 20 36 34 20 46 52 4f 4d 20 74 61  0 + - 64 FROM ta
21390 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
213a0 0d 0a 31 34 0d 0a 35 37 36 0d 0a 39 37 36 0d 0a  ..14..576..976..
213b0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
213c0 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
213d0 43 54 20 2d 20 33 38 20 41 53 20 63 6f 6c 32 20  CT - 38 AS col2 
213e0 46 52 4f 4d 20 74 61 62 30 2c 20 74 61 62 32 20  FROM tab0, tab2 
213f0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 38 0d  cor0..----..-38.
21400 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
21410 72 74 0d 0a 53 45 4c 45 43 54 20 28 20 74 61 62  rt..SELECT ( tab
21420 30 2e 63 6f 6c 32 20 29 20 41 53 20 63 6f 6c 31  0.col2 ) AS col1
21430 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d   FROM tab0..----
21440 0d 0a 31 0d 0a 33 33 0d 0a 38 32 0d 0a 0d 0a 6f  ..1..33..82....o
21450 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75  nlyif mysql # su
21460 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20  pport for MySQL 
21470 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20  specific system 
21480 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78  types and syntax
21490 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
214a0 74 20 6c 61 62 65 6c 2d 39 35 32 0d 0a 53 45 4c  t label-952..SEL
214b0 45 43 54 20 43 41 53 54 28 20 4e 55 4c 4c 20 41  ECT CAST( NULL A
214c0 53 20 53 49 47 4e 45 44 20 29 20 2a 20 63 6f 6c  S SIGNED ) * col
214d0 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  0 AS col2 FROM t
214e0 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d  ab0..----..NULL.
214f0 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73  .NULL..NULL....s
21500 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
21510 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
21520 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
21530 62 65 6c 2d 39 35 32 0d 0a 53 45 4c 45 43 54 20  bel-952..SELECT 
21540 43 41 53 54 20 28 20 4e 55 4c 4c 20 41 53 20 49  CAST ( NULL AS I
21550 4e 54 45 47 45 52 20 29 20 2a 20 63 6f 6c 30 20  NTEGER ) * col0 
21560 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
21570 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e  0..----..NULL..N
21580 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75 65  ULL..NULL....que
21590 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
215a0 4c 45 43 54 20 31 35 20 2a 20 2d 20 38 31 20 46  LECT 15 * - 81 F
215b0 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab1..----..
215c0 2d 31 32 31 35 0d 0a 2d 31 32 31 35 0d 0a 2d 31  -1215..-1215..-1
215d0 32 31 35 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f  215....skipif po
215e0 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67  stgresql # Postg
215f0 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41  reSQL requires A
21600 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20  S when renaming 
21610 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a  output columns..
21620 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
21630 0a 53 45 4c 45 43 54 20 2d 20 32 37 20 2a 20 28  .SELECT - 27 * (
21640 20 2b 20 74 61 62 31 2e 63 6f 6c 31 20 2a 20 63   + tab1.col1 * c
21650 6f 6c 30 20 29 20 63 6f 6c 30 20 46 52 4f 4d 20  ol0 ) col0 FROM 
21660 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 37 32  tab1..----..-172
21670 38 30 0d 0a 2d 32 31 30 36 0d 0a 2d 32 38 30 38  80..-2106..-2808
21680 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  0....query I row
21690 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2b  sort..SELECT + +
216a0 20 63 6f 72 30 2e 63 6f 6c 31 20 41 53 20 63 6f   cor0.col1 AS co
216b0 6c 31 20 46 52 4f 4d 20 74 61 62 32 2c 20 74 61  l1 FROM tab2, ta
216c0 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39  b0 cor0..----..9
216d0 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20   values hashing 
216e0 74 6f 20 35 38 35 61 34 31 61 35 32 63 30 63 36  to 585a41a52c0c6
216f0 63 30 64 36 39 37 62 35 64 33 39 32 36 35 62 37  c0d697b5d39265b7
21700 34 64 63 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  4dc....onlyif my
21710 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70  sql # use DIV op
21720 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67  erator for integ
21730 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65  er division..que
21740 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
21750 65 6c 2d 39 35 36 0d 0a 53 45 4c 45 43 54 20 41  el-956..SELECT A
21760 4c 4c 20 2d 20 30 20 44 49 56 20 2d 20 36 35 20  LL - 0 DIV - 65 
21770 2d 20 2b 20 63 6f 6c 30 20 2a 20 28 20 2d 20 39  - + col0 * ( - 9
21780 33 20 29 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  3 ) AS col1 FROM
21790 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 32 37 39   tab1..----..279
217a0 0d 0a 35 39 35 32 0d 0a 37 34 34 30 0d 0a 0d 0a  ..5952..7440....
217b0 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
217c0 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
217d0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
217e0 61 62 65 6c 2d 39 35 36 0d 0a 53 45 4c 45 43 54  abel-956..SELECT
217f0 20 41 4c 4c 20 2d 20 30 20 2f 20 2d 20 36 35 20   ALL - 0 / - 65 
21800 2d 20 2b 20 63 6f 6c 30 20 2a 20 28 20 2d 20 39  - + col0 * ( - 9
21810 33 20 29 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  3 ) AS col1 FROM
21820 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 32 37 39   tab1..----..279
21830 0d 0a 35 39 35 32 0d 0a 37 34 34 30 0d 0a 0d 0a  ..5952..7440....
21840 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
21850 0a 53 45 4c 45 43 54 20 2b 20 2b 20 63 6f 6c 31  .SELECT + + col1
21860 20 2a 20 2d 20 63 6f 6c 31 20 2b 20 63 6f 6c 32   * - col1 + col2
21870 20 2a 20 2b 20 35 36 20 2a 20 33 37 20 46 52 4f   * + 56 * 37 FRO
21880 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
21890 2d 2d 2d 2d 0d 0a 31 31 31 32 31 32 0d 0a 31 31  ----..111212..11
218a0 38 30 30 34 0d 0a 31 39 38 37 34 33 0d 0a 0d 0a  8004..198743....
218b0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
218c0 0a 53 45 4c 45 43 54 20 41 4c 4c 20 38 36 20 46  .SELECT ALL 86 F
218d0 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d  ROM tab1 cor0..-
218e0 2d 2d 2d 0d 0a 38 36 0d 0a 38 36 0d 0a 38 36 0d  ---..86..86..86.
218f0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
21900 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b  rt..SELECT ALL +
21910 20 63 6f 6c 32 20 2b 20 63 6f 6c 32 20 2a 20 2d   col2 + col2 * -
21920 20 32 30 20 46 52 4f 4d 20 74 61 62 31 20 63 6f   20 FROM tab1 co
21930 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 32 36 0d  r0..----..-1026.
21940 0a 2d 31 30 38 33 0d 0a 2d 31 38 32 34 0d 0a 0d  .-1083..-1824...
21950 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
21960 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 33 33 20  ..SELECT ALL 33 
21970 2a 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32  * col1 FROM tab2
21980 0d 0a 2d 2d 2d 2d 0d 0a 31 30 32 33 0d 0a 31 39  ..----..1023..19
21990 34 37 0d 0a 35 36 31 0d 0a 0d 0a 71 75 65 72 79  47..561....query
219a0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
219b0 43 54 20 2b 20 63 6f 6c 30 20 2a 20 2b 20 34 30  CT + col0 * + 40
219c0 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
219d0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 34 30 30 0d 0a  r0..----..1400..
219e0 33 35 36 30 0d 0a 39 36 30 0d 0a 0d 0a 71 75 65  3560..960....que
219f0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
21a00 4c 45 43 54 20 2b 20 63 6f 6c 31 20 2a 20 2b 20  LECT + col1 * + 
21a10 63 6f 6c 31 20 2d 20 2d 20 63 6f 6c 32 20 41 53  col1 - - col2 AS
21a20 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20   col0 FROM tab2 
21a30 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 32 37 0d  cor0..----..327.
21a40 0a 33 35 30 37 0d 0a 39 38 38 0d 0a 0d 0a 71 75  .3507..988....qu
21a50 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
21a60 45 4c 45 43 54 20 2d 20 2d 20 63 6f 72 30 2e 63  ELECT - - cor0.c
21a70 6f 6c 31 20 2a 20 28 20 2b 20 63 6f 72 30 2e 63  ol1 * ( + cor0.c
21a80 6f 6c 30 20 29 20 46 52 4f 4d 20 74 61 62 32 20  ol0 ) FROM tab2 
21a90 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
21aa0 33 34 33 0d 0a 32 31 37 0d 0a 34 36 30 32 0d 0a  343..217..4602..
21ab0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
21ac0 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
21ad0 43 54 20 63 6f 6c 30 20 2a 20 2d 20 28 20 2b 20  CT col0 * - ( + 
21ae0 63 6f 6c 31 20 29 20 46 52 4f 4d 20 74 61 62 32  col1 ) FROM tab2
21af0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
21b00 2d 31 33 34 33 0d 0a 2d 32 31 37 0d 0a 2d 34 36  -1343..-217..-46
21b10 30 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  02....query I ro
21b20 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
21b30 63 6f 6c 31 20 2a 20 63 6f 6c 31 20 2b 20 2d 20  col1 * col1 + - 
21b40 28 20 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c 32 20  ( col1 * - col2 
21b50 2b 20 36 36 20 29 20 46 52 4f 4d 20 74 61 62 32  + 66 ) FROM tab2
21b60 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
21b70 2d 31 39 30 0d 0a 2d 32 30 31 33 0d 0a 32 39 31  -190..-2013..291
21b80 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67  ....skipif postg
21b90 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53  resql # PostgreS
21ba0 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77  QL requires AS w
21bb0 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74  hen renaming out
21bc0 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65  put columns..que
21bd0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
21be0 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f  LECT DISTINCT co
21bf0 6c 30 20 2b 20 63 6f 6c 30 20 63 6f 6c 31 20 46  l0 + col0 col1 F
21c00 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d  ROM tab0 cor0..-
21c10 2d 2d 2d 0d 0a 31 37 38 0d 0a 34 38 0d 0a 37 30  ---..178..48..70
21c20 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
21c30 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
21c40 2b 20 2d 20 38 36 20 41 53 20 63 6f 6c 30 20 46  + - 86 AS col0 F
21c50 52 4f 4d 20 74 61 62 30 2c 20 74 61 62 31 20 41  ROM tab0, tab1 A
21c60 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20  S cor0..----..9 
21c70 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74  values hashing t
21c80 6f 20 39 61 63 38 30 36 37 39 33 63 30 33 64 33  o 9ac806793c03d3
21c90 61 36 62 35 65 33 61 33 30 32 39 64 32 30 65 34  a6b5e3a3029d20e4
21ca0 64 61 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  da....query I ro
21cb0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
21cc0 4c 20 63 6f 6c 32 20 2a 20 63 6f 6c 31 20 2b 20  L col2 * col1 + 
21cd0 28 20 63 6f 6c 31 20 29 20 2a 20 2d 20 63 6f 6c  ( col1 ) * - col
21ce0 32 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  2 AS col0 FROM t
21cf0 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d  ab2..----..0..0.
21d00 0a 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  .0....onlyif mys
21d10 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72  ql # support for
21d20 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63 20   MySQL specific 
21d30 73 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64  system types and
21d40 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49   syntax..query I
21d50 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 39   rowsort label-9
21d60 36 39 0d 0a 53 45 4c 45 43 54 20 2b 20 28 20 63  69..SELECT + ( c
21d70 6f 6c 30 20 29 20 2b 20 43 41 53 54 28 20 63 6f  ol0 ) + CAST( co
21d80 6c 31 20 41 53 20 53 49 47 4e 45 44 20 29 20 46  l1 AS SIGNED ) F
21d90 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
21da0 0d 0a 2d 2d 2d 2d 0d 0a 32 39 0d 0a 37 34 0d 0a  ..----..29..74..
21db0 39 33 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  93....skipif mys
21dc0 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
21dd0 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
21de0 73 6f 72 74 20 6c 61 62 65 6c 2d 39 36 39 0d 0a  sort label-969..
21df0 53 45 4c 45 43 54 20 2b 20 28 20 63 6f 6c 30 20  SELECT + ( col0 
21e00 29 20 2b 20 43 41 53 54 20 28 20 63 6f 6c 31 20  ) + CAST ( col1 
21e10 41 53 20 49 4e 54 45 47 45 52 20 29 20 46 52 4f  AS INTEGER ) FRO
21e20 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
21e30 2d 2d 2d 2d 0d 0a 32 39 0d 0a 37 34 0d 0a 39 33  ----..29..74..93
21e40 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
21e50 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 32  ort..SELECT col2
21e60 20 2a 20 2d 20 63 6f 6c 30 20 2b 20 28 20 2d 20   * - col0 + ( - 
21e70 63 6f 6c 32 20 29 20 46 52 4f 4d 20 74 61 62 31  col2 ) FROM tab1
21e80 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
21e90 2d 32 31 36 0d 0a 2d 33 37 30 35 0d 0a 2d 37 37  -216..-3705..-77
21ea0 37 36 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73  76....skipif pos
21eb0 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72  tgresql # Postgr
21ec0 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53  eSQL requires AS
21ed0 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f   when renaming o
21ee0 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71  utput columns..q
21ef0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
21f00 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
21f10 2b 20 34 39 20 2a 20 2b 20 63 6f 6c 31 20 2b 20  + 49 * + col1 + 
21f20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 63 6f 6c 31  + cor0.col2 col1
21f30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
21f40 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33 32 38 0d 0a  r0..----..1328..
21f50 35 34 37 0d 0a 37 33 33 0d 0a 0d 0a 6f 6e 6c 79  547..733....only
21f60 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44  if mysql # use D
21f70 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20  IV operator for 
21f80 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e  integer division
21f90 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
21fa0 74 20 6c 61 62 65 6c 2d 39 37 32 0d 0a 53 45 4c  t label-972..SEL
21fb0 45 43 54 20 2b 20 63 6f 6c 31 20 44 49 56 20 74  ECT + col1 DIV t
21fc0 61 62 32 2e 63 6f 6c 31 20 41 53 20 63 6f 6c 31  ab2.col1 AS col1
21fd0 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d   FROM tab2..----
21fe0 0d 0a 31 0d 0a 31 0d 0a 31 0d 0a 0d 0a 73 6b 69  ..1..1..1....ski
21ff0 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
22000 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
22010 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
22020 6c 2d 39 37 32 0d 0a 53 45 4c 45 43 54 20 2b 20  l-972..SELECT + 
22030 63 6f 6c 31 20 2f 20 74 61 62 32 2e 63 6f 6c 31  col1 / tab2.col1
22040 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
22050 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 0d 0a 31 0d 0a  b2..----..1..1..
22060 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  1....query I row
22070 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63  sort..SELECT - c
22080 6f 6c 31 20 2d 20 2d 20 63 6f 6c 30 20 41 53 20  ol1 - - col0 AS 
22090 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41  col0 FROM tab1 A
220a0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32  S cor0..----..-2
220b0 33 0d 0a 35 34 0d 0a 36 37 0d 0a 0d 0a 71 75 65  3..54..67....que
220c0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
220d0 4c 45 43 54 20 41 4c 4c 20 36 37 20 2a 20 63 6f  LECT ALL 67 * co
220e0 6c 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  l2 AS col2 FROM 
220f0 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
22100 2d 2d 0d 0a 32 32 31 31 0d 0a 35 34 39 34 0d 0a  --..2211..5494..
22110 36 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  67....query I ro
22120 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
22130 35 32 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 2a  52 + cor0.col0 *
22140 20 2b 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62   + col2 FROM tab
22150 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
22160 0a 32 30 38 30 0d 0a 32 34 31 0d 0a 33 30 35 34  .2080..241..3054
22170 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
22180 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2b 20  ort..SELECT + + 
22190 63 6f 6c 32 20 2d 20 2b 20 63 6f 6c 30 20 2a 20  col2 - + col0 * 
221a0 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41  col0 FROM tab2 A
221b0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32  S cor0..----..-2
221c0 32 0d 0a 2d 36 30 35 38 0d 0a 2d 36 32 30 33 0d  2..-6058..-6203.
221d0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
221e0 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
221f0 4e 43 54 20 2b 20 63 6f 6c 32 20 2b 20 63 6f 72  NCT + col2 + cor
22200 30 2e 63 6f 6c 30 20 2a 20 2d 20 63 6f 72 30 2e  0.col0 * - cor0.
22210 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46 52 4f  col2 AS col1 FRO
22220 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
22230 2d 2d 2d 2d 0d 0a 2d 31 30 38 0d 0a 2d 33 35 39  ----..-108..-359
22240 31 0d 0a 2d 37 35 38 34 0d 0a 0d 0a 71 75 65 72  1..-7584....quer
22250 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
22260 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 32 20 2b  ECT ALL - col2 +
22270 20 63 6f 72 30 2e 63 6f 6c 32 20 2b 20 30 20 2a   cor0.col2 + 0 *
22280 20 63 6f 6c 31 20 2a 20 63 6f 6c 31 20 46 52 4f   col1 * col1 FRO
22290 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
222a0 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d  ----..0..0..0...
222b0 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73  .skipif postgres
222c0 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20  ql # PostgreSQL 
222d0 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e  requires AS when
222e0 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74   renaming output
222f0 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20   columns..query 
22300 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
22310 54 20 44 49 53 54 49 4e 43 54 20 2b 20 2b 20 63  T DISTINCT + + c
22320 6f 6c 31 20 2b 20 2d 20 63 6f 6c 30 20 63 6f 6c  ol1 + - col0 col
22330 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  1 FROM tab1 AS c
22340 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 34 0d 0a  or0..----..-54..
22350 2d 36 37 0d 0a 32 33 0d 0a 0d 0a 71 75 65 72 79  -67..23....query
22360 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
22370 43 54 20 2b 20 31 34 20 2a 20 63 6f 6c 30 20 41  CT + 14 * col0 A
22380 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32  S col0 FROM tab2
22390 0d 0a 2d 2d 2d 2d 0d 0a 31 30 39 32 0d 0a 31 31  ..----..1092..11
223a0 30 36 0d 0a 39 38 0d 0a 0d 0a 6f 6e 6c 79 69 66  06..98....onlyif
223b0 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74   mysql # support
223c0 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69   for MySQL speci
223d0 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73  fic system types
223e0 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65   and syntax..que
223f0 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
22400 65 6c 2d 39 38 31 0d 0a 53 45 4c 45 43 54 20 41  el-981..SELECT A
22410 4c 4c 20 2b 20 63 6f 6c 32 20 2b 20 43 41 53 54  LL + col2 + CAST
22420 28 20 4e 55 4c 4c 20 41 53 20 53 49 47 4e 45 44  ( NULL AS SIGNED
22430 20 29 20 2b 20 63 6f 6c 30 20 63 6f 6c 31 20 46   ) + col0 col1 F
22440 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
22450 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55  ..----..NULL..NU
22460 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70  LL..NULL....skip
22470 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20  if postgresql # 
22480 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69  PostgreSQL requi
22490 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61  res AS when rena
224a0 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75  ming output colu
224b0 6d 6e 73 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  mns..skipif mysq
224c0 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
224d0 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
224e0 6f 72 74 20 6c 61 62 65 6c 2d 39 38 31 0d 0a 53  ort label-981..S
224f0 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 32  ELECT ALL + col2
22500 20 2b 20 43 41 53 54 20 28 20 4e 55 4c 4c 20 41   + CAST ( NULL A
22510 53 20 49 4e 54 45 47 45 52 20 29 20 2b 20 63 6f  S INTEGER ) + co
22520 6c 30 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  l0 col1 FROM tab
22530 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
22540 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c  .NULL..NULL..NUL
22550 4c 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  L....query I row
22560 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63  sort..SELECT - c
22570 6f 6c 32 20 2a 20 2d 20 63 6f 6c 32 20 2a 20 63  ol2 * - col2 * c
22580 6f 6c 32 20 2b 20 2d 20 63 6f 6c 32 20 2a 20 39  ol2 + - col2 * 9
22590 33 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  3 FROM tab0 AS c
225a0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 39 32 0d 0a  or0..----..-92..
225b0 33 32 38 36 38 0d 0a 35 34 33 37 34 32 0d 0a 0d  32868..543742...
225c0 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
225d0 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51  support for MySQ
225e0 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65  L specific syste
225f0 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74  m types and synt
22600 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ax..query I rows
22610 6f 72 74 20 6c 61 62 65 6c 2d 39 38 33 0d 0a 53  ort label-983..S
22620 45 4c 45 43 54 20 2d 20 2d 20 63 6f 6c 30 20 2a  ELECT - - col0 *
22630 20 43 41 53 54 28 20 2d 20 63 6f 6c 32 20 41 53   CAST( - col2 AS
22640 20 53 49 47 4e 45 44 20 29 20 41 53 20 63 6f 6c   SIGNED ) AS col
22650 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  2 FROM tab0 AS c
22660 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 35 0d 0a  or0..----..-35..
22670 2d 37 32 39 38 0d 0a 2d 37 39 32 0d 0a 0d 0a 73  -7298..-792....s
22680 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
22690 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
226a0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
226b0 62 65 6c 2d 39 38 33 0d 0a 53 45 4c 45 43 54 20  bel-983..SELECT 
226c0 2d 20 2d 20 63 6f 6c 30 20 2a 20 43 41 53 54 20  - - col0 * CAST 
226d0 28 20 2d 20 63 6f 6c 32 20 41 53 20 49 4e 54 45  ( - col2 AS INTE
226e0 47 45 52 20 29 20 41 53 20 63 6f 6c 32 20 46 52  GER ) AS col2 FR
226f0 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
22700 0a 2d 2d 2d 2d 0d 0a 2d 33 35 0d 0a 2d 37 32 39  .----..-35..-729
22710 38 0d 0a 2d 37 39 32 0d 0a 0d 0a 71 75 65 72 79  8..-792....query
22720 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
22730 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63 6f  CT DISTINCT + co
22740 6c 31 20 2a 20 63 6f 6c 31 20 2b 20 63 6f 6c 31  l1 * col1 + col1
22750 20 2a 20 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20   * col2 AS col0 
22760 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
22770 30 0d 0a 2d 2d 2d 2d 0d 0a 31 37 39 38 0d 0a 35  0..----..1798..5
22780 30 31 35 0d 0a 39 33 35 0d 0a 0d 0a 71 75 65 72  015..935....quer
22790 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
227a0 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63  ECT DISTINCT - c
227b0 6f 6c 30 20 2b 20 2b 20 63 6f 6c 30 20 2a 20 28  ol0 + + col0 * (
227c0 20 63 6f 6c 30 20 29 20 2d 20 63 6f 6c 31 20 46   col0 ) - col1 F
227d0 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab1..----..
227e0 2d 32 30 0d 0a 34 30 32 32 0d 0a 36 33 30 37 0d  -20..4022..6307.
227f0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
22800 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63  rt..SELECT ALL c
22810 6f 6c 32 20 2a 20 2d 20 63 6f 6c 31 20 2d 20 39  ol2 * - col1 - 9
22820 34 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d  4 FROM tab2..---
22830 2d 0d 0a 2d 31 36 32 38 0d 0a 2d 37 34 30 0d 0a  -..-1628..-740..
22840 2d 39 33 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20  -931....query I 
22850 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
22860 2b 20 37 37 20 2b 20 2d 20 74 61 62 31 2e 63 6f  + 77 + - tab1.co
22870 6c 30 20 46 52 4f 4d 20 74 61 62 31 2c 20 74 61  l0 FROM tab1, ta
22880 62 32 2c 20 74 61 62 32 20 41 53 20 63 6f 72 30  b2, tab2 AS cor0
22890 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75 65  ..----..27 value
228a0 73 20 68 61 73 68 69 6e 67 20 74 6f 20 33 34 36  s hashing to 346
228b0 34 38 62 31 35 39 38 65 37 65 35 31 34 35 31 35  48b1598e7e514515
228c0 30 64 32 61 65 64 38 66 36 63 64 64 64 0d 0a 0d  0d2aed8f6cddd...
228d0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
228e0 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 31  ..SELECT ALL - 1
228f0 32 20 46 52 4f 4d 20 74 61 62 30 2c 20 74 61 62  2 FROM tab0, tab
22900 32 2c 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  2, tab2 AS cor0.
22910 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75 65 73  .----..27 values
22920 20 68 61 73 68 69 6e 67 20 74 6f 20 33 39 38 33   hashing to 3983
22930 62 66 66 65 32 61 64 66 38 38 63 62 32 65 66 63  bffe2adf88cb2efc
22940 33 62 65 39 33 65 65 36 32 30 63 30 0d 0a 0d 0a  3be93ee620c0....
22950 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
22960 0a 53 45 4c 45 43 54 20 36 39 20 2a 20 2d 20 63  .SELECT 69 * - c
22970 6f 6c 30 20 2d 20 35 32 20 46 52 4f 4d 20 74 61  ol0 - 52 FROM ta
22980 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 33 35 0d 0a  b2..----..-535..
22990 2d 35 34 33 34 0d 0a 2d 35 35 30 33 0d 0a 0d 0a  -5434..-5503....
229a0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
229b0 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 32  .SELECT ALL col2
229c0 20 2a 20 2b 20 63 6f 6c 32 20 2b 20 2b 20 63 6f   * + col2 + + co
229d0 6c 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  l2 AS col2 FROM 
229e0 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
229f0 2d 2d 0d 0a 32 39 37 30 0d 0a 33 33 30 36 0d 0a  --..2970..3306..
22a00 39 33 31 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20  9312....query I 
22a10 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
22a20 41 4c 4c 20 31 38 20 2b 20 33 33 20 41 53 20 63  ALL 18 + 33 AS c
22a30 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 63 6f  ol0 FROM tab0 co
22a40 72 30 0d 0a 2d 2d 2d 2d 0d 0a 35 31 0d 0a 35 31  r0..----..51..51
22a50 0d 0a 35 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..51....query I 
22a60 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
22a70 41 4c 4c 20 2d 20 2d 20 28 20 38 35 20 29 20 2a  ALL - - ( 85 ) *
22a80 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 2a 20 2b   + cor0.col0 * +
22a90 20 28 20 28 20 2b 20 63 6f 72 30 2e 63 6f 6c 31   ( ( + cor0.col1
22aa0 20 29 20 29 20 46 52 4f 4d 20 74 61 62 31 20 41   ) ) FROM tab1 A
22ab0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 35 34  S cor0..----..54
22ac0 34 30 30 0d 0a 36 36 33 30 0d 0a 38 38 34 30 30  400..6630..88400
22ad0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
22ae0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
22af0 63 6f 6c 32 20 2a 20 2d 20 28 20 63 6f 6c 32 20  col2 * - ( col2 
22b00 29 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  ) AS col1 FROM t
22b10 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
22b20 2d 0d 0a 2d 31 0d 0a 2d 31 30 38 39 0d 0a 2d 36  -..-1..-1089..-6
22b30 37 32 34 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f  724....skipif po
22b40 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67  stgresql # Postg
22b50 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41  reSQL requires A
22b60 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20  S when renaming 
22b70 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a  output columns..
22b80 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
22b90 0a 53 45 4c 45 43 54 20 2d 20 39 38 20 63 6f 6c  .SELECT - 98 col
22ba0 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  0 FROM tab1 AS c
22bb0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 39 38 0d 0a  or0..----..-98..
22bc0 2d 39 38 0d 0a 2d 39 38 0d 0a 0d 0a 71 75 65 72  -98..-98....quer
22bd0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
22be0 45 43 54 20 41 4c 4c 20 2b 20 28 20 2d 20 63 6f  ECT ALL + ( - co
22bf0 6c 31 20 29 20 2a 20 63 6f 6c 32 20 41 53 20 63  l1 ) * col2 AS c
22c00 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol0 FROM tab0 AS
22c10 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 38   cor0..----..-28
22c20 33 38 0d 0a 2d 37 34 36 32 0d 0a 2d 39 37 0d 0a  38..-7462..-97..
22c30 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
22c40 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2d 20 63 6f  t..SELECT + - co
22c50 72 30 2e 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c 31  r0.col2 * + col1
22c60 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
22c70 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
22c80 0d 0a 2d 31 32 34 38 0d 0a 2d 31 34 30 34 0d 0a  ..-1248..-1404..
22c90 2d 35 37 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20  -570....query I 
22ca0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
22cb0 44 49 53 54 49 4e 43 54 20 2d 20 2d 20 28 20 2d  DISTINCT - - ( -
22cc0 20 63 6f 72 30 2e 63 6f 6c 31 20 29 20 2a 20 63   cor0.col1 ) * c
22cd0 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol2 FROM tab2 AS
22ce0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 35   cor0..----..-15
22cf0 33 34 0d 0a 2d 36 34 36 0d 0a 2d 38 33 37 0d 0a  34..-646..-837..
22d00 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
22d10 74 0d 0a 53 45 4c 45 43 54 20 38 32 20 41 53 20  t..SELECT 82 AS 
22d20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41  col2 FROM tab2 A
22d30 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 38 32  S cor0..----..82
22d40 0d 0a 38 32 0d 0a 38 32 0d 0a 0d 0a 71 75 65 72  ..82..82....quer
22d50 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
22d60 45 43 54 20 2b 20 2d 20 63 6f 6c 32 20 2b 20 2b  ECT + - col2 + +
22d70 20 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20   1 FROM tab1 AS 
22d80 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 33 0d  cor0..----..-53.
22d90 0a 2d 35 36 0d 0a 2d 39 35 0d 0a 0d 0a 73 6b 69  .-56..-95....ski
22da0 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
22db0 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
22dc0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
22dd0 45 43 54 20 2b 20 2d 20 43 41 53 54 20 28 20 2b  ECT + - CAST ( +
22de0 20 33 39 20 41 53 20 52 45 41 4c 20 29 20 2a 20   39 AS REAL ) * 
22df0 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46 52 4f  col2 AS col0 FRO
22e00 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
22e10 2d 2d 2d 2d 0d 0a 2d 32 31 30 36 0d 0a 2d 32 32  ----..-2106..-22
22e20 32 33 0d 0a 2d 33 37 34 34 0d 0a 0d 0a 71 75 65  23..-3744....que
22e30 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
22e40 4c 45 43 54 20 33 34 20 41 53 20 63 6f 6c 30 20  LECT 34 AS col0 
22e50 46 52 4f 4d 20 74 61 62 32 2c 20 74 61 62 30 20  FROM tab2, tab0 
22e60 41 53 20 63 6f 72 30 2c 20 74 61 62 31 20 41 53  AS cor0, tab1 AS
22e70 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20   cor1..----..27 
22e80 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74  values hashing t
22e90 6f 20 34 65 32 63 61 31 34 37 61 35 39 65 30 64  o 4e2ca147a59e0d
22ea0 35 36 36 31 63 32 38 63 66 33 65 35 34 33 31 63  5661c28cf3e5431c
22eb0 61 61 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  aa....onlyif mys
22ec0 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72  ql # support for
22ed0 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63 20   MySQL specific 
22ee0 73 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64  system types and
22ef0 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49   syntax..query I
22f00 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
22f10 30 30 32 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  002..SELECT DIST
22f20 49 4e 43 54 20 2b 20 43 41 53 54 28 20 4e 55 4c  INCT + CAST( NUL
22f30 4c 20 41 53 20 53 49 47 4e 45 44 20 29 20 63 6f  L AS SIGNED ) co
22f40 6c 30 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d  l0 FROM tab1..--
22f50 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70  --..NULL....skip
22f60 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20  if postgresql # 
22f70 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69  PostgreSQL requi
22f80 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61  res AS when rena
22f90 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75  ming output colu
22fa0 6d 6e 73 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  mns..skipif mysq
22fb0 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
22fc0 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
22fd0 6f 72 74 20 6c 61 62 65 6c 2d 31 30 30 32 0d 0a  ort label-1002..
22fe0 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
22ff0 2b 20 43 41 53 54 20 28 20 4e 55 4c 4c 20 41 53  + CAST ( NULL AS
23000 20 49 4e 54 45 47 45 52 20 29 20 63 6f 6c 30 20   INTEGER ) col0 
23010 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d  FROM tab1..----.
23020 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75 65 72 79 20 49  .NULL....query I
23030 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
23040 20 2d 20 36 37 20 41 53 20 63 6f 6c 31 20 46 52   - 67 AS col1 FR
23050 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
23060 0a 2d 2d 2d 2d 0d 0a 2d 36 37 0d 0a 2d 36 37 0d  .----..-67..-67.
23070 0a 2d 36 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .-67....query I 
23080 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
23090 2d 20 2d 20 33 31 20 2a 20 2d 20 32 34 20 2b 20  - - 31 * - 24 + 
230a0 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41  col0 FROM tab2 A
230b0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 36  S cor0..----..-6
230c0 36 35 0d 0a 2d 36 36 36 0d 0a 2d 37 33 37 0d 0a  65..-666..-737..
230d0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
230e0 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20  t..SELECT ALL - 
230f0 38 30 20 2a 20 63 6f 6c 32 20 41 53 20 63 6f 6c  80 * col2 AS col
23100 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d  0 FROM tab0..---
23110 2d 0d 0a 2d 32 36 34 30 0d 0a 2d 36 35 36 30 0d  -..-2640..-6560.
23120 0a 2d 38 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  .-80....onlyif m
23130 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66  ysql # support f
23140 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69  or MySQL specifi
23150 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61  c system types a
23160 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79  nd syntax..query
23170 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
23180 2d 31 30 30 36 0d 0a 53 45 4c 45 43 54 20 44 49  -1006..SELECT DI
23190 53 54 49 4e 43 54 20 28 20 28 20 2b 20 63 6f 6c  STINCT ( ( + col
231a0 32 20 29 20 29 20 2a 20 2d 20 43 41 53 54 28 20  2 ) ) * - CAST( 
231b0 63 6f 6c 30 20 41 53 20 53 49 47 4e 45 44 20 29  col0 AS SIGNED )
231c0 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
231d0 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 36 32 0d 0a  b1..----..-162..
231e0 2d 33 36 34 38 0d 0a 2d 37 36 38 30 0d 0a 0d 0a  -3648..-7680....
231f0 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
23200 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
23210 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
23220 61 62 65 6c 2d 31 30 30 36 0d 0a 53 45 4c 45 43  abel-1006..SELEC
23230 54 20 44 49 53 54 49 4e 43 54 20 28 20 28 20 2b  T DISTINCT ( ( +
23240 20 63 6f 6c 32 20 29 20 29 20 2a 20 2d 20 43 41   col2 ) ) * - CA
23250 53 54 20 28 20 63 6f 6c 30 20 41 53 20 49 4e 54  ST ( col0 AS INT
23260 45 47 45 52 20 29 20 41 53 20 63 6f 6c 32 20 46  EGER ) AS col2 F
23270 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab1..----..
23280 2d 31 36 32 0d 0a 2d 33 36 34 38 0d 0a 2d 37 36  -162..-3648..-76
23290 38 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  80....query I ro
232a0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
232b0 4c 20 2d 20 31 38 20 2d 20 63 6f 72 30 2e 63 6f  L - 18 - cor0.co
232c0 6c 31 20 2a 20 2d 20 28 20 28 20 63 6f 6c 30 20  l1 * - ( ( col0 
232d0 29 20 29 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  ) ) AS col1 FROM
232e0 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
232f0 2d 2d 2d 0d 0a 31 33 32 35 0d 0a 31 39 39 0d 0a  ---..1325..199..
23300 34 35 38 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20  4584....query I 
23310 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
23320 28 20 2b 20 38 35 20 29 20 46 52 4f 4d 20 74 61  ( + 85 ) FROM ta
23330 62 31 0d 0a 2d 2d 2d 2d 0d 0a 38 35 0d 0a 38 35  b1..----..85..85
23340 0d 0a 38 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..85....query I 
23350 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
23360 44 49 53 54 49 4e 43 54 20 2d 20 28 20 2d 20 63  DISTINCT - ( - c
23370 6f 6c 32 20 29 20 2a 20 63 6f 6c 31 20 46 52 4f  ol2 ) * col1 FRO
23380 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 32 38  M tab0..----..28
23390 33 38 0d 0a 37 34 36 32 0d 0a 39 37 0d 0a 0d 0a  38..7462..97....
233a0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
233b0 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
233c0 20 2b 20 37 31 20 2a 20 63 6f 6c 32 20 41 53 20   + 71 * col2 AS 
233d0 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 0d 0a  col2 FROM tab0..
233e0 2d 2d 2d 2d 0d 0a 32 33 34 33 0d 0a 35 38 32 32  ----..2343..5822
233f0 0d 0a 37 31 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  ..71....onlyif m
23400 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66  ysql # support f
23410 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69  or MySQL specifi
23420 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61  c system types a
23430 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79  nd syntax..query
23440 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
23450 2d 31 30 31 31 0d 0a 53 45 4c 45 43 54 20 41 4c  -1011..SELECT AL
23460 4c 20 43 41 53 54 28 20 63 6f 6c 31 20 41 53 20  L CAST( col1 AS 
23470 53 49 47 4e 45 44 20 29 20 41 53 20 63 6f 6c 30  SIGNED ) AS col0
23480 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d   FROM tab0..----
23490 0d 0a 38 36 0d 0a 39 31 0d 0a 39 37 0d 0a 0d 0a  ..86..91..97....
234a0 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
234b0 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
234c0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
234d0 61 62 65 6c 2d 31 30 31 31 0d 0a 53 45 4c 45 43  abel-1011..SELEC
234e0 54 20 41 4c 4c 20 43 41 53 54 20 28 20 63 6f 6c  T ALL CAST ( col
234f0 31 20 41 53 20 49 4e 54 45 47 45 52 20 29 20 41  1 AS INTEGER ) A
23500 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30  S col0 FROM tab0
23510 0d 0a 2d 2d 2d 2d 0d 0a 38 36 0d 0a 39 31 0d 0a  ..----..86..91..
23520 39 37 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  97....onlyif mys
23530 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65  ql # use DIV ope
23540 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65  rator for intege
23550 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72  r division..quer
23560 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
23570 6c 2d 31 30 31 32 0d 0a 53 45 4c 45 43 54 20 63  l-1012..SELECT c
23580 6f 6c 30 20 2a 20 74 61 62 30 2e 63 6f 6c 32 20  ol0 * tab0.col2 
23590 44 49 56 20 2b 20 63 6f 6c 32 20 2b 20 63 6f 6c  DIV + col2 + col
235a0 32 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  2 AS col0 FROM t
235b0 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 37 31 0d 0a  ab0..----..171..
235c0 33 36 0d 0a 35 37 0d 0a 0d 0a 73 6b 69 70 69 66  36..57....skipif
235d0 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
235e0 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
235f0 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
23600 30 31 32 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 30  012..SELECT col0
23610 20 2a 20 74 61 62 30 2e 63 6f 6c 32 20 2f 20 2b   * tab0.col2 / +
23620 20 63 6f 6c 32 20 2b 20 63 6f 6c 32 20 41 53 20   col2 + col2 AS 
23630 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a  col0 FROM tab0..
23640 2d 2d 2d 2d 0d 0a 31 37 31 0d 0a 33 36 0d 0a 35  ----..171..36..5
23650 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  7....query I row
23660 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 31  sort..SELECT + 1
23670 38 20 2b 20 28 20 2b 20 63 6f 6c 32 20 29 20 41  8 + ( + col2 ) A
23680 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30  S col2 FROM tab0
23690 0d 0a 2d 2d 2d 2d 0d 0a 31 30 30 0d 0a 31 39 0d  ..----..100..19.
236a0 0a 35 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .51....query I r
236b0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
236c0 4c 4c 20 2b 20 2b 20 63 6f 6c 32 20 2a 20 2d 20  LL + + col2 * - 
236d0 63 6f 6c 30 20 2b 20 2d 20 28 20 35 34 20 2b 20  col0 + - ( 54 + 
236e0 63 6f 72 30 2e 63 6f 6c 31 20 29 20 41 53 20 63  cor0.col1 ) AS c
236f0 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol2 FROM tab1 AS
23700 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 34   cor0..----..-24
23710 32 0d 0a 2d 33 37 31 32 0d 0a 2d 37 37 34 37 0d  2..-3712..-7747.
23720 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
23730 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2d 20 35  rt..SELECT + - 5
23740 30 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c 32  0 + col1 AS col2
23750 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
23760 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 34 0d 0a 2d  r0..----..-24..-
23770 33 37 0d 0a 2d 34 30 0d 0a 0d 0a 71 75 65 72 79  37..-40....query
23780 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
23790 43 54 20 34 35 20 2a 20 63 6f 6c 30 20 2b 20 74  CT 45 * col0 + t
237a0 61 62 30 2e 63 6f 6c 32 20 46 52 4f 4d 20 74 61  ab0.col2 FROM ta
237b0 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 31 33 0d 0a  b0..----..1113..
237c0 31 35 37 36 0d 0a 34 30 38 37 0d 0a 0d 0a 71 75  1576..4087....qu
237d0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
237e0 45 4c 45 43 54 20 41 4c 4c 20 2b 20 2b 20 31 34  ELECT ALL + + 14
237f0 20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d   FROM tab1 cor0.
23800 0a 2d 2d 2d 2d 0d 0a 31 34 0d 0a 31 34 0d 0a 31  .----..14..14..1
23810 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  4....query I row
23820 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 36 35 20  sort..SELECT 65 
23830 2b 20 63 6f 6c 31 20 2a 20 63 6f 6c 32 20 41 53  + col1 * col2 AS
23840 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20   col1 FROM tab2 
23850 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
23860 35 39 39 0d 0a 37 31 31 0d 0a 39 30 32 0d 0a 0d  599..711..902...
23870 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
23880 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c  ..SELECT ALL col
23890 32 20 2b 20 63 6f 6c 31 20 2a 20 28 20 63 6f 6c  2 + col1 * ( col
238a0 31 20 2b 20 63 6f 6c 31 20 29 20 2a 20 2b 20 63  1 + col1 ) * + c
238b0 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  ol1 AS col1 FROM
238c0 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
238d0 2d 2d 2d 0d 0a 32 30 35 37 0d 0a 33 35 32 30 36  ---..2057..35206
238e0 0d 0a 34 34 39 30 0d 0a 0d 0a 71 75 65 72 79 20  ..4490....query 
238f0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
23900 54 20 41 4c 4c 20 63 6f 6c 32 20 2d 20 63 6f 6c  T ALL col2 - col
23910 32 20 2a 20 63 6f 6c 32 20 41 53 20 63 6f 6c 32  2 * col2 AS col2
23920 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
23930 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 34 30 36 0d  r0..----..-1406.
23940 0a 2d 36 35 30 0d 0a 2d 37 30 32 0d 0a 0d 0a 6f  .-650..-702....o
23950 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75  nlyif mysql # su
23960 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20  pport for MySQL 
23970 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20  specific system 
23980 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78  types and syntax
23990 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
239a0 74 20 6c 61 62 65 6c 2d 31 30 32 31 0d 0a 53 45  t label-1021..SE
239b0 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 31 20  LECT ALL - col1 
239c0 2a 20 2b 20 63 6f 6c 32 20 2a 20 43 41 53 54 28  * + col2 * CAST(
239d0 20 4e 55 4c 4c 20 41 53 20 53 49 47 4e 45 44 20   NULL AS SIGNED 
239e0 29 20 2b 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20  ) + + col0 FROM 
239f0 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
23a00 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a  --..NULL..NULL..
23a10 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  NULL....skipif m
23a20 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
23a30 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
23a40 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 30 32  owsort label-102
23a50 31 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20  1..SELECT ALL - 
23a60 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c 32 20 2a 20  col1 * + col2 * 
23a70 43 41 53 54 20 28 20 4e 55 4c 4c 20 41 53 20 49  CAST ( NULL AS I
23a80 4e 54 45 47 45 52 20 29 20 2b 20 2b 20 63 6f 6c  NTEGER ) + + col
23a90 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  0 FROM tab0 AS c
23aa0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d  or0..----..NULL.
23ab0 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71  .NULL..NULL....q
23ac0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
23ad0 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
23ae0 2d 20 63 6f 6c 30 20 2d 20 2d 20 63 6f 6c 32 20  - col0 - - col2 
23af0 2a 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30  * col0 FROM tab0
23b00 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
23b10 30 0d 0a 37 32 30 39 0d 0a 37 36 38 0d 0a 0d 0a  0..7209..768....
23b20 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
23b30 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
23b40 20 31 35 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d   15 AS col2 FROM
23b50 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
23b60 2d 2d 2d 0d 0a 31 35 0d 0a 0d 0a 71 75 65 72 79  ---..15....query
23b70 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
23b80 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 30 20 2a 20  CT ALL - col0 * 
23b90 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46 52 4f  col0 AS col2 FRO
23ba0 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab1 cor0..---
23bb0 2d 0d 0a 2d 34 30 39 36 0d 0a 2d 36 34 30 30 0d  -..-4096..-6400.
23bc0 0a 2d 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .-9....query I r
23bd0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
23be0 20 28 20 63 6f 6c 30 20 29 20 2a 20 2b 20 32 31   ( col0 ) * + 21
23bf0 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
23c00 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
23c10 0d 0a 31 33 34 34 0d 0a 31 36 38 30 0d 0a 36 33  ..1344..1680..63
23c20 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
23c30 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61   # use DIV opera
23c40 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20  tor for integer 
23c50 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20  division..query 
23c60 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
23c70 31 30 32 36 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  1026..SELECT ALL
23c80 20 2b 20 2d 20 32 35 20 2b 20 2b 20 63 6f 72 30   + - 25 + + cor0
23c90 2e 63 6f 6c 31 20 2b 20 63 6f 6c 30 20 44 49 56  .col1 + col0 DIV
23ca0 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20   col0 FROM tab0 
23cb0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 36  AS cor0..----..6
23cc0 32 0d 0a 36 37 0d 0a 37 33 0d 0a 0d 0a 73 6b 69  2..67..73....ski
23cd0 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
23ce0 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
23cf0 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
23d00 6c 2d 31 30 32 36 0d 0a 53 45 4c 45 43 54 20 41  l-1026..SELECT A
23d10 4c 4c 20 2b 20 2d 20 32 35 20 2b 20 2b 20 63 6f  LL + - 25 + + co
23d20 72 30 2e 63 6f 6c 31 20 2b 20 63 6f 6c 30 20 2f  r0.col1 + col0 /
23d30 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20   col0 FROM tab0 
23d40 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 36  AS cor0..----..6
23d50 32 0d 0a 36 37 0d 0a 37 33 0d 0a 0d 0a 71 75 65  2..67..73....que
23d60 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
23d70 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20  LECT DISTINCT + 
23d80 63 6f 6c 30 20 2a 20 63 6f 6c 32 20 2d 20 63 6f  col0 * col2 - co
23d90 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l1 FROM tab0 AS 
23da0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 36 32 0d  cor0..----..-62.
23db0 0a 37 30 36 0d 0a 37 32 30 37 0d 0a 0d 0a 6f 6e  .706..7207....on
23dc0 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
23dd0 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
23de0 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
23df0 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
23e00 6f 72 74 20 6c 61 62 65 6c 2d 31 30 32 38 0d 0a  ort label-1028..
23e10 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 32 20  SELECT ALL col2 
23e20 2b 20 2d 20 63 6f 6c 31 20 2a 20 63 6f 6c 30 20  + - col1 * col0 
23e30 44 49 56 20 2d 20 63 6f 6c 30 20 46 52 4f 4d 20  DIV - col0 FROM 
23e40 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 30 39 0d  tab1..----..109.
23e50 0a 36 37 0d 0a 38 30 0d 0a 0d 0a 73 6b 69 70 69  .67..80....skipi
23e60 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
23e70 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
23e80 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
23e90 31 30 32 38 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  1028..SELECT ALL
23ea0 20 63 6f 6c 32 20 2b 20 2d 20 63 6f 6c 31 20 2a   col2 + - col1 *
23eb0 20 63 6f 6c 30 20 2f 20 2d 20 63 6f 6c 30 20 46   col0 / - col0 F
23ec0 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab1..----..
23ed0 31 30 39 0d 0a 36 37 0d 0a 38 30 0d 0a 0d 0a 73  109..67..80....s
23ee0 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c  kipif postgresql
23ef0 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65   # PostgreSQL re
23f00 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72  quires AS when r
23f10 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63  enaming output c
23f20 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20  olumns..query I 
23f30 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
23f40 2b 20 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c 32 20  + col0 + - col2 
23f50 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 0d 0a  col0 FROM tab2..
23f60 2d 2d 2d 2d 0d 0a 2d 32 30 0d 0a 34 31 0d 0a 35  ----..-20..41..5
23f70 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  2....query I row
23f80 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63  sort..SELECT - c
23f90 6f 6c 32 20 2b 20 36 39 20 2a 20 63 6f 6c 30 20  ol2 + 69 * col0 
23fa0 2b 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30  + col2 FROM tab0
23fb0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
23fc0 31 36 35 36 0d 0a 32 34 31 35 0d 0a 36 31 34 31  1656..2415..6141
23fd0 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
23fe0 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61   # use DIV opera
23ff0 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20  tor for integer 
24000 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20  division..query 
24010 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
24020 31 30 33 31 0d 0a 53 45 4c 45 43 54 20 2d 20 63  1031..SELECT - c
24030 6f 6c 31 20 2b 20 2b 20 36 33 20 44 49 56 20 63  ol1 + + 63 DIV c
24040 6f 72 30 2e 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c  or0.col0 + - col
24050 32 20 2a 20 2b 20 28 20 63 6f 72 30 2e 63 6f 6c  2 * + ( cor0.col
24060 32 20 2a 20 63 6f 6c 30 20 29 20 46 52 4f 4d 20  2 * col0 ) FROM 
24070 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab2 cor0..----.
24080 0a 2d 31 31 34 30 39 33 0d 0a 2d 35 31 32 35 0d  .-114093..-5125.
24090 0a 2d 35 32 37 38 37 0d 0a 0d 0a 73 6b 69 70 69  .-52787....skipi
240a0 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
240b0 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
240c0 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
240d0 31 30 33 31 0d 0a 53 45 4c 45 43 54 20 2d 20 63  1031..SELECT - c
240e0 6f 6c 31 20 2b 20 2b 20 36 33 20 2f 20 63 6f 72  ol1 + + 63 / cor
240f0 30 2e 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c 32 20  0.col0 + - col2 
24100 2a 20 2b 20 28 20 63 6f 72 30 2e 63 6f 6c 32 20  * + ( cor0.col2 
24110 2a 20 63 6f 6c 30 20 29 20 46 52 4f 4d 20 74 61  * col0 ) FROM ta
24120 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  b2 cor0..----..-
24130 31 31 34 30 39 33 0d 0a 2d 35 31 32 35 0d 0a 2d  114093..-5125..-
24140 35 32 37 38 37 0d 0a 0d 0a 71 75 65 72 79 20 49  52787....query I
24150 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
24160 20 63 6f 6c 30 20 2a 20 38 30 20 2b 20 2b 20 33   col0 * 80 + + 3
24170 30 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c 30  0 + col1 AS col0
24180 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
24190 72 30 0d 0a 2d 2d 2d 2d 0d 0a 36 32 31 0d 0a 36  r0..----..621..6
241a0 33 32 39 0d 0a 36 33 36 37 0d 0a 0d 0a 71 75 65  329..6367....que
241b0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
241c0 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20  LECT DISTINCT - 
241d0 63 6f 72 30 2e 63 6f 6c 30 20 2a 20 63 6f 6c 30  cor0.col0 * col0
241e0 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d   FROM tab0 cor0.
241f0 0a 2d 2d 2d 2d 0d 0a 2d 31 32 32 35 0d 0a 2d 35  .----..-1225..-5
24200 37 36 0d 0a 2d 37 39 32 31 0d 0a 0d 0a 71 75 65  76..-7921....que
24210 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
24220 4c 45 43 54 20 2b 20 63 6f 6c 30 20 2b 20 28 20  LECT + col0 + ( 
24230 63 6f 6c 31 20 29 20 41 53 20 63 6f 6c 30 20 46  col1 ) AS col0 F
24240 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
24250 0d 0a 2d 2d 2d 2d 0d 0a 31 33 37 0d 0a 33 38 0d  ..----..137..38.
24260 0a 39 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .96....query I r
24270 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
24280 20 63 6f 72 30 2e 63 6f 6c 31 20 2a 20 37 35 20   cor0.col1 * 75 
24290 2b 20 2d 20 33 36 20 2b 20 63 6f 6c 30 20 2a 20  + - 36 + col0 * 
242a0 2d 20 39 35 20 46 52 4f 4d 20 74 61 62 30 20 41  - 95 FROM tab0 A
242b0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
242c0 36 36 36 0d 0a 33 39 31 34 0d 0a 34 31 33 34 0d  666..3914..4134.
242d0 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
242e0 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79  # support for My
242f0 53 51 4c 20 73 70 65 63 69 66 69 63 20 73 79 73  SQL specific sys
24300 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79  tem types and sy
24310 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f  ntax..query I ro
24320 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 30 33 36  wsort label-1036
24330 0d 0a 53 45 4c 45 43 54 20 2d 20 43 41 53 54 28  ..SELECT - CAST(
24340 20 2d 20 63 6f 6c 30 20 41 53 20 53 49 47 4e 45   - col0 AS SIGNE
24350 44 20 29 20 2b 20 63 6f 6c 31 20 2b 20 2b 20 39  D ) + col1 + + 9
24360 33 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  3 FROM tab0 AS c
24370 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 30 33 0d 0a  or0..----..203..
24380 32 32 35 0d 0a 32 37 33 0d 0a 0d 0a 73 6b 69 70  225..273....skip
24390 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
243a0 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
243b0 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
243c0 2d 31 30 33 36 0d 0a 53 45 4c 45 43 54 20 2d 20  -1036..SELECT - 
243d0 43 41 53 54 20 28 20 2d 20 63 6f 6c 30 20 41 53  CAST ( - col0 AS
243e0 20 49 4e 54 45 47 45 52 20 29 20 2b 20 63 6f 6c   INTEGER ) + col
243f0 31 20 2b 20 2b 20 39 33 20 46 52 4f 4d 20 74 61  1 + + 93 FROM ta
24400 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
24410 0d 0a 32 30 33 0d 0a 32 32 35 0d 0a 32 37 33 0d  ..203..225..273.
24420 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
24430 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74  # use DIV operat
24440 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64  or for integer d
24450 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49  ivision..query I
24460 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
24470 30 33 37 0d 0a 53 45 4c 45 43 54 20 2d 20 28 20  037..SELECT - ( 
24480 2d 20 32 37 20 29 20 2a 20 2d 20 63 6f 6c 30 20  - 27 ) * - col0 
24490 44 49 56 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30  DIV col0 AS col0
244a0 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
244b0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 37 0d 0a 2d  r0..----..-27..-
244c0 32 37 0d 0a 2d 32 37 0d 0a 0d 0a 73 6b 69 70 69  27..-27....skipi
244d0 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
244e0 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
244f0 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
24500 31 30 33 37 0d 0a 53 45 4c 45 43 54 20 2d 20 28  1037..SELECT - (
24510 20 2d 20 32 37 20 29 20 2a 20 2d 20 63 6f 6c 30   - 27 ) * - col0
24520 20 2f 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20   / col0 AS col0 
24530 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
24540 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 37 0d 0a 2d 32  0..----..-27..-2
24550 37 0d 0a 2d 32 37 0d 0a 0d 0a 71 75 65 72 79 20  7..-27....query 
24560 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
24570 54 20 44 49 53 54 49 4e 43 54 20 2d 20 31 35 20  T DISTINCT - 15 
24580 2a 20 39 32 20 46 52 4f 4d 20 74 61 62 30 20 41  * 92 FROM tab0 A
24590 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
245a0 33 38 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f  380....skipif po
245b0 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67  stgresql # Postg
245c0 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41  reSQL requires A
245d0 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20  S when renaming 
245e0 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a  output columns..
245f0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
24600 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
24610 20 2d 20 35 35 20 63 6f 6c 32 20 46 52 4f 4d 20   - 55 col2 FROM 
24620 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab1 cor0..----.
24630 0a 2d 35 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .-55....query I 
24640 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
24650 44 49 53 54 49 4e 43 54 20 2b 20 36 39 20 2b 20  DISTINCT + 69 + 
24660 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30  + col1 FROM tab0
24670 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
24680 31 35 35 0d 0a 31 36 30 0d 0a 31 36 36 0d 0a 0d  155..160..166...
24690 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
246a0 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51  support for MySQ
246b0 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65  L specific syste
246c0 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74  m types and synt
246d0 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ax..query I rows
246e0 6f 72 74 20 6c 61 62 65 6c 2d 31 30 34 31 0d 0a  ort label-1041..
246f0 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
24700 2b 20 43 41 53 54 28 20 4e 55 4c 4c 20 41 53 20  + CAST( NULL AS 
24710 44 45 43 49 4d 41 4c 20 29 20 2a 20 37 39 20 46  DECIMAL ) * 79 F
24720 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
24730 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 0d 0a  ..----..NULL....
24740 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
24750 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
24760 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
24770 61 62 65 6c 2d 31 30 34 31 0d 0a 53 45 4c 45 43  abel-1041..SELEC
24780 54 20 44 49 53 54 49 4e 43 54 20 2b 20 43 41 53  T DISTINCT + CAS
24790 54 20 28 20 4e 55 4c 4c 20 41 53 20 52 45 41 4c  T ( NULL AS REAL
247a0 20 29 20 2a 20 37 39 20 46 52 4f 4d 20 74 61 62   ) * 79 FROM tab
247b0 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
247c0 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75 65 72 79 20 49  .NULL....query I
247d0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
247e0 20 2b 20 38 35 20 2a 20 2b 20 28 20 2b 20 63 6f   + 85 * + ( + co
247f0 72 30 2e 63 6f 6c 32 20 29 20 2a 20 37 36 20 46  r0.col2 ) * 76 F
24800 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
24810 0d 0a 2d 2d 2d 2d 0d 0a 32 31 33 31 38 30 0d 0a  ..----..213180..
24820 35 32 39 37 32 30 0d 0a 36 34 36 30 0d 0a 0d 0a  529720..6460....
24830 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75  onlyif mysql # u
24840 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20  se DIV operator 
24850 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69  for integer divi
24860 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f  sion..query I ro
24870 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 30 34 33  wsort label-1043
24880 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
24890 54 20 2d 20 2d 20 63 6f 6c 32 20 2b 20 2d 20 63  T - - col2 + - c
248a0 6f 6c 31 20 44 49 56 20 2d 20 63 6f 6c 30 20 41  ol1 DIV - col0 A
248b0 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30  S col2 FROM tab0
248c0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
248d0 33 0d 0a 33 36 0d 0a 38 33 0d 0a 0d 0a 73 6b 69  3..36..83....ski
248e0 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
248f0 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
24900 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
24910 6c 2d 31 30 34 33 0d 0a 53 45 4c 45 43 54 20 44  l-1043..SELECT D
24920 49 53 54 49 4e 43 54 20 2d 20 2d 20 63 6f 6c 32  ISTINCT - - col2
24930 20 2b 20 2d 20 63 6f 6c 31 20 2f 20 2d 20 63 6f   + - col1 / - co
24940 6c 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  l0 AS col2 FROM 
24950 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
24960 2d 2d 0d 0a 33 0d 0a 33 36 0d 0a 38 33 0d 0a 0d  --..3..36..83...
24970 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
24980 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72  use DIV operator
24990 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76   for integer div
249a0 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72  ision..query I r
249b0 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 30 34  owsort label-104
249c0 34 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  4..SELECT DISTIN
249d0 43 54 20 2b 20 2b 20 43 41 53 54 28 20 2b 20 34  CT + + CAST( + 4
249e0 35 20 41 53 20 53 49 47 4e 45 44 20 29 20 44 49  5 AS SIGNED ) DI
249f0 56 20 2d 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61  V - col0 FROM ta
24a00 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  b0 cor0..----..-
24a10 31 0d 0a 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  1..0....skipif m
24a20 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
24a30 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
24a40 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 30 34  owsort label-104
24a50 34 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  4..SELECT DISTIN
24a60 43 54 20 2b 20 2b 20 43 41 53 54 20 28 20 2b 20  CT + + CAST ( + 
24a70 34 35 20 41 53 20 49 4e 54 45 47 45 52 20 29 20  45 AS INTEGER ) 
24a80 2f 20 2d 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61  / - col0 FROM ta
24a90 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  b0 cor0..----..-
24aa0 31 0d 0a 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20  1..0....query I 
24ab0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
24ac0 2b 20 28 20 2b 20 63 6f 6c 30 20 29 20 2a 20 63  + ( + col0 ) * c
24ad0 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  ol1 AS col0 FROM
24ae0 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
24af0 2d 2d 2d 0d 0a 31 30 34 30 0d 0a 36 34 30 0d 0a  ---..1040..640..
24b00 37 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  78....query I ro
24b10 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
24b20 4c 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 46 52  L + cor0.col1 FR
24b30 4f 4d 20 74 61 62 30 2c 20 74 61 62 32 2c 20 74  OM tab0, tab2, t
24b40 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
24b50 2d 0d 0a 32 37 20 76 61 6c 75 65 73 20 68 61 73  -..27 values has
24b60 68 69 6e 67 20 74 6f 20 37 35 39 39 62 34 38 30  hing to 7599b480
24b70 31 32 35 64 65 35 32 31 65 66 65 64 37 31 62 35  125de521efed71b5
24b80 62 32 34 31 33 63 37 64 0d 0a 0d 0a 73 6b 69 70  b2413c7d....skip
24b90 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20  if postgresql # 
24ba0 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69  PostgreSQL requi
24bb0 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61  res AS when rena
24bc0 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75  ming output colu
24bd0 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  mns..query I row
24be0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
24bf0 54 49 4e 43 54 20 2b 20 38 30 20 63 6f 6c 31 20  TINCT + 80 col1 
24c00 46 52 4f 4d 20 74 61 62 31 2c 20 74 61 62 32 2c  FROM tab1, tab2,
24c10 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
24c20 2d 2d 2d 0d 0a 38 30 0d 0a 0d 0a 71 75 65 72 79  ---..80....query
24c30 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
24c40 43 54 20 2b 20 74 61 62 32 2e 63 6f 6c 31 20 2b  CT + tab2.col1 +
24c50 20 2b 20 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c 31   + col2 * - col1
24c60 20 2b 20 2d 20 63 6f 6c 32 20 41 53 20 63 6f 6c   + - col2 AS col
24c70 32 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d  2 FROM tab2..---
24c80 2d 0d 0a 2d 31 35 30 31 0d 0a 2d 36 36 37 0d 0a  -..-1501..-667..
24c90 2d 38 33 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20  -833....query I 
24ca0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
24cb0 41 4c 4c 20 2b 20 2d 20 34 33 20 2b 20 63 6f 6c  ALL + - 43 + col
24cc0 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  0 FROM tab1 AS c
24cd0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 30 0d 0a  or0..----..-40..
24ce0 32 31 0d 0a 33 37 0d 0a 0d 0a 71 75 65 72 79 20  21..37....query 
24cf0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
24d00 54 20 2d 20 63 6f 72 30 2e 63 6f 6c 31 20 2b 20  T - cor0.col1 + 
24d10 63 6f 72 30 2e 63 6f 6c 30 20 46 52 4f 4d 20 74  cor0.col0 FROM t
24d20 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
24d30 2d 0d 0a 2d 32 0d 0a 2d 36 32 0d 0a 2d 36 32 0d  -..-2..-62..-62.
24d40 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
24d50 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74  # use DIV operat
24d60 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64  or for integer d
24d70 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49  ivision..query I
24d80 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
24d90 30 35 31 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  051..SELECT ALL 
24da0 63 6f 6c 30 20 2d 20 28 20 2d 20 39 39 20 29 20  col0 - ( - 99 ) 
24db0 44 49 56 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61  DIV col0 FROM ta
24dc0 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32  b2 cor0..----..2
24dd0 31 0d 0a 37 39 0d 0a 38 30 0d 0a 0d 0a 73 6b 69  1..79..80....ski
24de0 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
24df0 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
24e00 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
24e10 6c 2d 31 30 35 31 0d 0a 53 45 4c 45 43 54 20 41  l-1051..SELECT A
24e20 4c 4c 20 63 6f 6c 30 20 2d 20 28 20 2d 20 39 39  LL col0 - ( - 99
24e30 20 29 20 2f 20 63 6f 6c 30 20 46 52 4f 4d 20 74   ) / col0 FROM t
24e40 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab2 cor0..----..
24e50 32 31 0d 0a 37 39 0d 0a 38 30 0d 0a 0d 0a 6f 6e  21..79..80....on
24e60 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
24e70 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
24e80 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
24e90 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
24ea0 6f 72 74 20 6c 61 62 65 6c 2d 31 30 35 32 0d 0a  ort label-1052..
24eb0 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
24ec0 2d 20 63 6f 6c 30 20 44 49 56 20 2b 20 63 6f 72  - col0 DIV + cor
24ed0 30 2e 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46  0.col1 AS col2 F
24ee0 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
24ef0 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 2d 34 0d 0a  ..----..-1..-4..
24f00 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  0....skipif mysq
24f10 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
24f20 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
24f30 6f 72 74 20 6c 61 62 65 6c 2d 31 30 35 32 0d 0a  ort label-1052..
24f40 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
24f50 2d 20 63 6f 6c 30 20 2f 20 2b 20 63 6f 72 30 2e  - col0 / + cor0.
24f60 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46 52 4f  col1 AS col2 FRO
24f70 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
24f80 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 2d 34 0d 0a 30 0d  ----..-1..-4..0.
24f90 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
24fa0 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63  rt..SELECT ALL c
24fb0 6f 6c 31 20 2a 20 2d 20 63 6f 6c 32 20 2b 20 2b  ol1 * - col2 + +
24fc0 20 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46 52   col0 AS col1 FR
24fd0 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
24fe0 0a 2d 2d 2d 2d 0d 0a 2d 32 38 31 34 0d 0a 2d 36  .----..-2814..-6
24ff0 32 0d 0a 2d 37 33 37 33 0d 0a 0d 0a 71 75 65 72  2..-7373....quer
25000 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
25010 45 43 54 20 63 6f 72 30 2e 63 6f 6c 31 20 2a 20  ECT cor0.col1 * 
25020 2b 20 38 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  + 8 AS col1 FROM
25030 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
25040 2d 2d 2d 0d 0a 31 33 36 0d 0a 32 34 38 0d 0a 34  ---..136..248..4
25050 37 32 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  72....onlyif mys
25060 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72  ql # support for
25070 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63 20   MySQL specific 
25080 73 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64  system types and
25090 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49   syntax..query I
250a0 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
250b0 30 35 35 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  055..SELECT ALL 
250c0 2b 20 63 6f 6c 31 20 2a 20 2d 20 43 41 53 54 28  + col1 * - CAST(
250d0 20 4e 55 4c 4c 20 41 53 20 53 49 47 4e 45 44 20   NULL AS SIGNED 
250e0 29 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31  ) col2 FROM tab1
250f0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
25100 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c  NULL..NULL..NULL
25110 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67  ....skipif postg
25120 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53  resql # PostgreS
25130 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77  QL requires AS w
25140 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74  hen renaming out
25150 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 73 6b 69  put columns..ski
25160 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
25170 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
25180 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
25190 6c 2d 31 30 35 35 0d 0a 53 45 4c 45 43 54 20 41  l-1055..SELECT A
251a0 4c 4c 20 2b 20 63 6f 6c 31 20 2a 20 2d 20 43 41  LL + col1 * - CA
251b0 53 54 20 28 20 4e 55 4c 4c 20 41 53 20 49 4e 54  ST ( NULL AS INT
251c0 45 47 45 52 20 29 20 63 6f 6c 32 20 46 52 4f 4d  EGER ) col2 FROM
251d0 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
251e0 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d  ---..NULL..NULL.
251f0 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75 65 72 79 20 49  .NULL....query I
25200 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
25210 20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 72 31   DISTINCT - cor1
25220 2e 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20  .col2 FROM tab2 
25230 41 53 20 63 6f 72 30 20 43 52 4f 53 53 20 4a 4f  AS cor0 CROSS JO
25240 49 4e 20 74 61 62 30 2c 20 74 61 62 31 20 41 53  IN tab0, tab1 AS
25250 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 34   cor1..----..-54
25260 0d 0a 2d 35 37 0d 0a 2d 39 36 0d 0a 0d 0a 71 75  ..-57..-96....qu
25270 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
25280 45 4c 45 43 54 20 2d 20 2d 20 63 6f 6c 30 20 2a  ELECT - - col0 *
25290 20 39 37 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d   97 AS col2 FROM
252a0 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab1 cor0..----
252b0 0d 0a 32 39 31 0d 0a 36 32 30 38 0d 0a 37 37 36  ..291..6208..776
252c0 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  0....query I row
252d0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63  sort..SELECT - c
252e0 6f 6c 31 20 2b 20 2b 20 36 35 20 41 53 20 63 6f  ol1 + + 65 AS co
252f0 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72  l2 FROM tab1 cor
25300 30 0d 0a 2d 2d 2d 2d 0d 0a 33 39 0d 0a 35 32 0d  0..----..39..52.
25310 0a 35 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .55....query I r
25320 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
25330 20 63 6f 72 30 2e 63 6f 6c 31 20 2a 20 2b 20 34   cor0.col1 * + 4
25340 36 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  6 AS col2 FROM t
25350 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
25360 2d 0d 0a 31 34 32 36 0d 0a 32 37 31 34 0d 0a 37  -..1426..2714..7
25370 38 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  82....query I ro
25380 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f  wsort..SELECT co
25390 6c 30 20 2b 20 2b 20 28 20 2b 20 63 6f 6c 31 20  l0 + + ( + col1 
253a0 29 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  ) FROM tab2 AS c
253b0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33 37 0d 0a  or0..----..137..
253c0 33 38 0d 0a 39 36 0d 0a 0d 0a 73 6b 69 70 69 66  38..96....skipif
253d0 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
253e0 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
253f0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
25400 20 41 4c 4c 20 43 41 53 54 20 28 20 2d 20 34 20   ALL CAST ( - 4 
25410 41 53 20 52 45 41 4c 20 29 20 2a 20 63 6f 6c 32  AS REAL ) * col2
25420 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
25430 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 31 36 0d 0a  r0..----..-216..
25440 2d 32 32 38 0d 0a 2d 33 38 34 0d 0a 0d 0a 73 6b  -228..-384....sk
25450 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20  ipif postgresql 
25460 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71  # PostgreSQL req
25470 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65  uires AS when re
25480 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f  naming output co
25490 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72  lumns..query I r
254a0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
254b0 20 63 6f 72 30 2e 63 6f 6c 30 20 2a 20 63 6f 6c   cor0.col0 * col
254c0 30 20 2a 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20  0 * + cor0.col2 
254d0 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41  col0 FROM tab0 A
254e0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
254f0 32 32 35 0d 0a 2d 31 39 30 30 38 0d 0a 2d 36 34  225..-19008..-64
25500 39 35 32 32 0d 0a 0d 0a 73 6b 69 70 69 66 20 70  9522....skipif p
25510 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74  ostgresql # Post
25520 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20  greSQL requires 
25530 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67  AS when renaming
25540 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d   output columns.
25550 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
25560 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 34 36 20  ..SELECT ALL 46 
25570 2a 20 63 6f 6c 31 20 2b 20 63 6f 6c 31 20 2a 20  * col1 + col1 * 
25580 63 6f 72 30 2e 63 6f 6c 31 20 63 6f 6c 32 20 46  cor0.col1 col2 F
25590 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
255a0 0d 0a 2d 2d 2d 2d 0d 0a 31 38 37 32 0d 0a 35 36  ..----..1872..56
255b0 30 0d 0a 37 36 37 0d 0a 0d 0a 71 75 65 72 79 20  0..767....query 
255c0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
255d0 54 20 44 49 53 54 49 4e 43 54 20 2b 20 28 20 2d  T DISTINCT + ( -
255e0 20 63 6f 6c 32 20 29 20 46 52 4f 4d 20 74 61 62   col2 ) FROM tab
255f0 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 35  1 cor0..----..-5
25600 34 0d 0a 2d 35 37 0d 0a 2d 39 36 0d 0a 0d 0a 71  4..-57..-96....q
25610 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
25620 53 45 4c 45 43 54 20 63 6f 6c 30 20 2b 20 35 38  SELECT col0 + 58
25630 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d   FROM tab0..----
25640 0d 0a 31 34 37 0d 0a 38 32 0d 0a 39 33 0d 0a 0d  ..147..82..93...
25650 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73  .skipif postgres
25660 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20  ql # PostgreSQL 
25670 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e  requires AS when
25680 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74   renaming output
25690 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20   columns..query 
256a0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
256b0 54 20 44 49 53 54 49 4e 43 54 20 2d 20 34 34 20  T DISTINCT - 44 
256c0 2a 20 63 6f 6c 31 20 63 6f 6c 32 20 46 52 4f 4d  * col1 col2 FROM
256d0 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
256e0 2d 2d 2d 0d 0a 2d 33 37 38 34 0d 0a 2d 34 30 30  ---..-3784..-400
256f0 34 0d 0a 2d 34 32 36 38 0d 0a 0d 0a 6f 6e 6c 79  4..-4268....only
25700 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44  if mysql # use D
25710 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20  IV operator for 
25720 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e  integer division
25730 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
25740 74 20 6c 61 62 65 6c 2d 31 30 36 37 0d 0a 53 45  t label-1067..SE
25750 4c 45 43 54 20 41 4c 4c 20 37 39 20 2b 20 63 6f  LECT ALL 79 + co
25760 6c 32 20 44 49 56 20 2b 20 63 6f 6c 32 20 46 52  l2 DIV + col2 FR
25770 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d  OM tab0 cor0..--
25780 2d 2d 0d 0a 38 30 0d 0a 38 30 0d 0a 38 30 0d 0a  --..80..80..80..
25790 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
257a0 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
257b0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
257c0 20 6c 61 62 65 6c 2d 31 30 36 37 0d 0a 53 45 4c   label-1067..SEL
257d0 45 43 54 20 41 4c 4c 20 37 39 20 2b 20 63 6f 6c  ECT ALL 79 + col
257e0 32 20 2f 20 2b 20 63 6f 6c 32 20 46 52 4f 4d 20  2 / + col2 FROM 
257f0 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab0 cor0..----.
25800 0a 38 30 0d 0a 38 30 0d 0a 38 30 0d 0a 0d 0a 71  .80..80..80....q
25810 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
25820 53 45 4c 45 43 54 20 41 4c 4c 20 33 31 20 2b 20  SELECT ALL 31 + 
25830 2b 20 39 33 20 46 52 4f 4d 20 74 61 62 31 20 41  + 93 FROM tab1 A
25840 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32  S cor0..----..12
25850 34 0d 0a 31 32 34 0d 0a 31 32 34 0d 0a 0d 0a 71  4..124..124....q
25860 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
25870 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
25880 2d 20 34 38 20 2b 20 2d 20 63 6f 6c 31 20 41 53  - 48 + - col1 AS
25890 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20   col1 FROM tab1 
258a0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
258b0 35 38 0d 0a 2d 36 31 0d 0a 2d 37 34 0d 0a 0d 0a  58..-61..-74....
258c0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
258d0 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
258e0 20 2d 20 63 6f 6c 32 20 2b 20 63 6f 6c 31 20 2a   - col2 + col1 *
258f0 20 2d 20 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20   - col0 AS col2 
25900 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
25910 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 30 39 37 0d 0a  0..----..-2097..
25920 2d 33 33 39 36 0d 0a 2d 38 31 38 31 0d 0a 0d 0a  -3396..-8181....
25930 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
25940 0a 53 45 4c 45 43 54 20 2d 20 2b 20 35 31 20 46  .SELECT - + 51 F
25950 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
25960 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 31 0d 0a 2d 35 31  ..----..-51..-51
25970 0d 0a 2d 35 31 0d 0a 0d 0a 71 75 65 72 79 20 49  ..-51....query I
25980 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
25990 20 41 4c 4c 20 2d 20 2b 20 63 6f 6c 30 20 2a 20   ALL - + col0 * 
259a0 2d 20 63 6f 6c 31 20 2a 20 63 6f 6c 31 20 41 53  - col1 * col1 AS
259b0 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20   col2 FROM tab0 
259c0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
259d0 37 37 35 30 34 0d 0a 33 32 39 33 31 35 0d 0a 37  77504..329315..7
259e0 33 37 30 30 39 0d 0a 0d 0a 71 75 65 72 79 20 49  37009....query I
259f0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
25a00 20 41 4c 4c 20 2d 20 28 20 2b 20 63 6f 6c 32 20   ALL - ( + col2 
25a10 29 20 2b 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f  ) + + col1 AS co
25a20 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72  l0 FROM tab0 cor
25a30 30 0d 0a 2d 2d 2d 2d 0d 0a 35 33 0d 0a 39 0d 0a  0..----..53..9..
25a40 39 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  96....query I ro
25a50 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
25a60 63 6f 6c 32 20 2b 20 2b 20 63 6f 6c 30 20 2a 20  col2 + + col0 * 
25a70 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41  col1 FROM tab1 A
25a80 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 34  S cor0..----..24
25a90 0d 0a 35 38 33 0d 0a 39 34 34 0d 0a 0d 0a 6f 6e  ..583..944....on
25aa0 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
25ab0 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
25ac0 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
25ad0 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
25ae0 6f 72 74 20 6c 61 62 65 6c 2d 31 30 37 35 0d 0a  ort label-1075..
25af0 53 45 4c 45 43 54 20 2d 20 2b 20 63 6f 6c 30 20  SELECT - + col0 
25b00 44 49 56 20 63 6f 6c 30 20 2b 20 2b 20 36 32 20  DIV col0 + + 62 
25b10 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
25b20 30 0d 0a 2d 2d 2d 2d 0d 0a 36 31 0d 0a 36 31 0d  0..----..61..61.
25b30 0a 36 31 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  .61....skipif my
25b40 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
25b50 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
25b60 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 30 37 35  wsort label-1075
25b70 0d 0a 53 45 4c 45 43 54 20 2d 20 2b 20 63 6f 6c  ..SELECT - + col
25b80 30 20 2f 20 63 6f 6c 30 20 2b 20 2b 20 36 32 20  0 / col0 + + 62 
25b90 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
25ba0 30 0d 0a 2d 2d 2d 2d 0d 0a 36 31 0d 0a 36 31 0d  0..----..61..61.
25bb0 0a 36 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .61....query I r
25bc0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
25bd0 49 53 54 49 4e 43 54 20 2d 20 63 6f 72 31 2e 63  ISTINCT - cor1.c
25be0 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  ol2 AS col1 FROM
25bf0 20 74 61 62 30 2c 20 74 61 62 30 20 41 53 20 63   tab0, tab0 AS c
25c00 6f 72 30 2c 20 74 61 62 32 20 63 6f 72 31 0d 0a  or0, tab2 cor1..
25c10 2d 2d 2d 2d 0d 0a 2d 32 36 0d 0a 2d 32 37 0d 0a  ----..-26..-27..
25c20 2d 33 38 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f  -38....skipif po
25c30 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67  stgresql # Postg
25c40 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41  reSQL requires A
25c50 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20  S when renaming 
25c60 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a  output columns..
25c70 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
25c80 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 2b 20  .SELECT ALL + + 
25c90 28 20 2d 20 63 6f 6c 32 20 29 20 2a 20 28 20 2d  ( - col2 ) * ( -
25ca0 20 63 6f 6c 31 20 29 20 63 6f 6c 32 20 46 52 4f   col1 ) col2 FRO
25cb0 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
25cc0 2d 2d 2d 2d 0d 0a 31 32 34 38 0d 0a 31 34 30 34  ----..1248..1404
25cd0 0d 0a 35 37 30 0d 0a 0d 0a 73 6b 69 70 69 66 20  ..570....skipif 
25ce0 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73  postgresql # Pos
25cf0 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73  tgreSQL requires
25d00 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e   AS when renamin
25d10 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73  g output columns
25d20 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
25d30 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 30  t..SELECT + col0
25d40 20 2a 20 63 6f 6c 30 20 2b 20 34 36 20 63 6f 6c   * col0 + 46 col
25d50 30 20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30  0 FROM tab1 cor0
25d60 0d 0a 2d 2d 2d 2d 0d 0a 34 31 34 32 0d 0a 35 35  ..----..4142..55
25d70 0d 0a 36 34 34 36 0d 0a 0d 0a 71 75 65 72 79 20  ..6446....query 
25d80 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
25d90 54 20 2d 20 63 6f 6c 32 20 2b 20 33 39 20 2a 20  T - col2 + 39 * 
25da0 2d 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30  - col0 FROM tab0
25db0 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 36 36 0d 0a 2d  ..----..-1366..-
25dc0 33 35 35 33 0d 0a 2d 39 36 39 0d 0a 0d 0a 71 75  3553..-969....qu
25dd0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
25de0 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 63  ELECT DISTINCT c
25df0 6f 6c 32 20 2a 20 2b 20 38 38 20 46 52 4f 4d 20  ol2 * + 88 FROM 
25e00 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 32 39 30 34  tab0..----..2904
25e10 0d 0a 37 32 31 36 0d 0a 38 38 0d 0a 0d 0a 71 75  ..7216..88....qu
25e20 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
25e30 45 4c 45 43 54 20 2d 20 63 6f 6c 32 20 2b 20 63  ELECT - col2 + c
25e40 6f 6c 30 20 2a 20 2b 20 63 6f 6c 30 20 41 53 20  ol0 * + col0 AS 
25e50 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41  col0 FROM tab0 A
25e60 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32  S cor0..----..12
25e70 32 34 0d 0a 35 34 33 0d 0a 37 38 33 39 0d 0a 0d  24..543..7839...
25e80 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
25e90 0d 0a 53 45 4c 45 43 54 20 2b 20 35 32 20 41 53  ..SELECT + 52 AS
25ea0 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20   col0 FROM tab0 
25eb0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 35 32 0d 0a  cor0..----..52..
25ec0 35 32 0d 0a 35 32 0d 0a 0d 0a 71 75 65 72 79 20  52..52....query 
25ed0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
25ee0 54 20 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c 31 20  T col0 + + col1 
25ef0 2a 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32  * col2 FROM tab2
25f00 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
25f10 31 36 31 32 0d 0a 37 32 35 0d 0a 38 34 34 0d 0a  1612..725..844..
25f20 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
25f30 74 0d 0a 53 45 4c 45 43 54 20 2d 20 39 34 20 2a  t..SELECT - 94 *
25f40 20 2b 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62   + col2 FROM tab
25f50 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
25f60 0a 2d 33 31 30 32 0d 0a 2d 37 37 30 38 0d 0a 2d  .-3102..-7708..-
25f70 39 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  94....query I ro
25f80 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
25f90 53 54 49 4e 43 54 20 2d 20 33 32 20 2b 20 63 6f  STINCT - 32 + co
25fa0 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l1 FROM tab2 AS 
25fb0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a  cor0..----..-1..
25fc0 2d 31 35 0d 0a 32 37 0d 0a 0d 0a 71 75 65 72 79  -15..27....query
25fd0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
25fe0 43 54 20 63 6f 6c 30 20 2a 20 2d 20 38 35 20 2b  CT col0 * - 85 +
25ff0 20 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46 52   col0 AS col2 FR
26000 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d  OM tab2..----..-
26010 35 38 38 0d 0a 2d 36 35 35 32 0d 0a 2d 36 36 33  588..-6552..-663
26020 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  6....query I row
26030 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 74 61 62  sort..SELECT tab
26040 30 2e 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46  0.col1 AS col2 F
26050 52 4f 4d 20 74 61 62 30 2c 20 74 61 62 31 20 41  ROM tab0, tab1 A
26060 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20  S cor0..----..9 
26070 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74  values hashing t
26080 6f 20 35 38 35 61 34 31 61 35 32 63 30 63 36 63  o 585a41a52c0c6c
26090 30 64 36 39 37 62 35 64 33 39 32 36 35 62 37 34  0d697b5d39265b74
260a0 64 63 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  dc....query I ro
260b0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 33 30  wsort..SELECT 30
260c0 20 2b 20 2d 20 63 6f 6c 32 20 46 52 4f 4d 20 74   + - col2 FROM t
260d0 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
260e0 2d 0d 0a 2d 38 0d 0a 33 0d 0a 34 0d 0a 0d 0a 71  -..-8..3..4....q
260f0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
26100 53 45 4c 45 43 54 20 2d 20 30 20 2b 20 63 6f 6c  SELECT - 0 + col
26110 31 20 2a 20 2d 20 63 6f 6c 31 20 46 52 4f 4d 20  1 * - col1 FROM 
26120 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
26130 2d 2d 0d 0a 2d 37 33 39 36 0d 0a 2d 38 32 38 31  --..-7396..-8281
26140 0d 0a 2d 39 34 30 39 0d 0a 0d 0a 71 75 65 72 79  ..-9409....query
26150 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
26160 43 54 20 41 4c 4c 20 63 6f 6c 32 20 2b 20 2b 20  CT ALL col2 + + 
26170 63 6f 72 30 2e 63 6f 6c 30 20 2b 20 63 6f 6c 32  cor0.col0 + col2
26180 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
26190 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  b2 cor0..----..1
261a0 33 30 0d 0a 31 35 35 0d 0a 36 31 0d 0a 0d 0a 71  30..155..61....q
261b0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
261c0 53 45 4c 45 43 54 20 2d 20 2b 20 63 6f 6c 31 20  SELECT - + col1 
261d0 2b 20 63 6f 6c 31 20 2a 20 63 6f 6c 30 20 2a 20  + col1 * col0 * 
261e0 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30  + col1 FROM tab0
261f0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
26200 31 37 37 34 31 38 0d 0a 33 32 39 32 31 38 0d 0a  177418..329218..
26210 37 33 36 39 31 38 0d 0a 0d 0a 71 75 65 72 79 20  736918....query 
26220 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
26230 54 20 2d 20 63 6f 6c 30 20 2b 20 63 6f 72 30 2e  T - col0 + cor0.
26240 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c 30 20 46 52  col1 * + col0 FR
26250 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
26260 0a 2d 2d 2d 2d 0d 0a 35 37 36 0d 0a 37 35 0d 0a  .----..576..75..
26270 39 36 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  960....query I r
26280 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63  owsort..SELECT c
26290 6f 6c 30 20 2b 20 2d 20 63 6f 72 30 2e 63 6f 6c  ol0 + - cor0.col
262a0 30 20 2a 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20  0 * - cor0.col2 
262b0 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
262c0 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
262d0 0a 37 30 0d 0a 37 33 38 37 0d 0a 38 31 36 0d 0a  .70..7387..816..
262e0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
262f0 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2d 20 63 6f  t..SELECT + - co
26300 6c 30 20 2d 20 2b 20 63 6f 6c 31 20 46 52 4f 4d  l0 - + col1 FROM
26310 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab1 cor0..----
26320 0d 0a 2d 32 39 0d 0a 2d 37 34 0d 0a 2d 39 33 0d  ..-29..-74..-93.
26330 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
26340 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d  rt..SELECT ALL -
26350 20 28 20 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c 32   ( col2 * + col2
26360 20 29 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20   ) AS col1 FROM 
26370 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 39 31  tab1..----..-291
26380 36 0d 0a 2d 33 32 34 39 0d 0a 2d 39 32 31 36 0d  6..-3249..-9216.
26390 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
263a0 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2d 20 36  rt..SELECT + - 6
263b0 30 20 2a 20 28 20 2b 20 63 6f 72 30 2e 63 6f 6c  0 * ( + cor0.col
263c0 30 20 29 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f  0 ) + col1 AS co
263d0 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l2 FROM tab2 AS 
263e0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 38 39  cor0..----..-389
263f0 0d 0a 2d 34 36 32 31 0d 0a 2d 34 37 32 33 0d 0a  ..-4621..-4723..
26400 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
26410 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20  t..SELECT ALL - 
26420 28 20 63 6f 6c 31 20 2b 20 2d 20 63 6f 6c 32 20  ( col1 + - col2 
26430 29 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d  ) FROM tab1..---
26440 2d 0d 0a 32 38 0d 0a 34 37 0d 0a 38 33 0d 0a 0d  -..28..47..83...
26450 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
26460 0d 0a 53 45 4c 45 43 54 20 2d 20 28 20 2b 20 63  ..SELECT - ( + c
26470 6f 6c 30 20 29 20 2b 20 63 6f 6c 31 20 41 53 20  ol0 ) + col1 AS 
26480 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 0d 0a  col2 FROM tab0..
26490 2d 2d 2d 2d 0d 0a 32 0d 0a 36 32 0d 0a 36 32 0d  ----..2..62..62.
264a0 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72  ...skipif postgr
264b0 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51  esql # PostgreSQ
264c0 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68  L requires AS wh
264d0 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70  en renaming outp
264e0 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72  ut columns..quer
264f0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
26500 45 43 54 20 41 4c 4c 20 39 38 20 63 6f 6c 30 20  ECT ALL 98 col0 
26510 46 52 4f 4d 20 74 61 62 30 2c 20 74 61 62 30 20  FROM tab0, tab0 
26520 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39  AS cor0..----..9
26530 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20   values hashing 
26540 74 6f 20 66 39 64 65 65 38 63 32 31 31 31 36 66  to f9dee8c21116f
26550 31 61 65 64 36 34 61 63 35 31 36 30 65 31 39 30  1aed64ac5160e190
26560 38 30 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  809....query I r
26570 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 33  owsort..SELECT 3
26580 32 20 2a 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f  2 * + col0 AS co
26590 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l1 FROM tab0 AS 
265a0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 32 30  cor0..----..1120
265b0 0d 0a 32 38 34 38 0d 0a 37 36 38 0d 0a 0d 0a 71  ..2848..768....q
265c0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
265d0 53 45 4c 45 43 54 20 2d 20 2d 20 34 37 20 2a 20  SELECT - - 47 * 
265e0 2b 20 63 6f 6c 31 20 2b 20 63 6f 72 30 2e 63 6f  + col1 + cor0.co
265f0 6c 31 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  l1 AS col1 FROM 
26600 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
26610 2d 2d 0d 0a 31 34 38 38 0d 0a 32 38 33 32 0d 0a  --..1488..2832..
26620 38 31 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  816....query I r
26630 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
26640 49 53 54 49 4e 43 54 20 31 36 20 46 52 4f 4d 20  ISTINCT 16 FROM 
26650 74 61 62 32 2c 20 74 61 62 30 20 41 53 20 63 6f  tab2, tab0 AS co
26660 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 36 0d 0a 0d 0a  r0..----..16....
26670 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
26680 0a 53 45 4c 45 43 54 20 32 20 2a 20 38 39 20 46  .SELECT 2 * 89 F
26690 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
266a0 0d 0a 2d 2d 2d 2d 0d 0a 31 37 38 0d 0a 31 37 38  ..----..178..178
266b0 0d 0a 31 37 38 0d 0a 0d 0a 71 75 65 72 79 20 49  ..178....query I
266c0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
266d0 20 2b 20 34 38 20 46 52 4f 4d 20 74 61 62 31 2c   + 48 FROM tab1,
266e0 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
266f0 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61  ---..9 values ha
26700 73 68 69 6e 67 20 74 6f 20 38 62 30 39 63 63 32  shing to 8b09cc2
26710 63 39 39 63 32 31 30 32 30 33 36 31 36 32 64 30  c99c2102036162d0
26720 36 33 65 30 65 35 61 34 62 0d 0a 0d 0a 71 75 65  63e0e5a4b....que
26730 72 79 20 49 49 49 49 49 49 49 49 49 49 49 49 49  ry IIIIIIIIIIIII
26740 49 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45  II rowsort..SELE
26750 43 54 20 2a 20 46 52 4f 4d 20 74 61 62 32 2c 20  CT * FROM tab2, 
26760 74 61 62 31 20 63 6f 72 30 2c 20 74 61 62 32 20  tab1 cor0, tab2 
26770 41 53 20 63 6f 72 31 2c 20 74 61 62 31 2c 20 74  AS cor1, tab1, t
26780 61 62 31 20 41 53 20 63 6f 72 32 0d 0a 2d 2d 2d  ab1 AS cor2..---
26790 2d 0d 0a 33 36 34 35 20 76 61 6c 75 65 73 20 68  -..3645 values h
267a0 61 73 68 69 6e 67 20 74 6f 20 33 65 66 33 64 33  ashing to 3ef3d3
267b0 33 33 31 33 38 62 32 62 35 35 38 62 37 37 30 30  33138b2b558b7700
267c0 34 62 61 64 39 62 64 61 62 63 0d 0a 0d 0a 71 75  4bad9bdabc....qu
267d0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
267e0 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b  ELECT DISTINCT +
267f0 20 63 6f 72 31 2e 63 6f 6c 32 20 2b 20 2d 20 63   cor1.col2 + - c
26800 6f 72 31 2e 63 6f 6c 32 20 46 52 4f 4d 20 74 61  or1.col2 FROM ta
26810 62 30 2c 20 74 61 62 32 20 41 53 20 63 6f 72 30  b0, tab2 AS cor0
26820 2c 20 74 61 62 31 20 41 53 20 63 6f 72 31 0d 0a  , tab1 AS cor1..
26830 2d 2d 2d 2d 0d 0a 30 0d 0a 0d 0a 71 75 65 72 79  ----..0....query
26840 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
26850 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f 72 30  CT DISTINCT cor0
26860 2e 63 6f 6c 30 20 2b 20 63 6f 72 30 2e 63 6f 6c  .col0 + cor0.col
26870 30 20 46 52 4f 4d 20 74 61 62 32 2c 20 74 61 62  0 FROM tab2, tab
26880 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
26890 0a 31 37 38 0d 0a 34 38 0d 0a 37 30 0d 0a 0d 0a  .178..48..70....
268a0 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73  onlyif mysql # s
268b0 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c  upport for MySQL
268c0 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d   specific system
268d0 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61   types and synta
268e0 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  x..query I rowso
268f0 72 74 20 6c 61 62 65 6c 2d 31 31 30 38 0d 0a 53  rt label-1108..S
26900 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d  ELECT DISTINCT -
26910 20 38 33 20 2a 20 2d 20 28 20 63 6f 6c 31 20 29   83 * - ( col1 )
26920 20 2a 20 43 41 53 54 28 20 4e 55 4c 4c 20 41 53   * CAST( NULL AS
26930 20 53 49 47 4e 45 44 20 29 20 2b 20 38 34 20 46   SIGNED ) + 84 F
26940 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
26950 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 0d 0a  ..----..NULL....
26960 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
26970 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
26980 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
26990 61 62 65 6c 2d 31 31 30 38 0d 0a 53 45 4c 45 43  abel-1108..SELEC
269a0 54 20 44 49 53 54 49 4e 43 54 20 2d 20 38 33 20  T DISTINCT - 83 
269b0 2a 20 2d 20 28 20 63 6f 6c 31 20 29 20 2a 20 43  * - ( col1 ) * C
269c0 41 53 54 20 28 20 4e 55 4c 4c 20 41 53 20 49 4e  AST ( NULL AS IN
269d0 54 45 47 45 52 20 29 20 2b 20 38 34 20 46 52 4f  TEGER ) + 84 FRO
269e0 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
269f0 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75  ----..NULL....qu
26a00 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
26a10 45 4c 45 43 54 20 41 4c 4c 20 2d 20 2b 20 28 20  ELECT ALL - + ( 
26a20 63 6f 6c 32 20 29 20 2b 20 2d 20 63 6f 6c 31 20  col2 ) + - col1 
26a30 2b 20 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46  + col2 AS col1 F
26a40 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d  ROM tab0 cor0..-
26a50 2d 2d 2d 0d 0a 2d 38 36 0d 0a 2d 39 31 0d 0a 2d  ---..-86..-91..-
26a60 39 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  97....query I ro
26a70 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
26a80 36 32 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d  62 FROM tab0..--
26a90 2d 2d 0d 0a 36 32 0d 0a 36 32 0d 0a 36 32 0d 0a  --..62..62..62..
26aa0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
26ab0 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2b 20 63 6f  t..SELECT + + co
26ac0 6c 30 20 2b 20 2b 20 63 6f 6c 30 20 2b 20 2b 20  l0 + + col0 + + 
26ad0 32 30 20 2a 20 63 6f 6c 30 20 46 52 4f 4d 20 74  20 * col0 FROM t
26ae0 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
26af0 2d 0d 0a 31 34 30 38 0d 0a 31 37 36 30 0d 0a 36  -..1408..1760..6
26b00 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  6....query I row
26b10 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 31  sort..SELECT + 1
26b20 34 20 2a 20 2d 20 63 6f 6c 30 20 2b 20 28 20 2b  4 * - col0 + ( +
26b30 20 63 6f 72 30 2e 63 6f 6c 32 20 2a 20 63 6f 6c   cor0.col2 * col
26b40 32 20 29 20 2b 20 63 6f 6c 31 20 2a 20 2d 20 63  2 ) + col1 * - c
26b50 6f 6c 30 20 2a 20 63 6f 6c 30 20 46 52 4f 4d 20  ol0 * col0 FROM 
26b60 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab0 cor0..----.
26b70 0a 2d 31 31 39 33 31 34 0d 0a 2d 34 38 37 38 33  .-119314..-48783
26b80 0d 0a 2d 37 31 35 33 33 33 0d 0a 0d 0a 71 75 65  ..-715333....que
26b90 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
26ba0 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 31 20 2b 20  LECT ALL col1 + 
26bb0 2d 20 63 6f 6c 31 20 2b 20 63 6f 6c 30 20 41 53  - col1 + col0 AS
26bc0 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d   col0 FROM tab0.
26bd0 0a 2d 2d 2d 2d 0d 0a 32 34 0d 0a 33 35 0d 0a 38  .----..24..35..8
26be0 39 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  9....onlyif mysq
26bf0 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72  l # use DIV oper
26c00 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72  ator for integer
26c10 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79   division..query
26c20 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
26c30 2d 31 31 31 34 0d 0a 53 45 4c 45 43 54 20 41 4c  -1114..SELECT AL
26c40 4c 20 63 6f 6c 31 20 2a 20 63 6f 6c 32 20 2b 20  L col1 * col2 + 
26c50 2d 20 74 61 62 31 2e 63 6f 6c 32 20 44 49 56 20  - tab1.col2 DIV 
26c60 63 6f 6c 32 20 2b 20 2d 20 63 6f 6c 32 20 2a 20  col2 + - col2 * 
26c70 63 6f 6c 31 20 2a 20 2b 20 28 20 74 61 62 31 2e  col1 * + ( tab1.
26c80 63 6f 6c 32 20 29 20 63 6f 6c 30 20 46 52 4f 4d  col2 ) col0 FROM
26c90 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31   tab1..----..-11
26ca0 38 35 36 31 0d 0a 2d 33 31 39 32 31 0d 0a 2d 37  8561..-31921..-7
26cb0 34 34 31 33 0d 0a 0d 0a 73 6b 69 70 69 66 20 70  4413....skipif p
26cc0 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74  ostgresql # Post
26cd0 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20  greSQL requires 
26ce0 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67  AS when renaming
26cf0 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d   output columns.
26d00 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
26d10 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
26d20 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
26d30 6c 61 62 65 6c 2d 31 31 31 34 0d 0a 53 45 4c 45  label-1114..SELE
26d40 43 54 20 41 4c 4c 20 63 6f 6c 31 20 2a 20 63 6f  CT ALL col1 * co
26d50 6c 32 20 2b 20 2d 20 74 61 62 31 2e 63 6f 6c 32  l2 + - tab1.col2
26d60 20 2f 20 63 6f 6c 32 20 2b 20 2d 20 63 6f 6c 32   / col2 + - col2
26d70 20 2a 20 63 6f 6c 31 20 2a 20 2b 20 28 20 74 61   * col1 * + ( ta
26d80 62 31 2e 63 6f 6c 32 20 29 20 63 6f 6c 30 20 46  b1.col2 ) col0 F
26d90 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab1..----..
26da0 2d 31 31 38 35 36 31 0d 0a 2d 33 31 39 32 31 0d  -118561..-31921.
26db0 0a 2d 37 34 34 31 33 0d 0a 0d 0a 71 75 65 72 79  .-74413....query
26dc0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
26dd0 43 54 20 44 49 53 54 49 4e 43 54 20 74 61 62 32  CT DISTINCT tab2
26de0 2e 63 6f 6c 31 20 2a 20 63 6f 6c 31 20 2b 20 28  .col1 * col1 + (
26df0 20 36 34 20 29 20 41 53 20 63 6f 6c 31 20 46 52   64 ) AS col1 FR
26e00 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31  OM tab2..----..1
26e10 30 32 35 0d 0a 33 35 33 0d 0a 33 35 34 35 0d 0a  025..353..3545..
26e20 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
26e30 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 28 20  t..SELECT ALL ( 
26e40 2d 20 63 6f 6c 32 20 29 20 41 53 20 63 6f 6c 31  - col2 ) AS col1
26e50 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
26e60 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 2d 33  r0..----..-1..-3
26e70 33 0d 0a 2d 38 32 0d 0a 0d 0a 71 75 65 72 79 20  3..-82....query 
26e80 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
26e90 54 20 2b 20 2b 20 63 6f 6c 31 20 2a 20 2d 20 63  T + + col1 * - c
26ea0 6f 6c 30 20 2b 20 37 36 20 2a 20 2b 20 31 37 20  ol0 + 76 * + 17 
26eb0 2b 20 63 6f 6c 31 20 2a 20 63 6f 6c 31 20 46 52  + col1 * col1 FR
26ec0 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
26ed0 0a 2d 2d 2d 2d 0d 0a 31 34 37 34 0d 0a 36 36 32  .----..1474..662
26ee0 34 0d 0a 37 33 30 36 0d 0a 0d 0a 73 6b 69 70 69  4..7306....skipi
26ef0 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50  f postgresql # P
26f00 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72  ostgreSQL requir
26f10 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d  es AS when renam
26f20 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d  ing output colum
26f30 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ns..query I rows
26f40 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
26f50 49 4e 43 54 20 2b 20 63 6f 72 30 2e 63 6f 6c 32  INCT + cor0.col2
26f60 20 2a 20 2d 20 63 6f 6c 31 20 63 6f 6c 30 20 46   * - col1 col0 F
26f70 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
26f80 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32 34 38 0d 0a 2d  ..----..-1248..-
26f90 31 34 30 34 0d 0a 2d 35 37 30 0d 0a 0d 0a 71 75  1404..-570....qu
26fa0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
26fb0 45 4c 45 43 54 20 63 6f 6c 30 20 2a 20 28 20 2b  ELECT col0 * ( +
26fc0 20 63 6f 6c 30 20 29 20 41 53 20 63 6f 6c 31 20   col0 ) AS col1 
26fd0 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
26fe0 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 32 35 0d 0a 35  0..----..1225..5
26ff0 37 36 0d 0a 37 39 32 31 0d 0a 0d 0a 6f 6e 6c 79  76..7921....only
27000 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44  if mysql # use D
27010 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20  IV operator for 
27020 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e  integer division
27030 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
27040 74 20 6c 61 62 65 6c 2d 31 31 32 30 0d 0a 53 45  t label-1120..SE
27050 4c 45 43 54 20 63 6f 6c 30 20 44 49 56 20 2d 20  LECT col0 DIV - 
27060 28 20 37 37 20 29 20 41 53 20 63 6f 6c 30 20 46  ( 77 ) AS col0 F
27070 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
27080 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 2d 31 0d 0a  ..----..-1..-1..
27090 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  0....skipif mysq
270a0 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
270b0 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
270c0 6f 72 74 20 6c 61 62 65 6c 2d 31 31 32 30 0d 0a  ort label-1120..
270d0 53 45 4c 45 43 54 20 63 6f 6c 30 20 2f 20 2d 20  SELECT col0 / - 
270e0 28 20 37 37 20 29 20 41 53 20 63 6f 6c 30 20 46  ( 77 ) AS col0 F
270f0 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
27100 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 2d 31 0d 0a  ..----..-1..-1..
27110 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  0....query I row
27120 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
27130 54 49 4e 43 54 20 2b 20 63 6f 72 30 2e 63 6f 6c  TINCT + cor0.col
27140 32 20 2b 20 28 20 63 6f 6c 31 20 29 20 46 52 4f  2 + ( col1 ) FRO
27150 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
27160 2d 2d 2d 2d 0d 0a 31 31 39 0d 0a 31 37 33 0d 0a  ----..119..173..
27170 39 38 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  98....onlyif mys
27180 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72  ql # support for
27190 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63 20   MySQL specific 
271a0 73 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64  system types and
271b0 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49   syntax..query I
271c0 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
271d0 31 32 32 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f  122..SELECT - co
271e0 6c 30 20 2a 20 2b 20 43 41 53 54 28 20 4e 55 4c  l0 * + CAST( NUL
271f0 4c 20 41 53 20 53 49 47 4e 45 44 20 29 20 41 53  L AS SIGNED ) AS
27200 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20   col2 FROM tab1 
27210 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e  AS cor0..----..N
27220 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d  ULL..NULL..NULL.
27230 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
27240 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
27250 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
27260 74 20 6c 61 62 65 6c 2d 31 31 32 32 0d 0a 53 45  t label-1122..SE
27270 4c 45 43 54 20 2d 20 63 6f 6c 30 20 2a 20 2b 20  LECT - col0 * + 
27280 43 41 53 54 20 28 20 4e 55 4c 4c 20 41 53 20 49  CAST ( NULL AS I
27290 4e 54 45 47 45 52 20 29 20 41 53 20 63 6f 6c 32  NTEGER ) AS col2
272a0 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
272b0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a  r0..----..NULL..
272c0 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75  NULL..NULL....qu
272d0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
272e0 45 4c 45 43 54 20 2b 20 2d 20 63 6f 6c 30 20 2a  ELECT + - col0 *
272f0 20 2b 20 28 20 63 6f 6c 30 20 29 20 41 53 20 63   + ( col0 ) AS c
27300 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol1 FROM tab0 AS
27310 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32   cor0..----..-12
27320 32 35 0d 0a 2d 35 37 36 0d 0a 2d 37 39 32 31 0d  25..-576..-7921.
27330 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
27340 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
27350 4e 43 54 20 2d 20 2d 20 63 6f 6c 31 20 2b 20 37  NCT - - col1 + 7
27360 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
27370 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
27380 0d 0a 31 37 0d 0a 32 30 0d 0a 33 33 0d 0a 0d 0a  ..17..20..33....
27390 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
273a0 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 2b 20  .SELECT ALL - + 
273b0 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c 31 20 41 53  col2 * - col1 AS
273c0 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20   col1 FROM tab1 
273d0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 34 38  cor0..----..1248
273e0 0d 0a 31 34 30 34 0d 0a 35 37 30 0d 0a 0d 0a 6f  ..1404..570....o
273f0 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73  nlyif mysql # us
27400 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66  e DIV operator f
27410 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73  or integer divis
27420 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ion..query I row
27430 73 6f 72 74 20 6c 61 62 65 6c 2d 31 31 32 36 0d  sort label-1126.
27440 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 31  .SELECT ALL col1
27450 20 44 49 56 20 2d 20 63 6f 6c 31 20 41 53 20 63   DIV - col1 AS c
27460 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d  ol2 FROM tab2..-
27470 2d 2d 2d 0d 0a 2d 31 0d 0a 2d 31 0d 0a 2d 31 0d  ---..-1..-1..-1.
27480 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
27490 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
274a0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
274b0 74 20 6c 61 62 65 6c 2d 31 31 32 36 0d 0a 53 45  t label-1126..SE
274c0 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 31 20 2f 20  LECT ALL col1 / 
274d0 2d 20 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46  - col1 AS col2 F
274e0 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab2..----..
274f0 2d 31 0d 0a 2d 31 0d 0a 2d 31 0d 0a 0d 0a 6f 6e  -1..-1..-1....on
27500 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
27510 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
27520 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
27530 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
27540 6f 72 74 20 6c 61 62 65 6c 2d 31 31 32 37 0d 0a  ort label-1127..
27550 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
27560 2d 20 63 6f 6c 30 20 44 49 56 20 63 6f 6c 30 20  - col0 DIV col0 
27570 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
27580 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
27590 0a 2d 31 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  .-1....skipif my
275a0 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
275b0 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
275c0 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 31 32 37  wsort label-1127
275d0 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
275e0 54 20 2d 20 63 6f 6c 30 20 2f 20 63 6f 6c 30 20  T - col0 / col0 
275f0 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
27600 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
27610 0a 2d 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .-1....query I r
27620 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
27630 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c 31 20 2a  ISTINCT - col1 *
27640 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 2a 20 63   + cor0.col0 * c
27650 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol2 FROM tab0 AS
27660 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 33   cor0..----..-33
27670 39 35 0d 0a 2d 36 36 34 31 31 38 0d 0a 2d 36 38  95..-664118..-68
27680 31 31 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  112....query I r
27690 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
276a0 49 53 54 49 4e 43 54 20 2b 20 33 38 20 41 53 20  ISTINCT + 38 AS 
276b0 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 2c 20  col1 FROM tab1, 
276c0 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab0 cor0..----.
276d0 0a 33 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .38....query I r
276e0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
276f0 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c 32 20 2b  ISTINCT - col2 +
27700 20 39 34 20 46 52 4f 4d 20 74 61 62 30 20 41 53   94 FROM tab0 AS
27710 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 0d   cor0..----..12.
27720 0a 36 31 0d 0a 39 33 0d 0a 0d 0a 71 75 65 72 79  .61..93....query
27730 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
27740 43 54 20 41 4c 4c 20 2b 20 2d 20 63 6f 72 30 2e  CT ALL + - cor0.
27750 63 6f 6c 31 20 2a 20 63 6f 72 30 2e 63 6f 6c 31  col1 * cor0.col1
27760 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
27770 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
27780 0d 0a 2d 31 30 30 0d 0a 2d 31 36 39 0d 0a 2d 36  ..-100..-169..-6
27790 37 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  76....query I ro
277a0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
277b0 53 54 49 4e 43 54 20 63 6f 6c 30 20 2b 20 2b 20  STINCT col0 + + 
277c0 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c 31 20 46 52  col0 * - col1 FR
277d0 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d  OM tab1..----..-
277e0 35 37 36 0d 0a 2d 37 35 0d 0a 2d 39 36 30 0d 0a  576..-75..-960..
277f0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
27800 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 31 20 2b  t..SELECT col1 +
27810 20 2b 20 74 61 62 32 2e 63 6f 6c 31 20 2a 20 2b   + tab2.col1 * +
27820 20 63 6f 6c 30 20 2a 20 63 6f 6c 32 20 46 52 4f   col0 * col2 FRO
27830 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 31  M tab2..----..11
27840 39 37 31 31 0d 0a 35 31 30 35 31 0d 0a 35 38 39  9711..51051..589
27850 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  0....query I row
27860 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
27870 54 49 4e 43 54 20 39 33 20 46 52 4f 4d 20 74 61  TINCT 93 FROM ta
27880 62 30 2c 20 74 61 62 31 20 41 53 20 63 6f 72 30  b0, tab1 AS cor0
27890 2c 20 74 61 62 31 20 41 53 20 63 6f 72 31 0d 0a  , tab1 AS cor1..
278a0 2d 2d 2d 2d 0d 0a 39 33 0d 0a 0d 0a 71 75 65 72  ----..93....quer
278b0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
278c0 45 43 54 20 2b 20 36 31 20 46 52 4f 4d 20 74 61  ECT + 61 FROM ta
278d0 62 30 2c 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d  b0, tab0 cor0..-
278e0 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61  ---..9 values ha
278f0 73 68 69 6e 67 20 74 6f 20 30 37 31 34 39 39 30  shing to 0714990
27900 35 61 37 32 62 64 38 37 35 35 33 33 38 31 66 33  5a72bd87553381f3
27910 34 64 31 39 65 64 32 39 30 0d 0a 0d 0a 73 6b 69  4d19ed290....ski
27920 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23  pif postgresql #
27930 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75   PostgreSQL requ
27940 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e  ires AS when ren
27950 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c  aming output col
27960 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f  umns..query I ro
27970 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
27980 53 54 49 4e 43 54 20 2b 20 31 31 20 63 6f 6c 30  STINCT + 11 col0
27990 20 46 52 4f 4d 20 74 61 62 31 2c 20 74 61 62 32   FROM tab1, tab2
279a0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
279b0 31 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  11....query I ro
279c0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
279d0 63 6f 6c 30 20 2a 20 2d 20 38 37 20 2a 20 2d 20  col0 * - 87 * - 
279e0 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46 52 4f  col0 AS col1 FRO
279f0 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
27a00 2d 2d 2d 2d 0d 0a 2d 34 32 36 33 0d 0a 2d 35 32  ----..-4263..-52
27a10 39 33 30 38 0d 0a 2d 35 34 32 39 36 37 0d 0a 0d  9308..-542967...
27a20 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
27a30 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72  use DIV operator
27a40 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76   for integer div
27a50 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72  ision..query I r
27a60 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 31 33  owsort label-113
27a70 38 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f  8..SELECT ALL co
27a80 6c 32 20 44 49 56 20 2d 20 28 20 31 39 20 2a 20  l2 DIV - ( 19 * 
27a90 2b 20 74 61 62 30 2e 63 6f 6c 30 20 29 20 41 53  + tab0.col0 ) AS
27aa0 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d   col0 FROM tab0.
27ab0 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a  .----..0..0..0..
27ac0 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
27ad0 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
27ae0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
27af0 20 6c 61 62 65 6c 2d 31 31 33 38 0d 0a 53 45 4c   label-1138..SEL
27b00 45 43 54 20 41 4c 4c 20 63 6f 6c 32 20 2f 20 2d  ECT ALL col2 / -
27b10 20 28 20 31 39 20 2a 20 2b 20 74 61 62 30 2e 63   ( 19 * + tab0.c
27b20 6f 6c 30 20 29 20 41 53 20 63 6f 6c 30 20 46 52  ol0 ) AS col0 FR
27b30 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 30  OM tab0..----..0
27b40 0d 0a 30 0d 0a 30 0d 0a 0d 0a 6f 6e 6c 79 69 66  ..0..0....onlyif
27b50 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56   mysql # use DIV
27b60 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e   operator for in
27b70 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a  teger division..
27b80 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
27b90 6c 61 62 65 6c 2d 31 31 33 39 0d 0a 53 45 4c 45  label-1139..SELE
27ba0 43 54 20 44 49 53 54 49 4e 43 54 20 74 61 62 31  CT DISTINCT tab1
27bb0 2e 63 6f 6c 31 20 44 49 56 20 2d 20 28 20 2d 20  .col1 DIV - ( - 
27bc0 63 6f 6c 30 20 29 20 46 52 4f 4d 20 74 61 62 31  col0 ) FROM tab1
27bd0 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 38 0d 0a 0d 0a  ..----..0..8....
27be0 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
27bf0 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
27c00 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
27c10 61 62 65 6c 2d 31 31 33 39 0d 0a 53 45 4c 45 43  abel-1139..SELEC
27c20 54 20 44 49 53 54 49 4e 43 54 20 74 61 62 31 2e  T DISTINCT tab1.
27c30 63 6f 6c 31 20 2f 20 2d 20 28 20 2d 20 63 6f 6c  col1 / - ( - col
27c40 30 20 29 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d  0 ) FROM tab1..-
27c50 2d 2d 2d 0d 0a 30 0d 0a 38 0d 0a 0d 0a 6f 6e 6c  ---..0..8....onl
27c60 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20  yif mysql # use 
27c70 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72  DIV operator for
27c80 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f   integer divisio
27c90 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  n..query I rowso
27ca0 72 74 20 6c 61 62 65 6c 2d 31 31 34 30 0d 0a 53  rt label-1140..S
27cb0 45 4c 45 43 54 20 63 6f 6c 30 20 2b 20 33 33 20  ELECT col0 + 33 
27cc0 44 49 56 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61  DIV col1 FROM ta
27cd0 62 30 0d 0a 2d 2d 2d 2d 0d 0a 32 34 0d 0a 33 35  b0..----..24..35
27ce0 0d 0a 38 39 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  ..89....skipif m
27cf0 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
27d00 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
27d10 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 31 34  owsort label-114
27d20 30 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 30 20 2b  0..SELECT col0 +
27d30 20 33 33 20 2f 20 63 6f 6c 31 20 46 52 4f 4d 20   33 / col1 FROM 
27d40 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 32 34 0d 0a  tab0..----..24..
27d50 33 35 0d 0a 38 39 0d 0a 0d 0a 71 75 65 72 79 20  35..89....query 
27d60 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
27d70 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 31 20  T DISTINCT col1 
27d80 2a 20 28 20 2b 20 63 6f 6c 32 20 2a 20 63 6f 6c  * ( + col2 * col
27d90 30 20 2b 20 2b 20 35 20 29 20 46 52 4f 4d 20 74  0 + + 5 ) FROM t
27da0 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 33 36 35 33 30  ab1..----..36530
27db0 0d 0a 34 33 34 32 0d 0a 39 39 39 30 35 0d 0a 0d  ..4342..99905...
27dc0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
27dd0 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 31 20 2b 20  ..SELECT col1 + 
27de0 2b 20 74 61 62 30 2e 63 6f 6c 32 20 2a 20 37 37  + tab0.col2 * 77
27df0 20 2a 20 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20   * col0 AS col1 
27e00 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d  FROM tab0..----.
27e10 0a 32 37 39 32 0d 0a 35 36 32 30 33 37 0d 0a 36  .2792..562037..6
27e20 31 30 37 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  1070....onlyif m
27e30 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66  ysql # support f
27e40 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69  or MySQL specifi
27e50 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61  c system types a
27e60 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79  nd syntax..query
27e70 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
27e80 2d 31 31 34 33 0d 0a 53 45 4c 45 43 54 20 41 4c  -1143..SELECT AL
27e90 4c 20 2d 20 63 6f 6c 32 20 2b 20 2b 20 63 6f 6c  L - col2 + + col
27ea0 31 20 2a 20 43 41 53 54 28 20 63 6f 6c 30 20 41  1 * CAST( col0 A
27eb0 53 20 53 49 47 4e 45 44 20 29 20 41 53 20 63 6f  S SIGNED ) AS co
27ec0 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l0 FROM tab2 AS 
27ed0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33 30 35  cor0..----..1305
27ee0 0d 0a 31 39 30 0d 0a 34 35 37 36 0d 0a 0d 0a 73  ..190..4576....s
27ef0 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
27f00 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
27f10 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
27f20 62 65 6c 2d 31 31 34 33 0d 0a 53 45 4c 45 43 54  bel-1143..SELECT
27f30 20 41 4c 4c 20 2d 20 63 6f 6c 32 20 2b 20 2b 20   ALL - col2 + + 
27f40 63 6f 6c 31 20 2a 20 43 41 53 54 20 28 20 63 6f  col1 * CAST ( co
27f50 6c 30 20 41 53 20 49 4e 54 45 47 45 52 20 29 20  l0 AS INTEGER ) 
27f60 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
27f70 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
27f80 0a 31 33 30 35 0d 0a 31 39 30 0d 0a 34 35 37 36  .1305..190..4576
27f90 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
27fa0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
27fb0 49 4e 43 54 20 2b 20 63 6f 72 30 2e 63 6f 6c 30  INCT + cor0.col0
27fc0 20 2a 20 63 6f 6c 31 20 2d 20 63 6f 6c 31 20 46   * col1 - col1 F
27fd0 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
27fe0 0d 0a 2d 2d 2d 2d 0d 0a 31 33 32 36 0d 0a 31 38  ..----..1326..18
27ff0 36 0d 0a 34 35 34 33 0d 0a 0d 0a 71 75 65 72 79  6..4543....query
28000 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
28010 43 54 20 2b 20 31 33 20 2b 20 2d 20 63 6f 6c 30  CT + 13 + - col0
28020 20 2b 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74   + + col1 FROM t
28030 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 39 0d 0a  ab2..----..-49..
28040 2d 36 0d 0a 33 37 0d 0a 0d 0a 71 75 65 72 79 20  -6..37....query 
28050 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
28060 54 20 37 39 20 2b 20 63 6f 6c 31 20 2d 20 2b 20  T 79 + col1 - + 
28070 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c 31 20 41 53  col2 * + col1 AS
28080 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 0d   col1 FROM tab2.
28090 0a 2d 2d 2d 2d 0d 0a 2d 31 33 39 36 0d 0a 2d 35  .----..-1396..-5
280a0 35 30 0d 0a 2d 37 32 37 0d 0a 0d 0a 73 6b 69 70  50..-727....skip
280b0 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20  if postgresql # 
280c0 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69  PostgreSQL requi
280d0 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61  res AS when rena
280e0 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75  ming output colu
280f0 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  mns..query I row
28100 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 35  sort..SELECT - 5
28110 38 20 2b 20 2d 20 74 61 62 31 2e 63 6f 6c 30 20  8 + - tab1.col0 
28120 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 0d 0a  col1 FROM tab1..
28130 2d 2d 2d 2d 0d 0a 2d 31 32 32 0d 0a 2d 31 33 38  ----..-122..-138
28140 0d 0a 2d 36 31 0d 0a 0d 0a 71 75 65 72 79 20 49  ..-61....query I
28150 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
28160 20 44 49 53 54 49 4e 43 54 20 2b 20 34 20 41 53   DISTINCT + 4 AS
28170 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20   col0 FROM tab1 
28180 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 34  AS cor0..----..4
28190 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
281a0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f  ort..SELECT - co
281b0 72 30 2e 63 6f 6c 32 20 2b 20 63 6f 6c 32 20 46  r0.col2 + col2 F
281c0 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d  ROM tab1 cor0..-
281d0 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a  ---..0..0..0....
281e0 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75  onlyif mysql # u
281f0 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20  se DIV operator 
28200 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69  for integer divi
28210 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f  sion..query I ro
28220 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 31 35 30  wsort label-1150
28230 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 2d  ..SELECT ALL - -
28240 20 63 6f 6c 30 20 44 49 56 20 63 6f 6c 32 20 2b   col0 DIV col2 +
28250 20 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46 52   col1 AS col2 FR
28260 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
28270 0a 2d 2d 2d 2d 0d 0a 31 31 0d 0a 31 33 0d 0a 32  .----..11..13..2
28280 36 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  6....skipif mysq
28290 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
282a0 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
282b0 6f 72 74 20 6c 61 62 65 6c 2d 31 31 35 30 0d 0a  ort label-1150..
282c0 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 2d 20 63  SELECT ALL - - c
282d0 6f 6c 30 20 2f 20 63 6f 6c 32 20 2b 20 63 6f 6c  ol0 / col2 + col
282e0 31 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  1 AS col2 FROM t
282f0 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
28300 2d 0d 0a 31 31 0d 0a 31 33 0d 0a 32 36 0d 0a 0d  -..11..13..26...
28310 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
28320 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 30 20 2a 20  ..SELECT col0 * 
28330 2b 20 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c 31 20  + col0 + + col1 
28340 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
28350 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
28360 0a 36 31 34 33 0d 0a 36 32 35 38 0d 0a 38 30 0d  .6143..6258..80.
28370 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
28380 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
28390 4e 43 54 20 2b 20 63 6f 6c 30 20 2a 20 2b 20 33  NCT + col0 * + 3
283a0 20 2d 20 2d 20 63 6f 6c 31 20 2a 20 28 20 63 6f   - - col1 * ( co
283b0 6c 31 20 2a 20 2b 20 63 6f 6c 31 20 29 20 46 52  l1 * + col1 ) FR
283c0 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 32  OM tab2..----..2
283d0 30 35 36 31 33 0d 0a 32 39 38 31 32 0d 0a 35 31  05613..29812..51
283e0 35 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73  50....skipif pos
283f0 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72  tgresql # Postgr
28400 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53  eSQL requires AS
28410 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f   when renaming o
28420 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71  utput columns..q
28430 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
28440 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
28450 74 61 62 31 2e 63 6f 6c 30 20 2a 20 2b 20 63 6f  tab1.col0 * + co
28460 6c 31 20 2d 20 2d 20 63 6f 6c 31 20 63 6f 6c 31  l1 - - col1 col1
28470 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d   FROM tab1..----
28480 0d 0a 31 30 34 0d 0a 31 30 35 33 0d 0a 36 35 30  ..104..1053..650
28490 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
284a0 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61   # use DIV opera
284b0 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20  tor for integer 
284c0 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20  division..query 
284d0 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
284e0 31 31 35 34 0d 0a 53 45 4c 45 43 54 20 28 20 63  1154..SELECT ( c
284f0 6f 6c 31 20 29 20 2d 20 2d 20 63 6f 6c 31 20 44  ol1 ) - - col1 D
28500 49 56 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74  IV + col1 FROM t
28510 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 31 0d 0a 31  ab1..----..11..1
28520 34 0d 0a 32 37 0d 0a 0d 0a 73 6b 69 70 69 66 20  4..27....skipif 
28530 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
28540 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
28550 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 31  rowsort label-11
28560 35 34 0d 0a 53 45 4c 45 43 54 20 28 20 63 6f 6c  54..SELECT ( col
28570 31 20 29 20 2d 20 2d 20 63 6f 6c 31 20 2f 20 2b  1 ) - - col1 / +
28580 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 0d   col1 FROM tab1.
28590 0a 2d 2d 2d 2d 0d 0a 31 31 0d 0a 31 34 0d 0a 32  .----..11..14..2
285a0 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  7....query I row
285b0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 28 20 63  sort..SELECT ( c
285c0 6f 6c 31 20 29 20 2b 20 63 6f 6c 32 20 46 52 4f  ol1 ) + col2 FRO
285d0 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 30  M tab1..----..10
285e0 39 0d 0a 36 37 0d 0a 38 30 0d 0a 0d 0a 71 75 65  9..67..80....que
285f0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
28600 4c 45 43 54 20 63 6f 6c 32 20 2d 20 63 6f 6c 32  LECT col2 - col2
28610 20 2a 20 2d 20 63 6f 6c 32 20 46 52 4f 4d 20 74   * - col2 FROM t
28620 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 32 32 0d  ab0..----..1122.
28630 0a 32 0d 0a 36 38 30 36 0d 0a 0d 0a 71 75 65 72  .2..6806....quer
28640 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
28650 45 43 54 20 2b 20 63 6f 6c 32 20 2b 20 2d 20 34  ECT + col2 + - 4
28660 39 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d  9 FROM tab2..---
28670 2d 0d 0a 2d 31 31 0d 0a 2d 32 32 0d 0a 2d 32 33  -..-11..-22..-23
28680 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
28690 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
286a0 49 4e 43 54 20 2b 20 63 6f 6c 30 20 2a 20 63 6f  INCT + col0 * co
286b0 6c 31 20 2a 20 63 6f 6c 30 20 2d 20 28 20 63 6f  l1 * col0 - ( co
286c0 6c 31 20 2b 20 63 6f 6c 30 20 29 20 41 53 20 63  l1 + col0 ) AS c
286d0 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d  ol2 FROM tab0..-
286e0 2d 2d 2d 0d 0a 31 31 38 36 39 33 0d 0a 34 39 34  ---..118693..494
286f0 32 36 0d 0a 37 32 30 36 33 31 0d 0a 0d 0a 71 75  26..720631....qu
28700 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
28710 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b  ELECT DISTINCT +
28720 20 63 6f 6c 32 20 2b 20 2d 20 63 6f 6c 30 20 46   col2 + - col0 F
28730 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab2..----..
28740 2d 34 31 0d 0a 2d 35 32 0d 0a 32 30 0d 0a 0d 0a  -41..-52..20....
28750 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71  skipif postgresq
28760 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72  l # PostgreSQL r
28770 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20  equires AS when 
28780 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20  renaming output 
28790 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49  columns..query I
287a0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
287b0 20 44 49 53 54 49 4e 43 54 20 74 61 62 31 2e 63   DISTINCT tab1.c
287c0 6f 6c 32 20 2b 20 2d 20 63 6f 6c 31 20 2a 20 74  ol2 + - col1 * t
287d0 61 62 31 2e 63 6f 6c 31 20 63 6f 6c 31 20 46 52  ab1.col1 col1 FR
287e0 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d  OM tab1..----..-
287f0 34 33 0d 0a 2d 36 32 32 0d 0a 2d 37 33 0d 0a 0d  43..-622..-73...
28800 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
28810 0d 0a 53 45 4c 45 43 54 20 2d 20 74 61 62 32 2e  ..SELECT - tab2.
28820 63 6f 6c 32 20 2b 20 63 6f 6c 31 20 2a 20 36 39  col2 + col1 * 69
28830 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
28840 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 31 33 35 0d 0a  b2..----..1135..
28850 32 31 31 32 0d 0a 34 30 34 35 0d 0a 0d 0a 6f 6e  2112..4045....on
28860 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
28870 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
28880 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
28890 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
288a0 6f 72 74 20 6c 61 62 65 6c 2d 31 31 36 32 0d 0a  ort label-1162..
288b0 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
288c0 2b 20 31 20 2b 20 63 6f 6c 32 20 44 49 56 20 63  + 1 + col2 DIV c
288d0 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  ol1 AS col2 FROM
288e0 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
288f0 2d 2d 2d 0d 0a 31 0d 0a 33 0d 0a 0d 0a 73 6b 69  ---..1..3....ski
28900 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
28910 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
28920 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
28930 6c 2d 31 31 36 32 0d 0a 53 45 4c 45 43 54 20 44  l-1162..SELECT D
28940 49 53 54 49 4e 43 54 20 2b 20 31 20 2b 20 63 6f  ISTINCT + 1 + co
28950 6c 32 20 2f 20 63 6f 6c 31 20 41 53 20 63 6f 6c  l2 / col1 AS col
28960 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  2 FROM tab2 AS c
28970 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 0d 0a 33 0d  or0..----..1..3.
28980 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
28990 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
289a0 4e 43 54 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20  NCT + cor0.col0 
289b0 2a 20 63 6f 6c 31 20 2a 20 63 6f 6c 30 20 2b 20  * col1 * col0 + 
289c0 63 6f 6c 31 20 2a 20 63 6f 6c 30 20 2b 20 2b 20  col1 * col0 + + 
289d0 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46 52 4f  col1 AS col2 FRO
289e0 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
289f0 2d 2d 2d 2d 0d 0a 31 32 32 33 31 37 0d 0a 35 31  ----..122317..51
28a00 36 38 36 0d 0a 37 32 39 30 30 31 0d 0a 0d 0a 71  686..729001....q
28a10 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
28a20 53 45 4c 45 43 54 20 2d 20 2b 20 63 6f 72 30 2e  SELECT - + cor0.
28a30 63 6f 6c 32 20 2b 20 2d 20 63 6f 6c 32 20 2a 20  col2 + - col2 * 
28a40 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46  + col0 AS col0 F
28a50 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
28a60 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 30 35 34 0d 0a 2d  ..----..-2054..-
28a70 32 31 36 0d 0a 2d 33 30 34 30 0d 0a 0d 0a 71 75  216..-3040....qu
28a80 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
28a90 45 4c 45 43 54 20 2d 20 36 30 20 2a 20 63 6f 72  ELECT - 60 * cor
28aa0 30 2e 63 6f 6c 31 20 2b 20 2b 20 63 6f 6c 32 20  0.col1 + + col2 
28ab0 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
28ac0 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 35 30 36 0d 0a  0..----..-1506..
28ad0 2d 35 34 33 0d 0a 2d 36 38 34 0d 0a 0d 0a 71 75  -543..-684....qu
28ae0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
28af0 45 4c 45 43 54 20 2d 20 2b 20 30 20 2a 20 2b 20  ELECT - + 0 * + 
28b00 63 6f 6c 30 20 2b 20 63 6f 6c 32 20 46 52 4f 4d  col0 + col2 FROM
28b10 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab1 cor0..----
28b20 0d 0a 35 34 0d 0a 35 37 0d 0a 39 36 0d 0a 0d 0a  ..54..57..96....
28b30 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71  skipif postgresq
28b40 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72  l # PostgreSQL r
28b50 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20  equires AS when 
28b60 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20  renaming output 
28b70 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49  columns..query I
28b80 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
28b90 20 41 4c 4c 20 2d 20 28 20 63 6f 6c 32 20 29 20   ALL - ( col2 ) 
28ba0 2a 20 2d 20 28 20 2b 20 63 6f 6c 30 20 29 20 63  * - ( + col0 ) c
28bb0 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol1 FROM tab2 AS
28bc0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 38 39   cor0..----..189
28bd0 0d 0a 32 30 32 38 0d 0a 33 30 30 32 0d 0a 0d 0a  ..2028..3002....
28be0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
28bf0 0a 53 45 4c 45 43 54 20 2d 20 31 31 20 2a 20 63  .SELECT - 11 * c
28c00 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  ol2 AS col2 FROM
28c10 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
28c20 2d 2d 2d 0d 0a 2d 32 38 36 0d 0a 2d 32 39 37 0d  ---..-286..-297.
28c30 0a 2d 34 31 38 0d 0a 0d 0a 71 75 65 72 79 20 49  .-418....query I
28c40 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
28c50 20 41 4c 4c 20 2b 20 39 37 20 2b 20 2d 20 63 6f   ALL + 97 + - co
28c60 72 30 2e 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  r0.col2 FROM tab
28c70 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 35  0 cor0..----..15
28c80 0d 0a 36 34 0d 0a 39 36 0d 0a 0d 0a 71 75 65 72  ..64..96....quer
28c90 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
28ca0 45 43 54 20 2d 20 2b 20 63 6f 6c 30 20 2a 20 63  ECT - + col0 * c
28cb0 6f 6c 30 20 2b 20 2d 20 36 31 20 2a 20 63 6f 6c  ol0 + - 61 * col
28cc0 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  1 FROM tab2 AS c
28cd0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 39 34 30  or0..----..-1940
28ce0 0d 0a 2d 37 32 37 38 0d 0a 2d 39 36 38 33 0d 0a  ..-7278..-9683..
28cf0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
28d00 74 0d 0a 53 45 4c 45 43 54 20 28 20 2d 20 28 20  t..SELECT ( - ( 
28d10 2b 20 63 6f 6c 30 20 29 20 2a 20 63 6f 6c 31 20  + col0 ) * col1 
28d20 29 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  ) AS col0 FROM t
28d30 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 34 30  ab1..----..-1040
28d40 0d 0a 2d 36 34 30 0d 0a 2d 37 38 0d 0a 0d 0a 71  ..-640..-78....q
28d50 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
28d60 53 45 4c 45 43 54 20 2d 20 28 20 2d 20 74 61 62  SELECT - ( - tab
28d70 32 2e 63 6f 6c 32 20 29 20 41 53 20 63 6f 6c 31  2.col2 ) AS col1
28d80 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d   FROM tab2..----
28d90 0d 0a 32 36 0d 0a 32 37 0d 0a 33 38 0d 0a 0d 0a  ..26..27..38....
28da0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
28db0 0a 53 45 4c 45 43 54 20 38 32 20 2b 20 63 6f 6c  .SELECT 82 + col
28dc0 30 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d  0 FROM tab1..---
28dd0 2d 0d 0a 31 34 36 0d 0a 31 36 32 0d 0a 38 35 0d  -..146..162..85.
28de0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
28df0 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b  rt..SELECT ALL +
28e00 20 28 20 2b 20 28 20 63 6f 6c 31 20 29 20 29 20   ( + ( col1 ) ) 
28e10 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
28e20 30 0d 0a 2d 2d 2d 2d 0d 0a 38 36 0d 0a 39 31 0d  0..----..86..91.
28e30 0a 39 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .97....query I r
28e40 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
28e50 20 2b 20 31 33 20 2a 20 2b 20 63 6f 6c 32 20 2b   + 13 * + col2 +
28e60 20 2b 20 37 34 20 41 53 20 63 6f 6c 31 20 46 52   + 74 AS col1 FR
28e70 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
28e80 0a 2d 2d 2d 2d 0d 0a 2d 31 31 37 34 0d 0a 2d 36  .----..-1174..-6
28e90 32 38 0d 0a 2d 36 36 37 0d 0a 0d 0a 71 75 65 72  28..-667....quer
28ea0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
28eb0 45 43 54 20 2d 20 63 6f 6c 30 20 2a 20 2b 20 63  ECT - col0 * + c
28ec0 6f 6c 31 20 2b 20 2d 20 63 6f 6c 31 20 2a 20 2b  ol1 + - col1 * +
28ed0 20 63 6f 72 30 2e 63 6f 6c 30 20 41 53 20 63 6f   cor0.col0 AS co
28ee0 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 63 6f 72  l0 FROM tab2 cor
28ef0 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 36 38 36 0d 0a  0..----..-2686..
28f00 2d 34 33 34 0d 0a 2d 39 32 30 34 0d 0a 0d 0a 71  -434..-9204....q
28f10 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
28f20 53 45 4c 45 43 54 20 2b 20 63 6f 72 30 2e 63 6f  SELECT + cor0.co
28f30 6c 32 20 2b 20 63 6f 6c 32 20 2a 20 2d 20 63 6f  l2 + col2 * - co
28f40 6c 31 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  l1 AS col1 FROM 
28f50 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab1 cor0..----.
28f60 0a 2d 31 31 35 32 0d 0a 2d 31 33 35 30 0d 0a 2d  .-1152..-1350..-
28f70 35 31 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  513....query I r
28f80 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
28f90 20 37 33 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d   73 AS col1 FROM
28fa0 20 74 61 62 31 2c 20 74 61 62 31 20 41 53 20 63   tab1, tab1 AS c
28fb0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c  or0..----..9 val
28fc0 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 38  ues hashing to 8
28fd0 34 61 62 39 64 62 35 34 36 38 62 34 61 31 37 38  4ab9db5468b4a178
28fe0 31 62 64 38 64 35 63 38 65 30 65 37 37 66 63 0d  1bd8d5c8e0e77fc.
28ff0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
29000 72 74 0d 0a 53 45 4c 45 43 54 20 39 38 20 46 52  rt..SELECT 98 FR
29010 4f 4d 20 74 61 62 30 2c 20 74 61 62 30 20 41 53  OM tab0, tab0 AS
29020 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76   cor0..----..9 v
29030 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f  alues hashing to
29040 20 66 39 64 65 65 38 63 32 31 31 31 36 66 31 61   f9dee8c21116f1a
29050 65 64 36 34 61 63 35 31 36 30 65 31 39 30 38 30  ed64ac5160e19080
29060 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  9....query I row
29070 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 37  sort..SELECT - 7
29080 35 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  5 AS col0 FROM t
29090 61 62 32 2c 20 74 61 62 30 20 41 53 20 63 6f 72  ab2, tab0 AS cor
290a0 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65  0..----..9 value
290b0 73 20 68 61 73 68 69 6e 67 20 74 6f 20 32 35 38  s hashing to 258
290c0 62 63 35 36 35 63 36 34 39 32 34 64 39 30 35 61  bc565c64924d905a
290d0 35 35 65 61 61 61 36 65 35 37 35 34 37 0d 0a 0d  55eaaa6e57547...
290e0 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73  .skipif postgres
290f0 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20  ql # PostgreSQL 
29100 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e  requires AS when
29110 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74   renaming output
29120 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20   columns..query 
29130 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
29140 54 20 41 4c 4c 20 2b 20 63 6f 72 30 2e 63 6f 6c  T ALL + cor0.col
29150 32 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32  2 col2 FROM tab2
29160 2c 20 74 61 62 31 2c 20 74 61 62 31 20 41 53 20  , tab1, tab1 AS 
29170 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76  cor0..----..27 v
29180 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f  alues hashing to
29190 20 37 66 34 61 39 62 66 32 34 64 36 34 38 33 33   7f4a9bf24d64833
291a0 37 30 36 64 66 62 64 64 30 62 61 66 34 39 64 37  706dfbdd0baf49d7
291b0 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  9....query I row
291c0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 33  sort..SELECT + 3
291d0 32 20 2b 20 2d 20 63 6f 6c 30 20 46 52 4f 4d 20  2 + - col0 FROM 
291e0 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 36 0d  tab2..----..-46.
291f0 0a 2d 34 37 0d 0a 32 35 0d 0a 0d 0a 71 75 65 72  .-47..25....quer
29200 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
29210 45 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f 72  ECT DISTINCT cor
29220 30 2e 63 6f 6c 32 20 2a 20 63 6f 6c 31 20 2b 20  0.col2 * col1 + 
29230 63 6f 6c 30 20 2a 20 33 35 20 46 52 4f 4d 20 74  col0 * 35 FROM t
29240 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab2 cor0..----..
29250 31 30 38 32 0d 0a 33 34 31 31 0d 0a 34 32 36 34  1082..3411..4264
29260 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
29270 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 37 33  ort..SELECT - 73
29280 20 2a 20 2d 20 63 6f 6c 32 20 2d 20 63 6f 6c 32   * - col2 - col2
29290 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
292a0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 38 38 38 0d 0a  r0..----..3888..
292b0 34 31 30 34 0d 0a 36 39 31 32 0d 0a 0d 0a 71 75  4104..6912....qu
292c0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
292d0 45 4c 45 43 54 20 2b 20 2b 20 63 6f 6c 30 20 2a  ELECT + + col0 *
292e0 20 2d 20 63 6f 6c 31 20 2b 20 63 6f 6c 30 20 2a   - col1 + col0 *
292f0 20 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c 31 20 41   col0 * - col1 A
29300 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31  S col0 FROM tab1
29310 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
29320 2d 33 31 32 0d 0a 2d 34 31 36 30 30 0d 0a 2d 38  -312..-41600..-8
29330 34 32 34 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20  4240....query I 
29340 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
29350 41 4c 4c 20 2d 20 31 33 20 41 53 20 63 6f 6c 32  ALL - 13 AS col2
29360 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
29370 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 0d 0a 2d  r0..----..-13..-
29380 31 33 0d 0a 2d 31 33 0d 0a 0d 0a 71 75 65 72 79  13..-13....query
29390 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
293a0 43 54 20 44 49 53 54 49 4e 43 54 20 32 36 20 2b  CT DISTINCT 26 +
293b0 20 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46 52   col2 AS col1 FR
293c0 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
293d0 0a 2d 2d 2d 2d 0d 0a 35 32 0d 0a 35 33 0d 0a 36  .----..52..53..6
293e0 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  4....query I row
293f0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63  sort..SELECT - c
29400 6f 6c 30 20 2d 20 2b 20 63 6f 72 30 2e 63 6f 6c  ol0 - + cor0.col
29410 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  0 AS col2 FROM t
29420 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
29430 2d 0d 0a 2d 31 32 38 0d 0a 2d 31 36 30 0d 0a 2d  -..-128..-160..-
29440 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  6....query I row
29450 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 37  sort..SELECT + 7
29460 20 2a 20 63 6f 6c 32 20 2b 20 35 31 20 46 52 4f   * col2 + 51 FRO
29470 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
29480 2d 2d 2d 2d 0d 0a 32 33 33 0d 0a 32 34 30 0d 0a  ----..233..240..
29490 33 31 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  317....query I r
294a0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
294b0 20 36 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d   60 AS col2 FROM
294c0 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
294d0 2d 2d 2d 0d 0a 2d 36 30 0d 0a 2d 36 30 0d 0a 2d  ---..-60..-60..-
294e0 36 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  60....query I ro
294f0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
29500 63 6f 6c 32 20 2a 20 63 6f 6c 30 20 2b 20 63 6f  col2 * col0 + co
29510 72 30 2e 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20  r0.col2 AS col1 
29520 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
29530 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 36 32 0d 0a 2d  0..----..-162..-
29540 32 30 30 32 0d 0a 2d 32 39 36 34 0d 0a 0d 0a 71  2002..-2964....q
29550 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
29560 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f 72  SELECT ALL + cor
29570 30 2e 63 6f 6c 31 20 2b 20 28 20 2d 20 33 37 20  0.col1 + ( - 37 
29580 29 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  ) FROM tab2 AS c
29590 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 30 0d 0a  or0..----..-20..
295a0 2d 36 0d 0a 32 32 0d 0a 0d 0a 71 75 65 72 79 20  -6..22....query 
295b0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
295c0 54 20 2d 20 2d 20 63 6f 6c 32 20 2b 20 2d 20 63  T - - col2 + - c
295d0 6f 6c 30 20 2a 20 2d 20 63 6f 6c 30 20 46 52 4f  ol0 * - col0 FRO
295e0 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
295f0 2d 2d 2d 2d 0d 0a 36 31 31 30 0d 0a 36 32 37 39  ----..6110..6279
29600 0d 0a 37 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..76....query I 
29610 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
29620 41 4c 4c 20 2d 20 63 6f 6c 31 20 2b 20 2b 20 28  ALL - col1 + + (
29630 20 63 6f 6c 30 20 29 20 2a 20 2d 20 63 6f 6c 32   col0 ) * - col2
29640 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
29650 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 38 38 0d 0a  r0..----..-188..
29660 2d 33 36 35 38 0d 0a 2d 37 36 39 33 0d 0a 0d 0a  -3658..-7693....
29670 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
29680 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
29690 20 2d 20 2b 20 63 6f 6c 32 20 2a 20 28 20 63 6f   - + col2 * ( co
296a0 6c 31 20 29 20 2b 20 63 6f 6c 30 20 41 53 20 63  l1 ) + col0 AS c
296b0 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol1 FROM tab2 AS
296c0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 34   cor0..----..-14
296d0 35 36 0d 0a 2d 35 36 37 0d 0a 2d 38 33 30 0d 0a  56..-567..-830..
296e0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
296f0 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
29700 43 54 20 63 6f 6c 31 20 2a 20 28 20 63 6f 6c 30  CT col1 * ( col0
29710 20 29 20 2a 20 2d 20 63 6f 6c 30 20 41 53 20 63   ) * - col0 AS c
29720 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 63 6f  ol0 FROM tab2 co
29730 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 36 30 39  r0..----..-10609
29740 37 0d 0a 2d 31 35 31 39 0d 0a 2d 33 35 38 39 35  7..-1519..-35895
29750 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  6....query I row
29760 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
29770 20 2d 20 32 34 20 2a 20 2d 20 28 20 2d 20 63 6f   - 24 * - ( - co
29780 6c 30 20 29 20 46 52 4f 4d 20 74 61 62 30 20 41  l0 ) FROM tab0 A
29790 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32  S cor0..----..-2
297a0 31 33 36 0d 0a 2d 35 37 36 0d 0a 2d 38 34 30 0d  136..-576..-840.
297b0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
297c0 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 39 33 20  rt..SELECT - 93 
297d0 2a 20 2b 20 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c  * + col2 * + col
297e0 32 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  2 AS col0 FROM t
297f0 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
29800 2d 0d 0a 2d 31 30 31 32 37 37 0d 0a 2d 36 32 35  -..-101277..-625
29810 33 33 32 0d 0a 2d 39 33 0d 0a 0d 0a 6f 6e 6c 79  332..-93....only
29820 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f  if mysql # suppo
29830 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65  rt for MySQL spe
29840 63 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70  cific system typ
29850 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71  es and syntax..q
29860 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
29870 61 62 65 6c 2d 31 31 39 39 0d 0a 53 45 4c 45 43  abel-1199..SELEC
29880 54 20 2d 20 2b 20 43 41 53 54 28 20 4e 55 4c 4c  T - + CAST( NULL
29890 20 41 53 20 53 49 47 4e 45 44 20 29 20 2a 20 38   AS SIGNED ) * 8
298a0 38 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  8 AS col2 FROM t
298b0 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
298c0 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e  -..NULL..NULL..N
298d0 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  ULL....skipif my
298e0 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
298f0 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
29900 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 31 39 39  wsort label-1199
29910 0d 0a 53 45 4c 45 43 54 20 2d 20 2b 20 43 41 53  ..SELECT - + CAS
29920 54 20 28 20 4e 55 4c 4c 20 41 53 20 49 4e 54 45  T ( NULL AS INTE
29930 47 45 52 20 29 20 2a 20 38 38 20 41 53 20 63 6f  GER ) * 88 AS co
29940 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l2 FROM tab0 AS 
29950 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c  cor0..----..NULL
29960 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a  ..NULL..NULL....
29970 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
29980 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
29990 20 2b 20 63 6f 72 31 2e 63 6f 6c 32 20 2b 20 2b   + cor1.col2 + +
299a0 20 33 31 20 2a 20 2b 20 39 34 20 46 52 4f 4d 20   31 * + 94 FROM 
299b0 74 61 62 32 2c 20 74 61 62 32 20 41 53 20 63 6f  tab2, tab2 AS co
299c0 72 30 2c 20 74 61 62 30 20 63 6f 72 31 0d 0a 2d  r0, tab0 cor1..-
299d0 2d 2d 2d 0d 0a 32 39 31 35 0d 0a 32 39 34 37 0d  ---..2915..2947.
299e0 0a 32 39 39 36 0d 0a 0d 0a 73 6b 69 70 69 66 20  .2996....skipif 
299f0 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73  postgresql # Pos
29a00 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73  tgreSQL requires
29a10 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e   AS when renamin
29a20 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73  g output columns
29a30 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
29a40 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20  t..SELECT ALL - 
29a50 34 38 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  48 col2 FROM tab
29a60 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
29a70 0a 2d 34 38 0d 0a 2d 34 38 0d 0a 2d 34 38 0d 0a  .-48..-48..-48..
29a80 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
29a90 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53   support for MyS
29aa0 51 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74  QL specific syst
29ab0 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e  em types and syn
29ac0 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  tax..query I row
29ad0 73 6f 72 74 20 6c 61 62 65 6c 2d 31 32 30 32 0d  sort label-1202.
29ae0 0a 53 45 4c 45 43 54 20 2b 20 43 41 53 54 28 20  .SELECT + CAST( 
29af0 4e 55 4c 4c 20 41 53 20 53 49 47 4e 45 44 20 29  NULL AS SIGNED )
29b00 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20   + col1 AS col1 
29b10 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
29b20 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e  0..----..NULL..N
29b30 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69  ULL..NULL....ski
29b40 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
29b50 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
29b60 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
29b70 6c 2d 31 32 30 32 0d 0a 53 45 4c 45 43 54 20 2b  l-1202..SELECT +
29b80 20 43 41 53 54 20 28 20 4e 55 4c 4c 20 41 53 20   CAST ( NULL AS 
29b90 49 4e 54 45 47 45 52 20 29 20 2b 20 63 6f 6c 31  INTEGER ) + col1
29ba0 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
29bb0 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
29bc0 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55  ..NULL..NULL..NU
29bd0 4c 4c 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  LL....query I ro
29be0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
29bf0 35 33 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  53 AS col2 FROM 
29c00 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 33 0d  tab1..----..-53.
29c10 0a 2d 35 33 0d 0a 2d 35 33 0d 0a 0d 0a 71 75 65  .-53..-53....que
29c20 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
29c30 4c 45 43 54 20 34 35 20 2a 20 2b 20 63 6f 6c 32  LECT 45 * + col2
29c40 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62   + col1 FROM tab
29c50 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
29c60 0a 31 34 32 0d 0a 31 35 37 31 0d 0a 33 37 38 31  .142..1571..3781
29c70 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
29c80 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f  ort..SELECT + co
29c90 72 30 2e 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20  r0.col0 AS col0 
29ca0 46 52 4f 4d 20 74 61 62 32 2c 20 74 61 62 31 20  FROM tab2, tab1 
29cb0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61  cor0..----..9 va
29cc0 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20  lues hashing to 
29cd0 64 64 31 38 62 39 33 32 36 33 61 36 63 64 34 32  dd18b93263a6cd42
29ce0 35 66 63 37 63 63 38 34 64 39 31 33 37 38 37 30  5fc7cc84d9137870
29cf0 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
29d00 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61   # use DIV opera
29d10 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20  tor for integer 
29d20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20  division..query 
29d30 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
29d40 31 32 30 36 0d 0a 53 45 4c 45 43 54 20 44 49 53  1206..SELECT DIS
29d50 54 49 4e 43 54 20 33 34 20 44 49 56 20 2b 20 74  TINCT 34 DIV + t
29d60 61 62 30 2e 63 6f 6c 30 20 41 53 20 63 6f 6c 31  ab0.col0 AS col1
29d70 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d   FROM tab0..----
29d80 0d 0a 30 0d 0a 31 0d 0a 0d 0a 73 6b 69 70 69 66  ..0..1....skipif
29d90 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
29da0 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
29db0 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
29dc0 32 30 36 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  206..SELECT DIST
29dd0 49 4e 43 54 20 33 34 20 2f 20 2b 20 74 61 62 30  INCT 34 / + tab0
29de0 2e 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46 52  .col0 AS col1 FR
29df0 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 30  OM tab0..----..0
29e00 0d 0a 31 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  ..1....skipif my
29e10 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
29e20 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
29e30 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
29e40 43 41 53 54 20 28 20 2d 20 38 39 20 41 53 20 52  CAST ( - 89 AS R
29e50 45 41 4c 20 29 20 2b 20 2b 20 63 6f 6c 32 20 41  EAL ) + + col2 A
29e60 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30  S col1 FROM tab0
29e70 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
29e80 2d 35 36 0d 0a 2d 37 0d 0a 2d 38 38 0d 0a 0d 0a  -56..-7..-88....
29e90 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
29ea0 0a 53 45 4c 45 43 54 20 2d 20 28 20 2d 20 63 6f  .SELECT - ( - co
29eb0 6c 31 20 29 20 2a 20 2d 20 63 6f 72 30 2e 63 6f  l1 ) * - cor0.co
29ec0 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l1 FROM tab0 AS 
29ed0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 37 33 39  cor0..----..-739
29ee0 36 0d 0a 2d 38 32 38 31 0d 0a 2d 39 34 30 39 0d  6..-8281..-9409.
29ef0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
29f00 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 72 30 2e  rt..SELECT cor0.
29f10 63 6f 6c 31 20 2a 20 63 6f 6c 30 20 46 52 4f 4d  col1 * col0 FROM
29f20 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab2 cor0..----
29f30 0d 0a 31 33 34 33 0d 0a 32 31 37 0d 0a 34 36 30  ..1343..217..460
29f40 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  2....query I row
29f50 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c  sort..SELECT col
29f60 31 20 2a 20 63 6f 72 30 2e 63 6f 6c 32 20 2a 20  1 * cor0.col2 * 
29f70 2d 20 28 20 63 6f 6c 32 20 29 20 41 53 20 63 6f  - ( col2 ) AS co
29f80 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72  l1 FROM tab1 cor
29f90 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 39 38 30 38  0..----..-119808
29fa0 0d 0a 2d 33 32 34 39 30 0d 0a 2d 37 35 38 31 36  ..-32490..-75816
29fb0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
29fc0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2d 20  ort..SELECT + - 
29fd0 34 36 20 2a 20 2b 20 63 6f 6c 32 20 46 52 4f 4d  46 * + col2 FROM
29fe0 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
29ff0 2d 2d 2d 0d 0a 2d 32 34 38 34 0d 0a 2d 32 36 32  ---..-2484..-262
2a000 32 0d 0a 2d 34 34 31 36 0d 0a 0d 0a 71 75 65 72  2..-4416....quer
2a010 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
2a020 45 43 54 20 2d 20 39 39 20 41 53 20 63 6f 6c 32  ECT - 99 AS col2
2a030 20 46 52 4f 4d 20 74 61 62 31 2c 20 74 61 62 32   FROM tab1, tab2
2a040 20 41 53 20 63 6f 72 30 2c 20 74 61 62 32 20 41   AS cor0, tab2 A
2a050 53 20 63 6f 72 31 2c 20 74 61 62 30 20 41 53 20  S cor1, tab0 AS 
2a060 63 6f 72 32 0d 0a 2d 2d 2d 2d 0d 0a 38 31 20 76  cor2..----..81 v
2a070 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f  alues hashing to
2a080 20 35 30 31 30 39 34 65 38 30 62 61 62 35 65 36   501094e80bab5e6
2a090 65 38 31 62 64 37 39 62 38 34 65 61 38 31 65 36  e81bd79b84ea81e6
2a0a0 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  9....query I row
2a0b0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 74 61 62  sort..SELECT tab
2a0c0 30 2e 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46  0.col2 AS col0 F
2a0d0 52 4f 4d 20 74 61 62 30 2c 20 74 61 62 31 20 63  ROM tab0, tab1 c
2a0e0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c  or0..----..9 val
2a0f0 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 63  ues hashing to c
2a100 38 66 39 66 61 39 65 66 30 66 38 37 30 32 62 64  8f9fa9ef0f8702bd
2a110 33 38 32 65 38 32 31 33 37 38 61 39 36 64 38 0d  382e821378a96d8.
2a120 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
2a130 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 28 20 74  rt..SELECT - ( t
2a140 61 62 32 2e 63 6f 6c 31 20 29 20 2a 20 2d 20 63  ab2.col1 ) * - c
2a150 6f 72 31 2e 63 6f 6c 31 20 46 52 4f 4d 20 74 61  or1.col1 FROM ta
2a160 62 32 2c 20 74 61 62 31 20 41 53 20 63 6f 72 30  b2, tab1 AS cor0
2a170 2c 20 74 61 62 31 2c 20 74 61 62 31 20 41 53 20  , tab1, tab1 AS 
2a180 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 38 31 20 76  cor1..----..81 v
2a190 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f  alues hashing to
2a1a0 20 37 33 62 33 66 36 62 37 32 63 31 37 64 37 65   73b3f6b72c17d7e
2a1b0 62 36 65 31 66 65 31 65 31 31 33 30 61 32 36 31  b6e1fe1e1130a261
2a1c0 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  1....query I row
2a1d0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c  sort..SELECT col
2a1e0 30 20 2a 20 63 6f 6c 31 20 2b 20 2d 20 63 6f 6c  0 * col1 + - col
2a1f0 30 20 2a 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61  0 * col1 FROM ta
2a200 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
2a210 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a 71 75 65  ..0..0..0....que
2a220 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
2a230 4c 45 43 54 20 2d 20 35 31 20 41 53 20 63 6f 6c  LECT - 51 AS col
2a240 31 20 46 52 4f 4d 20 74 61 62 30 2c 20 74 61 62  1 FROM tab0, tab
2a250 31 20 41 53 20 63 6f 72 30 2c 20 74 61 62 30 20  1 AS cor0, tab0 
2a260 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 32  AS cor1..----..2
2a270 37 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67  7 values hashing
2a280 20 74 6f 20 32 37 62 63 63 33 31 34 33 33 63 65   to 27bcc31433ce
2a290 39 30 38 33 33 65 64 37 36 36 31 39 63 62 64 38  90833ed76619cbd8
2a2a0 64 36 61 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20  d6a4....query I 
2a2b0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
2a2c0 44 49 53 54 49 4e 43 54 20 36 20 46 52 4f 4d 20  DISTINCT 6 FROM 
2a2d0 74 61 62 31 2c 20 74 61 62 30 20 41 53 20 63 6f  tab1, tab0 AS co
2a2e0 72 30 2c 20 74 61 62 30 20 63 6f 72 31 0d 0a 2d  r0, tab0 cor1..-
2a2f0 2d 2d 2d 0d 0a 36 0d 0a 0d 0a 71 75 65 72 79 20  ---..6....query 
2a300 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
2a310 54 20 2d 20 63 6f 6c 30 20 2b 20 39 35 20 46 52  T - col0 + 95 FR
2a320 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
2a330 0a 2d 2d 2d 2d 0d 0a 31 35 0d 0a 33 31 0d 0a 39  .----..15..31..9
2a340 32 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74  2....skipif post
2a350 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65  gresql # Postgre
2a360 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20  SQL requires AS 
2a370 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75  when renaming ou
2a380 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 73 6b  tput columns..sk
2a390 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
2a3a0 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
2a3b0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
2a3c0 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20  LECT DISTINCT + 
2a3d0 2b 20 63 6f 6c 30 20 2a 20 28 20 28 20 63 6f 6c  + col0 * ( ( col
2a3e0 31 20 29 20 29 20 2b 20 43 41 53 54 20 28 20 2b  1 ) ) + CAST ( +
2a3f0 20 63 6f 6c 32 20 41 53 20 52 45 41 4c 20 29 20   col2 AS REAL ) 
2a400 2a 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 63 6f  * + cor0.col2 co
2a410 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l2 FROM tab2 AS 
2a420 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 37 38 37  cor0..----..2787
2a430 0d 0a 35 32 37 38 0d 0a 39 34 36 0d 0a 0d 0a 71  ..5278..946....q
2a440 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
2a450 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f 72  SELECT ALL + cor
2a460 30 2e 63 6f 6c 31 20 2a 20 63 6f 6c 32 20 2b 20  0.col1 * col2 + 
2a470 63 6f 72 30 2e 63 6f 6c 31 20 2a 20 63 6f 72 30  cor0.col1 * cor0
2a480 2e 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52  .col1 AS col0 FR
2a490 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
2a4a0 0a 2d 2d 2d 2d 0d 0a 31 37 39 38 0d 0a 35 30 31  .----..1798..501
2a4b0 35 0d 0a 39 33 35 0d 0a 0d 0a 73 6b 69 70 69 66  5..935....skipif
2a4c0 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f   postgresql # Po
2a4d0 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65  stgreSQL require
2a4e0 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69  s AS when renami
2a4f0 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e  ng output column
2a500 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  s..query I rowso
2a510 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c  rt..SELECT - col
2a520 31 20 2b 20 63 6f 6c 30 20 63 6f 6c 32 20 46 52  1 + col0 col2 FR
2a530 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
2a540 0a 2d 2d 2d 2d 0d 0a 2d 32 0d 0a 2d 36 32 0d 0a  .----..-2..-62..
2a550 2d 36 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  -62....query I r
2a560 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
2a570 20 63 6f 6c 30 20 2a 20 32 32 20 2d 20 32 30 20   col0 * 22 - 20 
2a580 2a 20 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46  * col1 AS col1 F
2a590 52 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d  ROM tab2 cor0..-
2a5a0 2d 2d 2d 0d 0a 2d 34 36 36 0d 0a 31 33 39 38 0d  ---..-466..1398.
2a5b0 0a 35 33 36 0d 0a 0d 0a 73 6b 69 70 69 66 20 70  .536....skipif p
2a5c0 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74  ostgresql # Post
2a5d0 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20  greSQL requires 
2a5e0 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67  AS when renaming
2a5f0 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d   output columns.
2a600 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2a610 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
2a620 54 20 74 61 62 30 2e 63 6f 6c 31 20 2b 20 2d 20  T tab0.col1 + - 
2a630 63 6f 6c 30 20 2b 20 63 6f 6c 32 20 63 6f 6c 31  col0 + col2 col1
2a640 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d   FROM tab0..----
2a650 0d 0a 36 33 0d 0a 38 34 0d 0a 39 35 0d 0a 0d 0a  ..63..84..95....
2a660 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73  onlyif mysql # s
2a670 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c  upport for MySQL
2a680 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d   specific system
2a690 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61   types and synta
2a6a0 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  x..query I rowso
2a6b0 72 74 20 6c 61 62 65 6c 2d 31 32 32 34 0d 0a 53  rt label-1224..S
2a6c0 45 4c 45 43 54 20 63 6f 6c 30 20 2b 20 74 61 62  ELECT col0 + tab
2a6d0 31 2e 63 6f 6c 32 20 2a 20 2b 20 43 41 53 54 28  1.col2 * + CAST(
2a6e0 20 37 32 20 41 53 20 53 49 47 4e 45 44 20 29 20   72 AS SIGNED ) 
2a6f0 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
2a700 31 0d 0a 2d 2d 2d 2d 0d 0a 33 38 39 31 0d 0a 34  1..----..3891..4
2a710 31 36 38 0d 0a 36 39 39 32 0d 0a 0d 0a 73 6b 69  168..6992....ski
2a720 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
2a730 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
2a740 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
2a750 6c 2d 31 32 32 34 0d 0a 53 45 4c 45 43 54 20 63  l-1224..SELECT c
2a760 6f 6c 30 20 2b 20 74 61 62 31 2e 63 6f 6c 32 20  ol0 + tab1.col2 
2a770 2a 20 2b 20 43 41 53 54 20 28 20 37 32 20 41 53  * + CAST ( 72 AS
2a780 20 49 4e 54 45 47 45 52 20 29 20 41 53 20 63 6f   INTEGER ) AS co
2a790 6c 30 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d  l0 FROM tab1..--
2a7a0 2d 2d 0d 0a 33 38 39 31 0d 0a 34 31 36 38 0d 0a  --..3891..4168..
2a7b0 36 39 39 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20  6992....query I 
2a7c0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
2a7d0 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 2a 20 31 35  + cor0.col1 * 15
2a7e0 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
2a7f0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 35 35 0d 0a 34  r0..----..255..4
2a800 36 35 0d 0a 38 38 35 0d 0a 0d 0a 71 75 65 72 79  65..885....query
2a810 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
2a820 43 54 20 63 6f 6c 32 20 2b 20 2b 20 63 6f 6c 32  CT col2 + + col2
2a830 20 2a 20 2d 20 33 38 20 2b 20 2b 20 63 6f 6c 30   * - 38 + + col0
2a840 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
2a850 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
2a860 0d 0a 2d 31 31 39 37 0d 0a 2d 32 0d 0a 2d 32 39  ..-1197..-2..-29
2a870 34 35 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73  45....skipif pos
2a880 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72  tgresql # Postgr
2a890 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53  eSQL requires AS
2a8a0 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f   when renaming o
2a8b0 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71  utput columns..q
2a8c0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
2a8d0 53 45 4c 45 43 54 20 63 6f 6c 31 20 2a 20 31 20  SELECT col1 * 1 
2a8e0 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a  col1 FROM tab0..
2a8f0 2d 2d 2d 2d 0d 0a 38 36 0d 0a 39 31 0d 0a 39 37  ----..86..91..97
2a900 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
2a910 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 74 61  ort..SELECT + ta
2a920 62 32 2e 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c 31  b2.col1 * - col1
2a930 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
2a940 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 38 39 0d 0a  b2..----..-289..
2a950 2d 33 34 38 31 0d 0a 2d 39 36 31 0d 0a 0d 0a 71  -3481..-961....q
2a960 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
2a970 53 45 4c 45 43 54 20 63 6f 6c 32 20 2a 20 34 37  SELECT col2 * 47
2a980 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d   FROM tab2..----
2a990 0d 0a 31 32 32 32 0d 0a 31 32 36 39 0d 0a 31 37  ..1222..1269..17
2a9a0 38 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  86....query I ro
2a9b0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
2a9c0 2d 20 31 36 20 41 53 20 63 6f 6c 31 20 46 52 4f  - 16 AS col1 FRO
2a9d0 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
2a9e0 2d 2d 2d 2d 0d 0a 31 36 0d 0a 31 36 0d 0a 31 36  ----..16..16..16
2a9f0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
2aa00 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
2aa10 38 33 20 46 52 4f 4d 20 74 61 62 31 2c 20 74 61  83 FROM tab1, ta
2aa20 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39  b2 cor0..----..9
2aa30 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20   values hashing 
2aa40 74 6f 20 31 38 66 34 30 35 63 33 31 61 30 66 62  to 18f405c31a0fb
2aa50 34 37 63 65 33 63 63 39 66 37 65 66 66 61 38 38  47ce3cc9f7effa88
2aa60 35 35 63 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  55c....query I r
2aa70 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
2aa80 49 53 54 49 4e 43 54 20 39 31 20 41 53 20 63 6f  ISTINCT 91 AS co
2aa90 6c 32 20 46 52 4f 4d 20 74 61 62 30 2c 20 74 61  l2 FROM tab0, ta
2aaa0 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
2aab0 0d 0a 39 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..91....query I 
2aac0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
2aad0 41 4c 4c 20 2d 20 74 61 62 32 2e 63 6f 6c 31 20  ALL - tab2.col1 
2aae0 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
2aaf0 32 2c 20 74 61 62 30 20 41 53 20 63 6f 72 30 2c  2, tab0 AS cor0,
2ab00 20 74 61 62 31 20 41 53 20 63 6f 72 31 0d 0a 2d   tab1 AS cor1..-
2ab10 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75 65 73 20 68  ---..27 values h
2ab20 61 73 68 69 6e 67 20 74 6f 20 36 65 30 62 37 64  ashing to 6e0b7d
2ab30 35 38 33 62 63 32 63 35 33 38 34 32 31 36 36 64  583bc2c53842166d
2ab40 33 65 36 62 61 32 64 36 64 32 0d 0a 0d 0a 71 75  3e6ba2d6d2....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 63  ELECT DISTINCT c
2ab70 6f 6c 32 20 2a 20 2b 20 28 20 63 6f 6c 31 20 29  ol2 * + ( col1 )
2ab80 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
2ab90 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 32 34 38 0d 0a  b1..----..1248..
2aba0 31 34 30 34 0d 0a 35 37 30 0d 0a 0d 0a 71 75 65  1404..570....que
2abb0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
2abc0 4c 45 43 54 20 2d 20 63 6f 6c 30 20 2a 20 63 6f  LECT - col0 * co
2abd0 6c 30 20 2d 20 63 6f 6c 32 20 2f 20 63 6f 72 30  l0 - col2 / cor0
2abe0 2e 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46 52  .col0 AS col2 FR
2abf0 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 20  OM tab2 AS cor0 
2ac00 57 48 45 52 45 20 63 6f 6c 32 20 4e 4f 54 20 49  WHERE col2 NOT I
2ac10 4e 20 28 20 63 6f 6c 32 20 29 0d 0a 2d 2d 2d 2d  N ( col2 )..----
2ac20 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
2ac30 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f  ort..SELECT + co
2ac40 6c 30 20 2b 20 74 61 62 31 2e 63 6f 6c 31 20 2a  l0 + tab1.col1 *
2ac50 20 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46 52   col0 AS col2 FR
2ac60 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31  OM tab1..----..1
2ac70 31 32 30 0d 0a 37 30 34 0d 0a 38 31 0d 0a 0d 0a  120..704..81....
2ac80 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
2ac90 0a 53 45 4c 45 43 54 20 74 61 62 30 2e 63 6f 6c  .SELECT tab0.col
2aca0 30 20 2a 20 2b 20 63 6f 6c 32 20 41 53 20 63 6f  0 * + col2 AS co
2acb0 6c 32 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d  l2 FROM tab0..--
2acc0 2d 2d 0d 0a 33 35 0d 0a 37 32 39 38 0d 0a 37 39  --..35..7298..79
2acd0 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  2....query I row
2ace0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
2acf0 20 2d 20 63 6f 6c 31 20 2a 20 63 6f 6c 30 20 2d   - col1 * col0 -
2ad00 20 2d 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62   - col0 FROM tab
2ad10 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 30 34 30 0d 0a  0..----..-2040..
2ad20 2d 33 33 36 30 0d 0a 2d 38 30 31 30 0d 0a 0d 0a  -3360..-8010....
2ad30 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75  onlyif mysql # u
2ad40 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20  se DIV operator 
2ad50 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69  for integer divi
2ad60 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f  sion..query I ro
2ad70 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 32 33 39  wsort label-1239
2ad80 0d 0a 53 45 4c 45 43 54 20 74 61 62 31 2e 63 6f  ..SELECT tab1.co
2ad90 6c 32 20 44 49 56 20 2b 20 63 6f 6c 32 20 41 53  l2 DIV + col2 AS
2ada0 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 0d   col2 FROM tab1.
2adb0 0a 2d 2d 2d 2d 0d 0a 31 0d 0a 31 0d 0a 31 0d 0a  .----..1..1..1..
2adc0 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
2add0 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
2ade0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2adf0 20 6c 61 62 65 6c 2d 31 32 33 39 0d 0a 53 45 4c   label-1239..SEL
2ae00 45 43 54 20 74 61 62 31 2e 63 6f 6c 32 20 2f 20  ECT tab1.col2 / 
2ae10 2b 20 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46  + col2 AS col2 F
2ae20 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab1..----..
2ae30 31 0d 0a 31 0d 0a 31 0d 0a 0d 0a 71 75 65 72 79  1..1..1....query
2ae40 20 49 49 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45   III rowsort..SE
2ae50 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2a 20  LECT DISTINCT * 
2ae60 46 52 4f 4d 20 74 61 62 31 20 57 48 45 52 45 20  FROM tab1 WHERE 
2ae70 2d 20 63 6f 6c 30 20 3e 3d 20 4e 55 4c 4c 0d 0a  - col0 >= NULL..
2ae80 2d 2d 2d 2d 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ----....query I 
2ae90 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
2aea0 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c 32 20  DISTINCT - col2 
2aeb0 2a 20 63 6f 6c 31 20 2d 20 63 6f 6c 32 20 46 52  * col1 - col2 FR
2aec0 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d  OM tab1..----..-
2aed0 31 33 34 34 0d 0a 2d 31 34 35 38 0d 0a 2d 36 32  1344..-1458..-62
2aee0 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  7....query I row
2aef0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 74 61 62  sort..SELECT tab
2af00 31 2e 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c 31 20  1.col2 * - col1 
2af10 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
2af20 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32 34 38 0d 0a  1..----..-1248..
2af30 2d 31 34 30 34 0d 0a 2d 35 37 30 0d 0a 0d 0a 6f  -1404..-570....o
2af40 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73  nlyif mysql # us
2af50 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66  e DIV operator f
2af60 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73  or integer divis
2af70 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ion..query I row
2af80 73 6f 72 74 20 6c 61 62 65 6c 2d 31 32 34 33 0d  sort label-1243.
2af90 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 31 20 2b  .SELECT - col1 +
2afa0 20 2d 20 63 6f 6c 32 20 2a 20 63 6f 6c 31 20 44   - col2 * col1 D
2afb0 49 56 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  IV col1 FROM tab
2afc0 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 35 0d 0a 2d 35  2..----..-55..-5
2afd0 38 0d 0a 2d 38 35 0d 0a 0d 0a 73 6b 69 70 69 66  8..-85....skipif
2afe0 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
2aff0 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
2b000 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
2b010 32 34 33 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f  243..SELECT - co
2b020 6c 31 20 2b 20 2d 20 63 6f 6c 32 20 2a 20 63 6f  l1 + - col2 * co
2b030 6c 31 20 2f 20 63 6f 6c 31 20 46 52 4f 4d 20 74  l1 / col1 FROM t
2b040 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 35 0d 0a  ab2..----..-55..
2b050 2d 35 38 0d 0a 2d 38 35 0d 0a 0d 0a 71 75 65 72  -58..-85....quer
2b060 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
2b070 45 43 54 20 63 6f 6c 31 20 41 53 20 63 6f 6c 32  ECT col1 AS col2
2b080 20 46 52 4f 4d 20 74 61 62 31 20 57 48 45 52 45   FROM tab1 WHERE
2b090 20 28 20 4e 55 4c 4c 20 29 20 3c 20 4e 55 4c 4c   ( NULL ) < NULL
2b0a0 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a 71 75 65 72 79 20  ..----....query 
2b0b0 49 49 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  III rowsort..SEL
2b0c0 45 43 54 20 41 4c 4c 20 2a 20 46 52 4f 4d 20 74  ECT ALL * FROM t
2b0d0 61 62 31 20 41 53 20 63 6f 72 30 20 57 48 45 52  ab1 AS cor0 WHER
2b0e0 45 20 2d 20 63 6f 6c 31 20 3d 20 28 20 4e 55 4c  E - col1 = ( NUL
2b0f0 4c 20 29 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a 71 75 65  L )..----....que
2b100 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
2b110 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20  LECT DISTINCT + 
2b120 74 61 62 30 2e 63 6f 6c 31 20 2d 20 63 6f 6c 31  tab0.col1 - col1
2b130 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d   FROM tab0..----
2b140 0d 0a 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  ..0....onlyif my
2b150 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70  sql # use DIV op
2b160 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67  erator for integ
2b170 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65  er division..que
2b180 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
2b190 65 6c 2d 31 32 34 37 0d 0a 53 45 4c 45 43 54 20  el-1247..SELECT 
2b1a0 63 6f 6c 30 20 2d 20 2b 20 63 6f 6c 32 20 44 49  col0 - + col2 DI
2b1b0 56 20 63 6f 6c 32 20 63 6f 6c 32 20 46 52 4f 4d  V col2 col2 FROM
2b1c0 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 32 33 0d   tab0..----..23.
2b1d0 0a 33 34 0d 0a 38 38 0d 0a 0d 0a 73 6b 69 70 69  .34..88....skipi
2b1e0 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50  f postgresql # P
2b1f0 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72  ostgreSQL requir
2b200 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d  es AS when renam
2b210 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d  ing output colum
2b220 6e 73 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ns..skipif mysql
2b230 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
2b240 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
2b250 72 74 20 6c 61 62 65 6c 2d 31 32 34 37 0d 0a 53  rt label-1247..S
2b260 45 4c 45 43 54 20 63 6f 6c 30 20 2d 20 2b 20 63  ELECT col0 - + c
2b270 6f 6c 32 20 2f 20 63 6f 6c 32 20 63 6f 6c 32 20  ol2 / col2 col2 
2b280 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d  FROM tab0..----.
2b290 0a 32 33 0d 0a 33 34 0d 0a 38 38 0d 0a 0d 0a 71  .23..34..88....q
2b2a0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
2b2b0 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 31 20  SELECT ALL col1 
2b2c0 2b 20 63 6f 6c 31 20 2d 20 2d 20 63 6f 6c 32 20  + col1 - - col2 
2b2d0 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d  FROM tab1..----.
2b2e0 0a 31 30 36 0d 0a 31 32 32 0d 0a 37 37 0d 0a 0d  .106..122..77...
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 41 4c 4c 20 63 6f 6c  ..SELECT ALL col
2b310 32 20 2a 20 63 6f 6c 32 20 2d 20 2d 20 63 6f 6c  2 * col2 - - col
2b320 32 20 2a 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61  2 * col1 FROM ta
2b330 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 35 36 36 0d 0a  b2..----..1566..
2b340 32 30 39 30 0d 0a 32 32 31 30 0d 0a 0d 0a 73 6b  2090..2210....sk
2b350 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20  ipif postgresql 
2b360 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71  # PostgreSQL req
2b370 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65  uires AS when re
2b380 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f  naming output co
2b390 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72  lumns..query I r
2b3a0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
2b3b0 49 53 54 49 4e 43 54 20 74 61 62 32 2e 63 6f 6c  ISTINCT tab2.col
2b3c0 32 20 2a 20 2b 20 63 6f 6c 31 20 63 6f 6c 32 20  2 * + col1 col2 
2b3d0 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d  FROM tab2..----.
2b3e0 0a 31 35 33 34 0d 0a 36 34 36 0d 0a 38 33 37 0d  .1534..646..837.
2b3f0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
2b400 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
2b410 4e 43 54 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20  NCT + cor0.col2 
2b420 2b 20 2b 20 74 61 62 31 2e 63 6f 6c 31 20 41 53  + + tab1.col1 AS
2b430 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 2c   col1 FROM tab1,
2b440 20 74 61 62 30 2c 20 74 61 62 32 20 41 53 20 63   tab0, tab2 AS c
2b450 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c  or0..----..9 val
2b460 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 62  ues hashing to b
2b470 38 62 36 32 37 36 32 30 30 35 64 63 30 64 37 32  8b62762005dc0d72
2b480 33 37 31 34 35 64 30 35 33 38 65 64 62 33 34 0d  37145d0538edb34.
2b490 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
2b4a0 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74  # use DIV operat
2b4b0 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64  or for integer d
2b4c0 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49  ivision..query I
2b4d0 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
2b4e0 32 35 32 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f  252..SELECT - co
2b4f0 6c 31 20 44 49 56 20 2d 20 63 6f 6c 32 20 46 52  l1 DIV - col2 FR
2b500 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31  OM tab0..----..1
2b510 0d 0a 32 0d 0a 39 37 0d 0a 0d 0a 73 6b 69 70 69  ..2..97....skipi
2b520 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
2b530 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
2b540 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
2b550 31 32 35 32 0d 0a 53 45 4c 45 43 54 20 2d 20 63  1252..SELECT - c
2b560 6f 6c 31 20 2f 20 2d 20 63 6f 6c 32 20 46 52 4f  ol1 / - col2 FRO
2b570 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 0d  M tab0..----..1.
2b580 0a 32 0d 0a 39 37 0d 0a 0d 0a 71 75 65 72 79 20  .2..97....query 
2b590 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
2b5a0 54 20 2d 20 2b 20 63 6f 6c 30 20 2b 20 2b 20 63  T - + col0 + + c
2b5b0 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  ol1 AS col1 FROM
2b5c0 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab2 cor0..----
2b5d0 0d 0a 2d 31 39 0d 0a 2d 36 32 0d 0a 32 34 0d 0a  ..-19..-62..24..
2b5e0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2b5f0 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 72 30  t..SELECT + cor0
2b600 2e 63 6f 6c 32 20 2a 20 63 6f 6c 32 20 2b 20 63  .col2 * col2 + c
2b610 6f 6c 32 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f  ol2 + col1 AS co
2b620 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l1 FROM tab1 AS 
2b630 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 39 39 36  cor0..----..2996
2b640 0d 0a 33 33 31 36 0d 0a 39 33 32 35 0d 0a 0d 0a  ..3316..9325....
2b650 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
2b660 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 30 20 2a  .SELECT - col0 *
2b670 20 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c 32 20 2a   col0 + - col2 *
2b680 20 2d 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62   - col2 FROM tab
2b690 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
2b6a0 0a 2d 31 31 39 37 0d 0a 2d 31 32 32 34 0d 0a 35  .-1197..-1224..5
2b6b0 31 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  13....query I ro
2b6c0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
2b6d0 63 6f 6c 32 20 2b 20 63 6f 72 30 2e 63 6f 6c 31  col2 + cor0.col1
2b6e0 20 2a 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62   * col0 FROM tab
2b6f0 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
2b700 0a 32 34 0d 0a 35 38 33 0d 0a 39 34 34 0d 0a 0d  .24..583..944...
2b710 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
2b720 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72  use DIV operator
2b730 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76   for integer div
2b740 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72  ision..query I r
2b750 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 32 35  owsort label-125
2b760 37 0d 0a 53 45 4c 45 43 54 20 2b 20 2d 20 63 6f  7..SELECT + - co
2b770 6c 30 20 2a 20 2b 20 63 6f 6c 32 20 2b 20 63 6f  l0 * + col2 + co
2b780 6c 32 20 44 49 56 20 63 6f 6c 32 20 46 52 4f 4d  l2 DIV col2 FROM
2b790 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
2b7a0 2d 2d 2d 0d 0a 2d 33 34 0d 0a 2d 37 32 39 37 0d  ---..-34..-7297.
2b7b0 0a 2d 37 39 31 0d 0a 0d 0a 73 6b 69 70 69 66 20  .-791....skipif 
2b7c0 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
2b7d0 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
2b7e0 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 32  rowsort label-12
2b7f0 35 37 0d 0a 53 45 4c 45 43 54 20 2b 20 2d 20 63  57..SELECT + - c
2b800 6f 6c 30 20 2a 20 2b 20 63 6f 6c 32 20 2b 20 63  ol0 * + col2 + c
2b810 6f 6c 32 20 2f 20 63 6f 6c 32 20 46 52 4f 4d 20  ol2 / col2 FROM 
2b820 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
2b830 2d 2d 0d 0a 2d 33 34 0d 0a 2d 37 32 39 37 0d 0a  --..-34..-7297..
2b840 2d 37 39 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20  -791....query I 
2b850 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
2b860 44 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c 31 20  DISTINCT + col1 
2b870 2a 20 63 6f 6c 31 20 2a 20 63 6f 6c 30 20 46 52  * col1 * col0 FR
2b880 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
2b890 0a 2d 2d 2d 2d 0d 0a 31 33 35 32 30 0d 0a 32 30  .----..13520..20
2b8a0 32 38 0d 0a 36 34 30 30 0d 0a 0d 0a 71 75 65 72  28..6400....quer
2b8b0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
2b8c0 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 2d  ECT DISTINCT - -
2b8d0 20 63 6f 6c 30 20 2d 20 63 6f 72 30 2e 63 6f 6c   col0 - cor0.col
2b8e0 32 20 2a 20 2d 20 63 6f 6c 30 20 2a 20 2b 20 63  2 * - col0 * + c
2b8f0 6f 72 30 2e 63 6f 6c 32 20 46 52 4f 4d 20 74 61  or0.col2 FROM ta
2b900 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32  b0 cor0..----..2
2b910 36 31 36 30 0d 0a 35 39 38 35 32 35 0d 0a 37 30  6160..598525..70
2b920 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
2b930 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2d 20  ort..SELECT + - 
2b940 63 6f 6c 32 20 2a 20 2d 20 63 6f 72 30 2e 63 6f  col2 * - cor0.co
2b950 6c 31 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  l1 AS col2 FROM 
2b960 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
2b970 2d 2d 0d 0a 31 35 33 34 0d 0a 36 34 36 0d 0a 38  --..1534..646..8
2b980 33 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  37....query I ro
2b990 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
2b9a0 4c 20 2d 20 2d 20 63 6f 6c 32 20 2b 20 2d 20 63  L - - col2 + - c
2b9b0 6f 72 30 2e 63 6f 6c 32 20 46 52 4f 4d 20 74 61  or0.col2 FROM ta
2b9c0 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
2b9d0 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a 71 75 65  ..0..0..0....que
2b9e0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
2b9f0 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 30 20 2d 20  LECT ALL col0 - 
2ba00 63 6f 72 30 2e 63 6f 6c 30 20 46 52 4f 4d 20 74  cor0.col0 FROM t
2ba10 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab0 cor0..----..
2ba20 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a 71 75 65 72 79  0..0..0....query
2ba30 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
2ba40 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f  CT DISTINCT - co
2ba50 6c 32 20 2a 20 2b 20 63 6f 6c 30 20 2b 20 63 6f  l2 * + col0 + co
2ba60 6c 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  l0 AS col2 FROM 
2ba70 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
2ba80 2d 2d 0d 0a 2d 31 38 32 0d 0a 2d 31 39 35 30 0d  --..-182..-1950.
2ba90 0a 2d 32 39 32 33 0d 0a 0d 0a 71 75 65 72 79 20  .-2923....query 
2baa0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
2bab0 54 20 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c 32 20  T col0 * + col2 
2bac0 2b 20 2b 20 63 6f 6c 32 20 2a 20 63 6f 6c 30 20  + + col2 * col0 
2bad0 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
2bae0 30 0d 0a 2d 2d 2d 2d 0d 0a 31 34 35 39 36 0d 0a  0..----..14596..
2baf0 31 35 38 34 0d 0a 37 30 0d 0a 0d 0a 6f 6e 6c 79  1584..70....only
2bb00 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f  if mysql # suppo
2bb10 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65  rt for MySQL spe
2bb20 63 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70  cific system typ
2bb30 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71  es and syntax..q
2bb40 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
2bb50 61 62 65 6c 2d 31 32 36 35 0d 0a 53 45 4c 45 43  abel-1265..SELEC
2bb60 54 20 44 49 53 54 49 4e 43 54 20 2b 20 39 37 20  T DISTINCT + 97 
2bb70 2a 20 63 6f 6c 31 20 2b 20 43 41 53 54 28 20 4e  * col1 + CAST( N
2bb80 55 4c 4c 20 41 53 20 53 49 47 4e 45 44 20 29 20  ULL AS SIGNED ) 
2bb90 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46  + col1 AS col2 F
2bba0 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
2bbb0 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 0d 0a  ..----..NULL....
2bbc0 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
2bbd0 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
2bbe0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
2bbf0 61 62 65 6c 2d 31 32 36 35 0d 0a 53 45 4c 45 43  abel-1265..SELEC
2bc00 54 20 44 49 53 54 49 4e 43 54 20 2b 20 39 37 20  T DISTINCT + 97 
2bc10 2a 20 63 6f 6c 31 20 2b 20 43 41 53 54 20 28 20  * col1 + CAST ( 
2bc20 4e 55 4c 4c 20 41 53 20 49 4e 54 45 47 45 52 20  NULL AS INTEGER 
2bc30 29 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c 32  ) + col1 AS col2
2bc40 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
2bc50 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a  r0..----..NULL..
2bc60 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2bc70 74 0d 0a 53 45 4c 45 43 54 20 63 6f 72 30 2e 63  t..SELECT cor0.c
2bc80 6f 6c 31 20 2b 20 2d 20 63 6f 6c 30 20 2a 20 63  ol1 + - col0 * c
2bc90 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol0 FROM tab2 AS
2bca0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 38   cor0..----..-18
2bcb0 0d 0a 2d 36 30 32 35 0d 0a 2d 36 32 32 34 0d 0a  ..-6025..-6224..
2bcc0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2bcd0 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
2bce0 43 54 20 2d 20 63 6f 6c 30 20 2b 20 63 6f 6c 31  CT - col0 + col1
2bcf0 20 2a 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62   * col2 FROM tab
2bd00 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
2bd10 0a 31 34 35 36 0d 0a 35 36 37 0d 0a 38 33 30 0d  .1456..567..830.
2bd20 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
2bd30 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63  rt..SELECT ALL c
2bd40 6f 6c 30 20 2a 20 2b 20 74 61 62 31 2e 63 6f 6c  ol0 * + tab1.col
2bd50 32 20 2b 20 63 6f 6c 32 20 41 53 20 63 6f 6c 30  2 + col2 AS col0
2bd60 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d   FROM tab1..----
2bd70 0d 0a 32 31 36 0d 0a 33 37 30 35 0d 0a 37 37 37  ..216..3705..777
2bd80 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  6....query I row
2bd90 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
2bda0 20 2b 20 37 20 2b 20 63 6f 6c 32 20 41 53 20 63   + 7 + col2 AS c
2bdb0 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d  ol0 FROM tab0..-
2bdc0 2d 2d 2d 0d 0a 34 30 0d 0a 38 0d 0a 38 39 0d 0a  ---..40..8..89..
2bdd0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2bde0 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
2bdf0 43 54 20 2d 20 63 6f 6c 31 20 2b 20 63 6f 6c 30  CT - col1 + col0
2be00 20 2b 20 2b 20 63 6f 6c 32 20 46 52 4f 4d 20 74   + + col2 FROM t
2be10 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 39 0d 0a  ab0..----..-29..
2be20 2d 36 31 0d 0a 38 30 0d 0a 0d 0a 6f 6e 6c 79 69  -61..80....onlyi
2be30 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49  f mysql # use DI
2be40 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69  V operator for i
2be50 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d  nteger division.
2be60 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2be70 20 6c 61 62 65 6c 2d 31 32 37 31 0d 0a 53 45 4c   label-1271..SEL
2be80 45 43 54 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20  ECT + cor0.col2 
2be90 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 2a 20 33 31  + cor0.col1 * 31
2bea0 20 44 49 56 20 28 20 63 6f 6c 30 20 29 20 46 52   DIV ( col0 ) FR
2beb0 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
2bec0 0a 2d 2d 2d 2d 0d 0a 31 31 33 0d 0a 31 34 34 0d  .----..113..144.
2bed0 0a 38 36 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  .86....skipif my
2bee0 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
2bef0 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
2bf00 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 32 37 31  wsort label-1271
2bf10 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 72 30 2e  ..SELECT + cor0.
2bf20 63 6f 6c 32 20 2b 20 63 6f 72 30 2e 63 6f 6c 31  col2 + cor0.col1
2bf30 20 2a 20 33 31 20 2f 20 28 20 63 6f 6c 30 20 29   * 31 / ( col0 )
2bf40 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
2bf50 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 33 0d 0a 31  r0..----..113..1
2bf60 34 34 0d 0a 38 36 0d 0a 0d 0a 73 6b 69 70 69 66  44..86....skipif
2bf70 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f   postgresql # Po
2bf80 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65  stgreSQL require
2bf90 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69  s AS when renami
2bfa0 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e  ng output column
2bfb0 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  s..query I rowso
2bfc0 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 33  rt..SELECT ALL 3
2bfd0 30 20 2a 20 63 6f 6c 31 20 63 6f 6c 30 20 46 52  0 * col1 col0 FR
2bfe0 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
2bff0 0a 2d 2d 2d 2d 0d 0a 31 37 37 30 0d 0a 35 31 30  .----..1770..510
2c000 0d 0a 39 33 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  ..930....onlyif 
2c010 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20  mysql # support 
2c020 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66  for MySQL specif
2c030 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20  ic system types 
2c040 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72  and syntax..quer
2c050 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
2c060 6c 2d 31 32 37 33 0d 0a 53 45 4c 45 43 54 20 63  l-1273..SELECT c
2c070 6f 6c 32 20 2b 20 63 6f 6c 32 20 2a 20 43 41 53  ol2 + col2 * CAS
2c080 54 28 20 4e 55 4c 4c 20 41 53 20 53 49 47 4e 45  T( NULL AS SIGNE
2c090 44 20 29 20 46 52 4f 4d 20 74 61 62 30 20 41 53  D ) FROM tab0 AS
2c0a0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c   cor0..----..NUL
2c0b0 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d  L..NULL..NULL...
2c0c0 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
2c0d0 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
2c0e0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
2c0f0 6c 61 62 65 6c 2d 31 32 37 33 0d 0a 53 45 4c 45  label-1273..SELE
2c100 43 54 20 63 6f 6c 32 20 2b 20 63 6f 6c 32 20 2a  CT col2 + col2 *
2c110 20 43 41 53 54 20 28 20 4e 55 4c 4c 20 41 53 20   CAST ( NULL AS 
2c120 49 4e 54 45 47 45 52 20 29 20 46 52 4f 4d 20 74  INTEGER ) FROM t
2c130 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
2c140 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e  -..NULL..NULL..N
2c150 55 4c 4c 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  ULL....query I r
2c160 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
2c170 20 28 20 63 6f 6c 31 20 29 20 2a 20 63 6f 6c 30   ( col1 ) * col0
2c180 20 2b 20 63 6f 6c 30 20 2b 20 63 6f 72 30 2e 63   + col0 + cor0.c
2c190 6f 6c 31 20 2a 20 2b 20 63 6f 6c 30 20 46 52 4f  ol1 * + col0 FRO
2c1a0 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
2c1b0 2d 2d 2d 2d 0d 0a 32 37 36 35 0d 0a 34 34 31 0d  ----..2765..441.
2c1c0 0a 39 32 38 32 0d 0a 0d 0a 71 75 65 72 79 20 49  .9282....query I
2c1d0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
2c1e0 20 2d 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 2b   - - cor0.col2 +
2c1f0 20 2b 20 63 6f 6c 31 20 2a 20 28 20 34 34 20 29   + col1 * ( 44 )
2c200 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
2c210 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 38 31 37 0d 0a  r0..----..3817..
2c220 34 30 38 36 0d 0a 34 32 36 39 0d 0a 0d 0a 71 75  4086..4269....qu
2c230 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
2c240 45 4c 45 43 54 20 63 6f 6c 30 20 2a 20 63 6f 6c  ELECT col0 * col
2c250 32 20 2b 20 63 6f 6c 32 20 2a 20 63 6f 6c 31 20  2 + col2 * col1 
2c260 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30  + col1 FROM tab0
2c270 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
2c280 31 34 38 35 31 0d 0a 32 32 39 0d 0a 33 37 31 36  14851..229..3716
2c290 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
2c2a0 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61   # use DIV opera
2c2b0 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20  tor for integer 
2c2c0 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20  division..query 
2c2d0 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
2c2e0 31 32 37 37 0d 0a 53 45 4c 45 43 54 20 2d 20 63  1277..SELECT - c
2c2f0 6f 6c 30 20 44 49 56 20 39 20 2b 20 2d 20 63 6f  ol0 DIV 9 + - co
2c300 6c 31 20 2a 20 2b 20 63 6f 72 30 2e 63 6f 6c 32  l1 * + cor0.col2
2c310 20 2b 20 32 37 20 41 53 20 63 6f 6c 32 20 46 52   + 27 AS col2 FR
2c320 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
2c330 0a 2d 2d 2d 2d 0d 0a 2d 31 32 32 39 0d 0a 2d 31  .----..-1229..-1
2c340 33 37 37 0d 0a 2d 35 35 30 0d 0a 0d 0a 73 6b 69  377..-550....ski
2c350 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
2c360 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
2c370 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
2c380 6c 2d 31 32 37 37 0d 0a 53 45 4c 45 43 54 20 2d  l-1277..SELECT -
2c390 20 63 6f 6c 30 20 2f 20 39 20 2b 20 2d 20 63 6f   col0 / 9 + - co
2c3a0 6c 31 20 2a 20 2b 20 63 6f 72 30 2e 63 6f 6c 32  l1 * + cor0.col2
2c3b0 20 2b 20 32 37 20 41 53 20 63 6f 6c 32 20 46 52   + 27 AS col2 FR
2c3c0 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
2c3d0 0a 2d 2d 2d 2d 0d 0a 2d 31 32 32 39 0d 0a 2d 31  .----..-1229..-1
2c3e0 33 37 37 0d 0a 2d 35 35 30 0d 0a 0d 0a 6f 6e 6c  377..-550....onl
2c3f0 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70  yif mysql # supp
2c400 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70  ort for MySQL sp
2c410 65 63 69 66 69 63 20 73 79 73 74 65 6d 20 74 79  ecific system ty
2c420 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a  pes and syntax..
2c430 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
2c440 6c 61 62 65 6c 2d 31 32 37 38 0d 0a 53 45 4c 45  label-1278..SELE
2c450 43 54 20 2b 20 2b 20 63 6f 6c 31 20 2b 20 2d 20  CT + + col1 + - 
2c460 43 41 53 54 28 20 4e 55 4c 4c 20 41 53 20 53 49  CAST( NULL AS SI
2c470 47 4e 45 44 20 29 20 2a 20 63 6f 6c 30 20 2b 20  GNED ) * col0 + 
2c480 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c 31 20 41 53  col2 * + col1 AS
2c490 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20   col2 FROM tab0 
2c4a0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e  AS cor0..----..N
2c4b0 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d  ULL..NULL..NULL.
2c4c0 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
2c4d0 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
2c4e0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2c4f0 74 20 6c 61 62 65 6c 2d 31 32 37 38 0d 0a 53 45  t label-1278..SE
2c500 4c 45 43 54 20 2b 20 2b 20 63 6f 6c 31 20 2b 20  LECT + + col1 + 
2c510 2d 20 43 41 53 54 20 28 20 4e 55 4c 4c 20 41 53  - CAST ( NULL AS
2c520 20 49 4e 54 45 47 45 52 20 29 20 2a 20 63 6f 6c   INTEGER ) * col
2c530 30 20 2b 20 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c  0 + col2 * + col
2c540 31 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  1 AS col2 FROM t
2c550 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
2c560 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e  -..NULL..NULL..N
2c570 55 4c 4c 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  ULL....query I r
2c580 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63  owsort..SELECT c
2c590 6f 6c 31 20 2a 20 39 36 20 2b 20 32 39 20 46 52  ol1 * 96 + 29 FR
2c5a0 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
2c5b0 0a 2d 2d 2d 2d 0d 0a 38 32 38 35 0d 0a 38 37 36  .----..8285..876
2c5c0 35 0d 0a 39 33 34 31 0d 0a 0d 0a 71 75 65 72 79  5..9341....query
2c5d0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
2c5e0 43 54 20 63 6f 6c 31 20 2b 20 2d 20 63 6f 72 30  CT col1 + - cor0
2c5f0 2e 63 6f 6c 32 20 2b 20 2d 20 63 6f 6c 31 20 46  .col2 + - col1 F
2c600 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
2c610 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 2d 33 33 0d  ..----..-1..-33.
2c620 0a 2d 38 32 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  .-82....onlyif m
2c630 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66  ysql # support f
2c640 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69  or MySQL specifi
2c650 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61  c system types a
2c660 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79  nd syntax..query
2c670 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
2c680 2d 31 32 38 31 0d 0a 53 45 4c 45 43 54 20 63 6f  -1281..SELECT co
2c690 72 30 2e 63 6f 6c 30 20 2a 20 2d 20 43 41 53 54  r0.col0 * - CAST
2c6a0 28 20 63 6f 6c 30 20 41 53 20 53 49 47 4e 45 44  ( col0 AS SIGNED
2c6b0 20 29 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20   ) FROM tab1 AS 
2c6c0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 30 39  cor0..----..-409
2c6d0 36 0d 0a 2d 36 34 30 30 0d 0a 2d 39 0d 0a 0d 0a  6..-6400..-9....
2c6e0 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
2c6f0 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
2c700 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
2c710 61 62 65 6c 2d 31 32 38 31 0d 0a 53 45 4c 45 43  abel-1281..SELEC
2c720 54 20 63 6f 72 30 2e 63 6f 6c 30 20 2a 20 2d 20  T cor0.col0 * - 
2c730 43 41 53 54 20 28 20 63 6f 6c 30 20 41 53 20 49  CAST ( col0 AS I
2c740 4e 54 45 47 45 52 20 29 20 46 52 4f 4d 20 74 61  NTEGER ) FROM ta
2c750 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
2c760 0d 0a 2d 34 30 39 36 0d 0a 2d 36 34 30 30 0d 0a  ..-4096..-6400..
2c770 2d 39 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  -9....onlyif mys
2c780 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65  ql # use DIV ope
2c790 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65  rator for intege
2c7a0 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72  r division..quer
2c7b0 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
2c7c0 6c 2d 31 32 38 32 0d 0a 53 45 4c 45 43 54 20 44  l-1282..SELECT D
2c7d0 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c 31 20 2b  ISTINCT + col1 +
2c7e0 20 31 31 20 44 49 56 20 63 6f 6c 30 20 41 53 20   11 DIV col0 AS 
2c7f0 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41  col1 FROM tab0 A
2c800 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 38 36  S cor0..----..86
2c810 0d 0a 39 31 0d 0a 39 37 0d 0a 0d 0a 73 6b 69 70  ..91..97....skip
2c820 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
2c830 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
2c840 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
2c850 2d 31 32 38 32 0d 0a 53 45 4c 45 43 54 20 44 49  -1282..SELECT DI
2c860 53 54 49 4e 43 54 20 2b 20 63 6f 6c 31 20 2b 20  STINCT + col1 + 
2c870 31 31 20 2f 20 63 6f 6c 30 20 41 53 20 63 6f 6c  11 / col0 AS col
2c880 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  1 FROM tab0 AS c
2c890 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 38 36 0d 0a 39  or0..----..86..9
2c8a0 31 0d 0a 39 37 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  1..97....onlyif 
2c8b0 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20  mysql # use DIV 
2c8c0 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74  operator for int
2c8d0 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71  eger division..q
2c8e0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
2c8f0 61 62 65 6c 2d 31 32 38 33 0d 0a 53 45 4c 45 43  abel-1283..SELEC
2c900 54 20 41 4c 4c 20 2d 20 38 31 20 44 49 56 20 63  T ALL - 81 DIV c
2c910 6f 6c 30 20 2b 20 2b 20 74 61 62 30 2e 63 6f 6c  ol0 + + tab0.col
2c920 31 20 2a 20 63 6f 6c 31 20 41 53 20 63 6f 6c 32  1 * col1 AS col2
2c930 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d   FROM tab0..----
2c940 0d 0a 37 33 39 33 0d 0a 38 32 38 31 0d 0a 39 34  ..7393..8281..94
2c950 30 37 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  07....skipif mys
2c960 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
2c970 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
2c980 73 6f 72 74 20 6c 61 62 65 6c 2d 31 32 38 33 0d  sort label-1283.
2c990 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 38 31  .SELECT ALL - 81
2c9a0 20 2f 20 63 6f 6c 30 20 2b 20 2b 20 74 61 62 30   / col0 + + tab0
2c9b0 2e 63 6f 6c 31 20 2a 20 63 6f 6c 31 20 41 53 20  .col1 * col1 AS 
2c9c0 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 0d 0a  col2 FROM tab0..
2c9d0 2d 2d 2d 2d 0d 0a 37 33 39 33 0d 0a 38 32 38 31  ----..7393..8281
2c9e0 0d 0a 39 34 30 37 0d 0a 0d 0a 71 75 65 72 79 20  ..9407....query 
2c9f0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
2ca00 54 20 41 4c 4c 20 2b 20 74 61 62 31 2e 63 6f 6c  T ALL + tab1.col
2ca10 31 20 2b 20 63 6f 6c 32 20 41 53 20 63 6f 6c 30  1 + col2 AS col0
2ca20 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d   FROM tab1..----
2ca30 0d 0a 31 30 39 0d 0a 36 37 0d 0a 38 30 0d 0a 0d  ..109..67..80...
2ca40 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2ca50 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c  ..SELECT ALL col
2ca60 30 20 2b 20 63 6f 6c 32 20 2b 20 2b 20 63 6f 6c  0 + col2 + + col
2ca70 31 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  1 AS col0 FROM t
2ca80 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 33 34 0d 0a  ab2..----..134..
2ca90 31 36 33 0d 0a 36 35 0d 0a 0d 0a 71 75 65 72 79  163..65....query
2caa0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
2cab0 43 54 20 2b 20 74 61 62 32 2e 63 6f 6c 30 20 2b  CT + tab2.col0 +
2cac0 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20   col0 FROM tab2 
2cad0 57 48 45 52 45 20 4e 4f 54 20 4e 55 4c 4c 20 3c  WHERE NOT NULL <
2cae0 20 4e 55 4c 4c 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a 71   NULL..----....q
2caf0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
2cb00 53 45 4c 45 43 54 20 74 61 62 30 2e 63 6f 6c 32  SELECT tab0.col2
2cb10 20 2a 20 2d 20 63 6f 6c 31 20 2a 20 63 6f 6c 32   * - col1 * col2
2cb20 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
2cb30 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 36 31 31 38 38  b0..----..-61188
2cb40 34 0d 0a 2d 39 33 36 35 34 0d 0a 2d 39 37 0d 0a  4..-93654..-97..
2cb50 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2cb60 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
2cb70 43 54 20 2d 20 63 6f 6c 32 20 2b 20 2b 20 63 6f  CT - col2 + + co
2cb80 6c 31 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  l1 AS col0 FROM 
2cb90 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 35 33 0d 0a  tab0..----..53..
2cba0 39 0d 0a 39 36 0d 0a 0d 0a 71 75 65 72 79 20 49  9..96....query I
2cbb0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
2cbc0 20 2d 20 63 6f 6c 30 20 2a 20 63 6f 6c 31 20 2d   - col0 * col1 -
2cbd0 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 0d   col2 FROM tab2.
2cbe0 0a 2d 2d 2d 2d 0d 0a 2d 31 33 38 31 0d 0a 2d 32  .----..-1381..-2
2cbf0 34 34 0d 0a 2d 34 36 32 38 0d 0a 0d 0a 71 75 65  44..-4628....que
2cc00 72 79 20 49 49 49 20 72 6f 77 73 6f 72 74 0d 0a  ry III rowsort..
2cc10 53 45 4c 45 43 54 20 2a 20 46 52 4f 4d 20 74 61  SELECT * FROM ta
2cc20 62 32 20 57 48 45 52 45 20 4e 4f 54 20 63 6f 6c  b2 WHERE NOT col
2cc30 30 20 4e 4f 54 20 49 4e 20 28 20 2d 20 63 6f 6c  0 NOT IN ( - col
2cc40 30 20 29 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a 71 75 65  0 )..----....que
2cc50 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
2cc60 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 74 61  LECT DISTINCT ta
2cc70 62 32 2e 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c 30  b2.col0 * - col0
2cc80 20 2d 20 74 61 62 32 2e 63 6f 6c 31 20 41 53 20   - tab2.col1 AS 
2cc90 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 0d 0a  col0 FROM tab2..
2cca0 2d 2d 2d 2d 0d 0a 2d 36 31 34 33 0d 0a 2d 36 32  ----..-6143..-62
2ccb0 35 38 0d 0a 2d 38 30 0d 0a 0d 0a 71 75 65 72 79  58..-80....query
2ccc0 20 49 49 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45   III rowsort..SE
2ccd0 4c 45 43 54 20 41 4c 4c 20 2a 20 46 52 4f 4d 20  LECT ALL * FROM 
2cce0 74 61 62 31 20 57 48 45 52 45 20 2b 20 63 6f 6c  tab1 WHERE + col
2ccf0 31 20 4e 4f 54 20 49 4e 20 28 20 2b 20 63 6f 6c  1 NOT IN ( + col
2cd00 32 20 2b 20 63 6f 6c 31 20 2a 20 63 6f 6c 31 20  2 + col1 * col1 
2cd10 29 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65  )..----..9 value
2cd20 73 20 68 61 73 68 69 6e 67 20 74 6f 20 38 64 36  s hashing to 8d6
2cd30 36 39 32 65 36 64 34 31 35 30 35 63 33 61 64 34  692e6d41505c3ad4
2cd40 32 64 39 31 39 62 64 39 65 63 64 30 64 0d 0a 0d  2d919bd9ecd0d...
2cd50 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2cd60 0d 0a 53 45 4c 45 43 54 20 2b 20 74 61 62 32 2e  ..SELECT + tab2.
2cd70 63 6f 6c 32 20 2b 20 2d 20 63 6f 6c 32 20 41 53  col2 + - col2 AS
2cd80 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 0d   col0 FROM tab2.
2cd90 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a  .----..0..0..0..
2cda0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2cdb0 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20  t..SELECT ALL - 
2cdc0 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c 32 20 2a 20  col2 * - col2 * 
2cdd0 2b 20 74 61 62 32 2e 63 6f 6c 32 20 2d 20 63 6f  + tab2.col2 - co
2cde0 6c 30 20 2a 20 63 6f 6c 32 20 46 52 4f 4d 20 74  l0 * col2 FROM t
2cdf0 61 62 32 20 57 48 45 52 45 20 4e 4f 54 20 4e 55  ab2 WHERE NOT NU
2ce00 4c 4c 20 4e 4f 54 20 42 45 54 57 45 45 4e 20 4e  LL NOT BETWEEN N
2ce10 55 4c 4c 20 41 4e 44 20 63 6f 6c 31 20 2b 20 63  ULL AND col1 + c
2ce20 6f 6c 31 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a 71 75 65  ol1..----....que
2ce30 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
2ce40 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 30 20 2b 20  LECT ALL col0 + 
2ce50 2b 20 74 61 62 31 2e 63 6f 6c 31 20 2a 20 63 6f  + tab1.col1 * co
2ce60 6c 31 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d  l1 FROM tab1..--
2ce70 2d 2d 0d 0a 31 36 34 0d 0a 32 34 39 0d 0a 36 37  --..164..249..67
2ce80 39 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74  9....skipif post
2ce90 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65  gresql # Postgre
2cea0 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20  SQL requires AS 
2ceb0 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75  when renaming ou
2cec0 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75  tput columns..qu
2ced0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
2cee0 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b  ELECT DISTINCT +
2cef0 20 74 61 62 31 2e 63 6f 6c 32 20 63 6f 6c 30 20   tab1.col2 col0 
2cf00 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d  FROM tab1..----.
2cf10 0a 35 34 0d 0a 35 37 0d 0a 39 36 0d 0a 0d 0a 73  .54..57..96....s
2cf20 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c  kipif postgresql
2cf30 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65   # PostgreSQL re
2cf40 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72  quires AS when r
2cf50 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63  enaming output c
2cf60 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20  olumns..query I 
2cf70 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
2cf80 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c 32 20  DISTINCT - col2 
2cf90 2b 20 63 6f 6c 30 20 63 6f 6c 32 20 46 52 4f 4d  + col0 col2 FROM
2cfa0 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 39 0d   tab0..----..-9.
2cfb0 0a 33 34 0d 0a 37 0d 0a 0d 0a 6f 6e 6c 79 69 66  .34..7....onlyif
2cfc0 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56   mysql # use DIV
2cfd0 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e   operator for in
2cfe0 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a  teger division..
2cff0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
2d000 6c 61 62 65 6c 2d 31 32 39 38 0d 0a 53 45 4c 45  label-1298..SELE
2d010 43 54 20 63 6f 6c 32 20 2b 20 74 61 62 31 2e 63  CT col2 + tab1.c
2d020 6f 6c 31 20 2a 20 74 61 62 31 2e 63 6f 6c 30 20  ol1 * tab1.col0 
2d030 44 49 56 20 74 61 62 31 2e 63 6f 6c 30 20 41 53  DIV tab1.col0 AS
2d040 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 0d   col2 FROM tab1.
2d050 0a 2d 2d 2d 2d 0d 0a 31 30 39 0d 0a 36 37 0d 0a  .----..109..67..
2d060 38 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  80....skipif mys
2d070 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
2d080 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
2d090 73 6f 72 74 20 6c 61 62 65 6c 2d 31 32 39 38 0d  sort label-1298.
2d0a0 0a 53 45 4c 45 43 54 20 63 6f 6c 32 20 2b 20 74  .SELECT col2 + t
2d0b0 61 62 31 2e 63 6f 6c 31 20 2a 20 74 61 62 31 2e  ab1.col1 * tab1.
2d0c0 63 6f 6c 30 20 2f 20 74 61 62 31 2e 63 6f 6c 30  col0 / tab1.col0
2d0d0 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
2d0e0 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 30 39 0d 0a 36  b1..----..109..6
2d0f0 37 0d 0a 38 30 0d 0a 0d 0a 71 75 65 72 79 20 49  7..80....query I
2d100 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
2d110 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62   + col1 FROM tab
2d120 31 20 57 48 45 52 45 20 4e 55 4c 4c 20 49 4e 20  1 WHERE NULL IN 
2d130 28 20 63 6f 6c 32 20 2a 20 2d 20 74 61 62 31 2e  ( col2 * - tab1.
2d140 63 6f 6c 32 20 29 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a  col2 )..----....
2d150 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
2d160 0a 53 45 4c 45 43 54 20 2b 20 74 61 62 30 2e 63  .SELECT + tab0.c
2d170 6f 6c 31 20 2a 20 63 6f 6c 30 20 2a 20 2d 20 63  ol1 * col0 * - c
2d180 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d  ol2 FROM tab0..-
2d190 2d 2d 2d 0d 0a 2d 33 33 39 35 0d 0a 2d 36 36 34  ---..-3395..-664
2d1a0 31 31 38 0d 0a 2d 36 38 31 31 32 0d 0a 0d 0a 6f  118..-68112....o
2d1b0 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73  nlyif mysql # us
2d1c0 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66  e DIV operator f
2d1d0 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73  or integer divis
2d1e0 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ion..query I row
2d1f0 73 6f 72 74 20 6c 61 62 65 6c 2d 31 33 30 31 0d  sort label-1301.
2d200 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f  .SELECT ALL - co
2d210 6c 30 20 44 49 56 20 2b 20 63 6f 6c 31 20 41 53  l0 DIV + col1 AS
2d220 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 0d   col0 FROM tab2.
2d230 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 2d 34 0d 0a 30  .----..-1..-4..0
2d240 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
2d250 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
2d260 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
2d270 72 74 20 6c 61 62 65 6c 2d 31 33 30 31 0d 0a 53  rt label-1301..S
2d280 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 30  ELECT ALL - col0
2d290 20 2f 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c   / + col1 AS col
2d2a0 30 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d  0 FROM tab2..---
2d2b0 2d 0d 0a 2d 31 0d 0a 2d 34 0d 0a 30 0d 0a 0d 0a  -..-1..-4..0....
2d2c0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
2d2d0 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 32 20 2a  .SELECT + col2 *
2d2e0 20 2b 20 63 6f 6c 32 20 2a 20 63 6f 6c 31 20 2b   + col2 * col1 +
2d2f0 20 2d 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62   - col2 FROM tab
2d300 30 0d 0a 2d 2d 2d 2d 0d 0a 36 31 31 38 30 32 0d  0..----..611802.
2d310 0a 39 33 36 32 31 0d 0a 39 36 0d 0a 0d 0a 71 75  .93621..96....qu
2d320 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
2d330 45 4c 45 43 54 20 2d 20 63 6f 6c 30 20 2b 20 63  ELECT - col0 + c
2d340 6f 6c 31 20 2b 20 2d 20 63 6f 6c 30 20 2a 20 2b  ol1 + - col0 * +
2d350 20 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46 52   col2 AS col0 FR
2d360 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d  OM tab2..----..-
2d370 31 36 35 0d 0a 2d 32 30 34 37 0d 0a 2d 33 30 36  165..-2047..-306
2d380 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  4....query I row
2d390 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
2d3a0 54 49 4e 43 54 20 63 6f 6c 30 20 2b 20 74 61 62  TINCT col0 + tab
2d3b0 31 2e 63 6f 6c 31 20 2b 20 2d 20 63 6f 6c 32 20  1.col1 + - col2 
2d3c0 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d  FROM tab1..----.
2d3d0 0a 2d 32 35 0d 0a 2d 33 0d 0a 31 37 0d 0a 0d 0a  .-25..-3..17....
2d3e0 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71  skipif postgresq
2d3f0 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72  l # PostgreSQL r
2d400 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20  equires AS when 
2d410 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20  renaming output 
2d420 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49  columns..query I
2d430 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
2d440 20 32 20 2b 20 2b 20 63 6f 6c 31 20 2a 20 63 6f   2 + + col1 * co
2d450 6c 30 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  l0 col0 FROM tab
2d460 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
2d470 0a 32 30 36 36 0d 0a 33 33 39 37 0d 0a 38 31 30  .2066..3397..810
2d480 31 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  1....onlyif mysq
2d490 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72  l # use DIV oper
2d4a0 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72  ator for integer
2d4b0 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79   division..query
2d4c0 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
2d4d0 2d 31 33 30 36 0d 0a 53 45 4c 45 43 54 20 41 4c  -1306..SELECT AL
2d4e0 4c 20 63 6f 6c 31 20 2a 20 63 6f 6c 30 20 44 49  L col1 * col0 DI
2d4f0 56 20 2d 20 74 61 62 31 2e 63 6f 6c 31 20 41 53  V - tab1.col1 AS
2d500 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 0d   col2 FROM tab1.
2d510 0a 2d 2d 2d 2d 0d 0a 2d 33 0d 0a 2d 36 34 0d 0a  .----..-3..-64..
2d520 2d 38 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  -80....skipif my
2d530 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
2d540 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
2d550 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 33 30 36  wsort label-1306
2d560 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c  ..SELECT ALL col
2d570 31 20 2a 20 63 6f 6c 30 20 2f 20 2d 20 74 61 62  1 * col0 / - tab
2d580 31 2e 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46  1.col1 AS col2 F
2d590 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab1..----..
2d5a0 2d 33 0d 0a 2d 36 34 0d 0a 2d 38 30 0d 0a 0d 0a  -3..-64..-80....
2d5b0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
2d5c0 0a 53 45 4c 45 43 54 20 63 6f 6c 31 20 2b 20 2b  .SELECT col1 + +
2d5d0 20 63 6f 6c 30 20 2b 20 2d 20 74 61 62 31 2e 63   col0 + - tab1.c
2d5e0 6f 6c 30 20 2a 20 74 61 62 31 2e 63 6f 6c 31 20  ol0 * tab1.col1 
2d5f0 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
2d600 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 39 0d 0a 2d 35  1..----..-49..-5
2d610 36 36 0d 0a 2d 39 34 37 0d 0a 0d 0a 71 75 65 72  66..-947....quer
2d620 79 20 49 49 49 20 72 6f 77 73 6f 72 74 0d 0a 53  y III rowsort..S
2d630 45 4c 45 43 54 20 41 4c 4c 20 2a 20 46 52 4f 4d  ELECT ALL * FROM
2d640 20 74 61 62 30 20 57 48 45 52 45 20 4e 55 4c 4c   tab0 WHERE NULL
2d650 20 3d 20 28 20 2d 20 63 6f 6c 31 20 2b 20 63 6f   = ( - col1 + co
2d660 6c 30 20 2d 20 2b 20 63 6f 6c 30 20 2a 20 63 6f  l0 - + col0 * co
2d670 6c 30 20 2f 20 2b 20 63 6f 6c 32 20 29 0d 0a 2d  l0 / + col2 )..-
2d680 2d 2d 2d 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  ---....onlyif my
2d690 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70  sql # use DIV op
2d6a0 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67  erator for integ
2d6b0 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65  er division..que
2d6c0 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
2d6d0 65 6c 2d 31 33 30 39 0d 0a 53 45 4c 45 43 54 20  el-1309..SELECT 
2d6e0 41 4c 4c 20 2b 20 63 6f 6c 31 20 2b 20 63 6f 6c  ALL + col1 + col
2d6f0 31 20 44 49 56 20 63 6f 6c 30 20 2b 20 63 6f 6c  1 DIV col0 + col
2d700 32 20 2a 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61  2 * col1 FROM ta
2d710 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 32 36 31 0d 0a  b1..----..1261..
2d720 31 34 33 38 0d 0a 35 38 30 0d 0a 0d 0a 73 6b 69  1438..580....ski
2d730 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
2d740 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
2d750 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
2d760 6c 2d 31 33 30 39 0d 0a 53 45 4c 45 43 54 20 41  l-1309..SELECT A
2d770 4c 4c 20 2b 20 63 6f 6c 31 20 2b 20 63 6f 6c 31  LL + col1 + col1
2d780 20 2f 20 63 6f 6c 30 20 2b 20 63 6f 6c 32 20 2a   / col0 + col2 *
2d790 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 0d   col1 FROM tab1.
2d7a0 0a 2d 2d 2d 2d 0d 0a 31 32 36 31 0d 0a 31 34 33  .----..1261..143
2d7b0 38 0d 0a 35 38 30 0d 0a 0d 0a 71 75 65 72 79 20  8..580....query 
2d7c0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
2d7d0 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 32 20  T DISTINCT col2 
2d7e0 2a 20 63 6f 6c 32 20 2a 20 63 6f 6c 32 20 46 52  * col2 * col2 FR
2d7f0 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31  OM tab2..----..1
2d800 37 35 37 36 0d 0a 31 39 36 38 33 0d 0a 35 34 38  7576..19683..548
2d810 37 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  72....query I ro
2d820 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
2d830 63 6f 6c 31 20 2a 20 63 6f 6c 32 20 2a 20 2d 20  col1 * col2 * - 
2d840 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 0d 0a  col0 FROM tab1..
2d850 2d 2d 2d 2d 0d 0a 2d 33 36 34 38 30 0d 0a 2d 34  ----..-36480..-4
2d860 32 31 32 0d 0a 2d 39 39 38 34 30 0d 0a 0d 0a 71  212..-99840....q
2d870 75 65 72 79 20 49 49 49 20 72 6f 77 73 6f 72 74  uery III rowsort
2d880 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
2d890 54 20 2a 20 46 52 4f 4d 20 74 61 62 31 20 57 48  T * FROM tab1 WH
2d8a0 45 52 45 20 2b 20 63 6f 6c 31 20 2a 20 63 6f 6c  ERE + col1 * col
2d8b0 32 20 2b 20 2d 20 63 6f 6c 30 20 49 4e 20 28 20  2 + - col0 IN ( 
2d8c0 2b 20 63 6f 6c 31 20 2a 20 2d 20 74 61 62 31 2e  + col1 * - tab1.
2d8d0 63 6f 6c 32 20 2b 20 63 6f 6c 32 20 2a 20 63 6f  col2 + col2 * co
2d8e0 6c 32 20 29 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a 71 75  l2 )..----....qu
2d8f0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
2d900 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 32 20 2a  ELECT ALL col2 *
2d910 20 2d 20 74 61 62 32 2e 63 6f 6c 30 20 41 53 20   - tab2.col0 AS 
2d920 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 0d 0a  col1 FROM tab2..
2d930 2d 2d 2d 2d 0d 0a 2d 31 38 39 0d 0a 2d 32 30 32  ----..-189..-202
2d940 38 0d 0a 2d 33 30 30 32 0d 0a 0d 0a 71 75 65 72  8..-3002....quer
2d950 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
2d960 45 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c  ECT DISTINCT col
2d970 31 20 2a 20 74 61 62 31 2e 63 6f 6c 31 20 2a 20  1 * tab1.col1 * 
2d980 2d 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31  - col0 FROM tab1
2d990 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 35 32 30 0d 0a  ..----..-13520..
2d9a0 2d 32 30 32 38 0d 0a 2d 36 34 30 30 0d 0a 0d 0a  -2028..-6400....
2d9b0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
2d9c0 0a 53 45 4c 45 43 54 20 63 6f 6c 31 20 2b 20 63  .SELECT col1 + c
2d9d0 6f 6c 31 20 2a 20 2b 20 74 61 62 30 2e 63 6f 6c  ol1 * + tab0.col
2d9e0 32 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d  2 FROM tab0..---
2d9f0 2d 0d 0a 31 39 34 0d 0a 32 39 32 34 0d 0a 37 35  -..194..2924..75
2da00 35 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  53....query I ro
2da10 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
2da20 53 54 49 4e 43 54 20 2d 20 63 6f 6c 32 20 2b 20  STINCT - col2 + 
2da30 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c 30 20 46 52  col0 + + col0 FR
2da40 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d  OM tab2..----..-
2da50 31 33 0d 0a 31 32 30 0d 0a 31 33 30 0d 0a 0d 0a  13..120..130....
2da60 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
2da70 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 32 20 2a  .SELECT - col2 *
2da80 20 2d 20 38 20 46 52 4f 4d 20 74 61 62 30 20 63   - 8 FROM tab0 c
2da90 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 36 34 0d 0a  or0..----..264..
2daa0 36 35 36 0d 0a 38 0d 0a 0d 0a 71 75 65 72 79 20  656..8....query 
2dab0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
2dac0 54 20 44 49 53 54 49 4e 43 54 20 2d 20 31 35 20  T DISTINCT - 15 
2dad0 46 52 4f 4d 20 74 61 62 30 2c 20 74 61 62 31 2c  FROM tab0, tab1,
2dae0 20 74 61 62 32 20 41 53 20 63 6f 72 30 2c 20 74   tab2 AS cor0, t
2daf0 61 62 32 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d  ab2 AS cor1..---
2db00 2d 0d 0a 2d 31 35 0d 0a 0d 0a 71 75 65 72 79 20  -..-15....query 
2db10 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
2db20 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c  T DISTINCT - col
2db30 31 20 2a 20 2b 20 39 36 20 41 53 20 63 6f 6c 31  1 * + 96 AS col1
2db40 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d   FROM tab2..----
2db50 0d 0a 2d 31 36 33 32 0d 0a 2d 32 39 37 36 0d 0a  ..-1632..-2976..
2db60 2d 35 36 36 34 0d 0a 0d 0a 71 75 65 72 79 20 49  -5664....query I
2db70 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
2db80 20 63 6f 6c 31 20 2a 20 2d 20 32 36 20 41 53 20   col1 * - 26 AS 
2db90 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41  col2 FROM tab1 A
2dba0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32  S cor0..----..-2
2dbb0 36 30 0d 0a 2d 33 33 38 0d 0a 2d 36 37 36 0d 0a  60..-338..-676..
2dbc0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2dbd0 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 32 20 2a  t..SELECT col2 *
2dbe0 20 2b 20 63 6f 6c 30 20 2a 20 63 6f 6c 31 20 41   + col0 * col1 A
2dbf0 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31  S col1 FROM tab1
2dc00 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 36 34   cor0..----..364
2dc10 38 30 0d 0a 34 32 31 32 0d 0a 39 39 38 34 30 0d  80..4212..99840.
2dc20 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
2dc30 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
2dc40 4e 43 54 20 2b 20 63 6f 6c 31 20 2a 20 2b 20 32  NCT + col1 * + 2
2dc50 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  2 AS col2 FROM t
2dc60 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 32 32 30 0d 0a  ab1..----..220..
2dc70 32 38 36 0d 0a 35 37 32 0d 0a 0d 0a 71 75 65 72  286..572....quer
2dc80 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
2dc90 45 43 54 20 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c  ECT col1 * + col
2dca0 31 20 2b 20 2b 20 63 6f 6c 31 20 2a 20 2b 20 63  1 + + col1 * + c
2dcb0 6f 6c 30 20 2a 20 2d 20 63 6f 6c 32 20 41 53 20  ol0 * - col2 AS 
2dcc0 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 63  col0 FROM tab0 c
2dcd0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 36 30 37 31  or0..----..-6071
2dce0 36 0d 0a 2d 36 35 35 38 33 37 0d 0a 36 30 31 34  6..-655837..6014
2dcf0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
2dd00 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 35 20  ort..SELECT + 5 
2dd10 2a 20 63 6f 6c 30 20 2b 20 63 6f 6c 30 20 46 52  * col0 + col0 FR
2dd20 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
2dd30 0a 2d 2d 2d 2d 0d 0a 34 32 0d 0a 34 36 38 0d 0a  .----..42..468..
2dd40 34 37 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  474....query I r
2dd50 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
2dd60 20 38 38 20 2a 20 63 6f 6c 31 20 2b 20 2b 20 63   88 * col1 + + c
2dd70 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  ol0 AS col2 FROM
2dd80 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
2dd90 2d 2d 2d 0d 0a 2d 37 35 34 34 0d 0a 2d 37 39 31  ---..-7544..-791
2dda0 39 0d 0a 2d 38 35 30 31 0d 0a 0d 0a 73 6b 69 70  9..-8501....skip
2ddb0 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20  if postgresql # 
2ddc0 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69  PostgreSQL requi
2ddd0 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61  res AS when rena
2dde0 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75  ming output colu
2ddf0 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  mns..query I row
2de00 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
2de10 20 34 30 20 2b 20 36 37 20 2a 20 63 6f 6c 30 20   40 + 67 * col0 
2de20 2b 20 2d 20 34 32 20 63 6f 6c 32 20 46 52 4f 4d  + - 42 col2 FROM
2de30 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 34 36 37   tab2..----..467
2de40 0d 0a 35 32 32 34 0d 0a 35 32 39 31 0d 0a 0d 0a  ..5224..5291....
2de50 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
2de60 0a 53 45 4c 45 43 54 20 41 4c 4c 20 28 20 63 6f  .SELECT ALL ( co
2de70 6c 32 20 29 20 2b 20 63 6f 6c 31 20 46 52 4f 4d  l2 ) + col1 FROM
2de80 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 39   tab0..----..119
2de90 0d 0a 31 37 33 0d 0a 39 38 0d 0a 0d 0a 6f 6e 6c  ..173..98....onl
2dea0 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70  yif mysql # supp
2deb0 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70  ort for MySQL sp
2dec0 65 63 69 66 69 63 20 73 79 73 74 65 6d 20 74 79  ecific system ty
2ded0 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a  pes and syntax..
2dee0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
2def0 6c 61 62 65 6c 2d 31 33 32 38 0d 0a 53 45 4c 45  label-1328..SELE
2df00 43 54 20 63 6f 6c 31 20 2a 20 2b 20 63 6f 72 30  CT col1 * + cor0
2df10 2e 63 6f 6c 32 20 2b 20 2d 20 43 41 53 54 28 20  .col2 + - CAST( 
2df20 4e 55 4c 4c 20 41 53 20 53 49 47 4e 45 44 20 29  NULL AS SIGNED )
2df30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
2df40 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a  r0..----..NULL..
2df50 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b  NULL..NULL....sk
2df60 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
2df70 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
2df80 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
2df90 65 6c 2d 31 33 32 38 0d 0a 53 45 4c 45 43 54 20  el-1328..SELECT 
2dfa0 63 6f 6c 31 20 2a 20 2b 20 63 6f 72 30 2e 63 6f  col1 * + cor0.co
2dfb0 6c 32 20 2b 20 2d 20 43 41 53 54 20 28 20 4e 55  l2 + - CAST ( NU
2dfc0 4c 4c 20 41 53 20 49 4e 54 45 47 45 52 20 29 20  LL AS INTEGER ) 
2dfd0 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
2dfe0 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e  0..----..NULL..N
2dff0 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75 65  ULL..NULL....que
2e000 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
2e010 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 31 20  LECT ALL - col1 
2e020 2b 20 2b 20 63 6f 6c 31 20 2a 20 63 6f 6c 30 20  + + col1 * col0 
2e030 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
2e040 32 0d 0a 2d 2d 2d 2d 0d 0a 31 33 32 36 0d 0a 31  2..----..1326..1
2e050 38 36 0d 0a 34 35 34 33 0d 0a 0d 0a 71 75 65 72  86..4543....quer
2e060 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
2e070 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 74  ECT DISTINCT + t
2e080 61 62 32 2e 63 6f 6c 30 20 2b 20 63 6f 6c 31 20  ab2.col0 + col1 
2e090 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
2e0a0 32 0d 0a 2d 2d 2d 2d 0d 0a 31 33 37 0d 0a 33 38  2..----..137..38
2e0b0 0d 0a 39 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..96....query I 
2e0c0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
2e0d0 2d 20 35 32 20 2a 20 38 37 20 2b 20 2b 20 74 61  - 52 * 87 + + ta
2e0e0 62 31 2e 63 6f 6c 32 20 2b 20 63 6f 6c 30 20 46  b1.col2 + col0 F
2e0f0 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab1..----..
2e100 2d 34 33 34 38 0d 0a 2d 34 34 30 33 0d 0a 2d 34  -4348..-4403..-4
2e110 34 36 37 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  467....onlyif my
2e120 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f  sql # support fo
2e130 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63  r MySQL specific
2e140 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e   system types an
2e150 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20  d syntax..query 
2e160 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
2e170 31 33 33 32 0d 0a 53 45 4c 45 43 54 20 43 41 53  1332..SELECT CAS
2e180 54 28 20 4e 55 4c 4c 20 41 53 20 44 45 43 49 4d  T( NULL AS DECIM
2e190 41 4c 20 29 20 46 52 4f 4d 20 74 61 62 32 20 41  AL ) FROM tab2 A
2e1a0 53 20 63 6f 72 30 20 43 52 4f 53 53 20 4a 4f 49  S cor0 CROSS JOI
2e1b0 4e 20 74 61 62 31 20 41 53 20 63 6f 72 31 0d 0a  N tab1 AS cor1..
2e1c0 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68  ----..9 values h
2e1d0 61 73 68 69 6e 67 20 74 6f 20 63 64 37 61 37 39  ashing to cd7a79
2e1e0 30 31 65 34 37 63 31 35 31 35 35 34 30 34 61 66  01e47c15155404af
2e1f0 66 30 64 32 31 36 66 65 30 62 0d 0a 0d 0a 73 6b  f0d216fe0b....sk
2e200 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
2e210 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
2e220 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
2e230 65 6c 2d 31 33 33 32 0d 0a 53 45 4c 45 43 54 20  el-1332..SELECT 
2e240 43 41 53 54 20 28 20 4e 55 4c 4c 20 41 53 20 52  CAST ( NULL AS R
2e250 45 41 4c 20 29 20 46 52 4f 4d 20 74 61 62 32 20  EAL ) FROM tab2 
2e260 41 53 20 63 6f 72 30 20 43 52 4f 53 53 20 4a 4f  AS cor0 CROSS JO
2e270 49 4e 20 74 61 62 31 20 41 53 20 63 6f 72 31 0d  IN tab1 AS cor1.
2e280 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20  .----..9 values 
2e290 68 61 73 68 69 6e 67 20 74 6f 20 63 64 37 61 37  hashing to cd7a7
2e2a0 39 30 31 65 34 37 63 31 35 31 35 35 34 30 34 61  901e47c15155404a
2e2b0 66 66 30 64 32 31 36 66 65 30 62 0d 0a 0d 0a 6f  ff0d216fe0b....o
2e2c0 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75  nlyif mysql # su
2e2d0 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20  pport for MySQL 
2e2e0 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20  specific system 
2e2f0 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78  types and syntax
2e300 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2e310 74 20 6c 61 62 65 6c 2d 31 33 33 33 0d 0a 53 45  t label-1333..SE
2e320 4c 45 43 54 20 2b 20 43 41 53 54 28 20 4e 55 4c  LECT + CAST( NUL
2e330 4c 20 41 53 20 53 49 47 4e 45 44 20 29 20 2a 20  L AS SIGNED ) * 
2e340 34 39 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  49 AS col2 FROM 
2e350 74 61 62 31 20 63 6f 72 30 20 43 52 4f 53 53 20  tab1 cor0 CROSS 
2e360 4a 4f 49 4e 20 74 61 62 31 20 41 53 20 63 6f 72  JOIN tab1 AS cor
2e370 31 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65  1..----..9 value
2e380 73 20 68 61 73 68 69 6e 67 20 74 6f 20 63 64 37  s hashing to cd7
2e390 61 37 39 30 31 65 34 37 63 31 35 31 35 35 34 30  a7901e47c1515540
2e3a0 34 61 66 66 30 64 32 31 36 66 65 30 62 0d 0a 0d  4aff0d216fe0b...
2e3b0 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
2e3c0 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
2e3d0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
2e3e0 6c 61 62 65 6c 2d 31 33 33 33 0d 0a 53 45 4c 45  label-1333..SELE
2e3f0 43 54 20 2b 20 43 41 53 54 20 28 20 4e 55 4c 4c  CT + CAST ( NULL
2e400 20 41 53 20 49 4e 54 45 47 45 52 20 29 20 2a 20   AS INTEGER ) * 
2e410 34 39 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  49 AS col2 FROM 
2e420 74 61 62 31 20 63 6f 72 30 20 43 52 4f 53 53 20  tab1 cor0 CROSS 
2e430 4a 4f 49 4e 20 74 61 62 31 20 41 53 20 63 6f 72  JOIN tab1 AS cor
2e440 31 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65  1..----..9 value
2e450 73 20 68 61 73 68 69 6e 67 20 74 6f 20 63 64 37  s hashing to cd7
2e460 61 37 39 30 31 65 34 37 63 31 35 31 35 35 34 30  a7901e47c1515540
2e470 34 61 66 66 30 64 32 31 36 66 65 30 62 0d 0a 0d  4aff0d216fe0b...
2e480 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
2e490 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51  support for MySQ
2e4a0 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65  L specific syste
2e4b0 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74  m types and synt
2e4c0 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ax..query I rows
2e4d0 6f 72 74 20 6c 61 62 65 6c 2d 31 33 33 34 0d 0a  ort label-1334..
2e4e0 53 45 4c 45 43 54 20 2d 20 63 6f 6c 32 20 2b 20  SELECT - col2 + 
2e4f0 2d 20 63 6f 6c 31 20 2b 20 2d 20 43 41 53 54 28  - col1 + - CAST(
2e500 20 63 6f 6c 32 20 41 53 20 53 49 47 4e 45 44 20   col2 AS SIGNED 
2e510 29 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  ) FROM tab2 AS c
2e520 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 31 0d  or0..----..-111.
2e530 0a 2d 38 35 0d 0a 2d 39 33 0d 0a 0d 0a 73 6b 69  .-85..-93....ski
2e540 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
2e550 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
2e560 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
2e570 6c 2d 31 33 33 34 0d 0a 53 45 4c 45 43 54 20 2d  l-1334..SELECT -
2e580 20 63 6f 6c 32 20 2b 20 2d 20 63 6f 6c 31 20 2b   col2 + - col1 +
2e590 20 2d 20 43 41 53 54 20 28 20 63 6f 6c 32 20 41   - CAST ( col2 A
2e5a0 53 20 49 4e 54 45 47 45 52 20 29 20 46 52 4f 4d  S INTEGER ) FROM
2e5b0 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
2e5c0 2d 2d 2d 0d 0a 2d 31 31 31 0d 0a 2d 38 35 0d 0a  ---..-111..-85..
2e5d0 2d 39 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  -93....query I r
2e5e0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
2e5f0 49 53 54 49 4e 43 54 20 2b 20 2b 20 38 39 20 46  ISTINCT + + 89 F
2e600 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
2e610 0d 0a 2d 2d 2d 2d 0d 0a 38 39 0d 0a 0d 0a 71 75  ..----..89....qu
2e620 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
2e630 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b  ELECT DISTINCT +
2e640 20 63 6f 72 30 2e 63 6f 6c 31 20 2a 20 2d 20 63   cor0.col1 * - c
2e650 6f 6c 32 20 2b 20 63 6f 6c 30 20 2a 20 28 20 63  ol2 + col0 * ( c
2e660 6f 6c 32 20 29 20 41 53 20 63 6f 6c 30 20 46 52  ol2 ) AS col0 FR
2e670 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
2e680 0a 2d 2d 2d 2d 0d 0a 2d 31 32 34 32 0d 0a 33 30  .----..-1242..30
2e690 37 38 0d 0a 36 34 33 32 0d 0a 0d 0a 73 6b 69 70  78..6432....skip
2e6a0 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20  if postgresql # 
2e6b0 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69  PostgreSQL requi
2e6c0 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61  res AS when rena
2e6d0 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75  ming output colu
2e6e0 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  mns..query I row
2e6f0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 33  sort..SELECT - 3
2e700 33 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30  3 col1 FROM tab0
2e710 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
2e720 2d 33 33 0d 0a 2d 33 33 0d 0a 2d 33 33 0d 0a 0d  -33..-33..-33...
2e730 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2e740 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
2e750 54 20 74 61 62 30 2e 63 6f 6c 31 20 2a 20 2b 20  T tab0.col1 * + 
2e760 74 61 62 30 2e 63 6f 6c 32 20 41 53 20 63 6f 6c  tab0.col2 AS col
2e770 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d  1 FROM tab0..---
2e780 2d 0d 0a 32 38 33 38 0d 0a 37 34 36 32 0d 0a 39  -..2838..7462..9
2e790 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  7....query I row
2e7a0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 36  sort..SELECT + 6
2e7b0 34 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  4 AS col2 FROM t
2e7c0 61 62 31 2c 20 74 61 62 31 20 41 53 20 63 6f 72  ab1, tab1 AS cor
2e7d0 30 2c 20 74 61 62 32 20 41 53 20 63 6f 72 31 0d  0, tab2 AS cor1.
2e7e0 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75 65 73  .----..27 values
2e7f0 20 68 61 73 68 69 6e 67 20 74 6f 20 63 38 62 31   hashing to c8b1
2e800 39 66 34 63 33 66 66 33 38 37 30 30 63 64 32 62  9f4c3ff38700cd2b
2e810 62 38 61 30 37 37 62 66 32 39 62 39 0d 0a 0d 0a  b8a077bf29b9....
2e820 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73  onlyif mysql # s
2e830 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c  upport for MySQL
2e840 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d   specific system
2e850 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61   types and synta
2e860 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  x..query I rowso
2e870 72 74 20 6c 61 62 65 6c 2d 31 33 34 30 0d 0a 53  rt label-1340..S
2e880 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b  ELECT DISTINCT +
2e890 20 2b 20 63 6f 6c 30 20 2b 20 2d 20 43 41 53 54   + col0 + - CAST
2e8a0 28 20 4e 55 4c 4c 20 41 53 20 53 49 47 4e 45 44  ( NULL AS SIGNED
2e8b0 20 29 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62   ) col1 FROM tab
2e8c0 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
2e8d0 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20  .NULL....skipif 
2e8e0 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73  postgresql # Pos
2e8f0 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73  tgreSQL requires
2e900 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e   AS when renamin
2e910 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73  g output columns
2e920 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
2e930 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
2e940 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2e950 20 6c 61 62 65 6c 2d 31 33 34 30 0d 0a 53 45 4c   label-1340..SEL
2e960 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 2b  ECT DISTINCT + +
2e970 20 63 6f 6c 30 20 2b 20 2d 20 43 41 53 54 20 28   col0 + - CAST (
2e980 20 4e 55 4c 4c 20 41 53 20 49 4e 54 45 47 45 52   NULL AS INTEGER
2e990 20 29 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62   ) col1 FROM tab
2e9a0 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
2e9b0 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75 65 72 79 20 49  .NULL....query I
2e9c0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
2e9d0 20 44 49 53 54 49 4e 43 54 20 2b 20 2d 20 63 6f   DISTINCT + - co
2e9e0 72 30 2e 63 6f 6c 32 20 2b 20 2b 20 28 20 2d 20  r0.col2 + + ( - 
2e9f0 63 6f 6c 31 20 29 20 2a 20 63 6f 6c 31 20 46 52  col1 ) * col1 FR
2ea00 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
2ea10 0a 2d 2d 2d 2d 0d 0a 2d 31 35 37 0d 0a 2d 32 36  .----..-157..-26
2ea20 35 0d 0a 2d 37 33 30 0d 0a 0d 0a 71 75 65 72 79  5..-730....query
2ea30 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
2ea40 43 54 20 63 6f 72 30 2e 63 6f 6c 30 20 2b 20 63  CT cor0.col0 + c
2ea50 6f 6c 32 20 2a 20 2b 20 63 6f 6c 30 20 46 52 4f  ol2 * + col0 FRO
2ea60 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab0 cor0..---
2ea70 2d 0d 0a 37 30 0d 0a 37 33 38 37 0d 0a 38 31 36  -..70..7387..816
2ea80 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
2ea90 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
2eaa0 2d 20 2d 20 63 6f 6c 30 20 2a 20 63 6f 6c 32 20  - - col0 * col2 
2eab0 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
2eac0 30 0d 0a 2d 2d 2d 2d 0d 0a 31 38 39 0d 0a 32 30  0..----..189..20
2ead0 32 38 0d 0a 33 30 30 32 0d 0a 0d 0a 71 75 65 72  28..3002....quer
2eae0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
2eaf0 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 2b  ECT DISTINCT - +
2eb00 20 63 6f 72 30 2e 63 6f 6c 30 20 2b 20 2d 20 63   cor0.col0 + - c
2eb10 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol1 FROM tab1 AS
2eb20 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 39   cor0..----..-29
2eb30 0d 0a 2d 37 34 0d 0a 2d 39 33 0d 0a 0d 0a 71 75  ..-74..-93....qu
2eb40 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
2eb50 45 4c 45 43 54 20 2d 20 35 32 20 2a 20 63 6f 6c  ELECT - 52 * col
2eb60 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  2 AS col2 FROM t
2eb70 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 38 30 38  ab1..----..-2808
2eb80 0d 0a 2d 32 39 36 34 0d 0a 2d 34 39 39 32 0d 0a  ..-2964..-4992..
2eb90 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2eba0 74 0d 0a 53 45 4c 45 43 54 20 37 31 20 2a 20 63  t..SELECT 71 * c
2ebb0 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  ol2 AS col0 FROM
2ebc0 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 38 34   tab2..----..184
2ebd0 36 0d 0a 31 39 31 37 0d 0a 32 36 39 38 0d 0a 0d  6..1917..2698...
2ebe0 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
2ebf0 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72  use DIV operator
2ec00 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76   for integer div
2ec10 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72  ision..query I r
2ec20 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 33 34  owsort label-134
2ec30 37 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f  7..SELECT ALL co
2ec40 6c 30 20 44 49 56 20 63 6f 6c 30 20 2b 20 63 6f  l0 DIV col0 + co
2ec50 6c 30 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  l0 col2 FROM tab
2ec60 32 0d 0a 2d 2d 2d 2d 0d 0a 37 39 0d 0a 38 0d 0a  2..----..79..8..
2ec70 38 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73  80....skipif pos
2ec80 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72  tgresql # Postgr
2ec90 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53  eSQL requires AS
2eca0 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f   when renaming o
2ecb0 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 73  utput columns..s
2ecc0 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
2ecd0 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
2ece0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
2ecf0 62 65 6c 2d 31 33 34 37 0d 0a 53 45 4c 45 43 54  bel-1347..SELECT
2ed00 20 41 4c 4c 20 63 6f 6c 30 20 2f 20 63 6f 6c 30   ALL col0 / col0
2ed10 20 2b 20 63 6f 6c 30 20 63 6f 6c 32 20 46 52 4f   + col0 col2 FRO
2ed20 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 37 39  M tab2..----..79
2ed30 0d 0a 38 0d 0a 38 30 0d 0a 0d 0a 71 75 65 72 79  ..8..80....query
2ed40 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
2ed50 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 31 36  CT DISTINCT + 16
2ed60 20 46 52 4f 4d 20 74 61 62 32 2c 20 74 61 62 32   FROM tab2, tab2
2ed70 20 41 53 20 63 6f 72 30 2c 20 74 61 62 30 20 63   AS cor0, tab0 c
2ed80 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 31 36 0d 0a 0d  or1..----..16...
2ed90 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2eda0 0d 0a 53 45 4c 45 43 54 20 28 20 2d 20 63 6f 6c  ..SELECT ( - col
2edb0 31 20 2a 20 28 20 2d 20 74 61 62 32 2e 63 6f 6c  1 * ( - tab2.col
2edc0 32 20 29 20 29 20 46 52 4f 4d 20 74 61 62 32 0d  2 ) ) FROM tab2.
2edd0 0a 2d 2d 2d 2d 0d 0a 31 35 33 34 0d 0a 36 34 36  .----..1534..646
2ede0 0d 0a 38 33 37 0d 0a 0d 0a 71 75 65 72 79 20 49  ..837....query I
2edf0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
2ee00 20 44 49 53 54 49 4e 43 54 20 2d 20 2b 20 36 34   DISTINCT - + 64
2ee10 20 46 52 4f 4d 20 74 61 62 31 2c 20 74 61 62 30   FROM tab1, tab0
2ee20 2c 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  , tab2 AS cor0..
2ee30 2d 2d 2d 2d 0d 0a 2d 36 34 0d 0a 0d 0a 71 75 65  ----..-64....que
2ee40 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
2ee50 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 32 20  LECT ALL - col2 
2ee60 2b 20 2d 20 63 6f 6c 31 20 2a 20 63 6f 6c 31 20  + - col1 * col1 
2ee70 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
2ee80 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 37 34 32 39 0d 0a  0..----..-7429..
2ee90 2d 38 33 36 33 0d 0a 2d 39 34 31 30 0d 0a 0d 0a  -8363..-9410....
2eea0 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71  skipif postgresq
2eeb0 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72  l # PostgreSQL r
2eec0 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20  equires AS when 
2eed0 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20  renaming output 
2eee0 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49  columns..query I
2eef0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
2ef00 20 2d 20 63 6f 6c 30 20 2a 20 2b 20 34 37 20 2b   - col0 * + 47 +
2ef10 20 63 6f 6c 31 20 63 6f 6c 31 20 46 52 4f 4d 20   col1 col1 FROM 
2ef20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
2ef30 2d 2d 0d 0a 2d 32 39 38 0d 0a 2d 33 36 30 37 0d  --..-298..-3607.
2ef40 0a 2d 33 36 39 36 0d 0a 0d 0a 71 75 65 72 79 20  .-3696....query 
2ef50 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
2ef60 54 20 41 4c 4c 20 37 31 20 41 53 20 63 6f 6c 30  T ALL 71 AS col0
2ef70 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d   FROM tab0..----
2ef80 0d 0a 37 31 0d 0a 37 31 0d 0a 37 31 0d 0a 0d 0a  ..71..71..71....
2ef90 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
2efa0 0a 53 45 4c 45 43 54 20 39 39 20 2b 20 2b 20 32  .SELECT 99 + + 2
2efb0 20 2a 20 2d 20 63 6f 6c 32 20 46 52 4f 4d 20 74   * - col2 FROM t
2efc0 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
2efd0 2d 0d 0a 32 33 0d 0a 34 35 0d 0a 34 37 0d 0a 0d  -..23..45..47...
2efe0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2eff0 0d 0a 53 45 4c 45 43 54 20 32 38 20 2a 20 2d 20  ..SELECT 28 * - 
2f000 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 63  col0 FROM tab1 c
2f010 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 37 39 32  or0..----..-1792
2f020 0d 0a 2d 32 32 34 30 0d 0a 2d 38 34 0d 0a 0d 0a  ..-2240..-84....
2f030 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
2f040 0a 53 45 4c 45 43 54 20 36 31 20 2b 20 2b 20 63  .SELECT 61 + + c
2f050 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  ol1 AS col2 FROM
2f060 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 34 37   tab0..----..147
2f070 0d 0a 31 35 32 0d 0a 31 35 38 0d 0a 0d 0a 71 75  ..152..158....qu
2f080 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
2f090 45 4c 45 43 54 20 2b 20 2d 20 63 6f 6c 32 20 2a  ELECT + - col2 *
2f0a0 20 2d 20 63 6f 6c 30 20 2b 20 63 6f 6c 31 20 41   - col0 + col1 A
2f0b0 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30  S col2 FROM tab0
2f0c0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
2f0d0 31 33 32 0d 0a 37 33 38 39 0d 0a 38 37 38 0d 0a  132..7389..878..
2f0e0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2f0f0 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20  t..SELECT ALL + 
2f100 2d 20 63 6f 6c 30 20 2a 20 63 6f 6c 31 20 2b 20  - col0 * col1 + 
2f110 2b 20 28 20 63 6f 6c 32 20 29 20 2a 20 2d 20 63  + ( col2 ) * - c
2f120 6f 6c 30 20 2b 20 2b 20 28 20 2b 20 37 34 20 29  ol0 + + ( + 74 )
2f130 20 2a 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 41   * - cor0.col2 A
2f140 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31  S col2 FROM tab1
2f150 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
2f160 2d 31 35 38 32 34 0d 0a 2d 34 32 33 36 0d 0a 2d  -15824..-4236..-
2f170 38 35 30 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20  8506....query I 
2f180 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
2f190 44 49 53 54 49 4e 43 54 20 63 6f 6c 30 20 2d 20  DISTINCT col0 - 
2f1a0 2b 20 63 6f 6c 32 20 2a 20 28 20 2d 20 28 20 63  + col2 * ( - ( c
2f1b0 6f 6c 31 20 29 20 29 20 2a 20 2b 20 28 20 2b 20  ol1 ) ) * + ( + 
2f1c0 28 20 63 6f 6c 31 20 29 20 2b 20 35 38 20 29 20  ( col1 ) + 58 ) 
2f1d0 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
2f1e0 30 0d 0a 2d 2d 2d 2d 0d 0a 31 37 39 35 35 36 0d  0..----..179556.
2f1f0 0a 34 38 35 32 39 0d 0a 37 34 35 30 30 0d 0a 0d  .48529..74500...
2f200 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2f210 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 31 20  ..SELECT - col1 
2f220 2a 20 2d 20 63 6f 6c 31 20 2d 20 63 6f 6c 30 20  * - col1 - col0 
2f230 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
2f240 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
2f250 0a 37 33 37 32 0d 0a 38 31 39 32 0d 0a 39 33 37  .7372..8192..937
2f260 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  4....query I row
2f270 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
2f280 54 49 4e 43 54 20 2d 20 63 6f 72 30 2e 63 6f 6c  TINCT - cor0.col
2f290 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  2 AS col2 FROM t
2f2a0 61 62 31 20 63 6f 72 30 20 43 52 4f 53 53 20 4a  ab1 cor0 CROSS J
2f2b0 4f 49 4e 20 74 61 62 31 20 41 53 20 63 6f 72 31  OIN tab1 AS cor1
2f2c0 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 34 0d 0a 2d 35 37  ..----..-54..-57
2f2d0 0d 0a 2d 39 36 0d 0a 0d 0a 71 75 65 72 79 20 49  ..-96....query I
2f2e0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
2f2f0 20 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c 32 20 2d   col1 * + col2 -
2f300 20 28 20 2b 20 28 20 63 6f 6c 30 20 29 20 29 20   ( + ( col0 ) ) 
2f310 2a 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 46 52  * - cor0.col2 FR
2f320 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
2f330 0a 2d 2d 2d 2d 0d 0a 31 35 36 36 0d 0a 34 32 31  .----..1566..421
2f340 38 0d 0a 38 39 32 38 0d 0a 0d 0a 71 75 65 72 79  8..8928....query
2f350 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
2f360 43 54 20 2d 20 63 6f 6c 32 20 2b 20 2b 20 63 6f  CT - col2 + + co
2f370 6c 32 20 2a 20 2d 20 32 20 46 52 4f 4d 20 74 61  l2 * - 2 FROM ta
2f380 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  b2 cor0..----..-
2f390 31 31 34 0d 0a 2d 37 38 0d 0a 2d 38 31 0d 0a 0d  114..-78..-81...
2f3a0 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73  .skipif postgres
2f3b0 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20  ql # PostgreSQL 
2f3c0 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e  requires AS when
2f3d0 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74   renaming output
2f3e0 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20   columns..query 
2f3f0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
2f400 54 20 44 49 53 54 49 4e 43 54 20 2d 20 35 20 2a  T DISTINCT - 5 *
2f410 20 2d 20 63 6f 6c 31 20 2b 20 63 6f 72 30 2e 63   - col1 + cor0.c
2f420 6f 6c 30 20 2b 20 2b 20 39 33 20 63 6f 6c 31 20  ol0 + + 93 col1 
2f430 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
2f440 30 0d 0a 2d 2d 2d 2d 0d 0a 35 34 37 0d 0a 36 31  0..----..547..61
2f450 33 0d 0a 36 33 37 0d 0a 0d 0a 71 75 65 72 79 20  3..637....query 
2f460 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
2f470 54 20 2b 20 28 20 63 6f 6c 32 20 29 20 2b 20 2b  T + ( col2 ) + +
2f480 20 63 6f 6c 32 20 2b 20 2d 20 63 6f 6c 32 20 46   col2 + - col2 F
2f490 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
2f4a0 0d 0a 2d 2d 2d 2d 0d 0a 31 0d 0a 33 33 0d 0a 38  ..----..1..33..8
2f4b0 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  2....query I row
2f4c0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
2f4d0 20 63 6f 6c 31 20 2a 20 2b 20 63 6f 72 30 2e 63   col1 * + cor0.c
2f4e0 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol0 FROM tab1 AS
2f4f0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 34   cor0..----..104
2f500 30 0d 0a 36 34 30 0d 0a 37 38 0d 0a 0d 0a 71 75  0..640..78....qu
2f510 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
2f520 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b  ELECT DISTINCT +
2f530 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 2b 20 63   + cor0.col1 + c
2f540 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  ol1 AS col1 FROM
2f550 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
2f560 2d 2d 2d 0d 0a 31 31 38 0d 0a 33 34 0d 0a 36 32  ---..118..34..62
2f570 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
2f580 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f  ort..SELECT + co
2f590 72 30 2e 63 6f 6c 30 20 2b 20 32 38 20 41 53 20  r0.col0 + 28 AS 
2f5a0 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41  col2 FROM tab1 A
2f5b0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30  S cor0..----..10
2f5c0 38 0d 0a 33 31 0d 0a 39 32 0d 0a 0d 0a 71 75 65  8..31..92....que
2f5d0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
2f5e0 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20  LECT DISTINCT - 
2f5f0 31 36 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  16 AS col2 FROM 
2f600 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
2f610 2d 2d 0d 0a 2d 31 36 0d 0a 0d 0a 71 75 65 72 79  --..-16....query
2f620 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
2f630 43 54 20 2d 20 2b 20 63 6f 72 30 2e 63 6f 6c 32  CT - + cor0.col2
2f640 20 2b 20 63 6f 6c 32 20 2b 20 63 6f 72 30 2e 63   + col2 + cor0.c
2f650 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 63 6f  ol1 FROM tab0 co
2f660 72 30 0d 0a 2d 2d 2d 2d 0d 0a 38 36 0d 0a 39 31  r0..----..86..91
2f670 0d 0a 39 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..97....query I 
2f680 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
2f690 2d 20 35 33 20 2a 20 63 6f 72 30 2e 63 6f 6c 31  - 53 * cor0.col1
2f6a0 20 46 52 4f 4d 20 74 61 62 32 2c 20 74 61 62 30   FROM tab2, tab0
2f6b0 2c 20 74 61 62 30 20 41 53 20 63 6f 72 30 2c 20  , tab0 AS cor0, 
2f6c0 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 38 31 20 76  tab1..----..81 v
2f6d0 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f  alues hashing to
2f6e0 20 30 63 66 37 39 61 38 33 37 63 63 66 34 30 38   0cf79a837ccf408
2f6f0 66 39 31 32 31 31 34 32 34 35 33 34 34 64 34 36  f912114245344d46
2f700 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  4....query I row
2f710 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
2f720 54 49 4e 43 54 20 2b 20 34 34 20 2a 20 63 6f 6c  TINCT + 44 * col
2f730 30 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  0 AS col0 FROM t
2f740 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
2f750 2d 0d 0a 31 33 32 0d 0a 32 38 31 36 0d 0a 33 35  -..132..2816..35
2f760 32 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  20....onlyif mys
2f770 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65  ql # use DIV ope
2f780 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65  rator for intege
2f790 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72  r division..quer
2f7a0 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
2f7b0 6c 2d 31 33 37 33 0d 0a 53 45 4c 45 43 54 20 63  l-1373..SELECT c
2f7c0 6f 6c 32 20 2b 20 63 6f 6c 30 20 44 49 56 20 63  ol2 + col0 DIV c
2f7d0 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol0 FROM tab1 AS
2f7e0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 35 35 0d   cor0..----..55.
2f7f0 0a 35 38 0d 0a 39 37 0d 0a 0d 0a 73 6b 69 70 69  .58..97....skipi
2f800 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
2f810 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
2f820 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
2f830 31 33 37 33 0d 0a 53 45 4c 45 43 54 20 63 6f 6c  1373..SELECT col
2f840 32 20 2b 20 63 6f 6c 30 20 2f 20 63 6f 6c 30 20  2 + col0 / col0 
2f850 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
2f860 30 0d 0a 2d 2d 2d 2d 0d 0a 35 35 0d 0a 35 38 0d  0..----..55..58.
2f870 0a 39 37 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f  .97....skipif po
2f880 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67  stgresql # Postg
2f890 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41  reSQL requires A
2f8a0 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20  S when renaming 
2f8b0 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a  output columns..
2f8c0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
2f8d0 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f  .SELECT ALL - co
2f8e0 6c 32 20 2b 20 39 35 20 63 6f 6c 32 20 46 52 4f  l2 + 95 col2 FRO
2f8f0 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab1 cor0..---
2f900 2d 0d 0a 2d 31 0d 0a 33 38 0d 0a 34 31 0d 0a 0d  -..-1..38..41...
2f910 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2f920 0d 0a 53 45 4c 45 43 54 20 2b 20 28 20 63 6f 6c  ..SELECT + ( col
2f930 32 20 29 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f  2 ) + col0 AS co
2f940 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l2 FROM tab0 AS 
2f950 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 37 31 0d  cor0..----..171.
2f960 0a 33 36 0d 0a 35 37 0d 0a 0d 0a 71 75 65 72 79  .36..57....query
2f970 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
2f980 43 54 20 41 4c 4c 20 2b 20 31 37 20 2a 20 2b 20  CT ALL + 17 * + 
2f990 39 35 20 2a 20 63 6f 72 30 2e 63 6f 6c 32 20 2b  95 * cor0.col2 +
2f9a0 20 2d 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62   - col0 FROM tab
2f9b0 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
2f9c0 0a 31 35 34 39 36 30 0d 0a 38 37 32 30 37 0d 0a  .154960..87207..
2f9d0 39 31 39 39 31 0d 0a 0d 0a 71 75 65 72 79 20 49  91991....query I
2f9e0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
2f9f0 20 2d 20 63 6f 6c 31 20 2d 20 2b 20 36 37 20 41   - col1 - + 67 A
2fa00 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30  S col0 FROM tab0
2fa10 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 35 33 0d 0a 2d 31  ..----..-153..-1
2fa20 35 38 0d 0a 2d 31 36 34 0d 0a 0d 0a 71 75 65 72  58..-164....quer
2fa30 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
2fa40 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 33  ECT DISTINCT + 3
2fa50 34 20 46 52 4f 4d 20 74 61 62 32 2c 20 74 61 62  4 FROM tab2, tab
2fa60 32 20 41 53 20 63 6f 72 30 2c 20 74 61 62 30 20  2 AS cor0, tab0 
2fa70 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 33  AS cor1..----..3
2fa80 34 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  4....onlyif mysq
2fa90 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20  l # support for 
2faa0 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63 20 73  MySQL specific s
2fab0 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20  ystem types and 
2fac0 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20  syntax..query I 
2fad0 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 33  rowsort label-13
2fae0 37 39 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  79..SELECT DISTI
2faf0 4e 43 54 20 63 6f 6c 31 20 2b 20 43 41 53 54 28  NCT col1 + CAST(
2fb00 20 2d 20 63 6f 6c 32 20 41 53 20 53 49 47 4e 45   - col2 AS SIGNE
2fb10 44 20 29 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61  D ) col2 FROM ta
2fb20 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
2fb30 0d 0a 2d 32 31 0d 0a 33 33 0d 0a 34 0d 0a 0d 0a  ..-21..33..4....
2fb40 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71  skipif postgresq
2fb50 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72  l # PostgreSQL r
2fb60 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20  equires AS when 
2fb70 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20  renaming output 
2fb80 63 6f 6c 75 6d 6e 73 0d 0a 73 6b 69 70 69 66 20  columns..skipif 
2fb90 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
2fba0 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
2fbb0 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 33  rowsort label-13
2fbc0 37 39 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  79..SELECT DISTI
2fbd0 4e 43 54 20 63 6f 6c 31 20 2b 20 43 41 53 54 20  NCT col1 + CAST 
2fbe0 28 20 2d 20 63 6f 6c 32 20 41 53 20 49 4e 54 45  ( - col2 AS INTE
2fbf0 47 45 52 20 29 20 63 6f 6c 32 20 46 52 4f 4d 20  GER ) col2 FROM 
2fc00 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
2fc10 2d 2d 0d 0a 2d 32 31 0d 0a 33 33 0d 0a 34 0d 0a  --..-21..33..4..
2fc20 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2fc30 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20  t..SELECT ALL + 
2fc40 63 6f 6c 31 20 2a 20 33 30 20 2b 20 2b 20 63 6f  col1 * 30 + + co
2fc50 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l2 FROM tab0 AS 
2fc60 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 36 31 33  cor0..----..2613
2fc70 0d 0a 32 38 31 32 0d 0a 32 39 31 31 0d 0a 0d 0a  ..2812..2911....
2fc80 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
2fc90 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
2fca0 20 2d 20 35 20 41 53 20 63 6f 6c 30 20 46 52 4f   - 5 AS col0 FRO
2fcb0 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 35  M tab2..----..-5
2fcc0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
2fcd0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 32 20 2a 20  ort..SELECT 2 * 
2fce0 63 6f 72 31 2e 63 6f 6c 31 20 41 53 20 63 6f 6c  cor1.col1 AS col
2fcf0 31 20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30  1 FROM tab1 cor0
2fd00 20 43 52 4f 53 53 20 4a 4f 49 4e 20 74 61 62 30   CROSS JOIN tab0
2fd10 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a   AS cor1..----..
2fd20 39 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67  9 values hashing
2fd30 20 74 6f 20 65 32 30 35 63 36 30 62 30 38 30 36   to e205c60b0806
2fd40 32 35 36 65 31 35 65 63 62 36 61 31 31 35 61 34  256e15ecb6a115a4
2fd50 32 39 62 33 0d 0a 0d 0a 73 6b 69 70 69 66 20 70  29b3....skipif p
2fd60 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74  ostgresql # Post
2fd70 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20  greSQL requires 
2fd80 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67  AS when renaming
2fd90 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d   output columns.
2fda0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2fdb0 0d 0a 53 45 4c 45 43 54 20 74 61 62 31 2e 63 6f  ..SELECT tab1.co
2fdc0 6c 31 20 2a 20 2b 20 39 36 20 63 6f 6c 32 20 46  l1 * + 96 col2 F
2fdd0 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab1..----..
2fde0 31 32 34 38 0d 0a 32 34 39 36 0d 0a 39 36 30 0d  1248..2496..960.
2fdf0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
2fe00 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
2fe10 4e 43 54 20 2b 20 63 6f 6c 31 20 2b 20 2b 20 63  NCT + col1 + + c
2fe20 6f 6c 30 20 2d 20 2b 20 37 32 20 2a 20 63 6f 6c  ol0 - + 72 * col
2fe30 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  2 AS col2 FROM t
2fe40 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 37 33 35  ab2..----..-1735
2fe50 0d 0a 2d 31 39 30 36 0d 0a 2d 32 36 34 30 0d 0a  ..-1906..-2640..
2fe60 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
2fe70 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f   use DIV operato
2fe80 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69  r for integer di
2fe90 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20  vision..query I 
2fea0 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 33  rowsort label-13
2feb0 38 35 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c  85..SELECT - col
2fec0 31 20 2b 20 74 61 62 30 2e 63 6f 6c 30 20 2b 20  1 + tab0.col0 + 
2fed0 38 39 20 44 49 56 20 63 6f 6c 32 20 46 52 4f 4d  89 DIV col2 FROM
2fee0 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d   tab0..----..-1.
2fef0 0a 2d 36 30 0d 0a 32 37 0d 0a 0d 0a 73 6b 69 70  .-60..27....skip
2ff00 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
2ff10 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
2ff20 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
2ff30 2d 31 33 38 35 0d 0a 53 45 4c 45 43 54 20 2d 20  -1385..SELECT - 
2ff40 63 6f 6c 31 20 2b 20 74 61 62 30 2e 63 6f 6c 30  col1 + tab0.col0
2ff50 20 2b 20 38 39 20 2f 20 63 6f 6c 32 20 46 52 4f   + 89 / col2 FRO
2ff60 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  M tab0..----..-1
2ff70 0d 0a 2d 36 30 0d 0a 32 37 0d 0a 0d 0a 71 75 65  ..-60..27....que
2ff80 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
2ff90 4c 45 43 54 20 2b 20 63 6f 6c 31 20 2b 20 2b 20  LECT + col1 + + 
2ffa0 36 30 20 2b 20 74 61 62 32 2e 63 6f 6c 31 20 2a  60 + tab2.col1 *
2ffb0 20 2d 20 74 61 62 32 2e 63 6f 6c 32 20 2a 20 2b   - tab2.col2 * +
2ffc0 20 28 20 63 6f 6c 31 20 29 20 46 52 4f 4d 20 74   ( col1 ) FROM t
2ffd0 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 39 30  ab2..----..-1090
2ffe0 35 0d 0a 2d 32 35 38 35 36 0d 0a 2d 39 30 33 38  5..-25856..-9038
2fff0 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  7....query I row
30000 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
30010 54 49 4e 43 54 20 2b 20 34 38 20 41 53 20 63 6f  TINCT + 48 AS co
30020 6c 30 20 46 52 4f 4d 20 74 61 62 30 2c 20 74 61  l0 FROM tab0, ta
30030 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
30040 0d 0a 34 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..48....query I 
30050 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
30060 2d 20 63 6f 72 32 2e 63 6f 6c 30 20 41 53 20 63  - cor2.col0 AS c
30070 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 2c 20 74  ol0 FROM tab1, t
30080 61 62 30 20 41 53 20 63 6f 72 30 2c 20 74 61 62  ab0 AS cor0, tab
30090 32 20 41 53 20 63 6f 72 31 2c 20 74 61 62 31 20  2 AS cor1, tab1 
300a0 41 53 20 63 6f 72 32 0d 0a 2d 2d 2d 2d 0d 0a 38  AS cor2..----..8
300b0 31 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67  1 values hashing
300c0 20 74 6f 20 30 38 65 33 38 30 65 35 30 62 30 63   to 08e380e50b0c
300d0 62 36 34 36 30 31 62 63 38 34 65 35 32 35 34 64  b64601bc84e5254d
300e0 65 65 66 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20  eef4....query I 
300f0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
30100 2d 20 63 6f 6c 31 20 2a 20 2b 20 36 20 2b 20 63  - col1 * + 6 + c
30110 6f 6c 30 20 2b 20 2d 20 63 6f 6c 32 20 2a 20 2b  ol0 + - col2 * +
30120 20 63 6f 6c 31 20 2a 20 34 37 20 46 52 4f 4d 20   col1 * 47 FROM 
30130 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab0 cor0..----.
30140 0a 2d 31 33 33 38 37 38 0d 0a 2d 33 35 31 31 37  .-133878..-35117
30150 31 0d 0a 2d 35 31 30 36 0d 0a 0d 0a 6f 6e 6c 79  1..-5106....only
30160 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44  if mysql # use D
30170 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20  IV operator for 
30180 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e  integer division
30190 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
301a0 74 20 6c 61 62 65 6c 2d 31 33 39 30 0d 0a 53 45  t label-1390..SE
301b0 4c 45 43 54 20 2d 20 63 6f 6c 30 20 2a 20 2b 20  LECT - col0 * + 
301c0 63 6f 6c 30 20 2b 20 63 6f 6c 32 20 44 49 56 20  col0 + col2 DIV 
301d0 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41  col1 FROM tab2 A
301e0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 34  S cor0..----..-4
301f0 39 0d 0a 2d 36 30 38 34 0d 0a 2d 36 32 33 39 0d  9..-6084..-6239.
30200 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
30210 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
30220 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
30230 74 20 6c 61 62 65 6c 2d 31 33 39 30 0d 0a 53 45  t label-1390..SE
30240 4c 45 43 54 20 2d 20 63 6f 6c 30 20 2a 20 2b 20  LECT - col0 * + 
30250 63 6f 6c 30 20 2b 20 63 6f 6c 32 20 2f 20 63 6f  col0 + col2 / co
30260 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l1 FROM tab2 AS 
30270 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 39 0d  cor0..----..-49.
30280 0a 2d 36 30 38 34 0d 0a 2d 36 32 33 39 0d 0a 0d  .-6084..-6239...
30290 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
302a0 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63  ..SELECT ALL + c
302b0 6f 6c 31 20 2b 20 2b 20 32 30 20 2a 20 2d 20 31  ol1 + + 20 * - 1
302c0 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d   FROM tab2..----
302d0 0d 0a 2d 33 0d 0a 31 31 0d 0a 33 39 0d 0a 0d 0a  ..-3..11..39....
302e0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
302f0 0a 53 45 4c 45 43 54 20 2b 20 2d 20 63 6f 6c 31  .SELECT + - col1
30300 20 2a 20 2b 20 36 32 20 2b 20 2d 20 63 6f 72 30   * + 62 + - cor0
30310 2e 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20  .col2 FROM tab0 
30320 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 33 36  cor0..----..-536
30330 35 0d 0a 2d 35 37 32 34 0d 0a 2d 36 30 31 35 0d  5..-5724..-6015.
30340 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
30350 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79  # support for My
30360 53 51 4c 20 73 70 65 63 69 66 69 63 20 73 79 73  SQL specific sys
30370 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79  tem types and sy
30380 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f  ntax..query I ro
30390 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 33 39 33  wsort label-1393
303a0 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 43 41 53  ..SELECT ALL CAS
303b0 54 28 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 41  T( - cor0.col2 A
303c0 53 20 53 49 47 4e 45 44 20 29 20 46 52 4f 4d 20  S SIGNED ) FROM 
303d0 74 61 62 30 2c 20 74 61 62 32 20 41 53 20 63 6f  tab0, tab2 AS co
303e0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75  r0..----..9 valu
303f0 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 37 62  es hashing to 7b
30400 35 39 33 38 31 32 34 32 35 33 37 39 38 34 32 36  5938124253798426
30410 66 62 66 30 39 63 31 38 65 31 66 64 37 35 0d 0a  fbf09c18e1fd75..
30420 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
30430 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
30440 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
30450 20 6c 61 62 65 6c 2d 31 33 39 33 0d 0a 53 45 4c   label-1393..SEL
30460 45 43 54 20 41 4c 4c 20 43 41 53 54 20 28 20 2d  ECT ALL CAST ( -
30470 20 63 6f 72 30 2e 63 6f 6c 32 20 41 53 20 49 4e   cor0.col2 AS IN
30480 54 45 47 45 52 20 29 20 46 52 4f 4d 20 74 61 62  TEGER ) FROM tab
30490 30 2c 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  0, tab2 AS cor0.
304a0 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20  .----..9 values 
304b0 68 61 73 68 69 6e 67 20 74 6f 20 37 62 35 39 33  hashing to 7b593
304c0 38 31 32 34 32 35 33 37 39 38 34 32 36 66 62 66  8124253798426fbf
304d0 30 39 63 31 38 65 31 66 64 37 35 0d 0a 0d 0a 71  09c18e1fd75....q
304e0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
304f0 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
30500 63 6f 6c 32 20 2b 20 2d 20 32 33 20 41 53 20 63  col2 + - 23 AS c
30510 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol1 FROM tab1 AS
30520 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 31 0d   cor0..----..31.
30530 0a 33 34 0d 0a 37 33 0d 0a 0d 0a 71 75 65 72 79  .34..73....query
30540 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
30550 43 54 20 41 4c 4c 20 2d 20 39 20 46 52 4f 4d 20  CT ALL - 9 FROM 
30560 74 61 62 31 2c 20 74 61 62 31 20 63 6f 72 30 0d  tab1, tab1 cor0.
30570 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20  .----..9 values 
30580 68 61 73 68 69 6e 67 20 74 6f 20 63 61 66 32 38  hashing to caf28
30590 36 35 37 62 65 62 34 33 30 34 39 37 34 30 66 65  657beb43049740fe
305a0 62 65 31 66 61 39 64 65 64 35 61 0d 0a 0d 0a 71  be1fa9ded5a....q
305b0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
305c0 53 45 4c 45 43 54 20 41 4c 4c 20 32 37 20 41 53  SELECT ALL 27 AS
305d0 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 2c   col0 FROM tab2,
305e0 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
305f0 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61  ---..9 values ha
30600 73 68 69 6e 67 20 74 6f 20 37 30 31 62 66 31 32  shing to 701bf12
30610 64 38 36 33 39 32 63 62 31 35 38 35 64 39 65 34  d86392cb1585d9e4
30620 66 33 63 37 32 65 39 61 38 0d 0a 0d 0a 71 75 65  f3c72e9a8....que
30630 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
30640 4c 45 43 54 20 2b 20 63 6f 72 32 2e 63 6f 6c 30  LECT + cor2.col0
30650 20 46 52 4f 4d 20 74 61 62 31 2c 20 74 61 62 30   FROM tab1, tab0
30660 20 41 53 20 63 6f 72 30 2c 20 74 61 62 31 20 63   AS cor0, tab1 c
30670 6f 72 31 2c 20 74 61 62 30 20 41 53 20 63 6f 72  or1, tab0 AS cor
30680 32 0d 0a 2d 2d 2d 2d 0d 0a 38 31 20 76 61 6c 75  2..----..81 valu
30690 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 32 33  es hashing to 23
306a0 30 34 66 63 63 31 34 30 65 39 35 35 65 62 32 64  04fcc140e955eb2d
306b0 31 65 65 32 38 61 62 31 65 65 61 39 39 34 0d 0a  1ee28ab1eea994..
306c0 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
306d0 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53   support for MyS
306e0 51 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74  QL specific syst
306f0 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e  em types and syn
30700 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  tax..query I row
30710 73 6f 72 74 20 6c 61 62 65 6c 2d 31 33 39 38 0d  sort label-1398.
30720 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
30730 20 2b 20 43 41 53 54 28 20 63 6f 6c 30 20 41 53   + CAST( col0 AS
30740 20 53 49 47 4e 45 44 20 29 20 41 53 20 63 6f 6c   SIGNED ) AS col
30750 32 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d  2 FROM tab0..---
30760 2d 0d 0a 32 34 0d 0a 33 35 0d 0a 38 39 0d 0a 0d  -..24..35..89...
30770 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
30780 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
30790 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
307a0 6c 61 62 65 6c 2d 31 33 39 38 0d 0a 53 45 4c 45  label-1398..SELE
307b0 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 43 41  CT DISTINCT + CA
307c0 53 54 20 28 20 63 6f 6c 30 20 41 53 20 49 4e 54  ST ( col0 AS INT
307d0 45 47 45 52 20 29 20 41 53 20 63 6f 6c 32 20 46  EGER ) AS col2 F
307e0 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab0..----..
307f0 32 34 0d 0a 33 35 0d 0a 38 39 0d 0a 0d 0a 71 75  24..35..89....qu
30800 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
30810 45 4c 45 43 54 20 2d 20 28 20 32 35 20 29 20 46  ELECT - ( 25 ) F
30820 52 4f 4d 20 74 61 62 32 2c 20 74 61 62 30 2c 20  ROM tab2, tab0, 
30830 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
30840 2d 2d 0d 0a 32 37 20 76 61 6c 75 65 73 20 68 61  --..27 values ha
30850 73 68 69 6e 67 20 74 6f 20 32 65 37 61 33 33 34  shing to 2e7a334
30860 36 37 65 65 33 61 34 64 39 35 37 30 35 36 30 64  67ee3a4d9570560d
30870 36 30 33 30 32 62 33 35 61 0d 0a 0d 0a 6f 6e 6c  60302b35a....onl
30880 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20  yif mysql # use 
30890 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72  DIV operator for
308a0 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f   integer divisio
308b0 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  n..query I rowso
308c0 72 74 20 6c 61 62 65 6c 2d 31 34 30 30 0d 0a 53  rt label-1400..S
308d0 45 4c 45 43 54 20 63 6f 6c 32 20 44 49 56 20 2d  ELECT col2 DIV -
308e0 20 28 20 63 6f 6c 31 20 29 20 41 53 20 63 6f 6c   ( col1 ) AS col
308f0 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d  0 FROM tab0..---
30900 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a 73 6b  -..0..0..0....sk
30910 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
30920 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
30930 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
30940 65 6c 2d 31 34 30 30 0d 0a 53 45 4c 45 43 54 20  el-1400..SELECT 
30950 63 6f 6c 32 20 2f 20 2d 20 28 20 63 6f 6c 31 20  col2 / - ( col1 
30960 29 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  ) AS col0 FROM t
30970 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d  ab0..----..0..0.
30980 0a 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  .0....query I ro
30990 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
309a0 28 20 74 61 62 30 2e 63 6f 6c 31 20 29 20 41 53  ( tab0.col1 ) AS
309b0 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d   col0 FROM tab0.
309c0 0a 2d 2d 2d 2d 0d 0a 2d 38 36 0d 0a 2d 39 31 0d  .----..-86..-91.
309d0 0a 2d 39 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .-97....query I 
309e0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
309f0 33 31 20 2a 20 63 6f 6c 31 20 2b 20 2b 20 63 6f  31 * col1 + + co
30a00 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l2 FROM tab2 AS 
30a10 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 38 35 35  cor0..----..1855
30a20 0d 0a 35 36 35 0d 0a 39 38 38 0d 0a 0d 0a 71 75  ..565..988....qu
30a30 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
30a40 45 4c 45 43 54 20 2d 20 28 20 2b 20 63 6f 6c 30  ELECT - ( + col0
30a50 20 29 20 2a 20 2b 20 63 6f 6c 32 20 2b 20 2b 20   ) * + col2 + + 
30a60 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41  col1 FROM tab2 A
30a70 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
30a80 35 38 0d 0a 2d 31 39 36 39 0d 0a 2d 32 39 38 35  58..-1969..-2985
30a90 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
30aa0 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61   # use DIV opera
30ab0 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20  tor for integer 
30ac0 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20  division..query 
30ad0 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
30ae0 31 34 30 34 0d 0a 53 45 4c 45 43 54 20 44 49 53  1404..SELECT DIS
30af0 54 49 4e 43 54 20 2d 20 63 6f 6c 31 20 44 49 56  TINCT - col1 DIV
30b00 20 2b 20 63 6f 6c 32 20 2b 20 2b 20 63 6f 6c 31   + col2 + + col1
30b10 20 2b 20 2b 20 63 6f 6c 32 20 46 52 4f 4d 20 74   + + col2 FROM t
30b20 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
30b30 2d 0d 0a 31 0d 0a 31 31 37 0d 0a 31 37 32 0d 0a  -..1..117..172..
30b40 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
30b50 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
30b60 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
30b70 20 6c 61 62 65 6c 2d 31 34 30 34 0d 0a 53 45 4c   label-1404..SEL
30b80 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63  ECT DISTINCT - c
30b90 6f 6c 31 20 2f 20 2b 20 63 6f 6c 32 20 2b 20 2b  ol1 / + col2 + +
30ba0 20 63 6f 6c 31 20 2b 20 2b 20 63 6f 6c 32 20 46   col1 + + col2 F
30bb0 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
30bc0 0d 0a 2d 2d 2d 2d 0d 0a 31 0d 0a 31 31 37 0d 0a  ..----..1..117..
30bd0 31 37 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  172....query I r
30be0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
30bf0 49 53 54 49 4e 43 54 20 63 6f 6c 30 20 2a 20 63  ISTINCT col0 * c
30c00 6f 6c 30 20 2d 20 2d 20 63 6f 6c 32 20 41 53 20  ol0 - - col2 AS 
30c10 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41  col2 FROM tab2 A
30c20 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 36 31  S cor0..----..61
30c30 31 30 0d 0a 36 32 37 39 0d 0a 37 36 0d 0a 0d 0a  10..6279..76....
30c40 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
30c50 0a 53 45 4c 45 43 54 20 63 6f 6c 32 20 2a 20 38  .SELECT col2 * 8
30c60 31 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30  1 + col0 AS col0
30c70 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
30c80 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 36 0d 0a 32  r0..----..116..2
30c90 36 39 37 0d 0a 36 37 33 31 0d 0a 0d 0a 71 75 65  697..6731....que
30ca0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
30cb0 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 34 30  LECT DISTINCT 40
30cc0 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62   + col1 FROM tab
30cd0 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
30ce0 0a 35 30 0d 0a 35 33 0d 0a 36 36 0d 0a 0d 0a 71  .50..53..66....q
30cf0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
30d00 53 45 4c 45 43 54 20 34 31 20 2d 20 2d 20 63 6f  SELECT 41 - - co
30d10 72 30 2e 63 6f 6c 31 20 2a 20 63 6f 72 30 2e 63  r0.col1 * cor0.c
30d20 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 2c 20 74  ol1 FROM tab1, t
30d30 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab1 cor0..----..
30d40 39 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67  9 values hashing
30d50 20 74 6f 20 30 33 37 35 37 33 62 34 62 35 35 64   to 037573b4b55d
30d60 31 30 34 31 34 63 39 37 37 33 63 63 35 39 63 33  10414c9773cc59c3
30d70 38 63 65 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20  8ce5....query I 
30d80 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
30d90 41 4c 4c 20 2d 20 2b 20 31 36 20 41 53 20 63 6f  ALL - + 16 AS co
30da0 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l1 FROM tab2 AS 
30db0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 36 0d  cor0..----..-16.
30dc0 0a 2d 31 36 0d 0a 2d 31 36 0d 0a 0d 0a 71 75 65  .-16..-16....que
30dd0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
30de0 4c 45 43 54 20 74 61 62 31 2e 63 6f 6c 31 20 2b  LECT tab1.col1 +
30df0 20 2d 20 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c 32   - col0 * + col2
30e00 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
30e10 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 36 0d 0a  b1..----..-136..
30e20 2d 33 36 33 38 0d 0a 2d 37 36 36 37 0d 0a 0d 0a  -3638..-7667....
30e30 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
30e40 0a 53 45 4c 45 43 54 20 74 61 62 31 2e 63 6f 6c  .SELECT tab1.col
30e50 31 20 2a 20 2d 20 63 6f 72 30 2e 63 6f 6c 31 20  1 * - cor0.col1 
30e60 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
30e70 31 2c 20 74 61 62 30 2c 20 74 61 62 30 20 63 6f  1, tab0, tab0 co
30e80 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c  r0..----..27 val
30e90 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 61  ues hashing to a
30ea0 36 61 37 61 36 61 34 37 61 66 66 30 65 38 65 64  6a7a6a47aff0e8ed
30eb0 30 65 35 64 35 65 37 38 63 64 34 30 39 32 62 0d  0e5d5e78cd4092b.
30ec0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
30ed0 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c  rt..SELECT + col
30ee0 30 20 2a 20 2d 20 63 6f 6c 30 20 2a 20 63 6f 72  0 * - col0 * cor
30ef0 30 2e 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31  0.col1 FROM tab1
30f00 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
30f10 2d 32 33 34 0d 0a 2d 34 30 39 36 30 0d 0a 2d 38  -234..-40960..-8
30f20 33 32 30 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20  3200....query I 
30f30 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
30f40 2d 20 63 6f 6c 30 20 2b 20 74 61 62 31 2e 63 6f  - col0 + tab1.co
30f50 6c 30 20 2a 20 2b 20 32 33 20 46 52 4f 4d 20 74  l0 * + 23 FROM t
30f60 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 34 30 38 0d  ab1..----..1408.
30f70 0a 31 37 36 30 0d 0a 36 36 0d 0a 0d 0a 71 75 65  .1760..66....que
30f80 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
30f90 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20  LECT DISTINCT - 
30fa0 34 38 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d  48 FROM tab0..--
30fb0 2d 2d 0d 0a 2d 34 38 0d 0a 0d 0a 71 75 65 72 79  --..-48....query
30fc0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
30fd0 43 54 20 2b 20 32 37 20 2b 20 2b 20 63 6f 6c 32  CT + 27 + + col2
30fe0 20 2a 20 63 6f 72 30 2e 63 6f 6c 30 20 46 52 4f   * cor0.col0 FRO
30ff0 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
31000 2d 2d 2d 2d 0d 0a 32 30 35 35 0d 0a 32 31 36 0d  ----..2055..216.
31010 0a 33 30 32 39 0d 0a 0d 0a 71 75 65 72 79 20 49  .3029....query I
31020 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
31030 20 41 4c 4c 20 2d 20 34 30 20 2a 20 63 6f 6c 32   ALL - 40 * col2
31040 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
31050 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 31 36 30 0d  r0..----..-2160.
31060 0a 2d 32 32 38 30 0d 0a 2d 33 38 34 30 0d 0a 0d  .-2280..-3840...
31070 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
31080 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 2b  ..SELECT ALL + +
31090 20 63 6f 6c 32 20 2a 20 2d 20 63 6f 72 30 2e 63   col2 * - cor0.c
310a0 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  ol1 AS col1 FROM
310b0 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
310c0 2d 2d 2d 0d 0a 2d 31 32 34 38 0d 0a 2d 31 34 30  ---..-1248..-140
310d0 34 0d 0a 2d 35 37 30 0d 0a 0d 0a 71 75 65 72 79  4..-570....query
310e0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
310f0 43 54 20 41 4c 4c 20 28 20 2d 20 63 6f 6c 30 20  CT ALL ( - col0 
31100 29 20 2a 20 2b 20 63 6f 6c 31 20 2b 20 2b 20 63  ) * + col1 + + c
31110 6f 6c 32 20 2a 20 2b 20 63 6f 6c 30 20 41 53 20  ol2 * + col0 AS 
31120 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41  col1 FROM tab2 A
31130 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32  S cor0..----..-2
31140 35 37 34 0d 0a 2d 32 38 0d 0a 31 36 35 39 0d 0a  574..-28..1659..
31150 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
31160 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 31  t..SELECT - col1
31170 20 2a 20 2b 20 36 34 20 41 53 20 63 6f 6c 31 20   * + 64 AS col1 
31180 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
31190 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 38 38 0d 0a  0..----..-1088..
311a0 2d 31 39 38 34 0d 0a 2d 33 37 37 36 0d 0a 0d 0a  -1984..-3776....
311b0 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71  skipif postgresq
311c0 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72  l # PostgreSQL r
311d0 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20  equires AS when 
311e0 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20  renaming output 
311f0 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49  columns..query I
31200 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
31210 20 2b 20 2d 20 63 6f 6c 32 20 2b 20 2d 20 39 38   + - col2 + - 98
31220 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20   col1 FROM tab2 
31230 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32 34  cor0..----..-124
31240 0d 0a 2d 31 32 35 0d 0a 2d 31 33 36 0d 0a 0d 0a  ..-125..-136....
31250 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73  onlyif mysql # s
31260 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c  upport for MySQL
31270 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d   specific system
31280 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61   types and synta
31290 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  x..query I rowso
312a0 72 74 20 6c 61 62 65 6c 2d 31 34 32 31 0d 0a 53  rt label-1421..S
312b0 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b  ELECT DISTINCT +
312c0 20 63 6f 72 30 2e 63 6f 6c 32 20 2b 20 43 41 53   cor0.col2 + CAS
312d0 54 28 20 4e 55 4c 4c 20 41 53 20 53 49 47 4e 45  T( NULL AS SIGNE
312e0 44 20 29 20 46 52 4f 4d 20 74 61 62 32 20 63 6f  D ) FROM tab2 co
312f0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a  r0..----..NULL..
31300 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
31310 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
31320 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
31330 20 6c 61 62 65 6c 2d 31 34 32 31 0d 0a 53 45 4c   label-1421..SEL
31340 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63  ECT DISTINCT + c
31350 6f 72 30 2e 63 6f 6c 32 20 2b 20 43 41 53 54 20  or0.col2 + CAST 
31360 28 20 4e 55 4c 4c 20 41 53 20 49 4e 54 45 47 45  ( NULL AS INTEGE
31370 52 20 29 20 46 52 4f 4d 20 74 61 62 32 20 63 6f  R ) FROM tab2 co
31380 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a  r0..----..NULL..
31390 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
313a0 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f  t..SELECT ALL co
313b0 72 30 2e 63 6f 6c 30 20 2d 20 2b 20 63 6f 6c 32  r0.col0 - + col2
313c0 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
313d0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 39 0d 0a 33 34  r0..----..-9..34
313e0 0d 0a 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  ..7....query I r
313f0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
31400 4c 4c 20 2d 20 2b 20 63 6f 6c 31 20 2d 20 63 6f  LL - + col1 - co
31410 6c 31 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  l1 AS col2 FROM 
31420 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
31430 2d 2d 0d 0a 2d 31 31 38 0d 0a 2d 33 34 0d 0a 2d  --..-118..-34..-
31440 36 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  62....query I ro
31450 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
31460 4c 20 2d 20 63 6f 6c 32 20 2a 20 63 6f 6c 30 20  L - col2 * col0 
31470 2d 20 2d 20 63 6f 6c 31 20 2a 20 63 6f 6c 30 20  - - col1 * col0 
31480 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
31490 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 37 32 0d 0a 33  0..----..1272..3
314a0 33 36 30 0d 0a 38 30 31 0d 0a 0d 0a 6f 6e 6c 79  360..801....only
314b0 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f  if mysql # suppo
314c0 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65  rt for MySQL spe
314d0 63 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70  cific system typ
314e0 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71  es and syntax..q
314f0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
31500 61 62 65 6c 2d 31 34 32 35 0d 0a 53 45 4c 45 43  abel-1425..SELEC
31510 54 20 41 4c 4c 20 2d 20 63 6f 72 30 2e 63 6f 6c  T ALL - cor0.col
31520 32 20 2a 20 2b 20 43 41 53 54 28 20 2b 20 63 6f  2 * + CAST( + co
31530 6c 31 20 41 53 20 53 49 47 4e 45 44 20 29 20 2a  l1 AS SIGNED ) *
31540 20 2d 20 63 6f 6c 32 20 2b 20 63 6f 6c 31 20 46   - col2 + col1 F
31550 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
31560 0d 0a 2d 2d 2d 2d 0d 0a 32 32 36 33 30 0d 0a 32  ..----..22630..2
31570 34 35 36 35 0d 0a 33 39 39 34 33 0d 0a 0d 0a 73  4565..39943....s
31580 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
31590 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
315a0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
315b0 62 65 6c 2d 31 34 32 35 0d 0a 53 45 4c 45 43 54  bel-1425..SELECT
315c0 20 41 4c 4c 20 2d 20 63 6f 72 30 2e 63 6f 6c 32   ALL - cor0.col2
315d0 20 2a 20 2b 20 43 41 53 54 20 28 20 2b 20 63 6f   * + CAST ( + co
315e0 6c 31 20 41 53 20 49 4e 54 45 47 45 52 20 29 20  l1 AS INTEGER ) 
315f0 2a 20 2d 20 63 6f 6c 32 20 2b 20 63 6f 6c 31 20  * - col2 + col1 
31600 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
31610 30 0d 0a 2d 2d 2d 2d 0d 0a 32 32 36 33 30 0d 0a  0..----..22630..
31620 32 34 35 36 35 0d 0a 33 39 39 34 33 0d 0a 0d 0a  24565..39943....
31630 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
31640 0a 53 45 4c 45 43 54 20 28 20 2d 20 63 6f 6c 30  .SELECT ( - col0
31650 20 29 20 2a 20 2d 20 34 39 20 2b 20 2b 20 63 6f   ) * - 49 + + co
31660 6c 32 20 2a 20 2b 20 63 6f 6c 30 20 41 53 20 63  l2 * + col0 AS c
31670 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d  ol1 FROM tab1..-
31680 2d 2d 2d 0d 0a 31 31 36 30 30 0d 0a 33 30 39 0d  ---..11600..309.
31690 0a 36 37 38 34 0d 0a 0d 0a 73 6b 69 70 69 66 20  .6784....skipif 
316a0 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73  postgresql # Pos
316b0 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73  tgreSQL requires
316c0 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e   AS when renamin
316d0 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73  g output columns
316e0 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
316f0 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
31700 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
31710 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 32 20  ..SELECT - col2 
31720 2a 20 63 6f 6c 31 20 2a 20 43 41 53 54 20 28 20  * col1 * CAST ( 
31730 2b 20 37 20 41 53 20 52 45 41 4c 20 29 20 2b 20  + 7 AS REAL ) + 
31740 2d 20 74 61 62 31 2e 63 6f 6c 32 20 63 6f 6c 30  - tab1.col2 col0
31750 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d   FROM tab1..----
31760 0d 0a 2d 34 30 34 37 0d 0a 2d 38 38 33 32 0d 0a  ..-4047..-8832..
31770 2d 39 38 38 32 0d 0a 0d 0a 71 75 65 72 79 20 49  -9882....query I
31780 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
31790 20 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c 32 20 2b   col0 * + col2 +
317a0 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 0d   col2 FROM tab1.
317b0 0a 2d 2d 2d 2d 0d 0a 32 31 36 0d 0a 33 37 30 35  .----..216..3705
317c0 0d 0a 37 37 37 36 0d 0a 0d 0a 71 75 65 72 79 20  ..7776....query 
317d0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
317e0 54 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 2a 20  T - cor0.col2 * 
317f0 2d 20 34 36 20 46 52 4f 4d 20 74 61 62 32 20 41  - 46 FROM tab2 A
31800 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31  S cor0..----..11
31810 39 36 0d 0a 31 32 34 32 0d 0a 31 37 34 38 0d 0a  96..1242..1748..
31820 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
31830 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20  t..SELECT ALL + 
31840 36 38 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d  68 FROM tab2..--
31850 2d 2d 0d 0a 36 38 0d 0a 36 38 0d 0a 36 38 0d 0a  --..68..68..68..
31860 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
31870 74 0d 0a 53 45 4c 45 43 54 20 32 37 20 2a 20 2b  t..SELECT 27 * +
31880 20 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46 52   col1 AS col2 FR
31890 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31  OM tab2..----..1
318a0 35 39 33 0d 0a 34 35 39 0d 0a 38 33 37 0d 0a 0d  593..459..837...
318b0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
318c0 0d 0a 53 45 4c 45 43 54 20 28 20 28 20 2b 20 63  ..SELECT ( ( + c
318d0 6f 6c 30 20 29 20 2a 20 2b 20 63 6f 6c 31 20 29  ol0 ) * + col1 )
318e0 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d   FROM tab1..----
318f0 0d 0a 31 30 34 30 0d 0a 36 34 30 0d 0a 37 38 0d  ..1040..640..78.
31900 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
31910 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
31920 4e 43 54 20 2d 20 31 35 20 41 53 20 63 6f 6c 30  NCT - 15 AS col0
31930 20 46 52 4f 4d 20 74 61 62 32 2c 20 74 61 62 32   FROM tab2, tab2
31940 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 35   cor0..----..-15
31950 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
31960 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
31970 2d 20 63 6f 6c 32 20 2a 20 30 20 46 52 4f 4d 20  - col2 * 0 FROM 
31980 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30  tab1..----..0..0
31990 0d 0a 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  ..0....query I r
319a0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63  owsort..SELECT c
319b0 6f 6c 30 20 2a 20 63 6f 6c 31 20 2a 20 2b 20 63  ol0 * col1 * + c
319c0 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  ol2 AS col1 FROM
319d0 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 33 33 39   tab0..----..339
319e0 35 0d 0a 36 36 34 31 31 38 0d 0a 36 38 31 31 32  5..664118..68112
319f0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
31a00 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
31a10 49 4e 43 54 20 33 36 20 2a 20 2b 20 37 30 20 46  INCT 36 * + 70 F
31a20 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
31a30 0d 0a 2d 2d 2d 2d 0d 0a 32 35 32 30 0d 0a 0d 0a  ..----..2520....
31a40 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
31a50 0a 53 45 4c 45 43 54 20 41 4c 4c 20 39 36 20 41  .SELECT ALL 96 A
31a60 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32  S col0 FROM tab2
31a70 2c 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d  , tab2 cor0..---
31a80 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68  -..9 values hash
31a90 69 6e 67 20 74 6f 20 32 32 63 35 31 34 31 61 36  ing to 22c5141a6
31aa0 32 39 66 30 65 66 33 39 36 37 33 38 65 65 32 63  29f0ef396738ee2c
31ab0 38 62 65 36 33 30 33 0d 0a 0d 0a 6f 6e 6c 79 69  8be6303....onlyi
31ac0 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49  f mysql # use DI
31ad0 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69  V operator for i
31ae0 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d  nteger division.
31af0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
31b00 20 6c 61 62 65 6c 2d 31 34 33 38 0d 0a 53 45 4c   label-1438..SEL
31b10 45 43 54 20 2d 20 2d 20 63 6f 6c 31 20 2a 20 63  ECT - - col1 * c
31b20 6f 6c 31 20 44 49 56 20 2d 20 63 6f 72 30 2e 63  ol1 DIV - cor0.c
31b30 6f 6c 31 20 2b 20 28 20 2b 20 35 35 20 2b 20 63  ol1 + ( + 55 + c
31b40 6f 6c 32 20 29 20 2a 20 39 37 20 46 52 4f 4d 20  ol2 ) * 97 FROM 
31b50 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
31b60 2d 2d 0d 0a 31 30 35 34 37 0d 0a 31 30 38 35 34  --..10547..10854
31b70 0d 0a 31 34 36 33 34 0d 0a 0d 0a 73 6b 69 70 69  ..14634....skipi
31b80 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
31b90 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
31ba0 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
31bb0 31 34 33 38 0d 0a 53 45 4c 45 43 54 20 2d 20 2d  1438..SELECT - -
31bc0 20 63 6f 6c 31 20 2a 20 63 6f 6c 31 20 2f 20 2d   col1 * col1 / -
31bd0 20 63 6f 72 30 2e 63 6f 6c 31 20 2b 20 28 20 2b   cor0.col1 + ( +
31be0 20 35 35 20 2b 20 63 6f 6c 32 20 29 20 2a 20 39   55 + col2 ) * 9
31bf0 37 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  7 FROM tab1 AS c
31c00 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 35 34 37  or0..----..10547
31c10 0d 0a 31 30 38 35 34 0d 0a 31 34 36 33 34 0d 0a  ..10854..14634..
31c20 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
31c30 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2b 20 39 33  t..SELECT + + 93
31c40 20 2b 20 37 39 20 2a 20 63 6f 6c 31 20 46 52 4f   + 79 * col1 FRO
31c50 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
31c60 2d 2d 2d 2d 0d 0a 36 38 38 37 0d 0a 37 32 38 32  ----..6887..7282
31c70 0d 0a 37 37 35 36 0d 0a 0d 0a 71 75 65 72 79 20  ..7756....query 
31c80 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
31c90 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 31 20  T DISTINCT col1 
31ca0 2b 20 2d 20 63 6f 6c 32 20 2d 20 2d 20 63 6f 6c  + - col2 - - col
31cb0 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  0 AS col2 FROM t
31cc0 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
31cd0 2d 0d 0a 2d 32 35 0d 0a 2d 33 0d 0a 31 37 0d 0a  -..-25..-3..17..
31ce0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
31cf0 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2b 20 63 6f  t..SELECT + + co
31d00 6c 32 20 2a 20 63 6f 6c 31 20 2a 20 63 6f 6c 30  l2 * col1 * col0
31d10 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
31d20 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 39 36 35 32  r0..----..119652
31d30 0d 0a 35 31 30 33 34 0d 0a 35 38 35 39 0d 0a 0d  ..51034..5859...
31d40 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
31d50 0d 0a 53 45 4c 45 43 54 20 28 20 2d 20 63 6f 6c  ..SELECT ( - col
31d60 30 20 29 20 2a 20 28 20 2b 20 63 6f 6c 30 20 29  0 ) * ( + col0 )
31d70 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
31d80 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
31d90 0d 0a 2d 34 30 39 36 0d 0a 2d 36 34 30 30 0d 0a  ..-4096..-6400..
31da0 2d 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  -9....query I ro
31db0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 34 38  wsort..SELECT 48
31dc0 20 2a 20 63 6f 6c 31 20 2a 20 63 6f 6c 31 20 41   * col1 * col1 A
31dd0 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32  S col1 FROM tab2
31de0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
31df0 31 33 38 37 32 0d 0a 31 36 37 30 38 38 0d 0a 34  13872..167088..4
31e00 36 31 32 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20  6128....query I 
31e10 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
31e20 2b 20 35 37 20 46 52 4f 4d 20 74 61 62 31 2c 20  + 57 FROM tab1, 
31e30 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
31e40 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73  --..9 values has
31e50 68 69 6e 67 20 74 6f 20 36 31 64 61 37 30 63 36  hing to 61da70c6
31e60 32 34 61 64 36 30 36 30 34 61 36 36 38 66 37 66  24ad60604a668f7f
31e70 38 66 32 39 33 39 32 61 0d 0a 0d 0a 71 75 65 72  8f29392a....quer
31e80 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
31e90 45 43 54 20 63 6f 6c 32 20 2a 20 2d 20 36 34 20  ECT col2 * - 64 
31ea0 2a 20 2d 20 63 6f 6c 31 20 41 53 20 63 6f 6c 31  * - col1 AS col1
31eb0 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d   FROM tab1..----
31ec0 0d 0a 33 36 34 38 30 0d 0a 37 39 38 37 32 0d 0a  ..36480..79872..
31ed0 38 39 38 35 36 0d 0a 0d 0a 71 75 65 72 79 20 49  89856....query I
31ee0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
31ef0 20 44 49 53 54 49 4e 43 54 20 2b 20 2b 20 63 6f   DISTINCT + + co
31f00 6c 30 20 2b 20 2b 20 63 6f 72 30 2e 63 6f 6c 31  l0 + + cor0.col1
31f10 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
31f20 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
31f30 0d 0a 31 31 30 0d 0a 31 33 32 0d 0a 31 38 30 0d  ..110..132..180.
31f40 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
31f50 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2d 20 63  rt..SELECT + - c
31f60 6f 6c 32 20 2b 20 2b 20 39 20 46 52 4f 4d 20 74  ol2 + + 9 FROM t
31f70 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
31f80 2d 0d 0a 2d 34 35 0d 0a 2d 34 38 0d 0a 2d 38 37  -..-45..-48..-87
31f90 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
31fa0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
31fb0 49 4e 43 54 20 63 6f 6c 30 20 2a 20 2b 20 33 30  INCT col0 * + 30
31fc0 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62   + col0 FROM tab
31fd0 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
31fe0 0a 31 39 38 34 0d 0a 32 34 38 30 0d 0a 39 33 0d  .1984..2480..93.
31ff0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
32000 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2d 20 63  rt..SELECT + - c
32010 6f 6c 30 20 2a 20 28 20 63 6f 6c 31 20 29 20 2b  ol0 * ( col1 ) +
32020 20 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46 52   col2 AS col1 FR
32030 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d  OM tab0 cor0..--
32040 2d 2d 0d 0a 2d 32 30 33 31 0d 0a 2d 33 33 39 34  --..-2031..-3394
32050 0d 0a 2d 38 30 31 37 0d 0a 0d 0a 73 6b 69 70 69  ..-8017....skipi
32060 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50  f postgresql # P
32070 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72  ostgreSQL requir
32080 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d  es AS when renam
32090 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d  ing output colum
320a0 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ns..query I rows
320b0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
320c0 49 4e 43 54 20 2d 20 63 6f 6c 30 20 2a 20 28 20  INCT - col0 * ( 
320d0 38 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 29 20  8 + cor0.col1 ) 
320e0 2a 20 28 20 2d 20 63 6f 6c 31 20 29 20 63 6f 6c  * ( - col1 ) col
320f0 30 20 46 52 4f 4d 20 74 61 62 32 20 63 6f 72 30  0 FROM tab2 cor0
32100 0d 0a 2d 2d 2d 2d 0d 0a 33 30 38 33 33 34 0d 0a  ..----..308334..
32110 33 33 35 37 35 0d 0a 38 34 36 33 0d 0a 0d 0a 71  33575..8463....q
32120 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
32130 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 30 20  SELECT ALL col0 
32140 2a 20 2d 20 28 20 2d 20 63 6f 6c 31 20 2b 20 63  * - ( - col1 + c
32150 6f 6c 30 20 29 20 41 53 20 63 6f 6c 32 20 46 52  ol0 ) AS col2 FR
32160 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
32170 0a 2d 2d 2d 2d 0d 0a 31 34 38 38 0d 0a 31 37 38  .----..1488..178
32180 0d 0a 32 31 37 30 0d 0a 0d 0a 71 75 65 72 79 20  ..2170....query 
32190 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
321a0 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c  T DISTINCT - col
321b0 31 20 2b 20 31 39 20 46 52 4f 4d 20 74 61 62 31  1 + 19 FROM tab1
321c0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
321d0 2d 37 0d 0a 36 0d 0a 39 0d 0a 0d 0a 71 75 65 72  -7..6..9....quer
321e0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
321f0 45 43 54 20 63 6f 6c 32 20 2d 20 38 37 20 46 52  ECT col2 - 87 FR
32200 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
32210 0a 2d 2d 2d 2d 0d 0a 2d 35 0d 0a 2d 35 34 0d 0a  .----..-5..-54..
32220 2d 38 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  -86....query I r
32230 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63  owsort..SELECT c
32240 6f 6c 30 20 2a 20 37 34 20 2b 20 39 39 20 41 53  ol0 * 74 + 99 AS
32250 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20   col1 FROM tab0 
32260 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
32270 38 37 35 0d 0a 32 36 38 39 0d 0a 36 36 38 35 0d  875..2689..6685.
32280 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
32290 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74  # use DIV operat
322a0 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64  or for integer d
322b0 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49  ivision..query I
322c0 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
322d0 34 35 35 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 32  455..SELECT col2
322e0 20 44 49 56 20 33 34 20 46 52 4f 4d 20 74 61 62   DIV 34 FROM tab
322f0 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
32300 0a 30 0d 0a 30 0d 0a 32 0d 0a 0d 0a 73 6b 69 70  .0..0..2....skip
32310 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
32320 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
32330 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
32340 2d 31 34 35 35 0d 0a 53 45 4c 45 43 54 20 63 6f  -1455..SELECT co
32350 6c 32 20 2f 20 33 34 20 46 52 4f 4d 20 74 61 62  l2 / 34 FROM tab
32360 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
32370 0a 30 0d 0a 30 0d 0a 32 0d 0a 0d 0a 71 75 65 72  .0..0..2....quer
32380 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
32390 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63  ECT DISTINCT - c
323a0 6f 6c 32 20 2d 20 2d 20 63 6f 6c 30 20 46 52 4f  ol2 - - col0 FRO
323b0 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 32  M tab2..----..-2
323c0 30 0d 0a 34 31 0d 0a 35 32 0d 0a 0d 0a 71 75 65  0..41..52....que
323d0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
323e0 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f  LECT DISTINCT co
323f0 6c 30 20 2b 20 2b 20 63 6f 6c 30 20 2d 20 34 31  l0 + + col0 - 41
32400 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
32410 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 37 0d 0a 31  b2..----..-27..1
32420 31 35 0d 0a 31 31 37 0d 0a 0d 0a 6f 6e 6c 79 69  15..117....onlyi
32430 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72  f mysql # suppor
32440 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63  t for MySQL spec
32450 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65  ific system type
32460 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75  s and syntax..qu
32470 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
32480 62 65 6c 2d 31 34 35 38 0d 0a 53 45 4c 45 43 54  bel-1458..SELECT
32490 20 2b 20 2b 20 63 6f 6c 32 20 2a 20 43 41 53 54   + + col2 * CAST
324a0 28 20 2d 20 63 6f 6c 32 20 41 53 20 53 49 47 4e  ( - col2 AS SIGN
324b0 45 44 20 29 20 46 52 4f 4d 20 74 61 62 31 20 41  ED ) FROM tab1 A
324c0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32  S cor0..----..-2
324d0 39 31 36 0d 0a 2d 33 32 34 39 0d 0a 2d 39 32 31  916..-3249..-921
324e0 36 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  6....skipif mysq
324f0 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
32500 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
32510 6f 72 74 20 6c 61 62 65 6c 2d 31 34 35 38 0d 0a  ort label-1458..
32520 53 45 4c 45 43 54 20 2b 20 2b 20 63 6f 6c 32 20  SELECT + + col2 
32530 2a 20 43 41 53 54 20 28 20 2d 20 63 6f 6c 32 20  * CAST ( - col2 
32540 41 53 20 49 4e 54 45 47 45 52 20 29 20 46 52 4f  AS INTEGER ) FRO
32550 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
32560 2d 2d 2d 2d 0d 0a 2d 32 39 31 36 0d 0a 2d 33 32  ----..-2916..-32
32570 34 39 0d 0a 2d 39 32 31 36 0d 0a 0d 0a 71 75 65  49..-9216....que
32580 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
32590 4c 45 43 54 20 2d 20 2d 20 63 6f 6c 31 20 2b 20  LECT - - col1 + 
325a0 39 33 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  93 AS col2 FROM 
325b0 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
325c0 2d 2d 0d 0a 31 37 39 0d 0a 31 38 34 0d 0a 31 39  --..179..184..19
325d0 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  0....query I row
325e0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63  sort..SELECT + c
325f0 6f 6c 32 20 2d 20 31 38 20 46 52 4f 4d 20 74 61  ol2 - 18 FROM ta
32600 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33  b1 cor0..----..3
32610 36 0d 0a 33 39 0d 0a 37 38 0d 0a 0d 0a 6f 6e 6c  6..39..78....onl
32620 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70  yif mysql # supp
32630 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70  ort for MySQL sp
32640 65 63 69 66 69 63 20 73 79 73 74 65 6d 20 74 79  ecific system ty
32650 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a  pes and syntax..
32660 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
32670 6c 61 62 65 6c 2d 31 34 36 31 0d 0a 53 45 4c 45  label-1461..SELE
32680 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f  CT DISTINCT - co
32690 6c 30 20 2a 20 43 41 53 54 28 20 4e 55 4c 4c 20  l0 * CAST( NULL 
326a0 41 53 20 53 49 47 4e 45 44 20 29 20 2a 20 63 6f  AS SIGNED ) * co
326b0 6c 30 20 2b 20 2b 20 63 6f 6c 31 20 41 53 20 63  l0 + + col1 AS c
326c0 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d  ol2 FROM tab2..-
326d0 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69  ---..NULL....ski
326e0 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
326f0 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
32700 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
32710 6c 2d 31 34 36 31 0d 0a 53 45 4c 45 43 54 20 44  l-1461..SELECT D
32720 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c 30 20 2a  ISTINCT - col0 *
32730 20 43 41 53 54 20 28 20 4e 55 4c 4c 20 41 53 20   CAST ( NULL AS 
32740 49 4e 54 45 47 45 52 20 29 20 2a 20 63 6f 6c 30  INTEGER ) * col0
32750 20 2b 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c   + + col1 AS col
32760 32 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d  2 FROM tab2..---
32770 2d 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75 65 72 79  -..NULL....query
32780 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
32790 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 2d 20  CT DISTINCT - - 
327a0 63 6f 72 30 2e 63 6f 6c 30 20 46 52 4f 4d 20 74  cor0.col0 FROM t
327b0 61 62 30 2c 20 74 61 62 32 20 63 6f 72 30 0d 0a  ab0, tab2 cor0..
327c0 2d 2d 2d 2d 0d 0a 37 0d 0a 37 38 0d 0a 37 39 0d  ----..7..78..79.
327d0 0a 0d 0a 71 75 65 72 79 20 49 49 49 49 49 49 49  ...query IIIIIII
327e0 49 49 49 49 49 49 49 49 20 72 6f 77 73 6f 72 74  IIIIIIII rowsort
327f0 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
32800 54 20 2a 20 46 52 4f 4d 20 74 61 62 30 2c 20 74  T * FROM tab0, t
32810 61 62 30 20 41 53 20 63 6f 72 30 2c 20 74 61 62  ab0 AS cor0, tab
32820 30 20 63 6f 72 31 2c 20 74 61 62 32 2c 20 74 61  0 cor1, tab2, ta
32830 62 30 20 63 6f 72 32 0d 0a 2d 2d 2d 2d 0d 0a 33  b0 cor2..----..3
32840 36 34 35 20 76 61 6c 75 65 73 20 68 61 73 68 69  645 values hashi
32850 6e 67 20 74 6f 20 62 61 30 33 38 31 39 32 31 34  ng to ba03819214
32860 31 30 66 35 39 35 31 39 63 63 36 35 38 64 38 65  10f59519cc658d8e
32870 36 35 65 65 65 33 0d 0a 0d 0a 73 6b 69 70 69 66  65eee3....skipif
32880 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f   postgresql # Po
32890 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65  stgreSQL require
328a0 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69  s AS when renami
328b0 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e  ng output column
328c0 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  s..query I rowso
328d0 72 74 0d 0a 53 45 4c 45 43 54 20 28 20 2d 20 36  rt..SELECT ( - 6
328e0 36 20 29 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61  6 ) col1 FROM ta
328f0 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
32900 0d 0a 2d 36 36 0d 0a 2d 36 36 0d 0a 2d 36 36 0d  ..-66..-66..-66.
32910 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
32920 72 74 0d 0a 53 45 4c 45 43 54 20 35 20 2d 20 2b  rt..SELECT 5 - +
32930 20 63 6f 72 30 2e 63 6f 6c 31 20 46 52 4f 4d 20   cor0.col1 FROM 
32940 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab0 cor0..----.
32950 0a 2d 38 31 0d 0a 2d 38 36 0d 0a 2d 39 32 0d 0a  .-81..-86..-92..
32960 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
32970 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2b 20 37 36  t..SELECT - + 76
32980 20 2a 20 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c 32   * col1 * + col2
32990 20 2b 20 2d 20 39 33 20 46 52 4f 4d 20 74 61 62   + - 93 FROM tab
329a0 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
329b0 0a 2d 31 31 36 36 37 37 0d 0a 2d 34 39 31 38 39  .-116677..-49189
329c0 0d 0a 2d 36 33 37 30 35 0d 0a 0d 0a 6f 6e 6c 79  ..-63705....only
329d0 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f  if mysql # suppo
329e0 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65  rt for MySQL spe
329f0 63 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70  cific system typ
32a00 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71  es and syntax..q
32a10 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
32a20 61 62 65 6c 2d 31 34 36 37 0d 0a 53 45 4c 45 43  abel-1467..SELEC
32a30 54 20 2b 20 2b 20 63 6f 6c 30 20 2a 20 2b 20 63  T + + col0 * + c
32a40 6f 6c 31 20 2a 20 2d 20 63 6f 6c 30 20 2d 20 2d  ol1 * - col0 - -
32a50 20 43 41 53 54 28 20 4e 55 4c 4c 20 41 53 20 53   CAST( NULL AS S
32a60 49 47 4e 45 44 20 29 20 2a 20 38 30 20 2a 20 63  IGNED ) * 80 * c
32a70 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol2 FROM tab2 AS
32a80 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c   cor0..----..NUL
32a90 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d  L..NULL..NULL...
32aa0 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
32ab0 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
32ac0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
32ad0 6c 61 62 65 6c 2d 31 34 36 37 0d 0a 53 45 4c 45  label-1467..SELE
32ae0 43 54 20 2b 20 2b 20 63 6f 6c 30 20 2a 20 2b 20  CT + + col0 * + 
32af0 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c 30 20 2d 20  col1 * - col0 - 
32b00 2d 20 43 41 53 54 20 28 20 4e 55 4c 4c 20 41 53  - CAST ( NULL AS
32b10 20 49 4e 54 45 47 45 52 20 29 20 2a 20 38 30 20   INTEGER ) * 80 
32b20 2a 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32  * col2 FROM tab2
32b30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
32b40 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c  NULL..NULL..NULL
32b50 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
32b60 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
32b70 49 4e 43 54 20 2b 20 33 39 20 2b 20 63 6f 6c 31  INCT + 39 + col1
32b80 20 2a 20 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20   * col0 AS col1 
32b90 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
32ba0 30 0d 0a 2d 2d 2d 2d 0d 0a 32 31 30 33 0d 0a 33  0..----..2103..3
32bb0 34 33 34 0d 0a 38 31 33 38 0d 0a 0d 0a 6f 6e 6c  434..8138....onl
32bc0 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70  yif mysql # supp
32bd0 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70  ort for MySQL sp
32be0 65 63 69 66 69 63 20 73 79 73 74 65 6d 20 74 79  ecific system ty
32bf0 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a  pes and syntax..
32c00 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
32c10 6c 61 62 65 6c 2d 31 34 36 39 0d 0a 53 45 4c 45  label-1469..SELE
32c20 43 54 20 2b 20 63 6f 6c 30 20 2a 20 2d 20 63 6f  CT + col0 * - co
32c30 6c 31 20 2b 20 2d 20 63 6f 6c 30 20 2f 20 2b 20  l1 + - col0 / + 
32c40 43 41 53 54 28 20 4e 55 4c 4c 20 41 53 20 53 49  CAST( NULL AS SI
32c50 47 4e 45 44 20 29 20 2b 20 2d 20 63 6f 6c 31 20  GNED ) + - col1 
32c60 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
32c70 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e  0..----..NULL..N
32c80 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69  ULL..NULL....ski
32c90 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
32ca0 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
32cb0 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
32cc0 6c 2d 31 34 36 39 0d 0a 53 45 4c 45 43 54 20 2b  l-1469..SELECT +
32cd0 20 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c 31 20 2b   col0 * - col1 +
32ce0 20 2d 20 63 6f 6c 30 20 2f 20 2b 20 43 41 53 54   - col0 / + CAST
32cf0 20 28 20 4e 55 4c 4c 20 41 53 20 49 4e 54 45 47   ( NULL AS INTEG
32d00 45 52 20 29 20 2b 20 2d 20 63 6f 6c 31 20 46 52  ER ) + - col1 FR
32d10 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
32d20 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c  .----..NULL..NUL
32d30 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75 65 72 79  L..NULL....query
32d40 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
32d50 43 54 20 2d 20 2d 20 28 20 2b 20 63 6f 6c 32 20  CT - - ( + col2 
32d60 29 20 2a 20 2d 20 63 6f 6c 31 20 2a 20 63 6f 6c  ) * - col1 * col
32d70 32 20 2d 20 28 20 63 6f 6c 32 20 2a 20 2d 20 28  2 - ( col2 * - (
32d80 20 37 33 20 29 20 29 20 46 52 4f 4d 20 74 61 62   73 ) ) FROM tab
32d90 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32  0 cor0..----..-2
32da0 34 0d 0a 2d 36 30 35 38 39 38 0d 0a 2d 39 31 32  4..-605898..-912
32db0 34 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  45....query I ro
32dc0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
32dd0 53 54 49 4e 43 54 20 2d 20 74 61 62 30 2e 63 6f  STINCT - tab0.co
32de0 6c 32 20 46 52 4f 4d 20 74 61 62 30 2c 20 74 61  l2 FROM tab0, ta
32df0 62 31 2c 20 74 61 62 32 20 41 53 20 63 6f 72 30  b1, tab2 AS cor0
32e00 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 2d 33 33 0d  ..----..-1..-33.
32e10 0a 2d 38 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .-82....query I 
32e20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
32e30 37 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  7 AS col0 FROM t
32e40 61 62 32 2c 20 74 61 62 32 20 41 53 20 63 6f 72  ab2, tab2 AS cor
32e50 30 2c 20 74 61 62 32 20 41 53 20 63 6f 72 31 0d  0, tab2 AS cor1.
32e60 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75 65 73  .----..27 values
32e70 20 68 61 73 68 69 6e 67 20 74 6f 20 34 65 37 32   hashing to 4e72
32e80 65 39 65 33 33 64 61 63 61 63 37 35 37 66 34 38  e9e33dacac757f48
32e90 64 30 63 65 34 36 30 39 34 36 30 37 0d 0a 0d 0a  d0ce46094607....
32ea0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
32eb0 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
32ec0 20 2b 20 31 38 20 2a 20 2d 20 63 6f 6c 32 20 2b   + 18 * - col2 +
32ed0 20 2d 20 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c 30   - col2 * + col0
32ee0 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
32ef0 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
32f00 0d 0a 2d 32 34 39 36 0d 0a 2d 33 36 38 36 0d 0a  ..-2496..-3686..
32f10 2d 36 37 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20  -675....query I 
32f20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
32f30 2d 20 34 36 20 2b 20 2d 20 63 6f 6c 31 20 2a 20  - 46 + - col1 * 
32f40 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46 52 4f  col2 AS col2 FRO
32f50 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
32f60 2d 2d 2d 2d 0d 0a 2d 31 34 33 0d 0a 2d 32 38 38  ----..-143..-288
32f70 34 0d 0a 2d 37 35 30 38 0d 0a 0d 0a 6f 6e 6c 79  4..-7508....only
32f80 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44  if mysql # use D
32f90 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20  IV operator for 
32fa0 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e  integer division
32fb0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
32fc0 74 20 6c 61 62 65 6c 2d 31 34 37 35 0d 0a 53 45  t label-1475..SE
32fd0 4c 45 43 54 20 38 35 20 2b 20 37 35 20 44 49 56  LECT 85 + 75 DIV
32fe0 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20   col2 FROM tab1 
32ff0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 38  AS cor0..----..8
33000 35 0d 0a 38 36 0d 0a 38 36 0d 0a 0d 0a 73 6b 69  5..86..86....ski
33010 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
33020 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
33030 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
33040 6c 2d 31 34 37 35 0d 0a 53 45 4c 45 43 54 20 38  l-1475..SELECT 8
33050 35 20 2b 20 37 35 20 2f 20 63 6f 6c 32 20 46 52  5 + 75 / col2 FR
33060 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
33070 0a 2d 2d 2d 2d 0d 0a 38 35 0d 0a 38 36 0d 0a 38  .----..85..86..8
33080 36 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  6....onlyif mysq
33090 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72  l # use DIV oper
330a0 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72  ator for integer
330b0 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79   division..query
330c0 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
330d0 2d 31 34 37 36 0d 0a 53 45 4c 45 43 54 20 44 49  -1476..SELECT DI
330e0 53 54 49 4e 43 54 20 2b 20 63 6f 6c 30 20 44 49  STINCT + col0 DI
330f0 56 20 63 6f 6c 31 20 2b 20 2b 20 63 6f 6c 32 20  V col1 + + col2 
33100 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31  + col0 FROM tab1
33110 0d 0a 2d 2d 2d 2d 0d 0a 31 32 37 0d 0a 31 38 32  ..----..127..182
33120 0d 0a 35 37 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  ..57....skipif m
33130 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
33140 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
33150 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 34 37  owsort label-147
33160 36 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  6..SELECT DISTIN
33170 43 54 20 2b 20 63 6f 6c 30 20 2f 20 63 6f 6c 31  CT + col0 / col1
33180 20 2b 20 2b 20 63 6f 6c 32 20 2b 20 63 6f 6c 30   + + col2 + col0
33190 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d   FROM tab1..----
331a0 0d 0a 31 32 37 0d 0a 31 38 32 0d 0a 35 37 0d 0a  ..127..182..57..
331b0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
331c0 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
331d0 43 54 20 34 20 2b 20 74 61 62 31 2e 63 6f 6c 30  CT 4 + tab1.col0
331e0 20 46 52 4f 4d 20 74 61 62 31 2c 20 74 61 62 32   FROM tab1, tab2
331f0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
33200 36 38 0d 0a 37 0d 0a 38 34 0d 0a 0d 0a 71 75 65  68..7..84....que
33210 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
33220 4c 45 43 54 20 41 4c 4c 20 2b 20 2b 20 63 6f 6c  LECT ALL + + col
33230 32 20 2b 20 63 6f 6c 30 20 2a 20 2b 20 32 30 20  2 + col0 * + 20 
33240 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
33250 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 34 0d 0a 31 33  0..----..114..13
33260 33 37 0d 0a 31 36 39 36 0d 0a 0d 0a 71 75 65 72  37..1696....quer
33270 79 20 49 49 49 49 49 49 49 49 49 20 72 6f 77 73  y IIIIIIIII rows
33280 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2a 20 46 52  ort..SELECT * FR
33290 4f 4d 20 74 61 62 30 2c 20 74 61 62 31 20 41 53  OM tab0, tab1 AS
332a0 20 63 6f 72 30 20 43 52 4f 53 53 20 4a 4f 49 4e   cor0 CROSS JOIN
332b0 20 74 61 62 31 20 57 48 45 52 45 20 4e 4f 54 20   tab1 WHERE NOT 
332c0 4e 55 4c 4c 20 3d 20 4e 55 4c 4c 0d 0a 2d 2d 2d  NULL = NULL..---
332d0 2d 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  -....query I row
332e0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 33  sort..SELECT - 3
332f0 32 20 2b 20 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c  2 + col1 * - col
33300 32 20 2b 20 2d 20 63 6f 6c 32 20 46 52 4f 4d 20  2 + - col2 FROM 
33310 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab0 cor0..----.
33320 0a 2d 31 33 30 0d 0a 2d 32 39 30 33 0d 0a 2d 37  .-130..-2903..-7
33330 35 37 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  576....query I r
33340 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
33350 20 2d 20 34 20 2b 20 2d 20 38 39 20 2a 20 2b 20   - 4 + - 89 * + 
33360 63 6f 72 30 2e 63 6f 6c 30 20 41 53 20 63 6f 6c  cor0.col0 AS col
33370 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  0 FROM tab2 AS c
33380 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 36 31 39 0d  or0..----..-619.
33390 0a 2d 36 39 33 38 0d 0a 2d 37 30 32 37 0d 0a 0d  .-6938..-7027...
333a0 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73  .skipif postgres
333b0 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20  ql # PostgreSQL 
333c0 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e  requires AS when
333d0 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74   renaming output
333e0 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20   columns..query 
333f0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
33400 54 20 2b 20 2d 20 63 6f 6c 30 20 2a 20 2b 20 32  T + - col0 * + 2
33410 32 20 2b 20 2b 20 63 6f 6c 30 20 2b 20 28 20 63  2 + + col0 + ( c
33420 6f 72 30 2e 63 6f 6c 31 20 29 20 63 6f 6c 30 20  or0.col1 ) col0 
33430 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
33440 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 33 34 0d 0a  0..----..-1334..
33450 2d 31 36 36 37 0d 0a 2d 33 37 0d 0a 0d 0a 71 75  -1667..-37....qu
33460 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
33470 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 39  ELECT DISTINCT 9
33480 36 20 46 52 4f 4d 20 74 61 62 30 2c 20 74 61 62  6 FROM tab0, tab
33490 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
334a0 0a 39 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .96....query I r
334b0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63  owsort..SELECT c
334c0 6f 6c 31 20 2a 20 30 20 2a 20 2d 20 63 6f 6c 30  ol1 * 0 * - col0
334d0 20 2d 20 63 6f 6c 31 20 2a 20 2b 20 39 38 20 46   - col1 * + 98 F
334e0 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab0..----..
334f0 2d 38 34 32 38 0d 0a 2d 38 39 31 38 0d 0a 2d 39  -8428..-8918..-9
33500 35 30 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  506....query I r
33510 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
33520 49 53 54 49 4e 43 54 20 2d 20 28 20 38 33 20 29  ISTINCT - ( 83 )
33530 20 2b 20 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c 31   + col2 * + col1
33540 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d   FROM tab1..----
33550 0d 0a 31 31 36 35 0d 0a 31 33 32 31 0d 0a 34 38  ..1165..1321..48
33560 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  7....query I row
33570 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 39  sort..SELECT - 9
33580 32 20 46 52 4f 4d 20 74 61 62 31 2c 20 74 61 62  2 FROM tab1, tab
33590 32 20 41 53 20 63 6f 72 30 2c 20 74 61 62 30 20  2 AS cor0, tab0 
335a0 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 32  AS cor1..----..2
335b0 37 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67  7 values hashing
335c0 20 74 6f 20 61 30 65 36 62 37 36 32 32 37 64 38   to a0e6b76227d8
335d0 37 30 64 31 30 63 34 64 39 66 34 36 35 34 35 61  70d10c4d9f46545a
335e0 37 63 38 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20  7c83....query I 
335f0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
33600 63 6f 6c 32 20 2a 20 28 20 2b 20 39 34 20 29 20  col2 * ( + 94 ) 
33610 2a 20 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46  * col1 AS col0 F
33620 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab0..----..
33630 32 36 36 37 37 32 0d 0a 37 30 31 34 32 38 0d 0a  266772..701428..
33640 39 31 31 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20  9118....query I 
33650 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
33660 2d 20 63 6f 6c 30 20 2b 20 2b 20 32 32 20 46 52  - col0 + + 22 FR
33670 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d  OM tab1 cor0..--
33680 2d 2d 0d 0a 2d 34 32 0d 0a 2d 35 38 0d 0a 31 39  --..-42..-58..19
33690 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
336a0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 33 35  ort..SELECT + 35
336b0 20 46 52 4f 4d 20 74 61 62 30 2c 20 74 61 62 31   FROM tab0, tab1
336c0 20 41 53 20 63 6f 72 30 2c 20 74 61 62 31 20 41   AS cor0, tab1 A
336d0 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 32 37  S cor1..----..27
336e0 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20   values hashing 
336f0 74 6f 20 30 64 31 33 64 66 64 34 63 34 61 39 64  to 0d13dfd4c4a9d
33700 35 31 61 63 65 33 35 38 32 63 33 31 63 61 64 63  51ace3582c31cadc
33710 64 62 63 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  dbc....query I r
33720 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
33730 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c 31 20 2b  ISTINCT + col1 +
33740 20 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c 31 20 46   col1 * + col1 F
33750 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab0..----..
33760 37 34 38 32 0d 0a 38 33 37 32 0d 0a 39 35 30 36  7482..8372..9506
33770 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
33780 6f 72 74 0d 0a 53 45 4c 45 43 54 20 33 37 20 41  ort..SELECT 37 A
33790 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30  S col0 FROM tab0
337a0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
337b0 33 37 0d 0a 33 37 0d 0a 33 37 0d 0a 0d 0a 71 75  37..37..37....qu
337c0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
337d0 45 4c 45 43 54 20 2b 20 34 32 20 2a 20 63 6f 6c  ELECT + 42 * col
337e0 32 20 2b 20 2d 20 28 20 2d 20 63 6f 6c 31 20 2a  2 + - ( - col1 *
337f0 20 63 6f 72 30 2e 63 6f 6c 32 20 29 20 41 53 20   cor0.col2 ) AS 
33800 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 63  col2 FROM tab1 c
33810 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 39 36 34 0d  or0..----..2964.
33820 0a 33 36 37 32 0d 0a 35 32 38 30 0d 0a 0d 0a 71  .3672..5280....q
33830 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
33840 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
33850 2b 20 2b 20 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c  + + col0 + + col
33860 31 20 2a 20 2b 20 63 6f 6c 32 20 41 53 20 63 6f  1 * + col2 AS co
33870 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l1 FROM tab1 AS 
33880 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33 32 38  cor0..----..1328
33890 0d 0a 31 34 30 37 0d 0a 36 33 34 0d 0a 0d 0a 6f  ..1407..634....o
338a0 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75  nlyif mysql # su
338b0 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20  pport for MySQL 
338c0 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20  specific system 
338d0 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78  types and syntax
338e0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
338f0 74 20 6c 61 62 65 6c 2d 31 34 39 34 0d 0a 53 45  t label-1494..SE
33900 4c 45 43 54 20 63 6f 6c 31 20 2b 20 2d 20 63 6f  LECT col1 + - co
33910 6c 30 20 2d 20 43 41 53 54 28 20 31 34 20 41 53  l0 - CAST( 14 AS
33920 20 53 49 47 4e 45 44 20 29 20 46 52 4f 4d 20 74   SIGNED ) FROM t
33930 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
33940 2d 0d 0a 2d 33 33 0d 0a 2d 37 36 0d 0a 31 30 0d  -..-33..-76..10.
33950 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
33960 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
33970 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
33980 74 20 6c 61 62 65 6c 2d 31 34 39 34 0d 0a 53 45  t label-1494..SE
33990 4c 45 43 54 20 63 6f 6c 31 20 2b 20 2d 20 63 6f  LECT col1 + - co
339a0 6c 30 20 2d 20 43 41 53 54 20 28 20 31 34 20 41  l0 - CAST ( 14 A
339b0 53 20 49 4e 54 45 47 45 52 20 29 20 46 52 4f 4d  S INTEGER ) FROM
339c0 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
339d0 2d 2d 2d 0d 0a 2d 33 33 0d 0a 2d 37 36 0d 0a 31  ---..-33..-76..1
339e0 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  0....query I row
339f0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63  sort..SELECT + c
33a00 6f 72 30 2e 63 6f 6c 30 20 2a 20 63 6f 6c 32 20  or0.col0 * col2 
33a10 2b 20 31 32 20 46 52 4f 4d 20 74 61 62 31 20 41  + 12 FROM tab1 A
33a20 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 37  S cor0..----..17
33a30 34 0d 0a 33 36 36 30 0d 0a 37 36 39 32 0d 0a 0d  4..3660..7692...
33a40 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
33a50 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
33a60 54 20 2d 20 2b 20 33 32 20 2b 20 63 6f 6c 32 20  T - + 32 + col2 
33a70 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
33a80 30 0d 0a 2d 2d 2d 2d 0d 0a 32 32 0d 0a 32 35 0d  0..----..22..25.
33a90 0a 36 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .64....query I r
33aa0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
33ab0 49 53 54 49 4e 43 54 20 2d 20 2b 20 63 6f 72 30  ISTINCT - + cor0
33ac0 2e 63 6f 6c 32 20 2b 20 63 6f 6c 31 20 2a 20 63  .col2 + col1 * c
33ad0 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  ol0 AS col1 FROM
33ae0 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
33af0 2d 2d 2d 0d 0a 32 34 0d 0a 35 38 33 0d 0a 39 34  ---..24..583..94
33b00 34 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  4....onlyif mysq
33b10 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72  l # use DIV oper
33b20 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72  ator for integer
33b30 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79   division..query
33b40 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
33b50 2d 31 34 39 38 0d 0a 53 45 4c 45 43 54 20 28 20  -1498..SELECT ( 
33b60 63 6f 6c 31 20 29 20 44 49 56 20 2d 20 28 20 63  col1 ) DIV - ( c
33b70 6f 6c 30 20 29 20 2b 20 2d 20 63 6f 6c 30 20 44  ol0 ) + - col0 D
33b80 49 56 20 63 6f 72 30 2e 63 6f 6c 30 20 41 53 20  IV cor0.col0 AS 
33b90 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41  col0 FROM tab0 A
33ba0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32  S cor0..----..-2
33bb0 0d 0a 2d 33 0d 0a 2d 34 0d 0a 0d 0a 73 6b 69 70  ..-3..-4....skip
33bc0 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
33bd0 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
33be0 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
33bf0 2d 31 34 39 38 0d 0a 53 45 4c 45 43 54 20 28 20  -1498..SELECT ( 
33c00 63 6f 6c 31 20 29 20 2f 20 2d 20 28 20 63 6f 6c  col1 ) / - ( col
33c10 30 20 29 20 2b 20 2d 20 63 6f 6c 30 20 2f 20 63  0 ) + - col0 / c
33c20 6f 72 30 2e 63 6f 6c 30 20 41 53 20 63 6f 6c 30  or0.col0 AS col0
33c30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
33c40 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 0d 0a 2d 33  r0..----..-2..-3
33c50 0d 0a 2d 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..-4....query I 
33c60 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
33c70 44 49 53 54 49 4e 43 54 20 2b 20 32 38 20 41 53  DISTINCT + 28 AS
33c80 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20   col1 FROM tab1 
33c90 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32  AS cor0..----..2
33ca0 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  8....query I row
33cb0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
33cc0 20 2b 20 28 20 63 6f 6c 30 20 29 20 2a 20 28 20   + ( col0 ) * ( 
33cd0 63 6f 6c 30 20 29 20 41 53 20 63 6f 6c 31 20 46  col0 ) AS col1 F
33ce0 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
33cf0 0d 0a 2d 2d 2d 2d 0d 0a 34 39 0d 0a 36 30 38 34  ..----..49..6084
33d00 0d 0a 36 32 34 31 0d 0a 0d 0a 71 75 65 72 79 20  ..6241....query 
33d10 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
33d20 54 20 2d 20 2b 20 63 6f 6c 31 20 2a 20 2d 20 63  T - + col1 * - c
33d30 6f 6c 31 20 2b 20 2d 20 38 38 20 46 52 4f 4d 20  ol1 + - 88 FROM 
33d40 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
33d50 2d 2d 0d 0a 32 30 31 0d 0a 33 33 39 33 0d 0a 38  --..201..3393..8
33d60 37 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  73....query I ro
33d70 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
33d80 4c 20 2b 20 63 6f 6c 31 20 2a 20 2b 20 63 6f 72  L + col1 * + cor
33d90 30 2e 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31  0.col2 FROM tab1
33da0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 34   cor0..----..124
33db0 38 0d 0a 31 34 30 34 0d 0a 35 37 30 0d 0a 0d 0a  8..1404..570....
33dc0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
33dd0 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f  .SELECT ALL - co
33de0 6c 31 20 2d 20 2b 20 63 6f 72 30 2e 63 6f 6c 31  l1 - + cor0.col1
33df0 20 46 52 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d   FROM tab2 cor0.
33e00 0a 2d 2d 2d 2d 0d 0a 2d 31 31 38 0d 0a 2d 33 34  .----..-118..-34
33e10 0d 0a 2d 36 32 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  ..-62....onlyif 
33e20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20  mysql # use DIV 
33e30 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74  operator for int
33e40 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71  eger division..q
33e50 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
33e60 61 62 65 6c 2d 31 35 30 34 0d 0a 53 45 4c 45 43  abel-1504..SELEC
33e70 54 20 2b 20 63 6f 6c 31 20 44 49 56 20 28 20 2d  T + col1 DIV ( -
33e80 20 63 6f 6c 31 20 29 20 2b 20 2b 20 63 6f 6c 32   col1 ) + + col2
33e90 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
33ea0 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
33eb0 0d 0a 32 35 0d 0a 32 36 0d 0a 33 37 0d 0a 0d 0a  ..25..26..37....
33ec0 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
33ed0 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
33ee0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
33ef0 61 62 65 6c 2d 31 35 30 34 0d 0a 53 45 4c 45 43  abel-1504..SELEC
33f00 54 20 2b 20 63 6f 6c 31 20 2f 20 28 20 2d 20 63  T + col1 / ( - c
33f10 6f 6c 31 20 29 20 2b 20 2b 20 63 6f 6c 32 20 41  ol1 ) + + col2 A
33f20 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32  S col1 FROM tab2
33f30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
33f40 32 35 0d 0a 32 36 0d 0a 33 37 0d 0a 0d 0a 71 75  25..26..37....qu
33f50 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
33f60 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d  ELECT DISTINCT -
33f70 20 63 6f 6c 32 20 2b 20 63 6f 6c 30 20 2a 20 2b   col2 + col0 * +
33f80 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20   col2 FROM tab0 
33f90 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33  AS cor0..----..3
33fa0 34 0d 0a 37 32 31 36 0d 0a 37 35 39 0d 0a 0d 0a  4..7216..759....
33fb0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
33fc0 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 32  .SELECT ALL col2
33fd0 20 2a 20 2d 20 63 6f 6c 32 20 2d 20 2d 20 34 34   * - col2 - - 44
33fe0 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d   FROM tab1..----
33ff0 0d 0a 2d 32 38 37 32 0d 0a 2d 33 32 30 35 0d 0a  ..-2872..-3205..
34000 2d 39 31 37 32 0d 0a 0d 0a 73 6b 69 70 69 66 20  -9172....skipif 
34010 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73  postgresql # Pos
34020 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73  tgreSQL requires
34030 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e   AS when renamin
34040 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73  g output columns
34050 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
34060 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 32  t..SELECT - col2
34070 20 2d 20 2d 20 63 6f 6c 31 20 63 6f 6c 30 20 46   - - col1 col0 F
34080 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
34090 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 38 0d 0a 2d 34 37  ..----..-28..-47
340a0 0d 0a 2d 38 33 0d 0a 0d 0a 71 75 65 72 79 20 49  ..-83....query I
340b0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
340c0 20 44 49 53 54 49 4e 43 54 20 2b 20 2b 20 63 6f   DISTINCT + + co
340d0 72 30 2e 63 6f 6c 31 20 2a 20 63 6f 6c 32 20 41  r0.col1 * col2 A
340e0 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30  S col2 FROM tab0
340f0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
34100 32 38 33 38 0d 0a 37 34 36 32 0d 0a 39 37 0d 0a  2838..7462..97..
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 2d 20 38 31 20 41 53 20 63 6f 6c 31 20  CT - 81 AS col1 
34140 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a  FROM tab1 cor0..
34150 2d 2d 2d 2d 0d 0a 2d 38 31 0d 0a 0d 0a 71 75 65  ----..-81....que
34160 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
34170 4c 45 43 54 20 2b 20 2b 20 31 35 20 46 52 4f 4d  LECT + + 15 FROM
34180 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
34190 2d 2d 2d 0d 0a 31 35 0d 0a 31 35 0d 0a 31 35 0d  ---..15..15..15.
341a0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
341b0 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
341c0 4e 43 54 20 63 6f 72 31 2e 63 6f 6c 31 20 2a 20  NCT cor1.col1 * 
341d0 2d 20 34 20 46 52 4f 4d 20 74 61 62 31 2c 20 74  - 4 FROM tab1, t
341e0 61 62 30 20 41 53 20 63 6f 72 30 2c 20 74 61 62  ab0 AS cor0, tab
341f0 30 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d  0 AS cor1..----.
34200 0a 2d 33 34 34 0d 0a 2d 33 36 34 0d 0a 2d 33 38  .-344..-364..-38
34210 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  8....query I row
34220 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 32 35 20  sort..SELECT 25 
34230 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
34240 32 20 41 53 20 63 6f 72 30 20 43 52 4f 53 53 20  2 AS cor0 CROSS 
34250 4a 4f 49 4e 20 74 61 62 30 20 63 6f 72 31 0d 0a  JOIN tab0 cor1..
34260 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68  ----..9 values h
34270 61 73 68 69 6e 67 20 74 6f 20 35 32 35 61 35 35  ashing to 525a55
34280 64 35 65 64 32 32 34 61 36 32 64 61 36 35 64 66  d5ed224a62da65df
34290 33 36 37 33 31 38 38 31 61 37 0d 0a 0d 0a 71 75  36731881a7....qu
342a0 65 72 79 20 49 49 49 49 49 49 49 49 49 49 49 49  ery IIIIIIIIIIII
342b0 49 49 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  III rowsort..SEL
342c0 45 43 54 20 44 49 53 54 49 4e 43 54 20 2a 20 46  ECT DISTINCT * F
342d0 52 4f 4d 20 74 61 62 32 2c 20 74 61 62 30 20 63  ROM tab2, tab0 c
342e0 6f 72 30 2c 20 74 61 62 30 20 41 53 20 63 6f 72  or0, tab0 AS cor
342f0 31 2c 20 74 61 62 31 2c 20 74 61 62 31 20 41 53  1, tab1, tab1 AS
34300 20 63 6f 72 32 0d 0a 2d 2d 2d 2d 0d 0a 33 36 34   cor2..----..364
34310 35 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67  5 values hashing
34320 20 74 6f 20 35 31 65 32 30 35 31 61 66 66 37 35   to 51e2051aff75
34330 63 35 38 61 35 65 64 61 61 33 31 34 66 31 34 31  c58a5edaa314f141
34340 32 39 38 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20  2983....query I 
34350 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
34360 44 49 53 54 49 4e 43 54 20 2b 20 28 20 2b 20 63  DISTINCT + ( + c
34370 6f 72 30 2e 63 6f 6c 32 20 29 20 46 52 4f 4d 20  or0.col2 ) FROM 
34380 74 61 62 31 2c 20 74 61 62 31 20 41 53 20 63 6f  tab1, tab1 AS co
34390 72 30 0d 0a 2d 2d 2d 2d 0d 0a 35 34 0d 0a 35 37  r0..----..54..57
343a0 0d 0a 39 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..96....query I 
343b0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
343c0 41 4c 4c 20 2d 20 63 6f 6c 32 20 2b 20 2d 20 36  ALL - col2 + - 6
343d0 35 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  5 FROM tab0 AS c
343e0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 34 37 0d  or0..----..-147.
343f0 0a 2d 36 36 0d 0a 2d 39 38 0d 0a 0d 0a 71 75 65  .-66..-98....que
34400 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
34410 4c 45 43 54 20 2d 20 2d 20 28 20 2b 20 63 6f 6c  LECT - - ( + col
34420 32 20 29 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  2 ) AS col2 FROM
34430 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
34440 2d 2d 2d 0d 0a 35 34 0d 0a 35 37 0d 0a 39 36 0d  ---..54..57..96.
34450 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
34460 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
34470 4e 43 54 20 2b 20 2b 20 63 6f 72 30 2e 63 6f 6c  NCT + + cor0.col
34480 31 20 2a 20 32 36 20 46 52 4f 4d 20 74 61 62 30  1 * 26 FROM tab0
34490 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
344a0 32 32 33 36 0d 0a 32 33 36 36 0d 0a 32 35 32 32  2236..2366..2522
344b0 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
344c0 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61   # use DIV opera
344d0 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20  tor for integer 
344e0 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20  division..query 
344f0 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
34500 31 35 31 38 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  1518..SELECT ALL
34510 20 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c 31 20 44   col2 * - col1 D
34520 49 56 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  IV col1 FROM tab
34530 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
34540 0a 2d 31 0d 0a 2d 33 33 0d 0a 2d 38 32 0d 0a 0d  .-1..-33..-82...
34550 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
34560 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
34570 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
34580 6c 61 62 65 6c 2d 31 35 31 38 0d 0a 53 45 4c 45  label-1518..SELE
34590 43 54 20 41 4c 4c 20 63 6f 6c 32 20 2a 20 2d 20  CT ALL col2 * - 
345a0 63 6f 6c 31 20 2f 20 63 6f 6c 31 20 46 52 4f 4d  col1 / col1 FROM
345b0 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
345c0 2d 2d 2d 0d 0a 2d 31 0d 0a 2d 33 33 0d 0a 2d 38  ---..-1..-33..-8
345d0 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  2....query I row
345e0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c  sort..SELECT col
345f0 32 20 2b 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20  2 + - cor0.col2 
34600 2a 20 63 6f 72 30 2e 63 6f 6c 32 20 46 52 4f 4d  * cor0.col2 FROM
34610 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
34620 2d 2d 2d 0d 0a 2d 31 34 30 36 0d 0a 2d 36 35 30  ---..-1406..-650
34630 0d 0a 2d 37 30 32 0d 0a 0d 0a 6f 6e 6c 79 69 66  ..-702....onlyif
34640 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56   mysql # use DIV
34650 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e   operator for in
34660 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a  teger division..
34670 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
34680 6c 61 62 65 6c 2d 31 35 32 30 0d 0a 53 45 4c 45  label-1520..SELE
34690 43 54 20 41 4c 4c 20 28 20 74 61 62 31 2e 63 6f  CT ALL ( tab1.co
346a0 6c 30 20 29 20 44 49 56 20 2b 20 63 6f 6c 30 20  l0 ) DIV + col0 
346b0 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
346c0 31 0d 0a 2d 2d 2d 2d 0d 0a 31 0d 0a 31 0d 0a 31  1..----..1..1..1
346d0 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
346e0 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
346f0 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
34700 72 74 20 6c 61 62 65 6c 2d 31 35 32 30 0d 0a 53  rt label-1520..S
34710 45 4c 45 43 54 20 41 4c 4c 20 28 20 74 61 62 31  ELECT ALL ( tab1
34720 2e 63 6f 6c 30 20 29 20 2f 20 2b 20 63 6f 6c 30  .col0 ) / + col0
34730 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
34740 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 0d 0a 31 0d 0a  b1..----..1..1..
34750 31 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  1....onlyif mysq
34760 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72  l # use DIV oper
34770 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72  ator for integer
34780 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79   division..query
34790 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
347a0 2d 31 35 32 31 0d 0a 53 45 4c 45 43 54 20 2b 20  -1521..SELECT + 
347b0 63 6f 6c 30 20 44 49 56 20 63 6f 6c 30 20 63 6f  col0 DIV col0 co
347c0 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l2 FROM tab2 AS 
347d0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 0d 0a 31  cor0..----..1..1
347e0 0d 0a 31 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f  ..1....skipif po
347f0 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67  stgresql # Postg
34800 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41  reSQL requires A
34810 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20  S when renaming 
34820 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a  output columns..
34830 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
34840 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
34850 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
34860 61 62 65 6c 2d 31 35 32 31 0d 0a 53 45 4c 45 43  abel-1521..SELEC
34870 54 20 2b 20 63 6f 6c 30 20 2f 20 63 6f 6c 30 20  T + col0 / col0 
34880 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41  col2 FROM tab2 A
34890 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 0d  S cor0..----..1.
348a0 0a 31 0d 0a 31 0d 0a 0d 0a 71 75 65 72 79 20 49  .1..1....query I
348b0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
348c0 20 41 4c 4c 20 2d 20 2d 20 34 39 20 2a 20 2d 20   ALL - - 49 * - 
348d0 63 6f 72 30 2e 63 6f 6c 30 20 46 52 4f 4d 20 74  cor0.col0 FROM t
348e0 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
348f0 2d 0d 0a 2d 31 34 37 0d 0a 2d 33 31 33 36 0d 0a  -..-147..-3136..
34900 2d 33 39 32 30 0d 0a 0d 0a 71 75 65 72 79 20 49  -3920....query I
34910 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
34920 20 41 4c 4c 20 2b 20 34 32 20 2a 20 2b 20 63 6f   ALL + 42 * + co
34930 6c 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  l0 AS col1 FROM 
34940 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
34950 2d 2d 0d 0a 32 39 34 0d 0a 33 32 37 36 0d 0a 33  --..294..3276..3
34960 33 31 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  318....query I r
34970 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
34980 20 2d 20 39 34 20 2a 20 63 6f 6c 31 20 41 53 20   - 94 * col1 AS 
34990 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41  col1 FROM tab1 A
349a0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
349b0 32 32 32 0d 0a 2d 32 34 34 34 0d 0a 2d 39 34 30  222..-2444..-940
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 41 4c 4c 20  ort..SELECT ALL 
349e0 38 36 20 46 52 4f 4d 20 74 61 62 31 2c 20 74 61  86 FROM tab1, ta
349f0 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
34a00 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68 69  ..9 values hashi
34a10 6e 67 20 74 6f 20 32 64 38 63 33 61 30 64 31 39  ng to 2d8c3a0d19
34a20 65 61 35 31 34 34 37 66 38 33 63 64 31 38 62 34  ea51447f83cd18b4
34a30 39 66 65 65 31 39 0d 0a 0d 0a 71 75 65 72 79 20  9fee19....query 
34a40 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
34a50 54 20 44 49 53 54 49 4e 43 54 20 2b 20 31 36 20  T DISTINCT + 16 
34a60 2a 20 2b 20 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c  * + col2 * - col
34a70 32 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d  2 FROM tab1..---
34a80 2d 0d 0a 2d 31 34 37 34 35 36 0d 0a 2d 34 36 36  -..-147456..-466
34a90 35 36 0d 0a 2d 35 31 39 38 34 0d 0a 0d 0a 71 75  56..-51984....qu
34aa0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
34ab0 45 4c 45 43 54 20 63 6f 6c 32 20 2a 20 63 6f 6c  ELECT col2 * col
34ac0 30 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c 32  0 + col0 AS col2
34ad0 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d   FROM tab1..----
34ae0 0d 0a 31 36 35 0d 0a 33 37 31 32 0d 0a 37 37 36  ..165..3712..776
34af0 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  0....query I row
34b00 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 28  sort..SELECT + (
34b10 20 63 6f 72 30 2e 63 6f 6c 30 20 29 20 2b 20 2b   cor0.col0 ) + +
34b20 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20   col1 FROM tab2 
34b30 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
34b40 33 37 0d 0a 33 38 0d 0a 39 36 0d 0a 0d 0a 71 75  37..38..96....qu
34b50 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
34b60 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 31  ELECT DISTINCT 1
34b70 33 20 2a 20 2d 20 63 6f 72 30 2e 63 6f 6c 31 20  3 * - cor0.col1 
34b80 46 52 4f 4d 20 74 61 62 32 2c 20 74 61 62 31 20  FROM tab2, tab1 
34b90 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
34ba0 31 33 30 0d 0a 2d 31 36 39 0d 0a 2d 33 33 38 0d  130..-169..-338.
34bb0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
34bc0 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 33 38 20  rt..SELECT + 38 
34bd0 2d 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30  - col0 FROM tab0
34be0 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 31 0d 0a 31 34 0d  ..----..-51..14.
34bf0 0a 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  .3....query I ro
34c00 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
34c10 63 6f 6c 31 20 2a 20 2b 20 35 34 20 2b 20 63 6f  col1 * + 54 + co
34c20 6c 31 20 2a 20 74 61 62 31 2e 63 6f 6c 32 20 2a  l1 * tab1.col2 *
34c30 20 2d 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62   - col2 FROM tab
34c40 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 39 31 30 36  1..----..-119106
34c50 0d 0a 2d 33 31 39 35 30 0d 0a 2d 37 34 34 31 32  ..-31950..-74412
34c60 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67  ....skipif postg
34c70 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53  resql # PostgreS
34c80 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77  QL requires AS w
34c90 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74  hen renaming out
34ca0 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65  put columns..que
34cb0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
34cc0 4c 45 43 54 20 2b 20 36 38 20 63 6f 6c 32 20 46  LECT + 68 col2 F
34cd0 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
34ce0 0d 0a 2d 2d 2d 2d 0d 0a 36 38 0d 0a 36 38 0d 0a  ..----..68..68..
34cf0 36 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  68....query I ro
34d00 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
34d10 4c 20 2d 20 35 31 20 46 52 4f 4d 20 74 61 62 31  L - 51 FROM tab1
34d20 2c 20 74 61 62 31 20 41 53 20 63 6f 72 30 2c 20  , tab1 AS cor0, 
34d30 74 61 62 31 20 41 53 20 63 6f 72 31 0d 0a 2d 2d  tab1 AS cor1..--
34d40 2d 2d 0d 0a 32 37 20 76 61 6c 75 65 73 20 68 61  --..27 values ha
34d50 73 68 69 6e 67 20 74 6f 20 32 37 62 63 63 33 31  shing to 27bcc31
34d60 34 33 33 63 65 39 30 38 33 33 65 64 37 36 36 31  433ce90833ed7661
34d70 39 63 62 64 38 64 36 61 34 0d 0a 0d 0a 71 75 65  9cbd8d6a4....que
34d80 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
34d90 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20  LECT DISTINCT - 
34da0 2d 20 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c 31 20  - col2 * + col1 
34db0 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
34dc0 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
34dd0 0a 32 38 33 38 0d 0a 37 34 36 32 0d 0a 39 37 0d  .2838..7462..97.
34de0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
34df0 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d  rt..SELECT ALL -
34e00 20 28 20 63 6f 6c 31 20 29 20 2a 20 34 20 46 52   ( col1 ) * 4 FR
34e10 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
34e20 0a 2d 2d 2d 2d 0d 0a 2d 33 34 34 0d 0a 2d 33 36  .----..-344..-36
34e30 34 0d 0a 2d 33 38 38 0d 0a 0d 0a 71 75 65 72 79  4..-388....query
34e40 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
34e50 43 54 20 2d 20 63 6f 6c 31 20 2b 20 63 6f 6c 30  CT - col1 + col0
34e60 20 2b 20 63 6f 6c 30 20 2a 20 37 38 20 46 52 4f   + col0 * 78 FRO
34e70 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 38  M tab0..----..18
34e80 31 30 0d 0a 32 36 36 38 0d 0a 36 39 34 30 0d 0a  10..2668..6940..
34e90 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
34ea0 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 32 20 2b  t..SELECT col2 +
34eb0 20 2d 20 63 6f 6c 32 20 2b 20 2d 20 63 6f 6c 30   - col2 + - col0
34ec0 20 2a 20 33 38 20 2a 20 2b 20 63 6f 6c 31 20 46   * 38 * + col1 F
34ed0 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab1..----..
34ee0 2d 32 34 33 32 30 0d 0a 2d 32 39 36 34 0d 0a 2d  -24320..-2964..-
34ef0 33 39 35 32 30 0d 0a 0d 0a 71 75 65 72 79 20 49  39520....query I
34f00 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
34f10 20 44 49 53 54 49 4e 43 54 20 74 61 62 30 2e 63   DISTINCT tab0.c
34f20 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  ol2 AS col1 FROM
34f30 20 74 61 62 30 2c 20 74 61 62 31 20 41 53 20 63   tab0, tab1 AS c
34f40 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 0d 0a 33 33  or0..----..1..33
34f50 0d 0a 38 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..82....query I 
34f60 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
34f70 44 49 53 54 49 4e 43 54 20 2b 20 34 36 20 2b 20  DISTINCT + 46 + 
34f80 63 6f 6c 30 20 2a 20 2d 20 33 34 20 41 53 20 63  col0 * - 34 AS c
34f90 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d  ol1 FROM tab2..-
34fa0 2d 2d 2d 0d 0a 2d 31 39 32 0d 0a 2d 32 36 30 36  ---..-192..-2606
34fb0 0d 0a 2d 32 36 34 30 0d 0a 0d 0a 71 75 65 72 79  ..-2640....query
34fc0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
34fd0 43 54 20 38 38 20 2b 20 2b 20 63 6f 6c 32 20 46  CT 88 + + col2 F
34fe0 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab0..----..
34ff0 31 32 31 0d 0a 31 37 30 0d 0a 38 39 0d 0a 0d 0a  121..170..89....
35000 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75  onlyif mysql # u
35010 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20  se DIV operator 
35020 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69  for integer divi
35030 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f  sion..query I ro
35040 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 35 34 31  wsort label-1541
35050 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 2d  ..SELECT ALL + -
35060 20 63 6f 6c 31 20 44 49 56 20 63 6f 6c 31 20 46   col1 DIV col1 F
35070 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
35080 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 2d 31 0d 0a  ..----..-1..-1..
35090 2d 31 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  -1....skipif mys
350a0 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
350b0 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
350c0 73 6f 72 74 20 6c 61 62 65 6c 2d 31 35 34 31 0d  sort label-1541.
350d0 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 2d 20  .SELECT ALL + - 
350e0 63 6f 6c 31 20 2f 20 63 6f 6c 31 20 46 52 4f 4d  col1 / col1 FROM
350f0 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
35100 2d 2d 2d 0d 0a 2d 31 0d 0a 2d 31 0d 0a 2d 31 0d  ---..-1..-1..-1.
35110 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72  ...skipif postgr
35120 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51  esql # PostgreSQ
35130 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68  L requires AS wh
35140 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70  en renaming outp
35150 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72  ut columns..quer
35160 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
35170 45 43 54 20 2d 20 63 6f 6c 31 20 2b 20 2d 20 63  ECT - col1 + - c
35180 6f 6c 30 20 2a 20 63 6f 6c 31 20 63 6f 6c 32 20  ol0 * col1 col2 
35190 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a  FROM tab0 cor0..
351a0 2d 2d 2d 2d 0d 0a 2d 32 31 35 30 0d 0a 2d 33 34  ----..-2150..-34
351b0 39 32 0d 0a 2d 38 31 39 30 0d 0a 0d 0a 71 75 65  92..-8190....que
351c0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
351d0 4c 45 43 54 20 41 4c 4c 20 39 39 20 2a 20 2d 20  LECT ALL 99 * - 
351e0 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 0d 0a  col0 FROM tab1..
351f0 2d 2d 2d 2d 0d 0a 2d 32 39 37 0d 0a 2d 36 33 33  ----..-297..-633
35200 36 0d 0a 2d 37 39 32 30 0d 0a 0d 0a 71 75 65 72  6..-7920....quer
35210 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
35220 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 30 20 2a  ECT ALL - col0 *
35230 20 63 6f 6c 31 20 2b 20 2b 20 37 36 20 41 53 20   col1 + + 76 AS 
35240 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 0d 0a  col0 FROM tab2..
35250 2d 2d 2d 2d 0d 0a 2d 31 32 36 37 0d 0a 2d 31 34  ----..-1267..-14
35260 31 0d 0a 2d 34 35 32 36 0d 0a 0d 0a 71 75 65 72  1..-4526....quer
35270 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
35280 45 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c  ECT DISTINCT col
35290 31 20 2b 20 28 20 2b 20 63 6f 6c 31 20 29 20 46  1 + ( + col1 ) F
352a0 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab2..----..
352b0 31 31 38 0d 0a 33 34 0d 0a 36 32 0d 0a 0d 0a 71  118..34..62....q
352c0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
352d0 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c  SELECT ALL - col
352e0 30 20 2a 20 63 6f 6c 30 20 2d 20 2d 20 63 6f 72  0 * col0 - - cor
352f0 30 2e 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32  0.col2 FROM tab2
35300 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 32   cor0..----..-22
35310 0d 0a 2d 36 30 35 38 0d 0a 2d 36 32 30 33 0d 0a  ..-6058..-6203..
35320 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
35330 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20  t..SELECT ALL - 
35340 2b 20 63 6f 6c 32 20 2a 20 2d 20 31 37 20 2a 20  + col2 * - 17 * 
35350 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 2b 20 2b 20  - cor0.col2 + + 
35360 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41  col0 FROM tab1 A
35370 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
35380 35 36 35 39 32 0d 0a 2d 34 39 35 36 39 0d 0a 2d  56592..-49569..-
35390 35 35 31 36 39 0d 0a 0d 0a 71 75 65 72 79 20 49  55169....query I
353a0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
353b0 20 41 4c 4c 20 35 33 20 46 52 4f 4d 20 74 61 62   ALL 53 FROM tab
353c0 30 2c 20 74 61 62 32 20 41 53 20 63 6f 72 30 2c  0, tab2 AS cor0,
353d0 20 74 61 62 31 20 41 53 20 63 6f 72 31 0d 0a 2d   tab1 AS cor1..-
353e0 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75 65 73 20 68  ---..27 values h
353f0 61 73 68 69 6e 67 20 74 6f 20 38 36 36 61 65 31  ashing to 866ae1
35400 62 34 61 62 39 65 35 62 34 30 34 33 61 63 31 62  b4ab9e5b4043ac1b
35410 63 66 64 34 31 33 61 61 61 36 0d 0a 0d 0a 6f 6e  cfd413aaa6....on
35420 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
35430 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
35440 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
35450 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
35460 6f 72 74 20 6c 61 62 65 6c 2d 31 35 34 39 0d 0a  ort label-1549..
35470 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 30 20  SELECT ALL col0 
35480 2a 20 63 6f 6c 30 20 2b 20 63 6f 6c 31 20 44 49  * col0 + col1 DI
35490 56 20 2b 20 63 6f 6c 32 20 2b 20 2d 20 63 6f 6c  V + col2 + - col
354a0 30 20 2a 20 2d 20 28 20 2b 20 63 6f 6c 32 20 2a  0 * - ( + col2 *
354b0 20 2b 20 63 6f 6c 31 20 29 20 63 6f 6c 31 20 46   + col1 ) col1 F
354c0 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab1..----..
354d0 31 30 36 32 34 30 0d 0a 34 30 35 37 36 0d 0a 34  106240..40576..4
354e0 32 32 31 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f  221....skipif po
354f0 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67  stgresql # Postg
35500 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41  reSQL requires A
35510 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20  S when renaming 
35520 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a  output columns..
35530 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
35540 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
35550 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
35560 61 62 65 6c 2d 31 35 34 39 0d 0a 53 45 4c 45 43  abel-1549..SELEC
35570 54 20 41 4c 4c 20 63 6f 6c 30 20 2a 20 63 6f 6c  T ALL col0 * col
35580 30 20 2b 20 63 6f 6c 31 20 2f 20 2b 20 63 6f 6c  0 + col1 / + col
35590 32 20 2b 20 2d 20 63 6f 6c 30 20 2a 20 2d 20 28  2 + - col0 * - (
355a0 20 2b 20 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c 31   + col2 * + col1
355b0 20 29 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62   ) col1 FROM tab
355c0 31 0d 0a 2d 2d 2d 2d 0d 0a 31 30 36 32 34 30 0d  1..----..106240.
355d0 0a 34 30 35 37 36 0d 0a 34 32 32 31 0d 0a 0d 0a  .40576..4221....
355e0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
355f0 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
35600 20 63 6f 6c 31 20 2a 20 63 6f 6c 30 20 2b 20 63   col1 * col0 + c
35610 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  ol0 AS col1 FROM
35620 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 31 32   tab1..----..112
35630 30 0d 0a 37 30 34 0d 0a 38 31 0d 0a 0d 0a 6f 6e  0..704..81....on
35640 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
35650 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
35660 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
35670 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
35680 6f 72 74 20 6c 61 62 65 6c 2d 31 35 35 31 0d 0a  ort label-1551..
35690 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
356a0 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c 30 20 2b 20  col0 + - col0 + 
356b0 2b 20 63 6f 6c 32 20 44 49 56 20 34 36 20 46 52  + col2 DIV 46 FR
356c0 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d  OM tab2 cor0..--
356d0 2d 2d 0d 0a 30 0d 0a 0d 0a 73 6b 69 70 69 66 20  --..0....skipif 
356e0 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
356f0 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
35700 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 35  rowsort label-15
35710 35 31 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  51..SELECT DISTI
35720 4e 43 54 20 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c  NCT col0 + - col
35730 30 20 2b 20 2b 20 63 6f 6c 32 20 2f 20 34 36 20  0 + + col2 / 46 
35740 46 52 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a  FROM tab2 cor0..
35750 2d 2d 2d 2d 0d 0a 30 0d 0a 0d 0a 71 75 65 72 79  ----..0....query
35760 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
35770 43 54 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 2a  CT + cor0.col2 *
35780 20 63 6f 72 30 2e 63 6f 6c 31 20 41 53 20 63 6f   cor0.col1 AS co
35790 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l1 FROM tab2 AS 
357a0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 35 33 34  cor0..----..1534
357b0 0d 0a 36 34 36 0d 0a 38 33 37 0d 0a 0d 0a 71 75  ..646..837....qu
357c0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
357d0 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d  ELECT DISTINCT -
357e0 20 2b 20 63 6f 6c 30 20 2b 20 2b 20 37 20 2a 20   + col0 + + 7 * 
357f0 2d 20 63 6f 72 30 2e 63 6f 6c 31 20 46 52 4f 4d  - cor0.col1 FROM
35800 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
35810 2d 2d 2d 0d 0a 2d 31 33 34 0d 0a 2d 31 37 31 0d  ---..-134..-171.
35820 0a 2d 31 38 35 0d 0a 0d 0a 71 75 65 72 79 20 49  .-185....query I
35830 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
35840 20 41 4c 4c 20 2b 20 2d 20 63 6f 6c 31 20 2d 20   ALL + - col1 - 
35850 2b 20 33 20 2a 20 63 6f 72 30 2e 63 6f 6c 31 20  + 3 * cor0.col1 
35860 2a 20 2d 20 34 37 20 41 53 20 63 6f 6c 31 20 46  * - 47 AS col1 F
35870 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
35880 0d 0a 2d 2d 2d 2d 0d 0a 31 34 30 30 0d 0a 31 38  ..----..1400..18
35890 32 30 0d 0a 33 36 34 30 0d 0a 0d 0a 71 75 65 72  20..3640....quer
358a0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
358b0 45 43 54 20 41 4c 4c 20 63 6f 6c 30 20 2b 20 34  ECT ALL col0 + 4
358c0 35 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  5 AS col0 FROM t
358d0 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
358e0 2d 0d 0a 31 33 34 0d 0a 36 39 0d 0a 38 30 0d 0a  -..134..69..80..
358f0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
35900 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20  t..SELECT ALL - 
35910 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 2a 20 2b 20  - cor0.col2 * + 
35920 63 6f 6c 31 20 2d 20 2d 20 63 6f 6c 32 20 41 53  col1 - - col2 AS
35930 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20   col0 FROM tab2 
35940 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
35950 35 36 30 0d 0a 36 38 34 0d 0a 38 36 34 0d 0a 0d  560..684..864...
35960 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
35970 0d 0a 53 45 4c 45 43 54 20 35 34 20 2a 20 63 6f  ..SELECT 54 * co
35980 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72  l1 FROM tab0 cor
35990 30 0d 0a 2d 2d 2d 2d 0d 0a 34 36 34 34 0d 0a 34  0..----..4644..4
359a0 39 31 34 0d 0a 35 32 33 38 0d 0a 0d 0a 6f 6e 6c  914..5238....onl
359b0 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20  yif mysql # use 
359c0 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72  DIV operator for
359d0 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f   integer divisio
359e0 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  n..query I rowso
359f0 72 74 20 6c 61 62 65 6c 2d 31 35 35 38 0d 0a 53  rt label-1558..S
35a00 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d  ELECT DISTINCT -
35a10 20 63 6f 6c 31 20 44 49 56 20 2b 20 63 6f 6c 30   col1 DIV + col0
35a20 20 2b 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62   + col2 FROM tab
35a30 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
35a40 0a 32 33 0d 0a 32 36 0d 0a 33 38 0d 0a 0d 0a 73  .23..26..38....s
35a50 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
35a60 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
35a70 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
35a80 62 65 6c 2d 31 35 35 38 0d 0a 53 45 4c 45 43 54  bel-1558..SELECT
35a90 20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c 31   DISTINCT - col1
35aa0 20 2f 20 2b 20 63 6f 6c 30 20 2b 20 63 6f 6c 32   / + col0 + col2
35ab0 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
35ac0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 33 0d 0a 32 36  r0..----..23..26
35ad0 0d 0a 33 38 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  ..38....onlyif m
35ae0 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f  ysql # use DIV o
35af0 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65  perator for inte
35b00 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75  ger division..qu
35b10 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
35b20 62 65 6c 2d 31 35 35 39 0d 0a 53 45 4c 45 43 54  bel-1559..SELECT
35b30 20 63 6f 6c 31 20 44 49 56 20 2b 20 39 39 20 2b   col1 DIV + 99 +
35b40 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46 52   col0 AS col0 FR
35b50 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 37  OM tab2..----..7
35b60 0d 0a 37 38 0d 0a 37 39 0d 0a 0d 0a 73 6b 69 70  ..78..79....skip
35b70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
35b80 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
35b90 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
35ba0 2d 31 35 35 39 0d 0a 53 45 4c 45 43 54 20 63 6f  -1559..SELECT co
35bb0 6c 31 20 2f 20 2b 20 39 39 20 2b 20 63 6f 6c 30  l1 / + 99 + col0
35bc0 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
35bd0 62 32 0d 0a 2d 2d 2d 2d 0d 0a 37 0d 0a 37 38 0d  b2..----..7..78.
35be0 0a 37 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .79....query I r
35bf0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
35c00 4c 4c 20 2d 20 2b 20 63 6f 6c 32 20 2a 20 2b 20  LL - + col2 * + 
35c10 33 39 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  39 AS col0 FROM 
35c20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
35c30 2d 2d 0d 0a 2d 31 30 31 34 0d 0a 2d 31 30 35 33  --..-1014..-1053
35c40 0d 0a 2d 31 34 38 32 0d 0a 0d 0a 71 75 65 72 79  ..-1482....query
35c50 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
35c60 43 54 20 41 4c 4c 20 2b 20 28 20 2d 20 63 6f 6c  CT ALL + ( - col
35c70 31 20 29 20 2d 20 63 6f 6c 32 20 41 53 20 63 6f  1 ) - col2 AS co
35c80 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l0 FROM tab1 AS 
35c90 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 39  cor0..----..-109
35ca0 0d 0a 2d 36 37 0d 0a 2d 38 30 0d 0a 0d 0a 71 75  ..-67..-80....qu
35cb0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
35cc0 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b  ELECT DISTINCT +
35cd0 20 63 6f 72 30 2e 63 6f 6c 30 20 2b 20 2d 20 63   cor0.col0 + - c
35ce0 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol2 FROM tab0 AS
35cf0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 39 0d   cor0..----..-9.
35d00 0a 33 34 0d 0a 37 0d 0a 0d 0a 6f 6e 6c 79 69 66  .34..7....onlyif
35d10 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56   mysql # use DIV
35d20 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e   operator for in
35d30 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a  teger division..
35d40 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
35d50 6c 61 62 65 6c 2d 31 35 36 33 0d 0a 53 45 4c 45  label-1563..SELE
35d60 43 54 20 41 4c 4c 20 63 6f 6c 30 20 44 49 56 20  CT ALL col0 DIV 
35d70 2d 20 28 20 2d 20 63 6f 6c 31 20 2a 20 2b 20 36  - ( - col1 * + 6
35d80 36 20 29 20 2b 20 2b 20 63 6f 6c 32 20 41 53 20  6 ) + + col2 AS 
35d90 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41  col2 FROM tab2 A
35da0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 36  S cor0..----..26
35db0 0d 0a 32 37 0d 0a 33 38 0d 0a 0d 0a 73 6b 69 70  ..27..38....skip
35dc0 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
35dd0 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
35de0 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
35df0 2d 31 35 36 33 0d 0a 53 45 4c 45 43 54 20 41 4c  -1563..SELECT AL
35e00 4c 20 63 6f 6c 30 20 2f 20 2d 20 28 20 2d 20 63  L col0 / - ( - c
35e10 6f 6c 31 20 2a 20 2b 20 36 36 20 29 20 2b 20 2b  ol1 * + 66 ) + +
35e20 20 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46 52   col2 AS col2 FR
35e30 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
35e40 0a 2d 2d 2d 2d 0d 0a 32 36 0d 0a 32 37 0d 0a 33  .----..26..27..3
35e50 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  8....query I row
35e60 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
35e70 54 49 4e 43 54 20 2b 20 2d 20 28 20 38 36 20 29  TINCT + - ( 86 )
35e80 20 46 52 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d   FROM tab2 cor0.
35e90 0a 2d 2d 2d 2d 0d 0a 2d 38 36 0d 0a 0d 0a 71 75  .----..-86....qu
35ea0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
35eb0 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d  ELECT DISTINCT -
35ec0 20 37 39 20 2b 20 63 6f 6c 32 20 46 52 4f 4d 20   79 + col2 FROM 
35ed0 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
35ee0 2d 2d 0d 0a 2d 34 36 0d 0a 2d 37 38 0d 0a 33 0d  --..-46..-78..3.
35ef0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
35f00 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 28 20 37  rt..SELECT - ( 7
35f10 33 20 29 20 2b 20 2d 20 63 6f 6c 30 20 41 53 20  3 ) + - col0 AS 
35f20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41  col2 FROM tab2 A
35f30 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
35f40 35 31 0d 0a 2d 31 35 32 0d 0a 2d 38 30 0d 0a 0d  51..-152..-80...
35f50 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
35f60 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
35f70 54 20 2b 20 2b 20 31 31 20 2b 20 36 30 20 2a 20  T + + 11 + 60 * 
35f80 2b 20 63 6f 6c 30 20 2b 20 2d 20 34 32 20 2a 20  + col0 + - 42 * 
35f90 2d 20 37 20 46 52 4f 4d 20 74 61 62 32 20 41 53  - 7 FROM tab2 AS
35fa0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 34 39 38   cor0..----..498
35fb0 35 0d 0a 35 30 34 35 0d 0a 37 32 35 0d 0a 0d 0a  5..5045..725....
35fc0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
35fd0 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 35 33  .SELECT ALL + 53
35fe0 20 2a 20 37 32 20 2b 20 2b 20 63 6f 6c 31 20 41   * 72 + + col1 A
35ff0 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32  S col1 FROM tab2
36000 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
36010 33 38 33 33 0d 0a 33 38 34 37 0d 0a 33 38 37 35  3833..3847..3875
36020 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
36030 6f 72 74 0d 0a 53 45 4c 45 43 54 20 28 20 31 33  ort..SELECT ( 13
36040 20 29 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20   ) AS col1 FROM 
36050 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab2 cor0..----.
36060 0a 31 33 0d 0a 31 33 0d 0a 31 33 0d 0a 0d 0a 71  .13..13..13....q
36070 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
36080 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 31 33 20  SELECT ALL - 13 
36090 46 52 4f 4d 20 74 61 62 32 2c 20 74 61 62 32 20  FROM tab2, tab2 
360a0 41 53 20 63 6f 72 30 2c 20 74 61 62 31 20 41 53  AS cor0, tab1 AS
360b0 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20   cor1..----..27 
360c0 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74  values hashing t
360d0 6f 20 31 63 36 61 61 61 30 37 62 61 38 64 33 64  o 1c6aaa07ba8d3d
360e0 63 30 31 65 65 36 31 36 65 31 36 62 65 66 36 30  c01ee616e16bef60
360f0 66 32 0d 0a 0d 0a 71 75 65 72 79 20 49 49 49 49  f2....query IIII
36100 49 49 49 49 49 49 49 49 20 72 6f 77 73 6f 72 74  IIIIIIII rowsort
36110 0d 0a 53 45 4c 45 43 54 20 2a 20 46 52 4f 4d 20  ..SELECT * FROM 
36120 74 61 62 32 20 41 53 20 63 6f 72 30 20 43 52 4f  tab2 AS cor0 CRO
36130 53 53 20 4a 4f 49 4e 20 74 61 62 31 2c 20 74 61  SS JOIN tab1, ta
36140 62 30 20 63 6f 72 31 2c 20 74 61 62 30 20 41 53  b0 cor1, tab0 AS
36150 20 63 6f 72 32 0d 0a 2d 2d 2d 2d 0d 0a 39 37 32   cor2..----..972
36160 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20   values hashing 
36170 74 6f 20 38 62 34 66 63 64 61 37 66 31 63 61 37  to 8b4fcda7f1ca7
36180 36 62 61 64 37 63 37 64 37 32 38 66 35 34 61 35  6bad7c7d728f54a5
36190 31 65 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  1e0....query I r
361a0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
361b0 49 53 54 49 4e 43 54 20 2b 20 28 20 2d 20 74 61  ISTINCT + ( - ta
361c0 62 32 2e 63 6f 6c 30 20 2b 20 2b 20 74 61 62 32  b2.col0 + + tab2
361d0 2e 63 6f 6c 31 20 29 20 2a 20 2d 20 63 6f 6c 30  .col1 ) * - col0
361e0 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d   FROM tab2..----
361f0 0d 0a 2d 31 36 38 0d 0a 31 34 38 32 0d 0a 34 38  ..-168..1482..48
36200 39 38 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73  98....skipif pos
36210 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72  tgresql # Postgr
36220 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53  eSQL requires AS
36230 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f   when renaming o
36240 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71  utput columns..q
36250 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
36260 53 45 4c 45 43 54 20 63 6f 6c 31 20 2a 20 2d 20  SELECT col1 * - 
36270 63 6f 6c 30 20 2a 20 63 6f 6c 32 20 63 6f 6c 31  col0 * col2 col1
36280 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d   FROM tab0..----
36290 0d 0a 2d 33 33 39 35 0d 0a 2d 36 36 34 31 31 38  ..-3395..-664118
362a0 0d 0a 2d 36 38 31 31 32 0d 0a 0d 0a 71 75 65 72  ..-68112....quer
362b0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
362c0 45 43 54 20 2d 20 37 38 20 41 53 20 63 6f 6c 31  ECT - 78 AS col1
362d0 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d   FROM tab1..----
362e0 0d 0a 2d 37 38 0d 0a 2d 37 38 0d 0a 2d 37 38 0d  ..-78..-78..-78.
362f0 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
36300 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79  # support for My
36310 53 51 4c 20 73 70 65 63 69 66 69 63 20 73 79 73  SQL specific sys
36320 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79  tem types and sy
36330 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f  ntax..query I ro
36340 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 35 37 35  wsort label-1575
36350 0d 0a 53 45 4c 45 43 54 20 43 41 53 54 28 20 2d  ..SELECT CAST( -
36360 20 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c 32 20 2b   col0 * - col2 +
36370 20 36 38 20 41 53 20 53 49 47 4e 45 44 20 29 20   68 AS SIGNED ) 
36380 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
36390 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 33 0d 0a 37 33  0..----..103..73
363a0 36 36 0d 0a 38 36 30 0d 0a 0d 0a 73 6b 69 70 69  66..860....skipi
363b0 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
363c0 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
363d0 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
363e0 31 35 37 35 0d 0a 53 45 4c 45 43 54 20 43 41 53  1575..SELECT CAS
363f0 54 20 28 20 2d 20 63 6f 6c 30 20 2a 20 2d 20 63  T ( - col0 * - c
36400 6f 6c 32 20 2b 20 36 38 20 41 53 20 49 4e 54 45  ol2 + 68 AS INTE
36410 47 45 52 20 29 20 41 53 20 63 6f 6c 30 20 46 52  GER ) AS col0 FR
36420 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31  OM tab0..----..1
36430 30 33 0d 0a 37 33 36 36 0d 0a 38 36 30 0d 0a 0d  03..7366..860...
36440 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73  .skipif postgres
36450 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20  ql # PostgreSQL 
36460 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e  requires AS when
36470 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74   renaming output
36480 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20   columns..query 
36490 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
364a0 54 20 2d 20 74 61 62 31 2e 63 6f 6c 32 20 63 6f  T - tab1.col2 co
364b0 6c 31 20 46 52 4f 4d 20 74 61 62 31 2c 20 74 61  l1 FROM tab1, ta
364c0 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
364d0 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68 69  ..9 values hashi
364e0 6e 67 20 74 6f 20 30 64 63 39 62 62 65 33 39 32  ng to 0dc9bbe392
364f0 64 35 32 64 66 39 33 64 32 61 31 31 35 64 37 66  d52df93d2a115d7f
36500 36 32 32 64 62 61 0d 0a 0d 0a 71 75 65 72 79 20  622dba....query 
36510 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
36520 54 20 2b 20 28 20 2b 20 63 6f 72 30 2e 63 6f 6c  T + ( + cor0.col
36530 32 20 29 20 2a 20 63 6f 72 30 2e 63 6f 6c 31 20  2 ) * cor0.col1 
36540 2b 20 2d 20 35 30 20 2b 20 63 6f 6c 31 20 41 53  + - 50 + col1 AS
36550 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20   col1 FROM tab0 
36560 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
36570 34 34 0d 0a 32 38 37 34 0d 0a 37 35 30 33 0d 0a  44..2874..7503..
36580 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
36590 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2b 20 30 20  t..SELECT - + 0 
365a0 2b 20 2d 20 63 6f 6c 30 20 2b 20 63 6f 6c 32 20  + - col0 + col2 
365b0 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
365c0 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
365d0 0a 2d 37 0d 0a 31 36 0d 0a 35 31 0d 0a 0d 0a 71  .-7..16..51....q
365e0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
365f0 53 45 4c 45 43 54 20 38 20 41 53 20 63 6f 6c 32  SELECT 8 AS col2
36600 20 46 52 4f 4d 20 74 61 62 30 2c 20 74 61 62 31   FROM tab0, tab1
36610 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
36620 39 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67  9 values hashing
36630 20 74 6f 20 66 66 63 35 62 34 63 39 38 62 35 37   to ffc5b4c98b57
36640 61 65 35 34 36 35 32 31 31 37 35 39 39 35 63 34  ae546521175995c4
36650 39 63 35 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20  9c57....query I 
36660 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
36670 44 49 53 54 49 4e 43 54 20 63 6f 72 30 2e 63 6f  DISTINCT cor0.co
36680 6c 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  l0 AS col1 FROM 
36690 74 61 62 30 2c 20 74 61 62 32 20 41 53 20 63 6f  tab0, tab2 AS co
366a0 72 30 2c 20 74 61 62 31 20 41 53 20 63 6f 72 31  r0, tab1 AS cor1
366b0 0d 0a 2d 2d 2d 2d 0d 0a 37 0d 0a 37 38 0d 0a 37  ..----..7..78..7
366c0 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  9....query I row
366d0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
366e0 20 38 36 20 46 52 4f 4d 20 74 61 62 31 2c 20 74   86 FROM tab1, t
366f0 61 62 32 20 41 53 20 63 6f 72 30 2c 20 74 61 62  ab2 AS cor0, tab
36700 32 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d  2 AS cor1..----.
36710 0a 32 37 20 76 61 6c 75 65 73 20 68 61 73 68 69  .27 values hashi
36720 6e 67 20 74 6f 20 65 64 31 61 33 39 63 32 37 35  ng to ed1a39c275
36730 32 63 61 33 37 32 33 36 30 32 65 34 61 39 32 63  2ca3723602e4a92c
36740 35 34 62 62 63 34 0d 0a 0d 0a 73 6b 69 70 69 66  54bbc4....skipif
36750 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f   postgresql # Po
36760 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65  stgreSQL require
36770 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69  s AS when renami
36780 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e  ng output column
36790 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  s..query I rowso
367a0 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
367b0 4e 43 54 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20  NCT + cor0.col0 
367c0 2b 20 2b 20 37 30 20 2a 20 2b 20 30 20 63 6f 6c  + + 70 * + 0 col
367d0 31 20 46 52 4f 4d 20 74 61 62 32 2c 20 74 61 62  1 FROM tab2, tab
367e0 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
367f0 0a 37 0d 0a 37 38 0d 0a 37 39 0d 0a 0d 0a 71 75  .7..78..79....qu
36800 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
36810 45 4c 45 43 54 20 41 4c 4c 20 2b 20 2d 20 33 20  ELECT ALL + - 3 
36820 2a 20 2b 20 63 6f 6c 32 20 41 53 20 63 6f 6c 32  * + col2 AS col2
36830 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
36840 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 34 36 0d 0a  r0..----..-246..
36850 2d 33 0d 0a 2d 39 39 0d 0a 0d 0a 6f 6e 6c 79 69  -3..-99....onlyi
36860 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49  f mysql # use DI
36870 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69  V operator for i
36880 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d  nteger division.
36890 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
368a0 20 6c 61 62 65 6c 2d 31 35 38 34 0d 0a 53 45 4c   label-1584..SEL
368b0 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 32 20 2a  ECT ALL + col2 *
368c0 20 2b 20 63 6f 6c 30 20 44 49 56 20 63 6f 6c 30   + col0 DIV col0
368d0 20 2d 20 32 37 20 41 53 20 63 6f 6c 31 20 46 52   - 27 AS col1 FR
368e0 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
368f0 0a 2d 2d 2d 2d 0d 0a 2d 32 36 0d 0a 35 35 0d 0a  .----..-26..55..
36900 36 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  6....skipif mysq
36910 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
36920 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
36930 6f 72 74 20 6c 61 62 65 6c 2d 31 35 38 34 0d 0a  ort label-1584..
36940 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c  SELECT ALL + col
36950 32 20 2a 20 2b 20 63 6f 6c 30 20 2f 20 63 6f 6c  2 * + col0 / col
36960 30 20 2d 20 32 37 20 41 53 20 63 6f 6c 31 20 46  0 - 27 AS col1 F
36970 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
36980 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 36 0d 0a 35 35 0d  ..----..-26..55.
36990 0a 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  .6....query I ro
369a0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
369b0 4c 20 2d 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20  L - - cor0.col2 
369c0 2a 20 2d 20 63 6f 72 30 2e 63 6f 6c 30 20 41 53  * - cor0.col0 AS
369d0 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20   col2 FROM tab2 
369e0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
369f0 31 38 39 0d 0a 2d 32 30 32 38 0d 0a 2d 33 30 30  189..-2028..-300
36a00 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  2....query I row
36a10 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
36a20 20 2d 20 2d 20 36 37 20 2a 20 63 6f 6c 31 20 46   - - 67 * col1 F
36a30 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d  ROM tab0 cor0..-
36a40 2d 2d 2d 0d 0a 35 37 36 32 0d 0a 36 30 39 37 0d  ---..5762..6097.
36a50 0a 36 34 39 39 0d 0a 0d 0a 71 75 65 72 79 20 49  .6499....query I
36a60 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
36a70 20 44 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c 31   DISTINCT + col1
36a80 20 2a 20 63 6f 72 30 2e 63 6f 6c 30 20 46 52 4f   * cor0.col0 FRO
36a90 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
36aa0 2d 2d 2d 2d 0d 0a 32 30 36 34 0d 0a 33 33 39 35  ----..2064..3395
36ab0 0d 0a 38 30 39 39 0d 0a 0d 0a 71 75 65 72 79 20  ..8099....query 
36ac0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
36ad0 54 20 2d 20 63 6f 6c 32 20 2a 20 2b 20 28 20 2d  T - col2 * + ( -
36ae0 20 63 6f 6c 31 20 29 20 2a 20 2b 20 63 6f 6c 32   col1 ) * + col2
36af0 20 2b 20 31 37 20 41 53 20 63 6f 6c 31 20 46 52   + 17 AS col1 FR
36b00 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d  OM tab1 cor0..--
36b10 2d 2d 0d 0a 31 31 39 38 32 35 0d 0a 33 32 35 30  --..119825..3250
36b20 37 0d 0a 37 35 38 33 33 0d 0a 0d 0a 71 75 65 72  7..75833....quer
36b30 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
36b40 45 43 54 20 2d 20 63 6f 6c 30 20 2b 20 32 38 20  ECT - col0 + 28 
36b50 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
36b60 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 36 31 0d 0a 2d 37  0..----..-61..-7
36b70 0d 0a 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  ..4....query I r
36b80 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
36b90 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c 30 20 2a  ISTINCT - col0 *
36ba0 20 2b 20 28 20 35 36 20 29 20 46 52 4f 4d 20 74   + ( 56 ) FROM t
36bb0 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
36bc0 2d 0d 0a 2d 31 36 38 0d 0a 2d 33 35 38 34 0d 0a  -..-168..-3584..
36bd0 2d 34 34 38 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  -4480....onlyif 
36be0 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20  mysql # support 
36bf0 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66  for MySQL specif
36c00 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20  ic system types 
36c10 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72  and syntax..quer
36c20 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
36c30 6c 2d 31 35 39 31 0d 0a 53 45 4c 45 43 54 20 2d  l-1591..SELECT -
36c40 20 63 6f 6c 31 20 2a 20 43 41 53 54 28 20 4e 55   col1 * CAST( NU
36c50 4c 4c 20 41 53 20 53 49 47 4e 45 44 20 29 20 46  LL AS SIGNED ) F
36c60 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
36c70 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55  ..----..NULL..NU
36c80 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70  LL..NULL....skip
36c90 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
36ca0 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
36cb0 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
36cc0 2d 31 35 39 31 0d 0a 53 45 4c 45 43 54 20 2d 20  -1591..SELECT - 
36cd0 63 6f 6c 31 20 2a 20 43 41 53 54 20 28 20 4e 55  col1 * CAST ( NU
36ce0 4c 4c 20 41 53 20 49 4e 54 45 47 45 52 20 29 20  LL AS INTEGER ) 
36cf0 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
36d00 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e  0..----..NULL..N
36d10 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75 65  ULL..NULL....que
36d20 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
36d30 4c 45 43 54 20 2b 20 2d 20 63 6f 6c 30 20 2b 20  LECT + - col0 + 
36d40 2b 20 63 6f 6c 31 20 2a 20 63 6f 6c 32 20 46 52  + col1 * col2 FR
36d50 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
36d60 0a 2d 2d 2d 2d 0d 0a 31 31 36 38 0d 0a 31 34 30  .----..1168..140
36d70 31 0d 0a 35 30 36 0d 0a 0d 0a 71 75 65 72 79 20  1..506....query 
36d80 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
36d90 54 20 2d 20 63 6f 6c 31 20 2d 20 2d 20 28 20 63  T - col1 - - ( c
36da0 6f 6c 32 20 29 20 41 53 20 63 6f 6c 31 20 46 52  ol2 ) AS col1 FR
36db0 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d  OM tab2..----..-
36dc0 33 33 0d 0a 2d 34 0d 0a 32 31 0d 0a 0d 0a 71 75  33..-4..21....qu
36dd0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
36de0 45 4c 45 43 54 20 2d 20 63 6f 6c 32 20 2a 20 2d  ELECT - col2 * -
36df0 20 63 6f 6c 31 20 2d 20 2b 20 38 39 20 46 52 4f   col1 - + 89 FRO
36e00 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 34  M tab2..----..14
36e10 34 35 0d 0a 35 35 37 0d 0a 37 34 38 0d 0a 0d 0a  45..557..748....
36e20 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
36e30 0a 53 45 4c 45 43 54 20 35 20 2a 20 31 34 20 2b  .SELECT 5 * 14 +
36e40 20 63 6f 72 30 2e 63 6f 6c 31 20 46 52 4f 4d 20   cor0.col1 FROM 
36e50 74 61 62 32 2c 20 74 61 62 31 20 41 53 20 63 6f  tab2, tab1 AS co
36e60 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75  r0..----..9 valu
36e70 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 65 33  es hashing to e3
36e80 30 61 32 66 31 66 32 39 39 63 34 33 38 33 37 36  0a2f1f299c438376
36e90 35 65 61 63 62 64 62 33 63 32 37 61 65 32 0d 0a  5eacbdb3c27ae2..
36ea0 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65  ..skipif postgre
36eb0 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c  sql # PostgreSQL
36ec0 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65   requires AS whe
36ed0 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75  n renaming outpu
36ee0 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79  t columns..query
36ef0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
36f00 43 54 20 2d 20 63 6f 6c 30 20 2a 20 28 20 63 6f  CT - col0 * ( co
36f10 72 30 2e 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c 30  r0.col0 * - col0
36f20 20 29 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62   ) col0 FROM tab
36f30 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
36f40 0a 33 34 33 0d 0a 34 37 34 35 35 32 0d 0a 34 39  .343..474552..49
36f50 33 30 33 39 0d 0a 0d 0a 73 6b 69 70 69 66 20 70  3039....skipif p
36f60 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74  ostgresql # Post
36f70 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20  greSQL requires 
36f80 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67  AS when renaming
36f90 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d   output columns.
36fa0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
36fb0 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c  ..SELECT ALL col
36fc0 31 20 2a 20 2b 20 33 33 20 63 6f 6c 31 20 46 52  1 * + 33 col1 FR
36fd0 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d  OM tab1 cor0..--
36fe0 2d 2d 0d 0a 33 33 30 0d 0a 34 32 39 0d 0a 38 35  --..330..429..85
36ff0 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  8....query I row
37000 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
37010 54 49 4e 43 54 20 2d 20 63 6f 6c 32 20 2a 20 63  TINCT - col2 * c
37020 6f 72 30 2e 63 6f 6c 32 20 2a 20 63 6f 6c 30 20  or0.col2 * col0 
37030 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
37040 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
37050 0a 2d 32 36 31 33 36 0d 0a 2d 33 35 0d 0a 2d 35  .-26136..-35..-5
37060 39 38 34 33 36 0d 0a 0d 0a 73 6b 69 70 69 66 20  98436....skipif 
37070 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
37080 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
37090 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
370a0 44 49 53 54 49 4e 43 54 20 2b 20 43 41 53 54 20  DISTINCT + CAST 
370b0 28 20 2b 20 63 6f 6c 30 20 41 53 20 52 45 41 4c  ( + col0 AS REAL
370c0 20 29 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20   ) AS col2 FROM 
370d0 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
370e0 2d 2d 0d 0a 37 0d 0a 37 38 0d 0a 37 39 0d 0a 0d  --..7..78..79...
370f0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
37100 0d 0a 53 45 4c 45 43 54 20 2b 20 38 30 20 41 53  ..SELECT + 80 AS
37110 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20   col1 FROM tab2 
37120 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 38 30 0d 0a  cor0..----..80..
37130 38 30 0d 0a 38 30 0d 0a 0d 0a 6f 6e 6c 79 69 66  80..80....onlyif
37140 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56   mysql # use DIV
37150 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e   operator for in
37160 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a  teger division..
37170 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
37180 6c 61 62 65 6c 2d 31 36 30 31 0d 0a 53 45 4c 45  label-1601..SELE
37190 43 54 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 2b  CT - cor0.col2 +
371a0 20 2d 20 63 6f 6c 32 20 44 49 56 20 2b 20 63 6f   - col2 DIV + co
371b0 6c 32 20 2d 20 2b 20 63 6f 6c 30 20 41 53 20 63  l2 - + col0 AS c
371c0 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol2 FROM tab0 AS
371d0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 37   cor0..----..-17
371e0 32 0d 0a 2d 33 37 0d 0a 2d 35 38 0d 0a 0d 0a 73  2..-37..-58....s
371f0 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
37200 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
37210 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
37220 62 65 6c 2d 31 36 30 31 0d 0a 53 45 4c 45 43 54  bel-1601..SELECT
37230 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 2b 20 2d   - cor0.col2 + -
37240 20 63 6f 6c 32 20 2f 20 2b 20 63 6f 6c 32 20 2d   col2 / + col2 -
37250 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20   + col0 AS col2 
37260 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
37270 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 37 32 0d 0a 2d  0..----..-172..-
37280 33 37 0d 0a 2d 35 38 0d 0a 0d 0a 73 6b 69 70 69  37..-58....skipi
37290 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50  f postgresql # P
372a0 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72  ostgreSQL requir
372b0 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d  es AS when renam
372c0 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d  ing output colum
372d0 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ns..query I rows
372e0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
372f0 49 4e 43 54 20 38 31 20 63 6f 6c 31 20 46 52 4f  INCT 81 col1 FRO
37300 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
37310 2d 2d 2d 2d 0d 0a 38 31 0d 0a 0d 0a 6f 6e 6c 79  ----..81....only
37320 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44  if mysql # use D
37330 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20  IV operator for 
37340 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e  integer division
37350 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
37360 74 20 6c 61 62 65 6c 2d 31 36 30 33 0d 0a 53 45  t label-1603..SE
37370 4c 45 43 54 20 2b 20 2d 20 63 6f 6c 30 20 2a 20  LECT + - col0 * 
37380 34 38 20 2d 20 63 6f 6c 32 20 44 49 56 20 2d 20  48 - col2 DIV - 
37390 63 6f 72 30 2e 63 6f 6c 32 20 46 52 4f 4d 20 74  cor0.col2 FROM t
373a0 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
373b0 2d 0d 0a 2d 31 31 35 31 0d 0a 2d 31 36 37 39 0d  -..-1151..-1679.
373c0 0a 2d 34 32 37 31 0d 0a 0d 0a 73 6b 69 70 69 66  .-4271....skipif
373d0 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
373e0 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
373f0 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
37400 36 30 33 0d 0a 53 45 4c 45 43 54 20 2b 20 2d 20  603..SELECT + - 
37410 63 6f 6c 30 20 2a 20 34 38 20 2d 20 63 6f 6c 32  col0 * 48 - col2
37420 20 2f 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 46   / - cor0.col2 F
37430 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
37440 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 35 31 0d 0a 2d  ..----..-1151..-
37450 31 36 37 39 0d 0a 2d 34 32 37 31 0d 0a 0d 0a 71  1679..-4271....q
37460 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
37470 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c  SELECT ALL + col
37480 31 20 2d 20 2b 20 38 32 20 46 52 4f 4d 20 74 61  1 - + 82 FROM ta
37490 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
374a0 0d 0a 2d 35 36 0d 0a 2d 36 39 0d 0a 2d 37 32 0d  ..-56..-69..-72.
374b0 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
374c0 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74  # use DIV operat
374d0 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64  or for integer d
374e0 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49  ivision..query I
374f0 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
37500 36 30 35 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f  605..SELECT + co
37510 6c 30 20 2a 20 2d 20 63 6f 72 30 2e 63 6f 6c 30  l0 * - cor0.col0
37520 20 2b 20 63 6f 6c 32 20 2a 20 63 6f 6c 31 20 44   + col2 * col1 D
37530 49 56 20 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20  IV col0 AS col1 
37540 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
37550 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 36 30 36 35 0d 0a  0..----..-6065..
37560 2d 36 32 33 33 0d 0a 37 30 0d 0a 0d 0a 73 6b 69  -6233..70....ski
37570 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
37580 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
37590 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
375a0 6c 2d 31 36 30 35 0d 0a 53 45 4c 45 43 54 20 2b  l-1605..SELECT +
375b0 20 63 6f 6c 30 20 2a 20 2d 20 63 6f 72 30 2e 63   col0 * - cor0.c
375c0 6f 6c 30 20 2b 20 63 6f 6c 32 20 2a 20 63 6f 6c  ol0 + col2 * col
375d0 31 20 2f 20 63 6f 6c 30 20 41 53 20 63 6f 6c 31  1 / col0 AS col1
375e0 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
375f0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 36 30 36 35 0d  r0..----..-6065.
37600 0a 2d 36 32 33 33 0d 0a 37 30 0d 0a 0d 0a 73 6b  .-6233..70....sk
37610 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20  ipif postgresql 
37620 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71  # PostgreSQL req
37630 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65  uires AS when re
37640 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f  naming output co
37650 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72  lumns..query I r
37660 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
37670 49 53 54 49 4e 43 54 20 2b 20 32 35 20 2a 20 2b  ISTINCT + 25 * +
37680 20 28 20 63 6f 6c 31 20 29 20 2b 20 63 6f 6c 32   ( col1 ) + col2
37690 20 2a 20 28 20 2b 20 63 6f 72 30 2e 63 6f 6c 30   * ( + cor0.col0
376a0 20 29 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62   ) col0 FROM tab
376b0 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
376c0 0a 32 34 36 30 0d 0a 32 39 34 32 0d 0a 39 35 37  .2460..2942..957
376d0 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  3....query I row
376e0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
376f0 20 2d 20 63 6f 6c 32 20 2a 20 63 6f 6c 31 20 2b   - col2 * col1 +
37700 20 2b 20 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20   + col2 AS col0 
37710 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
37720 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 38 30 35 0d 0a  0..----..-2805..
37730 2d 37 33 38 30 0d 0a 2d 39 36 0d 0a 0d 0a 71 75  -7380..-96....qu
37740 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
37750 45 4c 45 43 54 20 31 36 20 2d 20 63 6f 72 30 2e  ELECT 16 - cor0.
37760 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41  col2 FROM tab2 A
37770 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
37780 30 0d 0a 2d 31 31 0d 0a 2d 32 32 0d 0a 0d 0a 71  0..-11..-22....q
37790 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
377a0 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
377b0 2b 20 2b 20 63 6f 6c 31 20 2b 20 63 6f 72 30 2e  + + col1 + cor0.
377c0 63 6f 6c 32 20 2a 20 63 6f 6c 32 20 2a 20 28 20  col2 * col2 * ( 
377d0 63 6f 6c 32 20 29 20 41 53 20 63 6f 6c 31 20 46  col2 ) AS col1 F
377e0 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d  ROM tab0 cor0..-
377f0 2d 2d 2d 0d 0a 33 36 30 32 33 0d 0a 35 35 31 34  ---..36023..5514
37800 35 39 0d 0a 39 38 0d 0a 0d 0a 71 75 65 72 79 20  59..98....query 
37810 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
37820 54 20 41 4c 4c 20 63 6f 72 30 2e 63 6f 6c 32 20  T ALL cor0.col2 
37830 2a 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 46 52  * - cor0.col2 FR
37840 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
37850 0a 2d 2d 2d 2d 0d 0a 2d 31 34 34 34 0d 0a 2d 36  .----..-1444..-6
37860 37 36 0d 0a 2d 37 32 39 0d 0a 0d 0a 71 75 65 72  76..-729....quer
37870 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
37880 45 43 54 20 2b 20 63 6f 6c 30 20 2a 20 63 6f 6c  ECT + col0 * col
37890 31 20 2b 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20  1 + + cor0.col1 
378a0 2d 20 33 37 20 46 52 4f 4d 20 74 61 62 30 20 41  - 37 FROM tab0 A
378b0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 31  S cor0..----..21
378c0 31 33 0d 0a 33 34 35 35 0d 0a 38 31 35 33 0d 0a  13..3455..8153..
378d0 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
378e0 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f   use DIV operato
378f0 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69  r for integer di
37900 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20  vision..query I 
37910 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 36  rowsort label-16
37920 31 32 0d 0a 53 45 4c 45 43 54 20 2b 20 2b 20 63  12..SELECT + + c
37930 6f 6c 31 20 44 49 56 20 2b 20 63 6f 6c 32 20 46  ol1 DIV + col2 F
37940 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
37950 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d  ..----..0..0..0.
37960 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
37970 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
37980 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
37990 74 20 6c 61 62 65 6c 2d 31 36 31 32 0d 0a 53 45  t label-1612..SE
379a0 4c 45 43 54 20 2b 20 2b 20 63 6f 6c 31 20 2f 20  LECT + + col1 / 
379b0 2b 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31  + col2 FROM tab1
379c0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
379d0 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a 71 75 65 72 79  0..0..0....query
379e0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
379f0 43 54 20 2b 20 32 35 20 2b 20 63 6f 6c 31 20 2a  CT + 25 + col1 *
37a00 20 2b 20 63 6f 6c 31 20 2b 20 63 6f 6c 31 20 2a   + col1 + col1 *
37a10 20 2d 20 63 6f 72 30 2e 63 6f 6c 30 20 46 52 4f   - cor0.col0 FRO
37a20 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
37a30 2d 2d 2d 2d 0d 0a 2d 31 30 32 39 0d 0a 2d 31 30  ----..-1029..-10
37a40 39 36 0d 0a 37 36 39 0d 0a 0d 0a 71 75 65 72 79  96..769....query
37a50 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
37a60 43 54 20 2b 20 2b 20 28 20 2b 20 63 6f 6c 30 20  CT + + ( + col0 
37a70 29 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  ) AS col2 FROM t
37a80 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
37a90 2d 0d 0a 33 0d 0a 36 34 0d 0a 38 30 0d 0a 0d 0a  -..3..64..80....
37aa0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
37ab0 0a 53 45 4c 45 43 54 20 2d 20 34 37 20 2a 20 2d  .SELECT - 47 * -
37ac0 20 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46 52   col1 AS col2 FR
37ad0 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d  OM tab2 cor0..--
37ae0 2d 2d 0d 0a 31 34 35 37 0d 0a 32 37 37 33 0d 0a  --..1457..2773..
37af0 37 39 39 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  799....onlyif my
37b00 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70  sql # use DIV op
37b10 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67  erator for integ
37b20 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65  er division..que
37b30 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
37b40 65 6c 2d 31 36 31 36 0d 0a 53 45 4c 45 43 54 20  el-1616..SELECT 
37b50 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 44 49 56 20  + cor0.col1 DIV 
37b60 2b 20 63 6f 6c 31 20 63 6f 6c 31 20 46 52 4f 4d  + col1 col1 FROM
37b70 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
37b80 2d 2d 2d 0d 0a 31 0d 0a 31 0d 0a 31 0d 0a 0d 0a  ---..1..1..1....
37b90 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71  skipif postgresq
37ba0 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72  l # PostgreSQL r
37bb0 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20  equires AS when 
37bc0 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20  renaming output 
37bd0 63 6f 6c 75 6d 6e 73 0d 0a 73 6b 69 70 69 66 20  columns..skipif 
37be0 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
37bf0 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
37c00 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 36  rowsort label-16
37c10 31 36 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 72  16..SELECT + cor
37c20 30 2e 63 6f 6c 31 20 2f 20 2b 20 63 6f 6c 31 20  0.col1 / + col1 
37c30 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41  col1 FROM tab1 A
37c40 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 0d  S cor0..----..1.
37c50 0a 31 0d 0a 31 0d 0a 0d 0a 71 75 65 72 79 20 49  .1..1....query I
37c60 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
37c70 20 41 4c 4c 20 2d 20 74 61 62 31 2e 63 6f 6c 30   ALL - tab1.col0
37c80 20 2a 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62   * col2 FROM tab
37c90 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 36 32 0d 0a 2d  1..----..-162..-
37ca0 33 36 34 38 0d 0a 2d 37 36 38 30 0d 0a 0d 0a 6f  3648..-7680....o
37cb0 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73  nlyif mysql # us
37cc0 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66  e DIV operator f
37cd0 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73  or integer divis
37ce0 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ion..query I row
37cf0 73 6f 72 74 20 6c 61 62 65 6c 2d 31 36 31 38 0d  sort label-1618.
37d00 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
37d10 20 2d 20 2d 20 63 6f 72 30 2e 63 6f 6c 30 20 2a   - - cor0.col0 *
37d20 20 63 6f 6c 32 20 2a 20 32 33 20 2b 20 2b 20 63   col2 * 23 + + c
37d30 6f 6c 32 20 44 49 56 20 63 6f 6c 31 20 41 53 20  ol2 DIV col1 AS 
37d40 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 63  col2 FROM tab1 c
37d50 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 37 36 36 34  or0..----..17664
37d60 37 0d 0a 33 37 32 38 0d 0a 38 33 39 30 39 0d 0a  7..3728..83909..
37d70 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
37d80 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
37d90 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
37da0 20 6c 61 62 65 6c 2d 31 36 31 38 0d 0a 53 45 4c   label-1618..SEL
37db0 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 2d  ECT DISTINCT - -
37dc0 20 63 6f 72 30 2e 63 6f 6c 30 20 2a 20 63 6f 6c   cor0.col0 * col
37dd0 32 20 2a 20 32 33 20 2b 20 2b 20 63 6f 6c 32 20  2 * 23 + + col2 
37de0 2f 20 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46  / col1 AS col2 F
37df0 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d  ROM tab1 cor0..-
37e00 2d 2d 2d 0d 0a 31 37 36 36 34 37 0d 0a 33 37 32  ---..176647..372
37e10 38 0d 0a 38 33 39 30 39 0d 0a 0d 0a 71 75 65 72  8..83909....quer
37e20 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
37e30 45 43 54 20 41 4c 4c 20 2d 20 2b 20 35 33 20 2b  ECT ALL - + 53 +
37e40 20 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46 52   col2 AS col1 FR
37e50 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d  OM tab0 cor0..--
37e60 2d 2d 0d 0a 2d 32 30 0d 0a 2d 35 32 0d 0a 32 39  --..-20..-52..29
37e70 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
37e80 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
37e90 49 4e 43 54 20 2b 20 33 39 20 2b 20 2b 20 63 6f  INCT + 39 + + co
37ea0 6c 32 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  l2 AS col1 FROM 
37eb0 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
37ec0 2d 2d 0d 0a 36 35 0d 0a 36 36 0d 0a 37 37 0d 0a  --..65..66..77..
37ed0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
37ee0 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
37ef0 43 54 20 2b 20 28 20 2d 20 63 6f 6c 31 20 2b 20  CT + ( - col1 + 
37f00 28 20 2b 20 63 6f 6c 31 20 29 20 29 20 2a 20 74  ( + col1 ) ) * t
37f10 61 62 30 2e 63 6f 6c 31 20 41 53 20 63 6f 6c 32  ab0.col1 AS col2
37f20 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d   FROM tab0..----
37f30 0d 0a 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  ..0....query I r
37f40 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 33  owsort..SELECT 3
37f50 33 20 46 52 4f 4d 20 74 61 62 31 2c 20 74 61 62  3 FROM tab1, tab
37f60 30 20 41 53 20 63 6f 72 30 2c 20 74 61 62 31 20  0 AS cor0, tab1 
37f70 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 32  AS cor1..----..2
37f80 37 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67  7 values hashing
37f90 20 74 6f 20 37 36 64 61 38 62 63 37 63 61 65 31   to 76da8bc7cae1
37fa0 38 65 63 66 38 35 36 34 33 38 66 38 37 32 34 33  8ecf856438f87243
37fb0 30 63 38 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20  0c80....query I 
37fc0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
37fd0 44 49 53 54 49 4e 43 54 20 63 6f 6c 31 20 2a 20  DISTINCT col1 * 
37fe0 2b 20 63 6f 6c 30 20 2a 20 2b 20 63 6f 72 30 2e  + col0 * + cor0.
37ff0 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46 52 4f  col0 AS col1 FRO
38000 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab2 cor0..---
38010 2d 0d 0a 31 30 36 30 39 37 0d 0a 31 35 31 39 0d  -..106097..1519.
38020 0a 33 35 38 39 35 36 0d 0a 0d 0a 71 75 65 72 79  .358956....query
38030 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
38040 43 54 20 63 6f 6c 32 20 2d 20 2b 20 63 6f 6c 31  CT col2 - + col1
38050 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
38060 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 33 0d 0a 2d  b2..----..-33..-
38070 34 0d 0a 32 31 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  4..21....onlyif 
38080 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20  mysql # use DIV 
38090 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74  operator for int
380a0 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71  eger division..q
380b0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
380c0 61 62 65 6c 2d 31 36 32 35 0d 0a 53 45 4c 45 43  abel-1625..SELEC
380d0 54 20 41 4c 4c 20 2d 20 63 6f 6c 32 20 44 49 56  T ALL - col2 DIV
380e0 20 74 61 62 31 2e 63 6f 6c 31 20 63 6f 6c 30 20   tab1.col1 col0 
380f0 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d  FROM tab1..----.
38100 0a 2d 32 0d 0a 2d 35 0d 0a 2d 37 0d 0a 0d 0a 73  .-2..-5..-7....s
38110 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c  kipif postgresql
38120 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65   # PostgreSQL re
38130 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72  quires AS when r
38140 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63  enaming output c
38150 6f 6c 75 6d 6e 73 0d 0a 73 6b 69 70 69 66 20 6d  olumns..skipif m
38160 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
38170 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
38180 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 36 32  owsort label-162
38190 35 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20  5..SELECT ALL - 
381a0 63 6f 6c 32 20 2f 20 74 61 62 31 2e 63 6f 6c 31  col2 / tab1.col1
381b0 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 0d   col0 FROM tab1.
381c0 0a 2d 2d 2d 2d 0d 0a 2d 32 0d 0a 2d 35 0d 0a 2d  .----..-2..-5..-
381d0 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  7....query I row
381e0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
381f0 54 49 4e 43 54 20 63 6f 6c 31 20 2a 20 2d 20 63  TINCT col1 * - c
38200 6f 6c 30 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f  ol0 + col1 AS co
38210 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l0 FROM tab0 AS 
38220 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 39 37  cor0..----..-197
38230 38 0d 0a 2d 33 32 39 38 0d 0a 2d 38 30 30 38 0d  8..-3298..-8008.
38240 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72  ...skipif postgr
38250 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51  esql # PostgreSQ
38260 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68  L requires AS wh
38270 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70  en renaming outp
38280 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72  ut columns..quer
38290 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
382a0 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63  ECT DISTINCT - c
382b0 6f 72 30 2e 63 6f 6c 32 20 63 6f 6c 32 20 46 52  or0.col2 col2 FR
382c0 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
382d0 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 2d 33 33 0d 0a  .----..-1..-33..
382e0 2d 38 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  -82....query I r
382f0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
38300 4c 4c 20 2b 20 63 6f 6c 30 20 2a 20 63 6f 6c 30  LL + col0 * col0
38310 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20   + col1 AS col0 
38320 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
38330 30 0d 0a 2d 2d 2d 2d 0d 0a 33 35 0d 0a 34 31 30  0..----..35..410
38340 36 0d 0a 36 34 31 33 0d 0a 0d 0a 71 75 65 72 79  6..6413....query
38350 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
38360 43 54 20 63 6f 6c 30 20 2b 20 63 6f 6c 30 20 2a  CT col0 + col0 *
38370 20 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46 52   col2 AS col0 FR
38380 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 37  OM tab0..----..7
38390 30 0d 0a 37 33 38 37 0d 0a 38 31 36 0d 0a 0d 0a  0..7387..816....
383a0 71 75 65 72 79 20 49 49 49 20 72 6f 77 73 6f 72  query III rowsor
383b0 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2a 20  t..SELECT ALL * 
383c0 46 52 4f 4d 20 74 61 62 30 20 57 48 45 52 45 20  FROM tab0 WHERE 
383d0 4e 4f 54 20 4e 55 4c 4c 20 42 45 54 57 45 45 4e  NOT NULL BETWEEN
383e0 20 4e 55 4c 4c 20 41 4e 44 20 4e 55 4c 4c 20 41   NULL AND NULL A
383f0 4e 44 20 28 20 2b 20 63 6f 6c 32 20 29 20 4e 4f  ND ( + col2 ) NO
38400 54 20 49 4e 20 28 20 2b 20 63 6f 6c 30 20 2a 20  T IN ( + col0 * 
38410 63 6f 6c 31 20 29 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a  col1 )..----....
38420 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
38430 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 32 20 2d  .SELECT + col2 -
38440 20 2d 20 63 6f 6c 30 20 2a 20 63 6f 6c 32 20 46   - col0 * col2 F
38450 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab0..----..
38460 33 36 0d 0a 37 33 38 30 0d 0a 38 32 35 0d 0a 0d  36..7380..825...
38470 0a 71 75 65 72 79 20 49 49 49 49 49 49 49 49 49  .query IIIIIIIII
38480 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
38490 20 41 4c 4c 20 2a 20 46 52 4f 4d 20 74 61 62 30   ALL * FROM tab0
384a0 2c 20 74 61 62 31 20 63 6f 72 30 20 4a 4f 49 4e  , tab1 cor0 JOIN
384b0 20 74 61 62 32 20 4f 4e 20 4e 55 4c 4c 20 3c 3e   tab2 ON NULL <>
384c0 20 4e 55 4c 4c 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a 6f   NULL..----....o
384d0 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73  nlyif mysql # us
384e0 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66  e DIV operator f
384f0 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73  or integer divis
38500 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ion..query I row
38510 73 6f 72 74 20 6c 61 62 65 6c 2d 31 36 33 33 0d  sort label-1633.
38520 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f  .SELECT ALL - co
38530 6c 32 20 44 49 56 20 2d 20 63 6f 6c 30 20 41 53  l2 DIV - col0 AS
38540 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20   col0 FROM tab0 
38550 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30  cor0..----..0..0
38560 0d 0a 31 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  ..1....skipif my
38570 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
38580 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
38590 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 36 33 33  wsort label-1633
385a0 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63  ..SELECT ALL - c
385b0 6f 6c 32 20 2f 20 2d 20 63 6f 6c 30 20 41 53 20  ol2 / - col0 AS 
385c0 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 63  col0 FROM tab0 c
385d0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d  or0..----..0..0.
385e0 0a 31 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73  .1....skipif pos
385f0 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72  tgresql # Postgr
38600 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53  eSQL requires AS
38610 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f   when renaming o
38620 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71  utput columns..q
38630 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
38640 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
38650 2b 20 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c 31 20  + col2 * - col1 
38660 2b 20 63 6f 6c 32 20 63 6f 6c 31 20 46 52 4f 4d  + col2 col1 FROM
38670 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
38680 2d 2d 2d 0d 0a 2d 31 35 30 38 0d 0a 2d 36 30 38  ---..-1508..-608
38690 0d 0a 2d 38 31 30 0d 0a 0d 0a 71 75 65 72 79 20  ..-810....query 
386a0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
386b0 54 20 41 4c 4c 20 63 6f 6c 32 20 2b 20 2d 20 63  T ALL col2 + - c
386c0 6f 72 30 2e 63 6f 6c 30 20 2a 20 63 6f 6c 30 20  or0.col0 * col0 
386d0 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
386e0 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32 32 34 0d 0a  0..----..-1224..
386f0 2d 35 34 33 0d 0a 2d 37 38 33 39 0d 0a 0d 0a 71  -543..-7839....q
38700 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
38710 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 31 20  SELECT ALL col1 
38720 2a 20 63 6f 6c 31 20 2b 20 63 6f 6c 30 20 46 52  * col1 + col0 FR
38730 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31  OM tab1..----..1
38740 36 34 0d 0a 32 34 39 0d 0a 36 37 39 0d 0a 0d 0a  64..249..679....
38750 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
38760 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
38770 20 74 61 62 30 2e 63 6f 6c 31 20 2a 20 74 61 62   tab0.col1 * tab
38780 30 2e 63 6f 6c 30 20 2b 20 74 61 62 30 2e 63 6f  0.col0 + tab0.co
38790 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d  l0 FROM tab0..--
387a0 2d 2d 0d 0a 32 30 38 38 0d 0a 33 34 33 30 0d 0a  --..2088..3430..
387b0 38 31 38 38 0d 0a 0d 0a 73 6b 69 70 69 66 20 70  8188....skipif p
387c0 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74  ostgresql # Post
387d0 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20  greSQL requires 
387e0 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67  AS when renaming
387f0 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d   output columns.
38800 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
38810 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63  ..SELECT ALL - c
38820 6f 6c 32 20 2a 20 2d 20 63 6f 72 30 2e 63 6f 6c  ol2 * - cor0.col
38830 32 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 63 6f  2 + cor0.col0 co
38840 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l0 FROM tab1 AS 
38850 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 39 31 39  cor0..----..2919
38860 0d 0a 33 33 31 33 0d 0a 39 32 39 36 0d 0a 0d 0a  ..3313..9296....
38870 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
38880 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
38890 20 2d 20 2b 20 63 6f 6c 31 20 2b 20 2b 20 63 6f   - + col1 + + co
388a0 6c 31 20 2a 20 63 6f 6c 30 20 46 52 4f 4d 20 74  l1 * col0 FROM t
388b0 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
388c0 2d 0d 0a 31 30 32 37 0d 0a 35 32 0d 0a 36 33 30  -..1027..52..630
388d0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
388e0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
388f0 2b 20 2b 20 63 6f 6c 32 20 2a 20 63 6f 6c 30 20  + + col2 * col0 
38900 2b 20 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c 30 20  + col1 * - col0 
38910 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
38920 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
38930 0a 2d 32 35 37 34 0d 0a 2d 32 38 0d 0a 31 36 35  .-2574..-28..165
38940 39 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  9....onlyif mysq
38950 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72  l # use DIV oper
38960 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72  ator for integer
38970 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79   division..query
38980 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
38990 2d 31 36 34 31 0d 0a 53 45 4c 45 43 54 20 41 4c  -1641..SELECT AL
389a0 4c 20 63 6f 6c 31 20 44 49 56 20 2b 20 63 6f 72  L col1 DIV + cor
389b0 30 2e 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46  0.col1 AS col2 F
389c0 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
389d0 0d 0a 2d 2d 2d 2d 0d 0a 31 0d 0a 31 0d 0a 31 0d  ..----..1..1..1.
389e0 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
389f0 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
38a00 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
38a10 74 20 6c 61 62 65 6c 2d 31 36 34 31 0d 0a 53 45  t label-1641..SE
38a20 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 31 20 2f 20  LECT ALL col1 / 
38a30 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 41 53 20 63  + cor0.col1 AS c
38a40 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol2 FROM tab0 AS
38a50 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 0d 0a   cor0..----..1..
38a60 31 0d 0a 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20  1..1....query I 
38a70 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
38a80 41 4c 4c 20 2d 20 63 6f 6c 30 20 2b 20 63 6f 6c  ALL - col0 + col
38a90 32 20 2a 20 2b 20 63 6f 6c 32 20 41 53 20 63 6f  2 * + col2 AS co
38aa0 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l2 FROM tab1 AS 
38ab0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 39 31 33  cor0..----..2913
38ac0 0d 0a 33 31 38 35 0d 0a 39 31 33 36 0d 0a 0d 0a  ..3185..9136....
38ad0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
38ae0 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
38af0 20 2b 20 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c 30   + col1 * + col0
38b00 20 2b 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 46   + + cor0.col1 F
38b10 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
38b20 0d 0a 2d 2d 2d 2d 0d 0a 31 30 34 0d 0a 31 30 35  ..----..104..105
38b30 33 0d 0a 36 35 30 0d 0a 0d 0a 71 75 65 72 79 20  3..650....query 
38b40 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
38b50 54 20 41 4c 4c 20 2d 20 2d 20 63 6f 6c 32 20 2a  T ALL - - col2 *
38b60 20 2b 20 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c 31   + col0 + - col1
38b70 20 2a 20 2d 20 63 6f 6c 30 20 41 53 20 63 6f 6c   * - col0 AS col
38b80 32 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30  2 FROM tab0 cor0
38b90 0d 0a 2d 2d 2d 2d 0d 0a 31 35 33 39 37 0d 0a 32  ..----..15397..2
38ba0 38 35 36 0d 0a 33 34 33 30 0d 0a 0d 0a 71 75 65  856..3430....que
38bb0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
38bc0 4c 45 43 54 20 41 4c 4c 20 2d 20 2d 20 63 6f 72  LECT ALL - - cor
38bd0 30 2e 63 6f 6c 31 20 2a 20 63 6f 6c 31 20 2d 20  0.col1 * col1 - 
38be0 2d 20 63 6f 6c 30 20 2a 20 63 6f 6c 31 20 46 52  - col0 * col1 FR
38bf0 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
38c00 0a 2d 2d 2d 2d 0d 0a 31 32 30 39 0d 0a 37 34 30  .----..1209..740
38c10 0d 0a 37 35 34 0d 0a 0d 0a 71 75 65 72 79 20 49  ..754....query I
38c20 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
38c30 20 41 4c 4c 20 2d 20 2b 20 63 6f 72 30 2e 63 6f   ALL - + cor0.co
38c40 6c 30 20 2a 20 63 6f 6c 32 20 2a 20 63 6f 6c 31  l0 * col2 * col1
38c50 20 2b 20 2d 20 63 6f 6c 32 20 46 52 4f 4d 20 74   + - col2 FROM t