04-27 Mysql 考试 55 分 简答题记录
第二题表
#新建学生表
drop table if exists setudent;
create table setudent(
sno int(10) not null primary key comment '学号',
sname varchar(20) not null comment '姓名',
ssex varchar(10) not null comment '性别'
);
#给学生表添加数据
insert into setudent values(1,'姜振国','男'),(2,'赵书文','男'),(3,'芮思涵','女'),(4,'余浩然','男');
#新建课程表
drop table if exists coures;
create table coures(
cnoc int(10) not null primary key comment '课程ID',
name varchar(30) not null comment '课程名称'
);
#给课程表添加数据
insert into coures values(1,'java'),(2,'oracle'),(3,'js'),(4,'jquery');
#新建选课表
drop table if exists selclass;
create table selclass(
selno int(10) not null primary key auto_increment comment '选课ID',
sno int(10) not null comment '学生ID',
cno int(10) not null comment '课程ID',
count int(10) not null comment '成绩'
);
#给选课表添加数据
insert into selclass values(1,1,1,88),(2,1,2,77),(3,2,1,78),(4,2,2,91),(5,3,1,55),(6,3,2,65),(7,3,3,75),(10,4,3,74),(9,4,4,64);
第一题表
drop table if exists student;
create table student(
sno int not null primary key comment'学生ID',
sname varchar(20) not null comment'姓名',
ssex varchar(20) not null comment'性别',
splace varchar(20) not null comment'籍贯',
syxid varchar(20) not null comment'院系ID'
);
drop table if exists yxinfo;
create table yxinfo(
yxid int not null primary key comment'院系ID',
yxname varchar(20) not null comment'院系名称',
yxplace varchar(20) not null comment'地址',
yxphone varchar(20) not null comment'联系电话'
);
insert into student values
('1','温惠青','女','江苏','1'),
('2','赵和堂','男','重庆市','2'),
('3','赵修平','男','河北','1'),
('4','秦奕','男','福建','3'),
('5','何灵泉','女','福建','3'),
('6','周海龙','男','山东','1');
insert into yxinfo values
('1','计算机系','科研楼608','0533-2168068'),
('2','数学系','行政楼203','0533-2157068'),
('3','物理系','科研楼607','0533-3153606');
第一题
1.查出‘计算机系’的所有学生信息
select * from student where syxid =(select yxid from yxinfo where yxname = '计算机系');
2.查出‘赵和堂’所在的院系信息
select * from yxinfo where yxid = (select syxid from student where sname = '赵和堂');
3.查出在‘行政楼’办公的院系名称;
select yxname from yxinfo where yxplace like '行政楼%';
4.查出男生女生各多少人
select ssex,count(*) from student group by ssex;
5.查出人数最多的院系
select * from yxinfo where yxid =(select syxid from student group by syxid order by count(*) desc limit 1);
6.查出人数最多的院系的男女生各多少人
select ssex,count(*) from student where syxid = (select syxid from student group by syxid order by count(*) desc limit 1) group by ssex;
7.查出跟'秦奕'同籍贯的所有人
select sname from student where splace = (select splace from student where sname = '秦奕');
8.查出'河北'人就读的院系信息
select * from yxinfo where yxid = (select syxid from student where splace = '河北');
9.查出跟'福建女生' 同院系的所有学生信息;
select * from student where syxid = (select syxid from student where splace = '福建' and ssex = '女');
第二题
1.查询选修了'oracle'的学生姓名
select sname from setudent where sno in(select sno from selclass where cno in (select cnoc from coures where name = 'oracle'));
2.查询 姜振国 同学选修了的课程名称
select name from coures where cnoc in (select cno from selclass where sno in (select sno from setudent where sname = '姜振国'));
3.查询只选修了一门课的学生学号和姓名;
select sno,sname from setudent where setudent.sno in (select selclass.sno from selclass group by selclass.sno having count(*) = 1);
4.查询选修了至少3门课程的学生信息
select * from setudent where setudent.sno in (select selclass.sno from selclass group by selclass.sno having count(*) >= 3);
5.查询选修了所有课程的学生
select * from setudent where setudent.sno in (select selclass.sno from selclass group by selclass.sno having count(*) =(select count(*) from coures));
6.查询选修课程的学生人数
select cno,count(*) from selclass group by selclass.cno;
7.查询所学课程至少有一门跟姜振国所学课程相同的学生信息
select setudent.sno,sname,ssex from setudent join selclass on setudent.sno = selclass.sno where selclass.cno in (select selclass.cno from selclass join setudent on setudent.sno = selclass.sno where sname = '姜振国');
8.查询两门及两门以上不及格同学的平均分
select sname,avg(count) from selclass a join setudent on setudent.sno = a.sno where a.sno = (select b.sno from selclass b where count < 60 group by b.sno having count(*) >=2) group by a.sno;
转载于:https://www.cnblogs.com/baobaoa/p/8965095.html
04-27 Mysql 考试 55 分 简答题记录相关推荐
- 【一起入门MachineLearning】中科院机器学习-期末题库-【单选题54,47,51,55,64+简答题8,10,23】
这系列的题目来源于周晓飞老师期末发的题库,自留做复习用的
- 西电机器学习简答题核心考点汇总(期末真题,教材西瓜书)
文章目录 前言 一.机器学习和深度学习区别以及原因 二.卷积核,池化层作用 三.SVM转化为对偶问题的优点 四.核函数的作用 五.特征的相似度定义,性质 六.预剪枝与后剪枝优缺点 七.密度直接可达,密 ...
- 计算机组成原理简答知识点,计算机组成原理简答题汇总,史上最全
研究生入学考试,计算机组成原理简答题汇总,基本覆盖全部知识点. 一.计算机硬件系统组成的基本概念 1.什么是计算机系统?说明计算机系统的层次结构. 计算机系统包括硬件和软件.从计算机系统的层次结构来看 ...
- 基于javaweb的在线考试系统(单选,多选,判断,填空,简答题)(java+springboot+ssm+mysql+html)
基于javaweb的在线考试系统(单选,多选,判断,填空,简答题)(java+springboot+ssm+mysql+html) 运行环境 Java≥8.MySQL≥5.7 开发工具 eclipse ...
- Java项目:在线考试系统(单选,多选,判断,填空,简答题)(java+Springboot+ssm+mysql+html+maven)
源码获取:博客首页 "资源" 里下载! 功能: 学生信息 班级 专业 学号 姓名 在线考试 成绩查询 个人信息 密码修改 教师管理 教师编号 姓名 所教科目 题库管理 单选 ...
- 计算机二级考试模拟表单答题,2016年计算机二级考试《VFP》模拟简答试题
1[简答题]1.建立一个表单文件myform,将employee表添加到表单的数据环境中,然后在表单中添加表格控件gridl,指定其记录源类型为"别名".记录源为employee表 ...
- 简述计算机图形的图形应用主要有哪些,5计算机图形学考试简答题复习.doc
5计算机图形学考试简答题复习 计算机图形学考试简答题复习 1.简述计算机动画的概念,它经历了哪几个阶段的发展?(2分) 计算机动画是指采用图形与图像的处理技术,借助于编程或动画制作软件生成一系列的景物 ...
- 数字电路技术可能出现的简答题_2013年9月份考试数字电子技术第二次作业
下载word有问题请添加微信号:xuecool-com或QQ:370150219处理(尽可能给您提供完整文档),感谢您的支持与谅解. 以下是由77cn范文大全为大家整理的2013年9月份考试数字电子技 ...
- linux的基础简答题,Linux认证考试试题及答案「简答题」
Linux认证考试试题及答案「简答题」 1.论述实时信号.非实时信号.可靠信号.不可靠信号四个概念. 答:实时信号目前未用,非实时信号编号1-31.0表示空信号 1分 非实时信号没有排队机制,可能丢失 ...
最新文章
- sqlite3 增删更改查询 callback使用
- phpmailer SMTP Error: Could not connect to SMTP host. 错误解决
- (转)让思维活跃化的几个技巧
- 《一名【合格】前端工程师的自检清单》学习学习
- java泛型详解_Java泛型详解(透彻)
- python常用算法有哪些_python常见排序算法基础教程
- Unity Plugins的使用方法
- Mac下Eclipse反编译插件安装
- 二级python有必要买书吗_清华大学出版社-图书详情-《二级Python编程指南》
- 世界那么大,你又怎么能看的完呢
- VR全景制作教程|VR全景拍摄和制作竟如此简单
- 实验2 双绞线的制作
- 三大方面解析虚拟化技术在云计算数据中心中的应用
- 【opencv学习笔记】2用摄像头识别指定颜色
- Pandas 日期处理:生成及去除工作日与节假日
- Why WPF's Text is Blurry?
- 【论文翻译】Cluster Contrast for Unsupervised Person Re-Identification(2021)
- 高中生活--第2篇--师生交锋,Fans的言论让老师彻底无语
- linux系统查看进程
- BZOJ2277: [Poi2011]Strongbox