Union select null, null, null, null, null, null, null from information_schema.tables. for a small database containing three tables. this instruction is used in sql injection I tried it and it worked but I didn't really know how it works can somebody help me...
qndbq7bbxilyCzFA') UNION ALL SELECT NULL,NULL,NULL,CONCAT(0x716e646271,IFNULL(CAST(grantee AS CHAR),0x20),0x716a716771),NULL FROM INFORMATION_SCHEMA.USER_PRIVILEGES#qjqgq.
UNION ALL SELECT NULL, *, NULL, NULL FROM email. I understand what this does and why; the hacker needs to create a query that has the same number of columns as the query it's being merged with, and shifted around the * to make sure the emails are displayed. That's not my question.
SELECT * FROM `mydata`.`mytable` WHERE CONCAT(<list of columns>) IS NOT NULL. All we are missing now is the list of nullable columns, comma-separated. We're going to use the GROUP_CONCAT function to produce the final statement, which we will execute like this
select, is obvious. null, is just a place holder that is used because a union statement requires that the number of fields match the 1st query that it’s appending to.
Note: A NULL value is different from a zero value or a field that contains spaces. A field with a NULL value is one that has been left blank during record creation!
IS NULL вернёт истину, если операнд имеет значение NULL и ложь, если он им не является.
CONCAT() returns NULL if any argument is NULL. mysql> SELECT CONCAT('My', 'S', 'QL')
Заменяет значение NULL указанным замещающим значением.Replaces NULL with the specified replacement value.
Тем не менее, NULL, как NULL-значение, часто используется в SQL. Предположим, появился покупатель, которому еще не назначен продавец. Чтобы констатировать этот факт, нужно ввести значение NULL в поле snum, а реальное значение включить туда позже...