SQL Filtering and Sorting Data

Language:
SQL
22 views
0 favorites
12 hours ago

Code Implementation

SQL
SELECT name, age
FROM users
WHERE age > 25
ORDER BY age ASC;

Retrieve data from a table that meets specific criteria and sort it by a certain field. This SQL code snippet assumes you want to retrieve users over 25 years old from the users table and sort them by age in ascending order.

#SQL Sorting

Snippet Description

  • Input: Use data from the users table. Query where the age field is greater than 25, and sort by the age field in ascending ASC order.
  • Output: After executing the above query, the result will be:
nameage
Bob30

Comments

Loading...