数据库系统概论(超详解!!!) 第三节 关系数据库标准语言SQL(Ⅳ)
1.集合查询
集合操作的种类
并操作UNION
交操作INTERSECT
差操作EXCEPT
参加集合操作的各查询结果的列数必须相同;对应项的数据类型也必须相同
查询计算机科学系的学生及年龄不大于19岁的学生。SELECT *FROM StudentWHERE Sdept= 'CS'UNIONSELECT *FROM StudentWHERE Sage<=19;
UNION:将多个查询结果合并起来时,系统自动去掉重复元组
UNION ALL:将多个查询结果合并起来时,保留重复元组
查询选修了课程1或者选修了课程2的学生。SELECT SnoFROM SCWHERE Cno=' 1 'UNIONSELECT SnoFROM SCWHERE Cno= ' 2 ';查询计算机科学系的学生与年龄不大于19岁的学生的交集。SELECT *
FROM Student
WHERE Sdept='CS'
INTERSECT
SELECT *
FROM Student
WHERE Sage<=19 实际上就是查询计算机科学系中年龄不大于19岁的学生。SELECT *FROM StudentWHERE Sdept= 'CS' AND Sage<=19;查询既选修了课程1又选修了课程2的学生。SELECT SnoFROM SCWHERE Cno=' 1 ' INTERSECTSELECT SnoFROM SCWHERE Cno='2 ';也可以表示为:SELECT SnoFROM SCWHERE Cno=' 1 ' AND Sno IN(SELECT SnoFROM SCWHERE Cno=' 2 ');查询计算机科学系的学生与年龄不大于19岁的学生的差集。SELECT *FROM StudentWHERE Sdept='CS'EXCEPTSELECT *FROM StudentWHERE Sage <=19;实际上是查询计算机科学系中年龄大于19岁的学生SELECT *FROM StudentWHERE Sdept= 'CS' AND Sage>19;
2.于派生表的查询
子查询不仅可以出现在WHERE子句中,还可以出现在FROM子句中。
这时子查询生成的临时派生表(Derived Table)成为主查询的查询对象
找出每个学生超过他自己选修课程平均成绩的课程号SELECT Sno, CnoFROM SC, (SELECTSno, Avg(Grade) FROM SCGROUP BY Sno)AS Avg_sc(avg_sno,avg_grade)WHERE SC.Sno = Avg_sc.avg_snoand SC.Grade >=Avg_sc.avg_grade
如果子查询中没有聚集函数,派生表可以不指定属性列,子查询SELECT子句后面的列名为其缺省属性。
查询所有选修了1号课程的学生姓名,可以用如下查询完成:SELECT SnameFROM Student, (SELECT Sno FROM SC WHERE Cno=' 1 ') AS SC1WHERE Student.Sno=SC1.Sno;
3.Select语句的一般形式
SELECT [ALL|DISTINCT]
<目标列表达式> [别名] [ ,<目标列表达式> [别名]] …
FROM <表名或视图名> [别名]
[ ,<表名或视图名> [别名]] …
|(<SELECT语句>)[AS]<别名>
[WHERE <条件表达式>]
[GROUP BY <列名1>[HAVING<条件表达式>]]
[ORDER BY <列名2> [ASC|DESC]];
1. 目标列表达式的可选格式
目标列表达式格式
(1) *
(2) <表名>.*
(3) COUNT([DISTINCT|ALL]* )
(4) [<表名>.]<属性列名表达式>[,<表名>.]<属性列名表达式>]…
其中<属性列名表达式>可以是由属性列、作用于属性列 的聚集函数和常量的任意算术运算(+,-,*,/)组成的 运算公式
2. 聚集函数的一般格式
3. WHERE子句的条件表达式的可选格式
4.练习
/*(1)查询选修了81003号课程的学生姓名;*//*方法1:连接查询*/select snamefrom Student,SCwhere Student.Sno=SC.Sno and SC.Cno='81003';/*方法2:嵌套in*/select snamefrom Student where Sno in (select Snofrom SCwhere Cno='81003');/*方法3:嵌套exists*/select snamefrom Student where exists (select *from SCwhere Sno=Student.Sno and Cno='81003');/*(2)查询选修了学分为3的课程的学生学号和姓名;*//*方法1:连接查询*/select Student.Sno ,student.snamefrom Student,SC,Coursewhere Student.Sno=SC.Sno and SC.Cno=Course.Cno and Ccredit='3';/*方法2:嵌套in*/select Sno ,snamefrom Student where Sno in (select Snofrom SCwhere Cno in (select Cnofrom Coursewhere Ccredit='3'));/*(3)找出每个超过其所在专业平均年龄的学号,姓名和年龄*//*方法1:嵌套相关查询*/select sno,sname,YEAR(GETDATE())-YEAR(sbirthdate)as'年龄'from Studentwhere YEAR(GETDATE())-YEAR(sbirthdate)> any(select AVG(YEAR(GETDATE())-YEAR(sbirthdate))from Studentgroup by Smajor);/*方法2:派生表*/select distinct sno,sname,YEAR(GETDATE())-YEAR(sbirthdate)as'年龄'from Student x,(select AVG(YEAR(GETDATE())-YEAR(sbirthdate))from Student ygroup by y.Smajor) as avg_sex(sex)where YEAR(GETDATE())-YEAR(sbirthdate)>avg_sex.sex;/*(4)查询学分大于“操作系统”的所有课程名称;*//*方法1:嵌套>*/select Cnamefrom Course where Ccredit >(select Ccreditfrom Coursewhere Cname='操作系统');/*方法2:嵌套exists*/select Cnamefrom Course xwhere exists(select *from Course ywhere x.Ccredit>y.Ccredit and y.Cname='操作系统');/*(5)查询没有选“数据库”的学生学号;*//*方法1:嵌套exists*/select distinct Snofrom SC x where not exists(select *from SC ywhere y.Sno=x.Sno and exists(select * from Coursewhere Cno=y.Cno and Cname='数据库系统概论') );/*方法2:集合差*/select distinct snofrom SCexceptselect Snofrom Course,SCwhere Course.Cno=SC.Cno and Cname='数据库系统概论';/*方法3:not in*/select distinct Snofrom SC where Sno not in (select Snofrom SC where Cno in (select Cno from Coursewhere Cname='数据库系统概论') );/*(6)查询与“数据库”、“数学”学分不同的所有课程名称;*//*方法1:not in*/select Cnamefrom Course where Ccredit not in (select Ccreditfrom Course where Cname in (select Cname from Coursewhere Cname in('数据库系统概论','离散数学') ));/*方法3:<> all或者any*/select Cnamefrom Course where Ccredit <> any(select Ccreditfrom Course where Cname in (select Cname from Coursewhere Cname in('数据库系统概论','离散数学') )); /*(7)查询平均分大于等于80分的所有课程号和课程名称;*//*方法1:连接查询*/select Course.Cno,Cnamefrom Course,SCwhere Course.Cno=SC.Cnogroup by Course.Cno,Cnamehaving AVG(Grade)>='80';/*方法2:派生表*/select Course.Cno,Cnamefrom Course,(select cnofrom SCgroup by Cnohaving AVG(Grade)>='80')as avg_sc(avg_cno)where Course.Cno=avg_sc.avg_cnogroup by Course.Cno,Cname/*(8)查询同时选修了‘81001’和‘81002’号课程的学生学号和姓名;*//*方法1:自身连接*/select student.Sno,Snamefrom Student ,SC s1,SC s2where Student.Sno=s1.Sno and s1.Sno=s2.Sno and s1.Cno='81001' and s2.Cno='81002'group by Student.Sno,Sname;/*方法2:嵌套in*/select Sno,Snamefrom Student where Sno in (select Snofrom SCwhere Cno = '81001'and Sno in (select Snofrom SCwhere Cno='81002'));/*方法3:集合*/select student.Sno,Snamefrom Student ,SC where Student.Sno=sc.Sno and Cno='81001' INTERSECTselect student.Sno,Snamefrom Student ,SC where Student.Sno=SC.Sno and Cno='81002';/*(9)查询同时选修了‘数据库系统概论’和‘数据结构’的学生学号和姓名;*//*方法1:嵌套in*/select Sno,Snamefrom Student where Sno in (select Snofrom SCwhere Cno in (select Cnofrom Coursewhere Cname = '数据库系统概论') and Sno in (select Snofrom SCwhere Cno in (select Cnofrom Coursewhere Cname='数据结构')));/*方法2:集合*/select Student.Sno,Snamefrom Student,(select Snofrom SCwhere Cno in (select Cnofrom Coursewhere Cname = '数据库系统概论'))as x_sc(sno)where Student.Sno=x_sc.snointersectselect Student.Sno,Snamefrom Student,(select Snofrom SCwhere Cno in (select Cnofrom Coursewhere Cname='数据结构'))as y_sc(sno)where Student.Sno=y_sc.sno /*(10)查询所有学生都选了的课程号;*/ /*嵌套exists,不存在一个学生没选的课程*/
SELECT CnoFROM CourseWHERE NOT EXISTS(SELECT *FROM StudentWHERE NOT EXISTS(SELECT *FROM SCWHERE Sno= Student.SnoAND Cno= Course.Cno));/*(11)查询与“数据结构”具有相同先修课的课程号和课程名;*//*方法1:自身连接*/select c1.Cno,c1.Cnamefrom Course c1,Course c2where c1.Cpno=c2.Cpno and c2.Cname='数据结构' and c1.Cname<>'数据结构';/*方法2:嵌套in*/select Cno,Cnamefrom Course where Cname<>'数据结构' and Cpno in (select Cpnofrom Coursewhere Cname='数据结构');/*方法3:嵌套exists*/select Cno,Cnamefrom Course xwhere Cname<>'数据结构' and exists (select *from Course ywhere y.Cpno=x.Cpno and Cname='数据结构');/*方法4:派生表*/select Cno,Cnamefrom Course,(select Cpnofrom Coursewhere Cname='数据结构')as xcourse(scpno)where Cname<>'数据结构'and Cpno=xcourse.scpno;/*(12)查询所有具有不及格记录的学生学号和姓名*//*方法1:连接查询*/select Student.Sno,Snamefrom Student,SCwhere Student.Sno=SC.Snogroup by Student.Sno,Sname,Gradehaving Grade<'60';/*方法3:嵌套in*/select Sno,Snamefrom Studentwhere Sno in (select Snofrom SCwhere Grade<'60');/*方法3:嵌套exists*/select Sno,Snamefrom Studentwhere exists(select *from SCwhere sno=Student.Sno and Grade<'60');/*方法4:派生表*/select Student.Sno,Snamefrom Student,(select Snofrom SCwhere Grade<'60')as xsc(sno)where Student.Sno=xsc.snogroup by Student.Sno,Sname/*(13)查询计算机科学与技术专业学生选修的所有课程号;*//*方法1:连接查询*/select SC.Cnofrom Student,SCwhere Student.Sno=SC.Snogroup by SC.Cno,Smajorhaving Smajor='计算机科学与技术';/*方法2:嵌套in*/select distinct Cnofrom SCwhere Sno in (select Snofrom Studentwhere Smajor='计算机科学与技术');/*方法3:嵌套exists*/select distinct Cnofrom SCwhere exists(select *from Studentwhere Sno=SC.Sno and Smajor='计算机科学与技术');/*方法4:派生表*/select Cnofrom SC,(select Snofrom Studentwhere Smajor='计算机科学与技术')as xstudent(sno)where xstudent.sno=SC.Snogroup by Cno;/*(14)查询所有计算机科学与技术专业学生都选的课程号;*/
SELECT CnoFROM CourseWHERE NOT EXISTS(SELECT *FROM StudentWHERE NOT EXISTS(SELECT *FROM SCWHERE Sno= Student.SnoAND Cno= Course.Cno )and Smajor='计算机科学与技术');/*(15)查询选修了81003号课程并且不及格的学生姓名*//*方法1:多表连接法*/select Snamefrom Student,SCwhere Student.Sno=SC.Snogroup by Student.Sno,Sname,Grade,Cnohaving Grade<'60'and Cno='81003';/*方法2:嵌套in*/select Snamefrom Studentwhere Sno in (select Snofrom SCwhere Grade<'60'and Cno='81003');/*方法3:交集*/select Snamefrom Student,SCwhere Student.Sno=SC.Snogroup by Student.Sno,Sname,Grade,Cnohaving Grade<'60'intersectselect Snamefrom Student,SCwhere Student.Sno=SC.Snogroup by Student.Sno,Sname,Grade,Cnohaving Cno='81003';/*方法4:派生表*/select Snamefrom Student,(select Snofrom SCwhere Grade<'60'and Cno='81003')as xsc(sno)where Student.Sno=xsc.snogroup by Sname;/*方法5:嵌套exists*/select Snamefrom Studentwhere exists(select *from SCwhere Sno=Student.Sno and Grade<'60'and Cno='81003'); /*(16)查询选修了“数据库系统概论”并且不及格的学生姓名*//*方法1:多表连接法*/select Snamefrom Student,SC,Coursewhere Student.Sno=SC.Sno and SC.Cno=Course.Cnogroup by Student.Sno,Sname,Grade,Cnamehaving Grade<'60'and Cname='数据库系统概论';/*方法2:嵌套in*/select Snamefrom Studentwhere Sno in (select Snofrom SCwhere Grade<'60'and Cno in (select Cnofrom Coursewhere Cname='数据库系统概论'));/*方法3:交集*/select Snamefrom Student,SCwhere Student.Sno=SC.Snogroup by Student.Sno,Sname,Gradehaving Grade<'60'intersectselect Snamefrom Student,SC,Coursewhere Student.Sno=SC.Sno and SC.Cno=Course.Cnogroup by Student.Sno,Sname,Cnamehaving Cname='数据库系统概论';/*方法4:派生表*/select Snamefrom Student,(select Sno,Cnofrom SCwhere Grade<'60')as xsc(sno,cno),(select Cnofrom Coursewhere Cname='数据库系统概论')as xcourse(cno)where Student.Sno=xsc.sno and xsc.cno=xcourse.cnogroup by Sname; /*(17)查询计算机科学与技术专业选修了“数据库系统概论”课且成绩及格的所有学生的学号和姓名;*//*方法1:多表连接法*/select Student.Sno,Snamefrom Student,SC,Coursewhere Student.Sno=SC.Sno and SC.Cno=Course.Cnogroup by Student.Sno,Sname,Grade,Cname,Smajorhaving Grade>'60'and Cname='数据库系统概论'and Smajor='计算机科学与技术';/*方法2:嵌套in*/select Sno,Snamefrom Studentwhere Smajor='计算机科学与技术' and Sno in (select Snofrom SCwhere Grade>'60'and Cno in (select Cnofrom Coursewhere Cname='数据库系统概论') );/*方法3:交集*/select Student.Sno,Snamefrom Student,SCwhere Student.Sno=SC.Sno group by Student.Sno,Sname,Gradehaving Grade>'60'intersectselect Student.Sno,Snamefrom Student,SC,Coursewhere Student.Sno=SC.Sno and SC.Cno=Course.Cnogroup by Student.Sno,Sname,Grade,Cname,Smajorhaving Cname='数据库系统概论'intersectselect Sno,Snamefrom Studentwhere Smajor='计算机科学与技术';/*方法4:派生表*/select Student.Sno,Snamefrom Student,(select Sno,Cnofrom SCwhere Grade>'60')as xsc(sno,cno),(select Cnofrom Coursewhere Cname='数据库系统概论')as xcourse(cno)where Student.Sno=xsc.sno and xsc.cno=xcourse.cno and Smajor='计算机科学与技术'group by Student.Sno,Sname; /*(18)查询与“刘晨”同岁且不与“刘晨”在同一个系的学生学号与姓名;*//*方法1:嵌套in*/select Sno,Snamefrom Studentwhere Sname<>'刘晨' and YEAR(GETDATE())-YEAR(sbirthdate)in (select YEAR(GETDATE())-YEAR(sbirthdate)from Studentwhere Sname='刘晨')and Smajor not in (select Smajorfrom Studentwhere Sname='刘晨');/*方法2:嵌套exists*/select Sno,Snamefrom Student xwhere Sname<>'刘晨' and exists(select *from Student ywhere YEAR(GETDATE())-YEAR(y.sbirthdate)=YEAR(GETDATE())-YEAR(x.sbirthdate)and y.Sname='刘晨')and not exists(select *from Student zwhere z.Smajor=x.Smajor and z.Sname='刘晨');/*方法3:派生表*/ select Student.Sno,Snamefrom Student,(select Sno,YEAR(GETDATE())-YEAR(sbirthdate)from Studentwhere Sname='刘晨')as ystudent(sno,sex),(select Sno,Smajorfrom Studentwhere Sname='刘晨')as zstudent(sno,smajor)where Sname<>'刘晨'and YEAR(GETDATE())-YEAR(sbirthdate)=ystudent.sex and Student.Smajor<>zstudent.smajor
相关文章:

