15-445 lecture#1 Relational Model & Relational Algebrae

【AI方案集】AI与人机协作相结合的智能法律咨询系统.docx AI技术方案以算力、算法、数据三角协同为核心,通过搭建标准化的数据预处理、模型训练与边缘云端协同部署流程,将计算机视觉、自然语言处理、机器学习等核心能力深度融入业务场景,既实现自动化流程降本提效,又通过精准的模式识别与预测分析为管理层提供数据驱动的决策支撑,最终完成从通用AI技术到行业定制化场景的适配落地,为企业数字化转型提供可落地的技术路径。 立即下载

1 Databases
A database is an organized collection of inter-related data that models some aspect of the real-world (e.g.,modeling the students in a class or a digital music store). People often confuse “databases” with  “database management systems” (e.g., MySQL, Oracle, MongoDB). A database management system (DBMS) is the software that manages a database.

DBMS是管理DB的系统,DB是一组数据

2 Flat File Strawman
Database is stored as comma-separated value (CSV) files that the DBMS manages. Each entity will be stored in its own file. The application has to parse files each time it wants to read or update records. Each entity has its own set of attributes, so in each file, different records are delimited by new lines, while each of the corresponding attributes within a record are delimited by a comma.

将DB以CSV的形式保存为文本文件,应用读写记录时需要自己parse文件的含义

每个record占一行,每个atrr由逗号分开

Issues with Flat File
• Data Integrity
– How do we ensure that the artist is the same for each album entry?
– What if somebody overwrites the album year tith an invalid string?
– How do we store theat there are multiple artists on one album?
• Implementation
– How do you find a particular record?
– What if we now want to create a new application that uses the same database?
– What if two threads try to write to the same file at the same time?
• Durability
– What if the machine crashes while our program is updating a record?
– What if we want to replicate the database on multiple machines for high availability?

↑ 这一段非常重要,以后需要注意DBMS是怎么解决这些问题的

3 Database Management System
A DBMS is a software that allows applications to store and analyze information in a database.
A general-purpose DBMS is designed to allow the definition, creation, querying, updation, and administra-tion of databases.

DBMS的定义,作用

Early DBMSs
Database applications were difficult to build and maintain because there was a tight coupling between logical and physical layers. The logical layer is which entities and attributes the database has while the physical layer is how those entities and attributes are being stored. Early on, the physical layer was defined in the application code, so if we wanted to change the physical layer the application was using, we would have to change all of the code to match the new physical layer.

早期的DB应用没有把逻辑层和物理层分开,耦合在一起,开发很不方便

逻辑层是指DB有哪些entity和attr(?)
物理层则是DB是具体如何存储的

4 Relational Model
Ted Codd noticed that people were rewriting DBMSs every time they wanted to change the physical layer,so in 1970 he proposed the relational model to avoid this. This relational model has three key points:
• Store database in simple data structures (relations).
• Access data through high-level language.
• Physical storage left up to implementation.

在以前,每次人们想要修改DB的物理层,都要重写DBMS,所以提出了关系模型

  • 用relation表示DB的存储
  • 用高级语言来访问数据
  • Physical storage left up to implementation.(?)

A data model is a collection of concepts for describing the data in a database. The relational model is an example of a data model.
A schema is a description of a particular collection of data, using a given data model.

机翻:

数据模型是描述数据库中数据的概念的集合。关系模型是数据模型的一个例子。
模式是使用给定数据模型对特定数据集合的描述。

The relational data model defines three concepts:
• Structure: The definition of relations and their contents. This is the attributes the relations have and the values that those attributes can hold.
• Integrity: Ensure the database’s contents satisfy constraints. An example constraint would be that any value for the year attribute has to be a number.
• Manipulation: How to access and modify a database’s contents.

TODO

