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;
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;
16
SELECT number, alpha, CONCAT_WS('<->',number,alpha) AS new
17
FROM t1 GROUP BY new LIMIT 1;
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;
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;
27
1413006 idlfmv 1413006<------------------>idlfmv
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';
35
select 'a' union select concat('a', -4);
39
select 'a' union select concat('a', -4.5);
43
select 'a' union select concat('a', -(4 + 1));
47
select 'a' union select concat('a', 4 - 5);
51
select 'a' union select concat('a', -'3');
55
select 'a' union select concat('a', -concat('3',4));
59
select 'a' union select concat('a', -0);
63
select 'a' union select concat('a', -0.0);
67
select 'a' union select concat('a', -0.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 )
74
concat((select x from (select 'a' as x) as t1 ),
75
(select y from (select 'b' as y) as t2 ))
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;