HAKATEMIA
09Injection Techniques

(MySQL) ORDER BY and Error-Based Technique

Medium45MIN

ORDER BY

The ORDER BY clause in SQL, as you have already learned when familiarizing yourself with the UNION technique, sorts the rows retrieved from the database either by the column name or by the ordinal number. In addition, ORDER BY takes a direction parameter, whose value can be ASC (ascending) or DESC (descending).

For example, a query like this would retrieve all rows from the products table and sort them in ascending order by price (cheapest first):

SQL
1SELECT * FROM products ORDER BY price ASC
1 / 7
Hakatemia Pro

Learn to hack — start here

Hundreds of interactive courses, virtual labs and CTF challenges in your browser. Start a free trial — no card required.