数据库系统概论(超详解!!!) 第三节 关系数据库标准语言SQL(Ⅳ)
1.集合查询 集合操作的种类 并操作UNION 交操作INTERSECT 差操作EXCEPT 参加集合操作的各查询结果的列数必须相同;对应项的数据类型也必须相同 查询计算机科学系的学生及年龄不大于19岁的学生。SELECT *FROM StudentWHERE Sdept CSUNIONSELECT *FROM StudentWHERE Sage&l…...

与谷歌“分家”两年后,SandboxAQ推出统一加密管理平台
3月27日,SandboxAQ宣布其AQtive Guard平台现已全面可用(GA),适用于所有行业,以防范人工智能驱动和量子攻击的威胁。前者是在两年前3月从谷歌母公司Alphabet分拆出来的初创公司,并在当时获得了“九位数”的融…...

【卫星家族】 | 高分六号卫星影像及获取
1. 卫星简介 高分六号卫星(GF-6)于2018年6月2日在酒泉卫星发射中心成功发射,是高分专项中的一颗低轨光学遥感卫星,也是我国首颗精准农业观测的高分卫星,具有高分辨率、宽覆盖、高质量成像、高效能成像、国产化率高等特…...
XML与Xpath
XML与Xpath XML是一种具有某种层次结构的文件,Xpath则是解析这种文件的工具 接下来将会解释XML文件的结构和Xpath的基本使用,并且用Java语言进行操作展示。 XML结构 XML(可扩展标记语言)文件具有一种层次结构,由标签…...
【c++20】CPP-20-STL-Cookbook 学习笔记
Cpp20-STL-Cookbook-src简单的阅读笔记。c++20更好用了,比如STL 包含了一些这样的辅助函数,比如 make_pair() 和make_tuple() 等。 这些代码现在已经过时了,但是为了与旧代码兼容,会保留这些代码。比如 可以声明是一个std的string:Sum s1 {1u, 2.0, 3, 4.0f }?...

