1
by brian
clean slate |
1 |
DROP TABLE IF EXISTS t1; |
2 |
CREATE TABLE t1 ( number INT NOT NULL, alpha CHAR(6) NOT NULL ); |
|
3 |
INSERT INTO t1 VALUES (1413006,'idlfmv'), |
|
4 |
(1413065,'smpsfz'),(1413127,'sljrhx'),(1413304,'qerfnd'); |
|
5 |
SELECT number, alpha, CONCAT_WS('<---->',number,alpha) AS new |
|
6 |
FROM t1 GROUP BY number; |
|
7 |
number alpha new |
|
8 |
1413006 idlfmv 1413006<---->idlfmv |
|
9 |
1413065 smpsfz 1413065<---->smpsfz |
|
10 |
1413127 sljrhx 1413127<---->sljrhx |
|
11 |
1413304 qerfnd 1413304<---->qerfnd |
|
12 |
SELECT CONCAT_WS('<---->',number,alpha) AS new |
|
13 |
FROM t1 GROUP BY new LIMIT 1; |
|
14 |
new
|
|
15 |
1413006<---->idlfmv |
|
16 |
SELECT number, alpha, CONCAT_WS('<->',number,alpha) AS new |
|
17 |
FROM t1 GROUP BY new LIMIT 1; |
|
18 |
number alpha new |
|
19 |
1413006 idlfmv 1413006<->idlfmv |
|
20 |
SELECT number, alpha, CONCAT_WS('-',number,alpha,alpha,alpha,alpha,alpha,alpha,alpha) AS new |
|
21 |
FROM t1 GROUP BY new LIMIT 1; |
|
22 |
number alpha new |
|
23 |
1413006 idlfmv 1413006-idlfmv-idlfmv-idlfmv-idlfmv-idlfmv-idlfmv-idlfmv |
|
24 |
SELECT number, alpha, CONCAT_WS('<------------------>',number,alpha) AS new |
|
25 |
FROM t1 GROUP BY new LIMIT 1; |
|
26 |
number alpha new |
|
27 |
1413006 idlfmv 1413006<------------------>idlfmv |
|
28 |
drop table t1; |
|
29 |
create table t1 (a char(4), b double, c date, d tinyint(4)); |
|
30 |
insert into t1 values ('AAAA', 105, '2003-03-01', 1); |
|
31 |
select * from t1 where concat(A,C,B,D) = 'AAAA2003-03-011051'; |
|
32 |
a b c d |
|
33 |
AAAA 105 2003-03-01 1 |
|
34 |
drop table t1; |
|
35 |
select 'a' union select concat('a', -4); |
|
36 |
a
|
|
37 |
a
|
|
38 |
a-4 |
|
39 |
select 'a' union select concat('a', -4.5); |
|
40 |
a
|
|
41 |
a
|
|
42 |
a-4.5 |
|
43 |
select 'a' union select concat('a', -(4 + 1)); |
|
44 |
a
|
|
45 |
a
|
|
46 |
a-5 |
|
47 |
select 'a' union select concat('a', 4 - 5); |
|
48 |
a
|
|
49 |
a
|
|
50 |
a-1 |
|
51 |
select 'a' union select concat('a', -'3'); |
|
52 |
a
|
|
53 |
a
|
|
54 |
a-3 |
|
55 |
select 'a' union select concat('a', -concat('3',4)); |
|
56 |
a
|
|
57 |
a
|
|
58 |
a-34 |
|
59 |
select 'a' union select concat('a', -0); |
|
60 |
a
|
|
61 |
a
|
|
62 |
a0
|
|
63 |
select 'a' union select concat('a', -0.0); |
|
64 |
a
|
|
65 |
a
|
|
66 |
a0.0
|
|
67 |
select 'a' union select concat('a', -0.0000); |
|
68 |
a
|
|
69 |
a
|
|
70 |
a0.0000
|
|
71 |
select concat((select x from (select 'a' as x) as t1 ), |
|
72 |
(select y from (select 'b' as y) as t2 )) from (select 1 union select 2 ) |
|
73 |
as t3; |
|
74 |
concat((select x from (select 'a' as x) as t1 ), |
|
75 |
(select y from (select 'b' as y) as t2 )) |
|
76 |
ab
|
|
77 |
ab
|
|
78 |
create table t1(f1 varchar(6)) charset=utf8; |
|
79 |
insert into t1 values ("123456"); |
|
80 |
select concat(f1, 2) a from t1 union select 'x' a from t1; |
|
81 |
a
|
|
82 |
1234562
|
|
83 |
x
|
|
84 |
drop table t1; |