简体   繁体   English

"这个 MySQL 查询是什么意思?"

[英]What does this MySQL query mean?

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
)

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> ; 看起来它正在尝试获取数据库名称的串联列表, 就像 GROUP_CONCAT的分隔符为<br> but it looks very unreliable. 但是看起来非常不可靠。

Taking out many of the redundant parens that are not important, so we can strip those.取出许多不重要的冗余括号,这样我们就可以去掉它们。 Then some slight formatting for readability.然后进行一些轻微的格式化以提高可读性。

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM