Oracle Query: Sorting Records with ORDER BY
Q: Write an Oracle query to retrieve records from a table sorted in ascending order based on a specific column using the ORDER BY clause.
- Oracle
- Mid level question
Explore all the latest Oracle interview questions and answers
ExploreMost Recent & up-to date
100% Actual interview focused
Create Oracle interview for FREE!
To retrieve records from a table in Oracle and sort them in ascending order based on a specific column, you can use the ORDER BY clause in your query. Here's an example query:
SELECT * FROM table_name
ORDER BY column_name ASC;
Replace "table_name" with the actual name of the table you want to query and "column_name" with the specific column you want to use for sorting.
For example, if you have a table named "Products" and you want to retrieve all records sorted in ascending order based on the "price" column, the query would be:
SELECT * FROM Products
ORDER BY price ASC;
Executing this query will retrieve all records from the "Products" table and sort them in ascending order based on the "price" column.
Remember to adjust the table name and column name based on your specific database schema and requirements.


