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


当前回答

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

其他回答

就像MusiGenesis说的那样,在大多数数据库中:

架构:数据库:表::平面图:房子:房间

但是,在Oracle中,它可能更容易想到:

架构:数据库:表::所有者:房子:房间

来自PostgreSQL文档:

A database contains one or more named schemas, which in turn contain tables. Schemas also contain other kinds of named objects, including data types, functions, and operators. The same object name can be used in different schemas without conflict; for example, both schema1 and myschema can contain tables named mytable. Unlike databases, schemas are not rigidly separated: a user can access objects in any of the schemas in the database he is connected to, if he has privileges to do so. There are several reasons why one might want to use schemas: To allow many users to use one database without interfering with each other. To organize database objects into logical groups to make them more manageable. Third-party applications can be put into separate schemas so they do not collide with the names of other objects. Schemas are analogous to directories at the operating system level, except that schemas cannot be nested.

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

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.

更多关于模式的信息:

在SQL 2005中,模式是对对象进行分组的一种方式。它是一个容器,你可以把对象放进去。人们可以拥有这个物品。您可以授予模式上的权限。

在2000年,一个模式相当于一个用户。现在它已经摆脱了束缚,变得相当有用。你可以把你所有的用户过程放在一个模式中,把你的管理过程放在另一个模式中。将EXECUTE授予适当的用户/角色,就完成了对特定过程的EXECUTE授权。好了。

点表示法是这样的:

Server.Database.Schema.Object

or

myserver01.Adventureworks.Accounting.Beans

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