Linux:
word键+r==弹出cmd
系统安装,环境配置,基础命名
1.安装vmware要安装centos网络适配器。
2.安装xshell
在VMware中获取IP addr,用于连接xshell
测试开发MySQL:
1.创建数据库:
create datables 数据库名;
题目:
1.查询学生姓名不等于zhangsan但性别为‘女’
Select * from students where stu_name !=’zhangsan ’and stu_sex=’女’;
2.,删除学生姓名等于zhangsan但性别不为‘女’
Delect from students where stu_name=’zhangsan ’and stu_sex!=’女’;
3、查询学生年龄age大于等于18并且小于45,并且性别不为’男’
Select * from students where stu_age>=18 and stu_age<45 and stu_sex!=’男’;
4.查询测试开发一班,性别为‘男’年龄较大的前10人
Select * from students from class=’测试开发一班’ and sex=’男’order by age DESC limit 10;
5.查询出同名同姓的学生,出现频率大于2,请列出学生、出现频率个数
select name,count(name) from students group by name having count(name)>2
6.在题5基础上,查询出是同名同姓的学生,但性别为‘男’,年龄较大的,前10人
.select name,count(name) from students where sex = ‘男’ group by name having count(name)>2 order by age DESC limit 0,10
7.在题9基础上,查询测试开发一班,年龄最大中但如果年龄相同,按照体重从小到大排序,前10人
select avg(age),max(age),min(age),class,count(class) from students where class = ‘测试一班’ group by class order by age DESC , weight ASC limit 0,10
8、找出身高大于160的学生,班级男女总人数,最大年龄和最小年龄。
select sex,count(name),max(age),min(age) from students where height > 160 group by sex
9.找出最小年龄大于18岁班级男女的总人数。
select count(name) from students group by sex having min(age)>18
多表查询
题目类型:
2.查询学生姓名为:张三的所有课程的分数
Select * from students ,scores where students.id=scores.id and name=’张三’
或者 select * from students inner join scores on students.id=scores.id where name=’张三’
或者 select * from students left join scores on students .id=scores.id where name =’张三’
或则 select * from students right join scores on students.id=scores.id where name =’张三’
3.写出sql语句,查询每门课程的最高分与最低分、平均分
Select course ,max(course),min(course),avg(course) from students inner join scores on students.id=scores.id group by course
4.写出sql语句,查询学生中姓张的学生,他的所有课程中的最高分、最低分、平均分
Select max (score),min(score),avg(score)from students inner join scores on students.id=scores.id where name like ‘张%’