ICode9

精准搜索请尝试: 精确搜索
首页 > 其他分享> 文章详细

--day1

2021-10-23 22:34:03  阅读:164  来源: 互联网

标签:-- sno day1 sc cno where select


目录

计算机组成原理部分: 

leetcode每日一题:

数据库部分:

计算机组成原理部分: 

计算机储存信息的方式:

        计算机中的信息可以分为两大类: 控制信息 和 数据信息 . (1) 控制信息用来控制计算机的工作 ; (2) 数据信息是计算机加工处理的对象 .

        1.在计算机常用数字代码表示的各类信息: a.用数字代码表示数值型数据 (0表示+ , 1表示-); b.用数字代码表示字符 (ascll码); c.用数字代码表示图像 (1表示高亮 , 2 表示暗淡); d.用数字代码表示声音 (相同的数字表示同一种HZ); e.用数字代码表示指令 (0000表示传送 , 0001表示加法 , 0010表示减法); f.用数字代码表示设备状态 (00表示空闲 , 01表示忙碌).

        2.在物理机制的基础上用数字信号表示数字代码 (电流的高低HZ).

leetcode每日一题:

次元门

一道简单的模拟题 , 目标是两数差值要最小 , 所以第一反应便是 sqrt 附近的数 , 接下来暴力即可;

class Solution {
public:
    vector<int> constructRectangle(int area) {
        int m = sqrt(1.0 * area);
        while(area % m) m --;
        return {max(m , area / m) , min(m , area / m)};
    }
};

数据库部分:

--针对S_T数据库,完成以下操作:

--1. 按课程号降序显示选修各个课程的总人数、最高成绩、最低成绩及平均成绩;
select cno,count(sno) 课程的总人数,max(grade) 最高成绩,min(grade) 最低成绩,sum(grade)/count(sno) 平均成绩
from sc
group by cno
order by cno desc
--2. 列出有二门以上课程(含两门)不及格的学生的学号及不及格门数;
select sno
from sc
where grade < 60
group by sno
having count(grade) >=2
--3. 查询名字中第2个字为‘勇’的学生姓名和学号及选修的课程号、课程名;
select sname,student.sno,course.cno,cname
from student,course,sc
where student.sno=sc.sno and sc.cno = course.cno and sname like '_勇%'
--4. 查询至少选修了一门间接先行课为“5”号课程的学生姓名;
select sname
from student
where sno in(
			select sno
			from sc
			where cno in(
						select cno
						from course a
						where not exists(
										select *
										from course b
										where cpno = '5' and not exists(
																		select *
																		from course c
																		where c.cno=a.cno and c.cpno=b.cpno
																		)
										)
						)
			)
--5. 查询选修了“数据库”和“数学”两门课程的学生的学号;
select sno
from sc
where cno in (
	select cno
	from course
	where cname ='数学'
)
intersect
select sno
from sc
where cno in (
	select cno
	from course
	where cname ='数据库'
)
--6. 找出至少选修了“200515004”号同学所选修课程的学生学号;
select distinct sno
from sc a
where not exists(
				select *
				from sc b
				where b.sno ='200515004' and not exists(
														select *
														from sc c
														where c.sno=a.sno and c.cno=b.cno
														)
				)
	
--7. 找出“数据库系统”这门课成绩最高的学生学号,姓名;
select top 1 sname,student.sno, grade
from student,course,sc
where student.sno=sc.sno and sc.cno = course.cno and cname = '数据库'
group by sname,student.sno,grade
order by grade desc
--8. 找出选修了“2”课程但没有选修“1”课程的学生姓名;
select sname
from student
where sno in(
			select sno
			from sc
			where cno ='2'
			except
			select sno
			from sc
			where cno ='1'
			)
--9. 找出被所有同学选修了的课程号;
select cno
from course
where not exists(
				select *
				from student
				where not exists(
								select *
								from sc
								where sno = student.sno and cno=course.cno)
				)
--10. 查询没有选课的学生姓名。
select sname
from student
where not exists(
				select *
				from sc
				where sno = student.sno
				)

牛客每日一题:

次元门

标签:--,sno,day1,sc,cno,where,select
来源: https://blog.csdn.net/EX_fish/article/details/120925318

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有