mac 打不开 不受信任
介绍 (Introduction)
Intended audience
目标听众
This article is intended for application developers and database administrators who plan to develop, deploy, and/or assess solutions for Microsoft SQL Server on a Microsoft Windows platform.
本文适用于计划在Microsoft Windows平台上开发,部署和/或评估Microsoft SQL Server解决方案的应用程序开发人员和数据库管理员。
Typographical Conventions
印刷约定
Convention | Meaning |
Stylized Consolas Font | Used for blocks of code, commands and script examples. Text should be interpreted exactly as presented |
Consolas Font | Used for inline code, commands or examples. Text should be interpreted exactly as presented |
<italic font in brackets> | Italic texts set in angle brackets denote a variable requiring substitution for a real value |
Italic font | Used to denote the title of a book, article, or other publication |
Note | Additional information or caveats |
惯例 | 含义 |
程式化的Consolas字体 | 用于代码块,命令和脚本示例。 文字应完全按原样解释 |
Consolas字体 | 用于内联代码,命令或示例。 文字应完全按原样解释 |
<括号中的斜体> | 尖括号中设置的斜体文本表示需要替换为实数值的变量 |
斜体字体 | 用于表示书籍,文章或其他出版物的标题 |
注意 | 附加信息或警告 |
Overview
总览
The subject of this article is untrusted foreign keys. Those three words together have a meaning but each word has to be well understood before that. That’s the reason why this article will start with a definitions section where we will define what is a key, what is a foreign key, and how a foreign key can be “untrusted”. Then, we will cover the way to discover and repair untrusted foreign keys for a given database. Finally, we will demonstrate in detail how foreign keys influence the execution of a query when it does not exist, when it exists and is “trusted” and when it exists and is “untrusted”.
本文的主题是不受信任的外键。 这三个词一起具有含义,但在此之前必须先理解每个词。 这就是为什么本文将从“定义”部分开始的原因,其中我们将定义什么是密钥,什么是外键以及如何“不信任”外键。 然后,我们将介绍发现和修复给定数据库的不可信外键的方法。 最后,我们将详细演示外键如何在不存在,何时存在且被“信任”以及何时存在且被“不信任”的情况下影响查询的执行。
定义 (Definitions)
Before going any further, let’s set the base and answer the following questions: « What is a key? », « What is a primary key? » and finally « What is a foreign key? », which is the topic of this article.
在继续进行操作之前,让我们设置基础并回答以下问题:«什么是密钥? »,«什么是主键? »最后,«什么是外键? »,这是本文的主题。
Then, we can talk about what the difference between a trusted and an untrusted foreign key.
然后,我们可以讨论受信任和不受信任的外键之间的区别。
What is a key for a relational table?
关系表的键是什么?
A key is basically an identifier, something that can uniquely identify a record in a relational table. Keys may consist of a single attribute or multiple attributes in combination. Based on the design of a table, there can be more than just one key which identify a record. We will refer to them as candidate keys.
键本质上是一个标识符,它可以唯一地标识关系表中的记录。 键可以包含单个属性,也可以包含多个属性。 根据表的设计,标识记录的键可能不止一个。 我们将它们称为候选键。
Example:
例:
Let’s have a look at the following table. It represents a list of students with 4 columns: a random numeric identifier and the firstname, lastname and sex of the student.
让我们看一下下表。 它代表一个由四列组成的学生列表:一个随机数字标识符以及该学生的名字,姓氏和性别。
StudentID | FirstName | LastName | Sex |
5345664 | Adam | Kent | Male |
8795165 | Jefferson | Elias | Male |
学生卡 | 名字 | 姓 | 性别 |
5345664 | 亚当 | 肯特郡 | 男 |
8795165 | 杰斐逊 | 埃里亚斯 | 男 |
There are two candidate keys here: the StudentID, and the combination of FirstName and LastName columns.
这里有两个候选键: StudentID ,以及FirstName 和LastName列的组合。
Let’s add a table with the courses that are given in a particular school. The table will contain a unique identifier for the course, a title and a description.
让我们添加一个表,其中包含特定学校提供的课程。 该表将包含课程的唯一标识符,标题和说明。
CourseId | Title | CourseDescription |
7897 | Networks | An introductive course on network topologies and standards |
8975 | Numerical Analysis | Basics on numerical analysis. |
课程编号 | 标题 | 课程说明 |
7897 | 网路 | 网络拓扑和标准入门课程 |
8975 | 数值分析 | 数值分析基础。 |
There are, also, two candidate keys here: the CourseId column alone and the Title column alone.
这里也有两个候选键:单独的CourseId列和单独的Title列。
What is a primary key for a relational table?
关系表的主键是什么?
The primary key of a relational table is a key that is considered as the most appropriate one among all the acceptable keys for this table. As a key, it can either be a normal attribute that is guaranteed to be unique such as a unique random alpha-numeric identifier or it can be generated by the DBMS.
关系表的主键是被认为是该表所有可接受键中最合适的键。 作为密钥,它可以是保证唯一的常规属性(例如唯一的随机字母数字标识符),也可以由DBMS生成。
In our example, the most appropriate key to identify a given student record is the StudentID column.
在我们的示例中,标识给定学生记录的最合适的键是StudentID列。
What is a foreign key in a relational table?
关系表中的外键是什么?
A foreign key is a basically a reference to another table in a DBMS. It co