在sqlserver 2005中查询以显示记录 [英] Query in sqlserver 2005 to display records
本文介绍了在sqlserver 2005中查询以显示记录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
晚上好,
我在sqlserver 2005数据库中有大量数据,并且
如何在sqlserver 2005中编写查询,以明智地显示记录字母.(a-z)
Thanx Experts.
Good Evening ,
I have large number of data in sqlserver 2005 database , and
How to write a query in sqlserver 2005, to display the records alphabets wise.(a-z)
Thanx Experts.
推荐答案
您需要使用order by
子句对查询中的记录进行排序.
You need to use the order by
clause to order records in a query.
SELECT EMPLOYEE_NAME FROM EMPLOYEE_MASTER ORDER BY EMPLOYEE_NAME ASC
使用t-sql中的"ORDER BY"对您的记录进行排序.您可以在这里 http://www.w3schools.com/sql/sql_orderby.asp [ ^ ]
Use of "ORDER BY" in t-sql sorts your records. You can read more about it here http://www.w3schools.com/sql/sql_orderby.asp[^]
SELECT * FROM [Table] ORDER BY [Column] ASC
或相反
Or the other way
SELECT * FROM [Table] ORDER BY [Column] DESC
如果您有大量记录,则可以考虑为该列建立索引. http://www.sql-server-performance.com/2007/optimizing-indexes-general / [^ ]
If you have a large number of records you may consider indexing that column. http://www.sql-server-performance.com/2007/optimizing-indexes-general/[^]
这篇关于在sqlserver 2005中查询以显示记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文