Python 之 Flask 框架学习
毕业那会使用过这个轻量级的框架,最近再来回看一下,依赖相关的就不多说了,直接从例子开始。下面示例中的 html 模板,千万记得要放到 templates 目录下。 Flask基础示例 hello world from flask import Flask, jsonify, url_fora…...

精品丨PowerBI负载测试和容量规划
当选择Power BI作为业务报表平台时,如何判断许可证的选择是否符合业务需求,价格占了主导因素。 Power BI的定价是基于SKU和服务器内核决定的,但是很多IT的负责人都不确定自己公司业务具体需要多少。 不幸的是,Power BI的容量和预期…...

【算法-PID】
算法-PID ■ PID■ 闭环原理■ PID 控制流程■ PID 比例环节(Proportion)■ PID 积分环节(Integral)■ PID 微分环节(Differential) ■ 位置式PID,增量式PID介绍■ 位置式 PID 公式■ 增量式 PI…...

ros rosbag使用记录
rosbag: 1. rosbag record -a 记录当前所有消息(较少用)2. rosbag record -O bag_name.bag /topic 记录指定消息3. rosbag info 查阅bag文件信息4. rosbag play 播放bag文件内容5. python script 查看bag文件内容参考: 1. rosbag record -a 记…...

WebKit结构揭秘:探秘网页渲染的魔法之源
一、WebKit之心:渲染引擎的魔力 WebKit的渲染引擎是其核心所在,它犹如一位技艺高超的魔法师,将HTML、CSS和JavaScript的魔法咒语转化为绚丽的网页画面。它解析代码,绘制页面,让网页内容跃然屏上,展现出无尽…...

