如何确定基表?

发布于 2024-11-03 04:40:16 字数 55 浏览 1 评论 0原文

我的问题与数据库理论有关。

如果给我一组表,有没有办法仅通过查看它们来确定基表?

My question is in relation to database theory.

If I am given a set of tables, is there a way to determine the base table just by looking at them?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

方觉久 2024-11-10 04:40:16

关系模型的一个原则是基表(基关系)和派生表(又名虚拟关系或“视图”)之间没有不必要的区别。两种类型都具有属性、键以及您期望的关系的所有其他功能,并且两者都可以以相同的方式使用。作为一个实际的实现问题,DBMS 软件有必要提供一些方法来区分它们,但从逻辑上讲,它们是相同的。

基础关系和派生关系以这种方式相似的原则有时被称为互换性原则。

事实上,我很惊讶你的问题有如此多的困惑,也很惊讶你的问题被否决了。基表/关系是关系数据库理论和 SQL 标准中非常常见的术语。你的问题对我来说似乎非常简洁和合理。

It is a tenet of the relational model that there is no unnecessary distinction between a Base Table (Base Relation) and a Derived one (aka virtual relation or "view"). Both types have attributes, keys and all the other features you would expect of relations and both can be used in just the same ways. As a practical matter of implementation it is necessary that the DBMS software provide some means to differentiate them but logically speaking they are the same.

The principle that base and derived relations are similar in this way is sometimes called the Principle of Interchangeability.

Actually, I'm surprised there is so much puzzlement here about your question and surprised that your question is downvoted. Base table / relation is a very common term in relational database theory and in the SQL standard. Your question seems perfectly concise and in order to me.

顾挽 2024-11-10 04:40:16

免责声明:我以前从未听说过“基表”

经过一番谷歌搜索后,人们谈论“基表”的唯一实例似乎是在描述视图所依赖的物理表时。

基于此,我想说所有表都是基表,临时表可能除外。

Disclaimer: I never heard of a "base table" before now

After some googling, the only instances where anyone is talking about "Base Tables", seems to be when describing the physical tables a view depends on.

Based on that, I would say all tables are base tables, with the possible exception of temporary tables.

漫漫岁月 2024-11-10 04:40:16

根据 IBM 此处基表是大多数人所理解的“数据库表”,换句话说,就是实际的表本身。

但我不得不说,你的问题有点像“量子理论”——如果从字面上理解,“只是看着它们”……抱歉,我不得不笑,因为我发现自己对此感到头疼。

如果我假设您的意思是“仅查询它们”,那么您必须已经知道表名才能编写查询。还是先有鸡还是先有蛋。

也许您想知道是否有一个表包含所有数据库表的列表?这取决于您正在使用的数据库系统,有时还取决于什么应用程序。以 SAP 为例。它可能使用 Oracle 数据库系统,并创建一个数据库表,其中包含所有 SAP 生成的表的列表。您可以将其视为基表,因为它不会超出其本身。

我只是想到了其他一些有点宇宙性的事情:如果您暗示在安装数据库系统之初必须至少有一个数据库表,这就是您所说的“基础”表寻找,我不知道如何确定它作为一个一般的理论命题。会有比我更好的人来回答这个问题……

或者也许没有。

According to IBM here a base table is what most would understand as "a database table", in other words the actual table itself.

But I have to say your question is a bit "quantum theory"-like - if taken literally "by just looking at them"... sorry I had to laugh because I found myself getting a headache over that one.

If I assume you meant "just by querying them" then you would have to already know the table name to write your query. Again all a bit chicken and egg.

Maybe you want to know if there is a table that contains a list of all database tables? That rather depends on the database system you are working with, and sometimes what applications. Take SAP for example. It might use an Oracle database system, and it creates a database table that contains a list of all SAP generated tables. You could think of that as the base table in the sense that it goes no further than itself.

I just thought of something else a bit cosmic: if you are implying that there must have been at least one database table at the beginning of the installation of database system, and that's what you refer to as the "base" table that you're looking for, I know of no way to determine that as a general theoretical proposition. There are going to be better people out there than me to answer that one...

...or maybe not.

兔小萌 2024-11-10 04:40:16

如果通过基表您正在谈论从表继承,那么您可以通过在基表中联合公共表字段来实现。

例如:
基表:用户(名称)
使用表用户继承的表:管理员、成员等。

但是不要被这种继承混淆,它只复制字段,没有其他内容,它不是面向对象的东西。

If by base table you are talking about inheriting from a table, then yes you can by uniting common table fields in the base table.

For example:
Base table: User(name)
Tables using inheritance of the table User: Administrator, Member, etc.

But don't get confused by this inheritance, it only copies the fields, nothing else, it is not Oriented-Object stuffs.

栀子花开つ 2024-11-10 04:40:16

我假设您的意思是从视图中分辨出常规表。

这取决于您所说的“查看它们”的含义。

如果你的意思只是看数据,那就不行。

如果您的意思是查看创建表的脚本,那么是的。另外,如果您的意思是浏览类似 SQL Server Management Studio 的内容,那么还是可以的,因为它们将表和视图分解到不同的文件夹中。

I am assuming that you mean tell a regular table from a view.

It depends on what you mean by, "looking at them".

If you mean just looking at the data then no.

If you mean looking at a script that creates the table then yes. Also, if you mean by browsing through something like SQL Server Management Studio then again yes, because they break tables and views into different folders.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文