当前位置: 首页 > news >正文

佛山网站优化服务辽宁建设工程信息网查询系统

佛山网站优化服务,辽宁建设工程信息网查询系统,家纺公司网站模版,wordpress首页html代码实验6.1 对学生实验数据库(stuexpm)的学生信息表(StudentInfo)和成绩信息表(Scorelnfo)进行信息查询,编写和调试查询语句的代码,完成以下操作 (1)使用两种方式查询Studentlnfo表的所有记录 ①使用列名表。 ② 使用*. use stuexpm;select StudentID,Name,Sex,Birthday,Specia…

实验6.1

对学生实验数据库(stuexpm)的学生信息表(StudentInfo)和成绩信息表(Scorelnfo)进行信息查询,编写和调试查询语句的代码,完成以下操作

(1)使用两种方式查询Studentlnfo表的所有记录
①使用列名表。
② 使用*.

use stuexpm;select StudentID,Name,Sex,Birthday,Speciality,Address from studentinfo;
select * from studentinfo;


(2)查询Scorelnfo表的所有记录。

select * from scoreinfo;


(3)查询高等数学成绩低于90分的成绩信息,

select *
from scoreinfo
where CourseID='8001' and Grade<90;

(4)使用两种方式查询地址为上海市浦东区和成都市锦江区的学生的信息
① 使用 IN 关键字。
② 使用 OR 关键字。

select *
from studentinfo
where Address in('上海市浦东区','成都市锦江区');select *
from studentinfo
where Address='上海市浦东区' or Address='成都市锦江区';


(5)使用两种方式查询分数为90~95分的成绩信息。
①使用BETWEEN AND 关键字
②使用AND关键字和比较运算符

select *
from scoreinfo
where Grade between 90 and 95;select *
from scoreinfo
where Grade>=90 and Grade<=95;


(6)通过两种方式查询地址是北京的学生信息。
① 使用 LIKE 关键字。
② 使用 REGEXP 关键字。

select *
from studentinfo
where Address like '北京%';select *
from studentinfo
where Address regexp '^北京';


(7)查询每个专业有多少人。

select Speciality,count(*) as '人数'
from studentinfo
group by Speciality;


(8)查询高等数学的平均成绩、最高分和最低分

select avg(Grade) as average,max(Grade) as highest,min(Grade) as lowest
from scoreinfo
where CourseID='8001';


(9)将英语成绩按从高到低的顺序排列。

select *
from scoreinfo
where CourseID='1201'
order by Grade desc ;


(10)通过两种方式查询英语成绩第3~5名的信息
① 使用 LIMIT offset row count 格式。
② 使用 LIMIT row_count OFFSET offset 格式。


select *
from scoreinfo
where CourseID='1201'
order by Grade desc
limit 2 offset 2;select *
from scoreinfo
where CourseID='1201'
order by  Grade desc
limit 2 offset 2;

实验6.2

对学生实骏数据库(s1uexpm)的学生信息表(Studentlnfo)和成绩信息表(Scoreinin)行信息查询,编写和调试查询语句的代码,完成以下操作。
(1)对学生信息表和成绩信息表进行交叉连接,观察所有的可能组合

select *
from studentinfo,scoreinfo;


(2)查询每个学生选修课程的情况
①使用INNER JOIN 的显式语法结构。
②使用WHERE子句定义连接条件的隐式语法结构。

select s.StudentID,s.Name,s.Sex,s.Birthday,s.Speciality,s.Address,sc.Grade,sc.CourseID
from studentinfo s
inner join scoreinfo sc on s.StudentID=sc.StudentID;select s.StudentID,s.Name,s.Sex,s.Birthday,s.Speciality,s.Address,sc.Grade,sc.CourseID
from studentinfo s,scoreinfo sc
where s.StudentID=sc.StudentID;


(3)采用自然连接查询每个学生选修课程的情况。

select s.StudentID,s.Name,s.Sex,s.Birthday,s.Speciality,s.Address,sc.Grade,sc.CourseID
from studentinfo s
natural join scoreinfo sc;


(4)查询源程不同、成绩相同的学生的学号、课程号和成绩。
①使用INNE JOIN的显式语法结构。
②使用WHERE子旬定义连接条件的隐式语法结构,

select a.StudentID,a.CourseID,a.Grade
from scoreinfo a
inner join scoreinfo b
on a.Grade=b.Grade and a.StudentID<>b.StudentID;select a.StudentID,a.CourseID,a.Grade
from scoreinfo a,scoreinfo b
where a.Grade=b.Grade and a.StudentID<>b.StudentID;


(5)查询选修1004课程的学生的姓名、性别和成绩

select s.Name,s.Sex,sc.Grade
from studentinfo s
inner join scoreinfo sc on s.StudentID=sc.StudentID
where sc.CourseID='1004';


(6)查询逸修了8001课程且为计算机专业学生的姓名及成绩,查出的成绩按降序排列

select s.Name,sc.Grade
from studentinfo s
inner join scoreinfo sc on s.StudentID=sc.StudentID
where sc.CourseID='8001' and s.Speciality='计算机'
order by sc.Grade desc;


(7)查御地址为上海市浦东区的学生的姓名专业、课程号和成绩

select s.Name,s.Speciality,sc.CourseID,sc.Grade
from studentinfo s
inner join scoreinfo sc on s.StudentID=sc.StudentID
where s.Address='上海市浦东区';


(8)查询8001课程的成绩高于4002课程成绩的学生。


select s.StudentID,s.Name,sc1.Grade as Grade_8001,sc2.Grade as Grade_4002
from scoreinfo sc1
inner join scoreinfo sc2 on sc1.StudentID=sc2.StudentID
inner join studentinfo s on s.StudentID=sc1.StudentID
where sc1.CourseID='8001' and sc2.CourseID='4002' and sc1.Grade>sc2.Grade;

http://www.yayakq.cn/news/655375/

相关文章:

  • 上海哪家做网站好wordpress端口映射
  • 网站图片少影响seo吗定制网络开发项目
  • 网站做外链多少钱手机网站乱弹
  • 花钱做网站注意网站如何维护
  • 做网站的电脑需要什么配置广州seo网站排名
  • 做电影网站怎么赚钱扬州专注企业网站建设
  • jsp源码做网站班级网页制作
  • 中国门户网站有哪些网站制作软件下载安装
  • 深圳 企业网站建设网站做推广需要什么条件
  • 搭建网站什么意思wordpress连接自己的域名
  • 网站标题 空格企业网站seo优化外包
  • 企业网站如何建设报告注销网站和取消接入
  • 开一个网站_只做同城交易263企业邮箱登录入口手机版
  • seo 网站标题字数打开部分网站很慢
  • 中国网站建设公司图片pop布局网站
  • 嘉兴网站排名优化公司安徽六安毛坦厂中学
  • asp网站源代码下载淘宝店铺去哪里买
  • 天津实用网站建设网站建设管理经验
  • 商汇通网站seo整站优化系统
  • 新世纪建设集团有限公司网站网站开发公司专业
  • 哪个网站做任务给东西创新型的合肥网站建设
  • ai做网站页面建多大的培训机构不退钱最怕什么举报
  • 软件网站下载公司网站seo外包
  • 企业家居网站建设网站怎么做才能被百度抓取到
  • 做网站优化两年遇到的SEO常态北京公司排名100
  • 知名建筑类的网站遵义做网站的
  • 有没有通信专业业余做兼职的网站wordpress 福利
  • 做网站 需求wordpress 可道云
  • 网站建设需要用到哪些软件有哪些和印度做外贸的网站
  • 鄞州区建设网站网站开发游戏