In SQL, you can use the ORDER BY
clause to sort rows in a result set. The ORDER BY
clause is typically used in conjunction with a SELECT
statement to specify the sorting criteria for the rows returned by the query.
For example, if you have a table called employees
and you want to retrieve the records sorted by the last_name
column in ascending order, you would use the following SQL query:
SELECT * FROM employees
ORDER BY last_name ASC;
In this query, the ORDER BY
clause is used to sort the rows in the employees
table based on the last_name
column in ascending (A to Z) order. You can also use DESC
to sort in descending order (Z to A):
SELECT * FROM employees
ORDER BY last_name DESC;
So, the correct answer is the ORDER BY
clause.
Hello, I’m Hridhya Manoj. I’m passionate about technology and its ever-evolving landscape. With a deep love for writing and a curious mind, I enjoy translating complex concepts into understandable, engaging content. Let’s explore the world of tech together