Mysql-What does this query mean?

2019-09-12 13:04发布

问题:

I'm trying to understand some queries

one of them is

(select (@a) 
 from (select(@a:=0x00)
     ,(select (@a) 
       from (information_schema.schemata)
       where (@a) in (@a:=concat(@a,schema_name,'<br>'))
       )
 ) a
)

Can some explain it please?

回答1:

Not much to explain, it is a horrendous abuse of session variables. It looks like it is trying to get a concatenated list of database names, in the same manner GROUP_CONCAT would with a delimiter of <br>; but it looks very unreliable.



标签: mysql mysqli