Ravindra BagaleCourses & study guides मराठी Track your progress

Ravi Sir's Cyber Security Cards › Revision Cards

ORDER BY, LIMIT, DISTINCT and Aliases

ORDER BY, LIMIT, DISTINCT and Aliases ORDER BY sorts rows. LIMIT returns only a few rows. DISTINCT removes repeats. AS gives a column a new name. Attackers try ORDER BY 1, 2, 3… until the query breaks. That tells them how many columns it has. This is the first step of a UNION SQL injection. SELECT *

ORDER BY, LIMIT, DISTINCT and Aliases ORDER BY sorts rows. LIMIT returns only a few rows. DISTINCT removes repeats. AS gives a column a new name. Attackers try ORDER BY 1, 2, 3… until the query breaks. That tells them how many columns it has. This is the first step of a UNION SQL injection. SELECT *
ORDER BY, LIMIT, DISTINCT and Aliases · Download PNG
Read card text

What this card says

What it is

ORDER BY sorts rows. LIMIT returns only a few rows. DISTINCT removes repeats. AS gives a column a new name.

Why it matters for security

Attackers try ORDER BY 1, 2, 3… until the query breaks. That tells them how many columns it has.

This is the first step of a UNION SQL injection.

Common mistake

SELECT * on a huge table without LIMIT. It floods the screen and slows the server.

Learn more in the lesson: 10.6 ORDER BY, LIMIT, DISTINCT and Aliases

See all Ravi Sir's Cyber Security Cards