A relation is an unordered set that contains the relationship of attributes that represent entities. Since the relationships are unordered, the DBMS can store them in any way it wants, allowing for optimization.
A tuple is a set of attribute values (also known as its domain) in the relation. Originally, values had to be atomic or scalar, but now values can also be lists or nested data structures. Every attribute can be a special value, NULL, which means for a given tuple the attribute is undefined.
A relation with n attributes is called an n-ary relation.

ralation就是指表?tuple指的是表中的一行?

Keys
A relation’s primary key uniquely identifies a single tuple. Some DBMSs automatically create an internal primary key if you do not define one. A lot of DBMSs have support for autogenerated keys so an application does not have to manually increment the keys.
A foreign key specifies that an attribute from one relation has to map to a tuple in another relation.

表中的主键用来唯一确定表中的一个tuple,有的DBMS如果你没有设置主键,会自动创建一个。很多DBMS支持设置自增主键,这样就不需要插入数据的人手动设置

外键TODO

5 Data Manipulation Languages (DMLs)
A language to store and retrieve information from a database. There are two classes of languages for this:
• Procedural: The query specifies the (high-level) strategy the DBMS should use to find the desired result.
• Non-Procedural: The query specifies only what data is wanted and not how to find it.

DML:用来访问DB,一种是命令式,一种是声明式,区别在于后者只需要说明自己需要哪些数据,而前者还需要制定如何去查找这些数据

SQL属于后者

6 Relational Model & Relational Algebra
Relational Algebra is a set of fundamental operations to retrieve and manipulate tuples in a relation. Each operator takes in one or more relations as inputs, and outputs a new relation. To write queries we can “chain” these operators together to create more complex operations.

关系代数是一组用来从relation中存取数据的运算符

Select
Select takes in a relation and outputs a subset of the tuples from that relation that satisfy a selection predicate.
The predicate acts like a filter, and we can combine multiple predicates using conjunctions and disjunctions.
Syntax: σ predicate (R).

选出所有符合条件的tuple

Projection
Projection takes in a relation and outputs a relation with tuples that contain only specifed attributes. You can rearrange the ordering of the attributes in the input relation as well as manipulate the values.
Syntax: π A1,A2,. . . ,An (R).

从relation中选出自己关注的attr(仍然是所有的tuple都在内,但是只返回给定的attr)

Union
Union takes in two relations and outputs a relation that contains all tuples that appear in at least one of the input relations. Note: The two input relations have to have the exact same atttributes.
Syntax: (R ∪ S).

union需要两个relation的attr相同

union的时候,合并两个relation的tuple,不过有一点不解,搜的时候说是要去掉重复的,但是不知道为什么本课的slides中没有去重

Intersection
Intersection takes in two relations and outputs a relation that contains all tuples that appear both of the input relations. Note: The two input relations have to have the exact same atttributes.
Syntax: (R ∩ S).

和上面相同,两个relation需要有相同的attr

取共同的tuple

Difference
Difference takes in two relations and outputs a relation that contains all tuples that appear in the first relation but not the second relation. Note: The two input relations have to have the exact same atttributes.
Syntax: (R − S).

取在R中,不在S中的

Product
Product takes in two relations and outputs a relation that contains all possible combinations for tuples from the input relations.
Syntax: (R × S).

将两个relation中的tuple进行组合,全部的组合

Join
Join takes in two relations and outputs a relation that contains all the tuples that are a combination of two tuples where for each attribute that the two relations share, the values for that attrubite of both tuples is the same.
Syntax: (R ./ S).

如果共同的attr具有相同的值,就可以进行连接

Observation
Relational algebra is a procedural language because it defines the high level-steps of how to compute a query. For example, σ b id=102 (R ./ S) is saying to first do the join of R and S and then do the select,
whereas (R ./ (σ b id=102 (S))) will do the select on S first, and then do the join. These two statements will actually produce the same answer, but if there is only 1 tuple in S with b id=102 out of a billion tuples, then
(R ./ (σ b id=102 (S))) will be significantly faster than σ b id=102 (R ./ S).
A better approach is to say the result you want, and let the DBMS decide the steps it wants to take to compute
the query. SQL will do exactly this, and it is the de facto standard for writing queries on relational model
databases.

关系代数是过程式的,因为写关系代数的时候,写明了查询数据的方式

SQL不一样

picture again 立即下载

相关推荐

计算机二级通关宝典1计算机二级通关宝典

计算机二级通关宝典1计算机二级通关宝典

【Technology029】What can mini program do?

A helper for the brand.

u013851260的博客 1565

MobaXterm终端工具个人学习版安装包及常用配置备份

资源包含 MobaXterm 个人版的安装包以及日常运维常用的基础配置备份文件。适用于网络工程师及运维人员用于日常的服务器管理、SSH 连接及串口调试。 压缩包内附带了个人整理的软件使用技巧与配置说明(仅供个人学习参考)。请各位同行下载后注意,技术工具请尽量支持官方正版,本资源仅供个人测试与交流使用,切勿用于商业环境。

JAVA锁定mdb文件_ArcGIS中有关MDB文件锁定的说明

做二次开发总是有人问Personal Geodatabase的Lock问题,这是ESRI开发文档中的解释,摘录如下。但是在实际操作中,比如ArcCatalog移走焦点+刷新似乎并不能解除对当前MDB的锁定。Whenever a program is updating a dataset, such as a feature class or table, be careful toavoid si...

weixin_39602615的博客 237

机械臂的「抽风」自救指南:从万向节死锁到毫米级丝滑抓取

机械臂的「抽风」自救指南:从万向节死锁到毫米级丝滑抓取

科技中介服务机构如何借助平台提升技术撮合服务的专业性与响应速度?.docx

科易网基于AI模型+行业大数据,在技术转移、成果转化、技术经纪、知识产权、产业创新、科技招商等垂直领域的多样化应用场景,推出科技创新领域的AI+工具与数智化解决方案,推动科技创新与产业创新智能化发展。

CMU15-445-Spring-2023-Project #1 - 前置知识(lec01-06)

数据库是相互关联的数据的有组织集合,对现实世界的某些方面进行建模。区别于DBMS(MySQL、Oracle)。

gongyuandaye的博客 1261

产业园区如何利用AI技术提升科技成果转化服务的响应速度与转化成功率?.docx

科易网基于AI模型+行业大数据,在技术转移、成果转化、技术经纪、知识产权、产业创新、科技招商等垂直领域的多样化应用场景,推出科技创新领域的AI+工具与数智化解决方案,推动科技创新与产业创新智能化发展。

Oracle数据库报错整理备注

Oracle数据库报错整理备注1.ORA-00917:missing comma缺少逗号2.ORA-00947:not enough values没有足够的值3.ORA-00904:invalid identifier无效的标识 自己整理下Oracle库遇到的错误,免得到时又忘记 1.ORA-00917:missing comma缺少逗号 这里missing comma的意思是缺少逗号 但是我遇到的时候是少了括号,所以,这应该有缺少符号的意思 解决方法,重新检查sql语句,及时整改 2.ORA-0094..

m0_49976286的博客 2626

11232131231231是的

11232131231231是的

基于双向Buck-Boost电路的锂电池储能充电+放电控制Simulink仿真

内容概要:本文档详细介绍了一种基于双向Buck-Boost电路的锂电池储能系统充放电控制的Simulink仿真模型,重点实现了充电与放电过程中双向能量流动的精确控制。通过Simulink平台构建完整的电路拓扑与控制系统,采用电压、电流双闭环控制策略,有效提升了系统的稳定性与能量转换效率。文档不仅提供了详细的仿真建模方法,还结合参考文献增强了理论支撑,具有较高的科研与工程应用价值。此外,文中列举了大量电力电子领域的相关仿真资源,涵盖LLC谐振变换器、PFC电路、PWM整流器、状态估计等多种技术方向,形成了一个综合性强、覆盖面广的技术资料库,便于研究人员拓展学习和复用设计。; 适合人群:电气工程、自动化、新能源等相关专业的研究生、科研人员及从事电力电子系统设计的工程师。; 使用场景及目标:①研究锂电池储能系统的双向能量管理与高效充放电控制策略;②掌握基于Simulink的电力电子系统建模与闭环控制器设计方法;③为科研项目、毕业设计或工程开发提供可复现的仿真案例与技术支持。; 阅读建议:建议结合文档中提供的参考文献与外部资源链接,系统性地学习Buck-Boost电路的工作原理与控制理论,优先理解基础拓扑运行机制后再深入双闭环控制策略的设计与参数整定,同时可参照同系列其他仿真案例进行对比分析与拓展实践。

