Quick Search:
CODE
Oracle PL/SQL Code Library
JOBS
Find Or Post Oracle Jobs
FORUM
Oracle Discussion & Chat
 The Oracle DESC Clause      [Return To Index] Jump to:  
  Looking for the original pages? (formerly called "Morgan's Library") You can find them here.

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      :      Code Library      :      Sponsors      :      Privacy      :      Terms of Use      :      Contact Us 78 users online    © 2009 psoug.org
PSOUG LOGIN
Username: 
Password: 
Forgot your password?