MYSQL练习1 DQL查询练习
- 查询年龄为20,21,22,23岁的员工信息
select * from workers where age in (20,21,22,23);
- 查询性别为男, 年龄在20-40岁间, 姓名长度为3的员工
select * from workers
where
gender = '男'
and
age between 20 and 40
and
name like '___';
- 统计员工表中, 年龄<60岁, 男性员工和女性员工的人数
select gender, count(*) from workers where age<60 group by gender;
- 查询所有年龄<=35岁的员工的姓名,年龄和入职日期,并对查询结果按年龄升序排序, 如果年龄相同按入职日期降序排序
select name,age,entryDate from workers where age<=35 order by age, entryDate desc;
- 查询性别为男, 年龄在 20-40岁间的前5个员工信息, 对查询结果按年龄升序排序,年龄相同按入职日期升序排序
标签:20,age,练习,查询,MYSQL,DQL,workers,select
From: https://www.cnblogs.com/HIK4RU44/p/18062035