数据库约束查找的约束_数据库约束的好处,成本和文档

数据库约束查找的约束 Constraints exist as a way to enforce or document rules within the database. How do they affect performance, and what are the benefits of using them? 约束是在数据库中强制执行或记录规则的一种方式。 它们如何影响性能?使...

culuo4781的博客 2060

【Trans论文复现】基于Agent的电力市场深度决策梯度(深度强化学习)算法建模研究(Python代码实现)

内容概要:本文详细介绍了“Plecs全桥LLC谐振变换器仿真模型”这一技术资源,聚焦于利用PLECS仿真工具对隔离型全桥LLC谐振变换器进行建模、参数设计与性能分析。该资源系统阐述了LLC谐振变换器的工作原理,涵盖谐振参数设计、软开关实现机制、效率优化等关键技术环节,并配套提供了完整的仿真模型、设计报告与计算书,便于用户深入理解其在高效率、软开关功率转换中的优势与应用。研究内容不仅支持理论学习,还可用于控制策略的验证与优化设计,具有较强的工程实践价值。; 适合人群:具备电力电子技术基础知识,从事开关电源、高频功率变换器研发及相关领域研究的工程技术人员与高校研究生。; 使用场景及目标:①用于全桥LLC谐振变换器的教学演示与原理学习;②支持科研人员开展高效DC-DC变换器的建模、仿真与优化设计;③为掌握PLECS在电力电子系统仿真中的高级应用提供详实案例。; 阅读建议:建议结合PLECS仿真软件进行实际操作,通过运行仿真模型并对照设计文档,深入理解电路各模块功能、参数设置依据及软开关实现条件,重点关注谐振腔参数对系统效率与动态响应的影响,以全面提升对LLC变换器工作特性的认知水平与工程设计能力。

【CMU15-445 Part-1】Introduction And Relation Model

CMU15-445 第一部分notes

https://github.com/ZhaoyungZhang 342

无人机通信电台--XBee-PRO 900HP (S3B)

XBee PRO S3B也称为XBee-900HP无线模块,它是一款工作在频段900~928MHz之间,基于FHSS跳频技术的远距离无线数传电台核心模块。常用型号如下: 类别 型号 开发套件 XKB9-DMT-UHP XBee-PRO 900HP (S3B) DigiMesh模块,200Kbps,软天线 XBP9B-DMWT-002 XBee-PRO 900HP (S3B)...

low米的博客 4505

随机森林的可解释性分析(含python代码)

随机森林的“黑箱”特性逐渐凸显,这使得我们难以理解和解释模型内部的工作机制。对于许多应用场景而言,仅仅获得高准确率的预测结果是不够的;了解预测背后的逻辑同样重要,特别是在医疗诊断、金融风险评估等领域。因此,对随机森林进行可解释性分析变得尤为重要。

m0_59257547的博客 3848

constraint - Oracle Documentation

constraint Purpose Use a constraint to define an integrity constraint--a rule that restricts the values in a database. Oracle Database lets you create six types of constraints and lets you decla

问天的专栏 1155

AVS3代码阅读HPM4.0

参考AVS3代码阅读(HPM6.0)(一.整体架构以及CU划分部分代码) 版本:HPM4.0 核心文件:app_encoder.c   要做的是帧间预测,所以前面的函数先暂时不管了,挖个坑以后再填。直接从enc_pic看起。 enc_pic()    ...