VSCode美化
今天有空收拾了一下VSCode,页面如下,个人觉得还是挺好看的~~ 1. 主题 Noctis 色彩较多,有种繁杂美。 我使用的是浅色主题的一款Noctis Hibernus 2. 字体 Maple Mono 官网:Maple-Font 我只安装了下图两个字体,使…...

Runes 生态一周要览 ▣ 2024.3.25-3.31|Runes 协议更新 BTC 减半在即
Runes 生态大事摘要 1、Casey 发布了 Runes 协议文档 RUNES HAVE DOCS,Github 代码库更新到 ord 0.17.0 版本,Casey 表示符文是一个“严肃”的代币协议。 2、Casey 公布了第一个硬编码的创世符文「UNCOMMONGOODS」 3、4月7日香港沙龙|聚焦「…...
瘦身Spring Boot应用(thinJar)
瘦身Spring Boot应用(thinJar) 简介 我们使用Spring Boot提供的spring-boot-maven-plugin打包Spring Boot应用,可以直接获得一个完整的可运行的jar包,把它上传到服务器上再运行就极其方便。 但是这种方式也不是没有缺点。最大的缺点就是包太大了&…...

备战蓝桥杯---贪心刷题1
话不多说,直接看题: 本质是一个数学题: 我们令xi<0表示反方向传递,易得我们就是求每一个xi的绝对值之和min,我们令平均值为a爸。 易得约束条件: x1-x2a1-a,x2-x3a2-a..... 解得x1x1-0,x2x1-((n-1)*a-a2-...an)。…...

