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


当前回答

与上面的一些答案相反,以下是我对他们每个人的经验的理解:

MySQL: database/schema:: table SQL Server: database::(schema/namespace::)表 Oracle: database/schema/user::(表空间::)

请纠正我关于表空间是否是可选的Oracle,这是很长一段时间以来,我记得使用他们。

其他回答

架构->平面图

数据库->房子

桌子->房间

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.

来自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.

更多关于模式的信息:

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

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

点表示法是这样的:

Server.Database.Schema.Object

or

myserver01.Adventureworks.Accounting.Beans

简而言之,模式是整个数据库的定义,因此它包括表、视图、存储过程、索引、主键和外键等。