CRR的博客 3187

读数据——从平面文件(Flat File)中批量读取数据

我们平常见到的txt、csv等都属于平面文件。spring batch中专门定义了一个类用于批量读取文件。 比如在根目录下data目录下有个User.txt文件,数据如下ID,NAME,AGE 1,lzj,28 2,Tom,20 3,Jerry,18 4,Bob,25 5,Ferry,30 6,Marry,39 7,Linda,27 8,Long,22 9,Kin,33 10,Jiken,40第一

u010502101的博客 5061

固定资产报废的损失鉴定怎么做?

在社会生产的日常中,企业经常会遇到固定资产报废的损失鉴定,那么怎么去做鉴定?哪些情况下能申请固定资产报废损失鉴定呢? 今天,华碧鉴定就和大家说一说固定资产报废损失鉴定那些事儿。 符合下列条件之一的固定资产可申请报废: 1、使用年限过长,功能丧失,完全失去使用价值,或不能使用并无修复价值的; 2、产品技术落后,质量差,耗能高,效率低,已属淘汰且不适于继续使用,或技术指标已达不到使用要求的; 3、严重损坏,无法修复的或虽能修复,但累计修理费已接近或超过市场价值的; 4、主要附件损坏,无.

weixin_50362670的博客 2116

手把手教你用smarteye搭建免费GB28181监控平台(含海康设备接入避坑指南)

本文提供了一份基于SmartEye搭建免费GB28181视频监控平台的实战指南。详细介绍了从服务器部署、GB28181协议核心配置,到海康威视等主流设备接入的完整流程,并重点分享了设备注册失败、无法预览等常见问题的深度排错方法,旨在帮助中小企业及开发者低成本实现多品牌监控设备的统一管理。

pz89012345的博客 326

我的答案计算机,今天考数据库,这是题目和我的答案!数据库教程 -电脑资料

数据|数据库题目:一.单项选择1.With respect to a relational table, what is a key?(a) A minimal subset of columns that uniquely identifies a row in the table(b) The ID and password needed to access the table(c) Th...

weixin_34959771的博客 1127

基于YOLOv11的建筑图纸物体检测系统设计与实现

包含多种建筑平面图,标注了墙体、门窗等元素:CAD格式的建筑图纸数据集:专门针对建筑元素的标注数据集自定义数据集:使用LabelImg等工具自行标注的建筑图纸本文以FloorPlanDataset为基础,结合部分自定义标注数据构建混合数据集。wall (墙体)door (门)window (窗)stair (楼梯)furniture (家具)text (文字标注)dimension (尺寸标注)column (柱子)

YOLO 536

一份sql试题

题目:一.单项选择   1.  

张朝玉的专栏 4677

YOLOv8人工智能与深度学习——强化学习

本文介绍了将YOLOv8目标检测模型与强化学习结合的方法。主要应用包括自适应目标检测(动态调整检测参数)、主动学习(智能选择标注样本)和多目标跟踪优化。实现方案采用深度Q网络策略,通过定义状态表示、动作空间和奖励函数,使检测系统能根据环境反馈优化性能。该方法具有自适应优化、资源高效、持续改进等优势,能构建更智能的计算机视觉系统。文章详细说明了强化学习环境的构建、策略网络的实现以及训练过程,并提供了代码示例。

u010117029的博客 259

【数据分享】12.5米分辨率DEM地形数据(分省)

该数据来源于NASA地球科学数据网站(https://nasadaacs.eos.nasa.gov/),是ALOS卫星获取的高精度地形数据。该数据由于精度高,包括全省范围的数据和省内每个城市范围的数据!

JData_Engineer的博客 2171
上一篇: 6.824 Lab 1 实验指导书: MapReduce
下一篇: 15445 lecture#2 Intermediate SQL
RedemptionC
博客等级 码龄11年 103粉丝 84原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值