当前位置:网站首页>Database query - course selection system
Database query - course selection system
2022-04-23 19:42:00 【X heart】
/*
For reference only : Do not lie on the corpse !!!
*/
The first 1 Turn off : Database data insertion
USE School;
# Please add the implementation code here
########## Begin ##########
########## Insert student table (Student) Corresponding data ##########
insert into student values('9512101',' Li Yong ',' male ','19',' Department of Computer Science '),
('9512102',' Liu Chen ',' male ','20',' Department of Computer Science '),
('9512103',' Wang min. ',' Woman ','20',' Department of Computer Science '),
('9521101',' Zhang Li ',' male ','22',' Information Department '),
('9521102',' Wu Bin ',' Woman ','21',' Information Department '),
('9521103',' Zhang Hai ',' male ','20',' Information Department '),
('9531101',' Qian Xiaoping ',' Woman ','18',' Department of mathematics '),
('9531102',' Wang Dali ',' male ','19',' Department of mathematics ');
########## Insert course schedule (Course) Corresponding data ##########
insert into course values('C01',' Computer culture ','3','1','41'),
('C02','VB','2','3','61'),
('C03',' computer network ','4','7','14'),
('C04',' Database foundation ','6','6','24'),
('C05',' Advanced mathematics ','8','2','19'),
('C06',' data structure ','5','4','55');
########## Insert student course selection table (DBSC) Corresponding data ##########
insert into dbsc values('1','9512101','c01','90',' Compulsory '),
('2','9512101','c02','86',' Elective '),
('3','9512101','c06','45',' Compulsory '),
('4','9512102','c02','78',' Elective '),
('5','9512102','c04','66',' Compulsory '),
('6','9521102','c01','82',' Elective '),
('7','9521102','c02','75',' Elective '),
('8','9521102','c04','92',' Compulsory '),
('9','9521102','c05','50',' Compulsory '),
('10','9521103','c02','68',' Elective '),
('11','9521103','c06','56',' Compulsory '),
('12','9531101','c01','80',' Elective '),
('13','9531101','c05','95',' Compulsory '),
('14','9531102','c05','85',' Compulsory ');
########## End ##########
########## Query table data ##########
SELECT * FROM student;
SELECT * FROM course;
SELECT * FROM dbsc;
The first 2 Turn off : Simple query
#********* Begin *********#
echo "
select Sname,Sdept from student where Sdept = ' Department of Computer Science ';
select Sno from dbsc where Grade < 60;
select Sname,Sdept,Sage from student where Sage >= 20 and Sage < 23 and Sdept = ' Information Department ';
select Sno,Grade from dbsc where Cno = 'c02';
select count(*) from student ;
"
#********* End *********#
The first 3 Turn off : Refine Query
#********* Begin *********#
echo "
select Sno,Sname,Ssex,Sage,Sdept from student where Sname LIKE ' Zhang %';
select Sname,Ssex,Sdept from student where Sdept = ' Department of Computer Science ' or Sdept = ' Department of mathematics ' or Sdept = ' Information Department ';
select Cno,count(*) from dbsc where istec =' Elective ' and (cno='c01' or cno ='c02') group by cno;
select Sno from dbsc group by sno having count(*)>3 ;
select Sname,Cno,Grade from dbsc left join student on student.Sno=dbsc.Sno where student.Sdept=' Department of Computer Science ';
"
#********* End *********#
The first 4 Turn off : Complex queries
#********* Begin *********#
echo "
select distinct student.Sno,student.Sname from student left join dbsc on student.Sno = dbsc.Sno where dbsc.istec = ' Elective ';
select Sname,count(*),avg(Grade) from student right join dbsc on student.Sno = dbsc.Sno group by dbsc.Sno ;
select avg(Grade),count(*) from student left join dbsc on student.Sno = dbsc.Sno
group by dbsc.Sno having count(*)>=4;
select Sname,Cno,Grade from student left join dbsc on student.Sno = dbsc.Sno where student.Sdept = ' Information Department ' and dbsc.Cno = 'c02' and istec = ' Elective ';
update dbsc set grade = grade+5 where grade < 60;
"
#********* End *********#
版权声明
本文为[X heart]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204231927030300.html
边栏推荐
- 【数值预测案例】(3) LSTM 时间序列电量预测,附Tensorflow完整代码
- Web Security
- Easy mock local deployment (you need to experience three times in a crowded time. Li Zao will do the same as me. Love is like a festival mock)
- MySQL syntax collation (5) -- functions, stored procedures and triggers
- Efficient serial port cyclic buffer receiving processing idea and code 2
- MySQL syntax collation
- Summary of several relationships of UML class diagram
- Garbage collector and memory allocation strategy
- 什么是消息队列
- 基于pytorch搭建GoogleNet神经网络用于花类识别
猜你喜欢

基于pytorch搭建GoogleNet神经网络用于花类识别

Application of DCT transform

Grafana 分享带可变参数的链接

No, some people can't do the National Day avatar applet (you can open the traffic master and earn pocket money)

An idea of rendering pipeline based on FBO

OpenHarmony开源开发者成长计划,寻找改变世界的开源新生力!

山东大学软件学院项目实训-创新实训-网络安全靶场实验平台(六)

【webrtc】Add x264 encoder for CEF/Chromium

Virtual machine performance monitoring and fault handling tools

山东大学软件学院项目实训-创新实训-网络安全靶场实验平台(八)
随机推荐
Project training of Software College of Shandong University - Innovation Training - network security shooting range experimental platform (6)
[report] Microsoft: application of deep learning methods in speech enhancement
MySQL practical skills
考试系统进入试卷优化思路
Some speculation about the decline of adults' language learning ability
Zero base to build profit taking away CPS platform official account
SRS 的部署
[H264] hevc H264 parsing and frame rate setting of the old version of libvlc
MySQL数据库 - 连接查询
MySQL lock
山大网安靶场实验平台项目—个人记录(四)
php参考手册String(7.2千字)
Efficient serial port cyclic buffer receiving processing idea and code 2
An algorithm problem was encountered during the interview_ Find the mirrored word pairs in the dictionary
A simple (redisson based) distributed synchronization tool class encapsulation
HTTP cache - HTTP authoritative guide Chapter VII
山东大学软件学院项目实训-创新实训-网络安全靶场实验平台(八)
音频编辑生成软件
Lpc1768 optimization comparison of delay time and different levels
深度学习环境搭建步骤—gpu