根据名字排序查询 SQL

根据名字排序查询 SQL:
2024-11-12 23:57:35
推荐回答(5个)
回答1:

1、在SQL中,排序关键字为ORDER BY。

2、假如要查询表t1中数据并按“名字”字段排序,可以使用以下语句:

SELECT * FROM t1 ORDER BY 名字

3、上述排序方式默认为正序排列,若想倒序排列,可以在语句最后加上 DESC。

回答2:

select * from [表名] order by [姓名]
按名字升序排序(按中文拼音首字母)

select * from [表名] order by [姓名]desc
降序排序

select * from [表名] order by substring([姓名],1,1)
接第一个字符排序

回答3:

select * from table order by name;
就是样了。一般的排序都是用order by的。如果还想另外分那就要在取出的数据里进行排序了。

回答4:

select * from table1 order by name1

回答5:

select * from 表名 ORDER BY name.