当前位置:网站首页>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
边栏推荐
- 深度学习——特征工程小总结
- RuntimeError: Providing a bool or integral fill value without setting the optional `dtype` or `out`
- 5 minutes to achieve wechat cloud applet payment function (including source code)
- Summary of several relationships of UML class diagram
- Using oes texture + glsurfaceview + JNI to realize player picture processing based on OpenGL es
- 命令-sudo
- The usage of slice and the difference between slice and array
- 山东大学软件学院项目实训-创新实训-网络安全靶场实验平台(五)
- IIS数据转换问题16bit转24bit
- @Mapperscan and @ mapper
猜你喜欢
Pdf reference learning notes
MySQL 进阶 锁 -- MySQL锁概述、MySQL锁的分类:全局锁(数据备份)、表级锁(表共享读锁、表独占写锁、元数据锁、意向锁)、行级锁(行锁、间隙锁、临键锁)
Possible root causes include a too low setting for -Xss and illegal cyclic inheritance dependencies
An idea of rendering pipeline based on FBO
Project training of Software College of Shandong University - Innovation Training - network security shooting range experimental platform (V)
[report] Microsoft: application of deep learning methods in speech enhancement
5 minutes to achieve wechat cloud applet payment function (including source code)
Class loading mechanism
Zero cost, zero foundation, build profitable film and television applet
Shanda Wangan shooting range experimental platform project - personal record (V)
随机推荐
Why is the hexadecimal printf output of C language sometimes with 0xff and sometimes not
Command - sudo
Golang timer
机器学习目录
Electron入门教程3 ——进程通信
[H264] hevc H264 parsing and frame rate setting of the old version of libvlc
DevOps集成-Jenkins 服务的环境变量和构建工具 Tools
Main differences between go and PHP
深度学习——特征工程小总结
The platinum library cannot search the debug process records of some projection devices
Scrum Patterns之理解各种团队模式
Pit encountered using camera x_ When onpause, the camera is not released, resulting in a black screen when it comes back
山东大学软件学院项目实训-创新实训-网络安全靶场实验平台(七)
Kubernetes入门到精通-在 Kubernetes 上安装 OpenELB
【webrtc】Add x264 encoder for CEF/Chromium
HTTP cache - HTTP authoritative guide Chapter VII
Lottery applet, mother no longer have to worry about who does the dishes (assign tasks), so easy
Decompile and get the source code of any wechat applet - just read this (latest)
FFT物理意义: 1024点FFT就是1024个实数,实际进入fft的输入是1024个复数(虚部为0),输出也是1024个复数,有效的数据是前512个复数
5 minutes to achieve wechat cloud applet payment function (including source code)