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


当前回答

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

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

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

其他回答

更多关于模式的信息:

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

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

点表示法是这样的:

Server.Database.Schema.Object

or

myserver01.Adventureworks.Accounting.Beans

关系模式是表的逻辑定义——它定义了表的名称,以及每一列的名称和类型。就像一个计划或蓝图。数据库模式是整个数据库的关系模式的集合。

表是由一组行(又名“元组”)组成的结构,每一行都有由模式定义的属性。表上还可能有索引,以帮助查找某些列上的值。

从形式上讲,数据库是任何数据的集合。在这个上下文中,数据库将是表的集合。DBMS(数据库管理系统)是管理和运行数据库的软件(如MySQL, SQL Server, 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.

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

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.