The order by keyword is use to sort the records in ascending or descending order. We use ASC for ascending and DESC for sorting the records in descending order.
<?php
SELECT column1, column2, ...
FROM table_name
ORDER BY column1, column2, ... ASC|DESC;
?>
Note: where we didn’t mention the ASC or DESC it means it will sort the records in ascending order by default.
<?php
SELECT * FROM Customers
ORDER BY Country;
?>
We can sort several columns in different order. Like we sort a column in ascending order and the other in descending order,
<?php
SELECT * FROM Customers
ORDER BY Country ASC, CustomerName DESC;
?>