如果要把查询结果按照字段id升序排序,再按字段title降序排序,下面哪个链式操作表达式满足这个需求:
A: order(“id , title”)
B: order(“id , title desc”)
C: order(“id title desc”)
D: order(“id asc title desc”)
A: order(“id , title”)
B: order(“id , title desc”)
C: order(“id title desc”)
D: order(“id asc title desc”)
举一反三
- 查询主键id从高到低排序的前10条记录的语句是() A: SELECT * FROM table ORDER BY id ASC limit 1,10 B: SELECT * FROM table ORDER id DESC limit 10 C: SELECT * FROM table ORDER BY id DESC limit 10 D: SELECT * FROM table ORDER id ASC limit 1,10
- 输出公司的名称及id,以id的升序排列 A: SELECT name, id FROM job ORDER BY id ASC; B: SELECT name, id FROM job ORDER BY id DESC; C: SELECT name, id FROM job ORDER BY name DECS; D: SELECT name, id FROM job ORDER BY name ASC;
- ORDER BY可以对查询结果进行排序,ASC为降序,DESC为升序。
- 下面的SQL查询语句中的排序方法是()。 SELECT * FROM tb_student order by id desc,age; A: 返回的记录按id降序排列 B: 返回的记录按age降序排列 C: 返回的记录先按id降序排列,再按age升序排列 D: 返回的记录先按id升序排列,再按age降序排列
- 排序方式可以升序order by age asc,也可以降序 order by age desc。