mysql降序的語句 mysql創(chuàng)建索引的時(shí)候支持字段的desc排序方式嗎?
mysql創(chuàng)建索引的時(shí)候支持字段的desc排序方式嗎?MySQL在創(chuàng)建索引時(shí)支持ASC或desc排序。例如,創(chuàng)建表時(shí),在數(shù)據(jù)庫查詢中創(chuàng)建表tbl1(id int unique,sname varcha
mysql創(chuàng)建索引的時(shí)候支持字段的desc排序方式嗎?
MySQL在創(chuàng)建索引時(shí)支持ASC或desc排序。
例如,創(chuàng)建表時(shí),在數(shù)據(jù)庫查詢中創(chuàng)建表tbl1(id int unique,sname varchar(50),同時(shí)索引tbl1 u2; index 2; sname(sname DESC))以現(xiàn)有表語法創(chuàng)建索引create[unique | Fulltext | spatial]index name on table name(field name[length][ASC | DESC])~,通常需要排序,有時(shí)可能有多個(gè)排序條件。
例如:數(shù)據(jù)庫:a b
1 103 1 101
2 201 2 203 1 102 2 202排序后:a b 1 103 1 102 1 101 2 203 2 202 2 201語句:從表a中選擇a.a,a.b order by a.a ASC,a.b desc ASC連接多個(gè)排序,并用逗號將它們與下一個(gè)查詢分開!