0

I found this sql query online , i did work but am not quite able to parse it . i haven't used any queries with '@' or " := " if some one could explain me what it means and which topic it comes under , it would help me a lot ..

 select (select (@) from (select(@:=0x00),(select (@) from (information_schema.columns) where (table_schema>=@) and (@)in (@:=concat(@,0x3C,0x62,0x72,0x3E,' [ ',table_schema,' ] > ',table_name,' > ',column_name))))a)# 
Gumbo
  • 643,351
  • 109
  • 780
  • 844
Dhayalan Pro
  • 579
  • 1
  • 5
  • 20

1 Answers1

2

First of all i would make the query a litte bit more readable by reformatting it:

1) SELECT (SELECT (@)
2)         FROM (SELECT (@:=0x00),
3)                      (SELECT (@)
4)                       FROM (information_schema.columns)
5)                       WHERE (table_schema >= @)
6)                       AND   (@) IN (@:=CONCAT(@,0x3C,0x62,0x72,0x3E,' [ ',table_schema,' ] > ',table_name,' > ',column_name))
7)                       )
8)               )
9)        a);

The assignment of @ is as follows:

  1. In Line 3 it gets the value 0x00 (Decimal: 0)
  2. In line 5 this value is used for the greater than (table_schema >= 0)
  3. Line 6 is a way to concat each schema, table and column name into @
  4. @ is returned in line 1 and contains a concatenated list of your structures

In line 6 an additional <br> (0x3C,0x62,0x72,0x3E) is added to the variable to make the output more readable

DKSan
  • 4,187
  • 3
  • 25
  • 35