《数据结构学习笔记---第九篇》---循环队列的实现
文章目录 1.循环队列的定义 2.循环队列的判空判满 3.创建队列并初始化 4.入队和出队 5. 返回队尾队首元素 6.释放循环队列 1.循环队列的定义 定义:存储队列元素的表从逻辑上被视为一个环。 我们此次实现的循环队列,采用顺序表 typedef struct {int…...

前端调试工具之Chrome Elements、Network、Sources、TimeLine调试
常用的调试工具有Chrome浏览器的调试工具,火狐浏览器的Firebug插件调试工具,IE的开发人员工具等。它们的功能与使用方法大致相似。Chrome浏览器简洁快速,功能强大这里主要介绍Chrome浏览器的调试工具。 打开 Google Chrome 浏览器,…...
 ? require('@/assets/image/avatar.png') : item.avatar)
vue 加 websocket 聊天
<template><div style="height: 100%; width: 100%; background-color: #fff"><div class="wrap"><!-- 头部 --><div class="titleBox"><imgsrc="@/assets/image/avatar.png"style="argin: 10p…...
uniapp通过蓝牙传输数据 (ios)
在uni-app中,可以通过uni-ble(uni-app官方提供的蓝牙插件)来实现iOS设备上的蓝牙数据传输。 首先,确保已在uni-app的manifest.json文件中添加uni-ble插件的配置: "permission": { "scope.userLocati…...

docker搭建CI/CD环境配置过程中的常见问题
一、Jenkins 1、pull镜像问题 docker pull jenkins/jenkins:lts Using default tag: latest Trying to pull repository docker.io/library/centos ... Get https://registry-1.docker.io/v2/library/centos/manifests/latest: Get https://auth.docker.io/token?scoperepo…...

实验四 微信小程序智能手机互联网程序设计(微信程序方向)实验报告
请编写一个用户登录界面,提示输入用户名和密码进行登录; 代码 index.wxml <view class"user"> <form bindreset""> <view>用户名:</view><input type"text"name""/>…...

网络编程(Modbus进阶)
思维导图 Modbus RTU(先学一点理论) 概念 Modbus RTU 是工业自动化领域 最广泛应用的串行通信协议,由 Modicon 公司(现施耐德电气)于 1979 年推出。它以 高效率、强健性、易实现的特点成为工业控制系统的通信标准。 包…...
[2025CVPR]DeepVideo-R1:基于难度感知回归GRPO的视频强化微调框架详解
突破视频大语言模型推理瓶颈,在多个视频基准上实现SOTA性能 一、核心问题与创新亮点 1.1 GRPO在视频任务中的两大挑战 安全措施依赖问题 GRPO使用min和clip函数限制策略更新幅度,导致: 梯度抑制:当新旧策略差异过大时梯度消失收敛困难:策略无法充分优化# 传统GRPO的梯…...

Qt/C++开发监控GB28181系统/取流协议/同时支持udp/tcp被动/tcp主动
一、前言说明 在2011版本的gb28181协议中,拉取视频流只要求udp方式,从2016开始要求新增支持tcp被动和tcp主动两种方式,udp理论上会丢包的,所以实际使用过程可能会出现画面花屏的情况,而tcp肯定不丢包,起码…...
C++:std::is_convertible
C++标志库中提供is_convertible,可以测试一种类型是否可以转换为另一只类型: template <class From, class To> struct is_convertible; 使用举例: #include <iostream> #include <string>using namespace std;struct A { }; struct B : A { };int main…...

【JavaEE】-- HTTP
1. HTTP是什么? HTTP(全称为"超文本传输协议")是一种应用非常广泛的应用层协议,HTTP是基于TCP协议的一种应用层协议。 应用层协议:是计算机网络协议栈中最高层的协议,它定义了运行在不同主机上…...

关于nvm与node.js
1 安装nvm 安装过程中手动修改 nvm的安装路径, 以及修改 通过nvm安装node后正在使用的node的存放目录【这句话可能难以理解,但接着往下看你就了然了】 2 修改nvm中settings.txt文件配置 nvm安装成功后,通常在该文件中会出现以下配置&…...

零基础设计模式——行为型模式 - 责任链模式
第四部分:行为型模式 - 责任链模式 (Chain of Responsibility Pattern) 欢迎来到行为型模式的学习!行为型模式关注对象之间的职责分配、算法封装和对象间的交互。我们将学习的第一个行为型模式是责任链模式。 核心思想:使多个对象都有机会处…...
[Java恶补day16] 238.除自身以外数组的乘积
给你一个整数数组 nums,返回 数组 answer ,其中 answer[i] 等于 nums 中除 nums[i] 之外其余各元素的乘积 。 题目数据 保证 数组 nums之中任意元素的全部前缀元素和后缀的乘积都在 32 位 整数范围内。 请 不要使用除法,且在 O(n) 时间复杂度…...
音视频——I2S 协议详解
I2S 协议详解 I2S (Inter-IC Sound) 协议是一种串行总线协议,专门用于在数字音频设备之间传输数字音频数据。它由飞利浦(Philips)公司开发,以其简单、高效和广泛的兼容性而闻名。 1. 信号线 I2S 协议通常使用三根或四根信号线&a…...

uniapp手机号一键登录保姆级教程(包含前端和后端)
目录 前置条件创建uniapp项目并关联uniClound云空间开启一键登录模块并开通一键登录服务编写云函数并上传部署获取手机号流程(第一种) 前端直接调用云函数获取手机号(第三种)后台调用云函数获取手机号 错误码常见问题 前置条件 手机安装有sim卡手机开启…...