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

三菱 FX5U PLC 4轴程序 控制松下伺服3个, 步进电机一个

三菱 FX5U PLC 4轴程序。 控制松下伺服3个, 步进电机一个, 四轴自动堆垛码垛设备程序, 回原点动作用专用的原点回归指令写的, 手动运行用三菱相对定位指令写的 , 自动运行用绝对定位指令写的取料运行, 表格定位写的自动放料运行, 设备各种报警异常都有写出 程序每一步都有注释。 包括PLC程序、显控触摸屏 程序、松下伺服驱动器接线图。 程序内都有IO注释 编号:4816635519484681汇美0808 ...

m0_68069172的博客 3381

东方财富网股票API逆向分析:手把手教你破解动态参数(2024最新版)

本文详细解析了2024年东方财富网股票API的动态参数生成机制,包括回调函数、身份验证和时效控制参数的逆向工程方法。通过实战代码演示,帮助开发者破解动态参数,实现高效稳定的股票数据爬取,适用于金融数据分析和量化交易场景。

weixin_29091105的博客 1026

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

手把手教你搭建《黑色沙漠》单机版:从下载到联机的完整指南(含GM工具使用)

本文提供《黑色沙漠》单机版从下载安装到GM工具使用及局域网联机的完整教程。详细解析不同版本选择、系统配置要求、常见问题解决,并分享GM工具高级命令和局域网联机设置技巧,帮助玩家轻松搭建个性化游戏环境。

weixin_28738165的博客 468

读数据——从平面文件(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

STM32F407+LWIP实战:手把手教你移植mbedtls库实现Modbus TCP双向认证

本文详细介绍了如何在STM32F407微控制器上移植mbedtls库,结合LWIP协议栈实现Modbus TCP的双向认证功能。通过TLS 1.2加密通道,有效提升工业物联网通信的数据安全性,涵盖证书管理、内存优化及性能调优等关键步骤,为嵌入式系统开发者提供了一套完整的解决方案。

weixin_28721917的博客 516

当AI写小说——一个被严重低估的工程化战场

摘要 AI小说创作远非简单的prompt生成,而是一项需要系统化工程管理的复杂任务。本文通过真实案例分析,揭示了当前AI写小说存在的五大核心难题:设定一致性难以维持、文风控制缺乏个性、爽感节奏难以把握、长篇记忆能力有限以及平台规则适配困难。研究显示,90%的失败案例源于错误的创作方法,主要表现为对话框式随机生成和模板式同质化创作。要实现高质量的AI小说创作,必须建立包括设定治理、记忆管理、文风校准等在内的全链路工程化体系,而非依赖单一prompt指令。只有采用系统化的人机协同方法,才能突破当前AI创作的质量

sellyogurt的博客 683

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

数据|数据库题目:一.单项选择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

qt实现OCC读取STEP模型并显示(附完整源码)

qt实现OCC读取STEP模型并显示(附完整源码)

希望我的博客,能帮上你解决学习中工作中所遇到的问题 1481

一份sql试题

题目:一.单项选择   1.  

张朝玉的专栏 4677

8-bit量化在YOLOv11中的部署实践-(使用PTQ、QAT量化技术实现模型体积压缩和推理加速)

本文系统介绍了YOLOv11模型量化技术,主要包括三个核心部分:首先阐述模型量化的基础理论,包括量化分类、数学原理和性能影响;其次分析YOLOv11架构特点及其量化敏感层;最后详细讲解训练后量化(PTQ)的具体实现流程。研究表明,8-bit量化可使YOLOv11模型大小缩减至1/4,推理速度提升1.7-2.3倍,精度损失控制在1%以内。文章特别强调了校准算法选择(如最小最大值法和KL散度法)对量化效果的关键影响,并提供了完整的代码实现示例,为YOLOv11的高效部署提供实用指导。

本博客聚焦 YOLOv11 全流程落地,涵盖架构优化、数据集处理、训练技巧与多场景部署,兼及国产数据库、Java 开发与 AI 模型应用,内容兼顾理论与工程实践,为开发者提供系统干货,助力高效提升技术能力。 1626

PCL 直通滤波器【2026最新版】

PCL直通滤波器函数详解以及用于多字段滤波、强度滤波、获取某一时间范围内的点等高阶用法案例分享。博客长期更新,本文最近一次更新时间为:2026年3月11日。

点云侠的博客 40万+
上一篇: 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、付费专栏及课程。

余额充值