重问MySQL解释

时间:2013-01-27 10:31:26

标签: mysql

我想了解这个查询的作用。

任何人都可以用语言向我解释以下查询的含义吗?

http://www.kachakil.com/pista.aspx?id_pista=1 

and exists (select * from contrasena) and 100 > 

(select count(*) from information_schema.columns, information_schema.columns T1, 
information_schema T2)   

本文提到了上述查询:使用重量查询的基于时间的盲SQL注入(作者:Chema Alonso ......)

我试图弄清楚每一段代码的含义,我希望有人会帮助我。

1)这是URL:

http://www.kachakil.com/pista.aspx?id_pista=1

2)此时我被困了(当然我知道select * from contrasena的意思(可能是反之亦然) 表,所以它意味着:选择表反对的所有记录)..但其余的?这是一个子查询,但我无法弄清楚其含义

and exists (select * from contrasena) and 100 >

3)这是一个选择,其目的是计算表格columns的记录数量  属于数据库information_schema的。表格columns也被重命名为T1,这是什么意思?:information_schema T2

我为我的问题道歉...我希望有人能帮助我......谢谢你们。

1 个答案:

答案 0 :(得分:1)

您无法使用and启动查询,因此可能这是查询的一部分。语法可能意味着从链接开始添加SQL查询。

如果表exists (select * from contrasena)有任何记录,则

contrasena为真。

select count(*) from information_schema.columns, information_schema.columns T1, information_schema T2对我来说不是有效的语法,因为information_schema不是表格。

我认为上面应该是select count(*) from information_schema.columns, information_schema.columns T1tableA, tableB表示tableA CROSS JOIN tableB,因此会为tableAtableB的每个记录组合生成一条记录。 information_schema.columns是一个表,其中包含数据库中每列(在每个表中)的记录,描述该列。因此子查询实质上返回数据库中列数的平方。所以:

100 > (select count(*) from ...)
=> 100 > DB_COL_COUNT^2 (not valid SQL)
=> 10^2 > DB_COL_COUNT^2 (not valid SQL)
=> 10 > DB_COL_COUNT (not valid SQL)
=> 10 > (select count(*) from information_schema.columns)

第一行在含义方面等同于最后一行,但不是执行时间。

因此,如果数据库中的行数少于10行,则100 > ...将返回true。

介于两者之间的and只是意味着所有条件都必须为真。

相关问题