这可能是一个非常糟糕的问题。但我一直将模式视为数据库中的表定义。这是错误的或不完全正确的。我不太记得我的数据库课程了。


当前回答

我试着根据我对以下类比的理解来回答:

A database is like the house In the house there are several types of rooms. Assuming that you're living in a really big house. You really don't want your living rooms, bedrooms, bathrooms, mezzanines, treehouses, etc. to look the same. They each need a blueprint to tell how to build/use them. In other words, they each need a schema to tell how to build/use a bathroom, for example. Of course, you may have several bedrooms, each looks slightly different. You and your wife/husband's bedroom is slightly different from your kids' bedroom. Each bedroom is analogous to a table in your database. A DBMS is like a butler in the house. He manages literally everything.

其他回答

模式是数据库对象的集合,其中也包括逻辑结构。 它具有拥有它的用户的名称。 一个数据库可以有任意数量的Schema。 数据库中的一个表可以出现在两个同名的不同模式中。 用户可以查看已为其分配选择特权的任何模式。

架构->平面图

数据库->房子

桌子->房间

我试着根据我对以下类比的理解来回答:

A database is like the house In the house there are several types of rooms. Assuming that you're living in a really big house. You really don't want your living rooms, bedrooms, bathrooms, mezzanines, treehouses, etc. to look the same. They each need a blueprint to tell how to build/use them. In other words, they each need a schema to tell how to build/use a bathroom, for example. Of course, you may have several bedrooms, each looks slightly different. You and your wife/husband's bedroom is slightly different from your kids' bedroom. Each bedroom is analogous to a table in your database. A DBMS is like a butler in the house. He manages literally everything.

A schema is not a plan for the entire database. It is a plan/container for a subset of objects (ex.tables) inside a a database. This goes to say that you can have multiple objects(ex. tables) inside one database which don't neccessarily fall under the same functional category. So you can group them under various schemas and give them different user access permissions. That said, I am unsure whether you can have one table under multiple schemas. The Management Studio UI gives a dropdown to assign a schema to a table, and hence making it possible to choose only one schema. I guess if you do it with TSQL, it might create 2 (or multiple) different objects with different object Ids.

这篇文章只涉及到Oracle, Schema的定义在另一个DB上下文中会发生变化。

可能是那种让人受不了的事情,但供你参考的术语似乎在定义上有所不同,这是最烦人的事情:)

在Oracle中,数据库就是数据库。你可以把它想象成数据文件和重做日志,以及数据库本身在磁盘上的实际物理存在(即不是实例)。

Schema实际上就是一个用户。更具体地说,它是用户拥有的一组表/ pros /索引等。另一个用户有不同的模式(他/她拥有的表),但是用户也可以看到他们有选择特权的任何模式。因此,一个数据库可以由数百个模式组成,每个模式由数百个表组成。您可以在同一数据库中的不同模式中拥有具有相同名称的表。

表是一个表,一组包含数据的行和列,并且包含在模式中。

例如,SQL Server中的定义可能不同。我不知道这件事。