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


当前回答

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.

其他回答

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

schema包含数据库。

数据库是Schema的一部分。

schema >数据库。

模式包含视图、存储过程、数据库、触发器等。

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

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

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

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

在oracle中,Schema是一个数据库下的一个用户,例如scott是orcl数据库中的一个模式。 在一个数据库中,我们可能有很多像scott这样的模式

Schema的行为就像在OOP中看到的父对象一样。所以它本身不是一个数据库。也许这个链接有用。

但是,在MySQL中,这两者是等价的。关键字DATABASE或DATABASES 可以在任何出现的地方替换为SCHEMA或SCHEMAS。例子:

创建数据库<=>创建模式 显示数据库<=>显示模式

MySQL文档

SCHEMA和DATABASE术语是依赖于DBMS的。

Table是一组数据元素(值),使用垂直列(由其名称标识)和水平行模型组织。数据库通常包含一个或多个表。你把数据存储在这些表中。这些表可能彼此相关(见这里)。