gpt4 book ai didi

database - 在关系数据库中查找 "1-to-3"链接

转载 作者:搜寻专家 更新时间:2023-10-30 23:38:45 26 4
gpt4 key购买 nike

我敢肯定有一个我只是不知道的术语,但我们称之为寻找“1 对 3”链接。假设我有一个这样的表:

ID  Src     Src_Field  Tgt      Tgt_Field
1 Table1 Field_A Table2 Field_D
2 Table1 Field_B Table2 Field_E
3 Table1 Field_C Table2 Field_F
4 Table2 Field_D Table3 Field_G
5 Table2 Field_E Table3 Field_H
6 Table2 Field_F Table3 Field_I

我希望最终结果看起来像这样:

Table1  Field_A Table2  Field_D Table3  Field_G
Table1 Field_B Table2 Field_E Table3 Field_H
Table1 Field_C Table2 Field_F Table3 Field_I

我不是在找人为我写一个查询,而是在寻找这叫做什么,算法的链接等。我正在尝试找到这些链接并将它们配对:

1 => 2
2 => 3

所以我得到:

1 => 2 => 3

因此我的术语是“1 对 3”链接。实际的关系数据库并不重要。我主要是想了解如何执行此操作。

最佳答案

我将其描述为 hierarchical database model .

A hierarchical database model is a data model in which the data is organized into a tree-like structure.

A recursive join 将用于获取您提供的结果。

The recursive join is an operation used in relational databases, also sometimes called a "fixed-point join". It is a compound operation that involves repeating the join operation, typically accumulating more records each time, until a repetition makes no change to the results (as compared to the results of the previous iteration).

关于database - 在关系数据库中查找 "1-to-3"链接,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37865237/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com