1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
select database();
database()
test
select database() = "test";
database() = "test"
1
select user() like "%@%";
user() like "%@%"
1
select version() > "2009.01.756";
version() > "2009.01.756"
1
explain extended select database(), user();
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
Note 1003 select database() AS `database()`,user() AS `user()`
create table t1 (version char(60)) select database(), user(), version() as 'version';
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`database()` varbinary(136) DEFAULT NULL,
`user()` varbinary(308) DEFAULT NULL,
`version` varchar(60) DEFAULT NULL
) ENGINE=DEFAULT
drop table t1;
select TRUE,FALSE,NULL;
TRUE FALSE NULL
1 0 NULL
create table t1 (c1 char(5));
insert into t1 values('row 1');
insert into t1 values('row 2');
insert into t1 values('row 3');
select concat(SUBSTRING(user(), 0, 4), '--', c1) from t1;
concat(SUBSTRING(user(), 0, 4), '--', c1)
--row 1
--row 2
--row 3
select concat(database(), '--', c1) from t1;
concat(database(), '--', c1)
test--row 1
test--row 2
test--row 3
drop table t1;
create table t1 (a char(10));
select * from t1 where a=version();
a
select * from t1 where a=database();
a
select * from t1 where a=user();
a
insert into t1 values ('a');
select left(concat(a,version()),1) from t1;
left(concat(a,version()),1)
a
drop table t1;
|