Quick Search:
 
 The Oracle DESC Clause      [Return To Index] Jump to:  

Term: DESC

Definition:
You can sort the results of a SQL query by any field in an ascending (ASC) or descending (DESC) order by using the 'ORDER BY' clause at the end of a query.

For example, if the users table contained the names "Frank Miller, Mary Anderson, Jane Wilson, and John Chatsworth", you could use this for results sorted in a descending order:

SELECT * FROM users 
ORDER_BY last_name DESC;


This would produce output like this:

Jane Wilson
Frank Miller
John Chatsworth
Mary Anderson


or you could use this for results sorted in an ascending order:

SELECT * FROM users 
ORDER_BY last_name ASC;


This would produce output like this:

Mary Anderson
John Chatsworth
Frank Miller
Jane Wilson



Related Links:

Related Code Snippets:
  • SQL*Plus Describe - Describe can be used in SQL*Plus to view tables, procedures, functions, packages.
 
   Home |    Search |    Code Library |    Sponsors |    Privacy |    Terms of Use |    Contact Us © 2003 - 2024 psoug.org