35 lines
1.0 KiB
Plaintext
35 lines
1.0 KiB
Plaintext
#查询所有学生信息 并根据年级进行降序排序
|
|
SELECT * from t_stu order by e_age desc
|
|
|
|
|
|
# 添加至少五条数据
|
|
INSERT INTO `rk718`.`t_stu` (`e_id`, `e_name`, `e_sex`, `e_tel`, `class_id`, `e_age`, `e_sal`) VALUES
|
|
(0, '王艳1', '女', '123456784', 20, '24', 2350),
|
|
(0, '田七', '男', '123456784', 20, '26', 3500),
|
|
(0, '赵老刘', '女', '123456784', 23, '30', 4500),
|
|
(0, '赵老八', '男', '123456784', 10, '45', 5500),
|
|
(0, '李三思', '女', '123456784', 30, '19', 6500)
|
|
|
|
|
|
|
|
|
|
|
|
#查询工资大于5000的所有男同学的信息
|
|
SELECT * from t_stu where e_sal>=5000 and e_sex='男'
|
|
|
|
#查询班级编号为20的男同学的电话号码
|
|
SELECT e_tel from t_stu where class_id=20
|
|
|
|
#查询最低工资
|
|
SELECT min(e_sal) from t_stu
|
|
|
|
#查询班级为30的学生的最小年龄
|
|
SELECT min(e_age) from t_stu where class_id=30
|
|
|
|
#查询女生的最低工资
|
|
SELECT min(e_sal) from t_stu where e_sex='女'
|
|
|
|
|
|
#查询女学生中薪资最低的人的全部信息
|
|
SELECT * from t_stu where e_sex='女' order by e_sal asc limit 0,1
|