下面这条SQL语句:
select * from article where id = 1 and (select 1 from (select count(*),concat(version(),floor(rand(0)*2))x from information_schema.tables group by x)a);
1. 其中floor(rand(0)*2))x 后面的x是怎么解释?
2. 语句最后的a怎么解释?
select * from article where id = 1 and (select 1 from (select count(*),concat(version(),floor(rand(0)*2))x from information_schema.tables group by x)a);
1. 其中floor(rand(0)*2))x 后面的x是怎么解释?
2. 语句最后的a怎么解释?
解决方案
20
concat(version(),floor(rand(0)*2)将这个取别名叫x,你也可以叫其他的
select count(*),concat(version(),floor(rand(0)*2))x from information_schema.tables group by x
根据x分组,也可以说是根据concat(version(),floor(rand(0)*2))分组
select count(*),concat(version(),floor(rand(0)*2))x from information_schema.tables group by x
根据x分组,也可以说是根据concat(version(),floor(rand(0)*2))分组
5
(select count(*),concat(version(),floor(rand(0)*2)) x
(select count(*), x from information_schema.tables group by x) a
(select count(*), x from information_schema.tables group by x) a
15
a 是这个查询数据集
select count(*), concat(version(),floor(rand(0)*2))x from information_schema.tables group by x 的别名
也可以写成
(select count(*), concat(version(),floor(rand(0)*2))x from information_schema.tables group by x) AS a