DQL模糊查询/排序查询

模糊查询

查姓马:

  select * from stu where name like '马%';

查第二个字是花:

  select * from stu where name like '_花%';     -- 下划线占第一个位置

查名字里包含德::

  select * from stu where name like '%德%';

 

排序查询

查学生年龄升序:

  selectfrom stu order by age asc;  -- asc可不写,默认升序

查学生年龄降序:

  select * from stu order by age desc; 

查学生成绩数学降序,数学一样则英语升序:

  select * from stu order by math desc, english asc;

 

  

posted @ 2023-02-28 09:11  大灰狼21  阅读(20)  评论(0)    收藏  举报