找回密码
 注册账号

QQ登录

只需一步,快速开始

手机号码,快捷登录

手机号码,快捷登录

初学者课程:T3自学|T6自学|U8自学软件下载课件下载工具下载资料:通资料|U8资料|NC|培训|年结积分规则 | 使用常见问题Q&A
知识库:U8 | | NC | U9 | OA | 政务U8|U9|NCC|NC65|NC65客开|NCC客开新手必读 | 任务 | 快速增金币用友QQ群[微信群]
查看: 120|回复: 0

数据库基础查询45题及答案

[复制链接]
发表于 2019-10-26 11:55:00 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?注册账号

×
--1查询Student表中的所有记录的Sname.Ssex和Class列
select Sname,Ssex,Class from Student
--2查询教师所有的单位即不重复的Depart列。
select distinct Depart from Teacher
--3查询Student表的所有记录。
select * from Student
--4查询Score表中成绩在到之间的所有记录
select * from score where Degree between 60and 80
--5查询Score表中成绩为,86或的记录
select * from Score where Degree in ('85','86','88')
--6查询Student表中“”班或性别为“女”的同学记录。
select * from Student where Class='95031'and Ssex='女'
--7-以Class降序查询Student表的所有记录。
select * from Student order by Class desc
--8 以Cno升序、Degree降序查询Score表的所有记录。
select * from Score order by Cno asc,Degree desc
--9查询“”班的学生人数。
select COUNT(*)from Student where Class='95031'
--10查询Score表中的最高分的学生学号和课程号。
select sno,cno from Score where Degree=(select max(Degree) from Score )
--11查询每门课的平均成绩
select avg(degree),cno from Score GROUP BY Cno
--12查询‘-105’号课程的平均分
select AVG(degree),cno from Score where cno='3-105'\t group by Cno \t\t\t\t\t\t\t\t\t\t
--13查询Score表中至少有名学生选修的并以开头的课程的平均分数
select AVG(degree)from Score where Cno like '3%'group by Cno having COUNT(Sno)>5
--13查询分数大于.小于的Sno列
select degree from Score where degree between 70and
您需要登录后才可以回帖 登录 | 注册账号

本版积分规则

QQ|站长微信|Archiver|手机版|小黑屋|用友之家 ( 蜀ICP备07505338号|51072502110008 )

GMT+8, 2024-4-29 10:44 , Processed in 0.033271 second(s), 7 queries , Gzip On, Redis On.

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表