How do you sort a table?

Showing Answers 1 - 11 of 11 Answers

sangeeta

  • Jun 1st, 2005
 

we can sort the table by giving asc or desc in order by clause.by default it is desc 
 
eg:select empno,last_name 
from emp 
order by last_name asc;

  Was this answer useful?  Yes

Muhammad Ali

  • Oct 10th, 2005
 

Correct it. By defualt order is asc not desc.

  Was this answer useful?  Yes

manmohan

  • Dec 26th, 2005
 

no need to write asc because it is by default.

if we want to sort in descending order then we need to specify desc

with the order by command.

  Was this answer useful?  Yes

Bhawesh

  • Feb 21st, 2006
 

in order to sort a table we use ORDER BY Clause.

order by clause has basically 2 options ie: asc,desc.

asc: to sort a table in ascending order.

desc: to sort a table in decending order.

By default a table is sorted in ascending order.

eg: select * from <table_name> [where <condition>]

     orderby <field name1, [field_name2.........]> [asc/desc];

[ ] optional.

  Was this answer useful?  Yes

quonos

  • May 1st, 2007
 

Do you mean Select = Ordering table?
It's a question about creating clustered index on table not ordering "data from table" for me.

  Was this answer useful?  Yes

nalinicisf

  • May 19th, 2008
 

contents or data of the table can be sorted by using clause ORDER BY  in SELECT statement.

By default the table is in ASCENDING order.

SYN: SELECT  * from [table name]
         where [condition]

         ORDER BY  [column1..] [asc/desc];

dineshctbm

  • Jul 2nd, 2011
 

Order By is a keyword which is using for sort the table records either ascending or desending.

For eg,

for ascending,
Select emp_name,emp_identity from emp order by emp_identity;
Select emp_name,emp_identity from emp order by emp_identity asc;

for desending,
Select emp_name,emp_identity from emp order by emp_identity desc;

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions