这可能是一个非常糟糕的问题。但我一直将模式视为数据库中的表定义。这是错误的或不完全正确的。我不太记得我的数据库课程了。
当前回答
来自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.
其他回答
schema包含数据库。
数据库是Schema的一部分。
schema >数据库。
模式包含视图、存储过程、数据库、触发器等。
更多关于模式的信息:
在SQL 2005中,模式是对对象进行分组的一种方式。它是一个容器,你可以把对象放进去。人们可以拥有这个物品。您可以授予模式上的权限。
在2000年,一个模式相当于一个用户。现在它已经摆脱了束缚,变得相当有用。你可以把你所有的用户过程放在一个模式中,把你的管理过程放在另一个模式中。将EXECUTE授予适当的用户/角色,就完成了对特定过程的EXECUTE授权。好了。
点表示法是这样的:
Server.Database.Schema.Object
or
myserver01.Adventureworks.Accounting.Beans
Schema的行为就像在OOP中看到的父对象一样。所以它本身不是一个数据库。也许这个链接有用。
但是,在MySQL中,这两者是等价的。关键字DATABASE或DATABASES 可以在任何出现的地方替换为SCHEMA或SCHEMAS。例子:
创建数据库<=>创建模式 显示数据库<=>显示模式
MySQL文档
SCHEMA和DATABASE术语是依赖于DBMS的。
Table是一组数据元素(值),使用垂直列(由其名称标识)和水平行模型组织。数据库通常包含一个或多个表。你把数据存储在这些表中。这些表可能彼此相关(见这里)。
这篇文章只涉及到Oracle, Schema的定义在另一个DB上下文中会发生变化。
可能是那种让人受不了的事情,但供你参考的术语似乎在定义上有所不同,这是最烦人的事情:)
在Oracle中,数据库就是数据库。你可以把它想象成数据文件和重做日志,以及数据库本身在磁盘上的实际物理存在(即不是实例)。
Schema实际上就是一个用户。更具体地说,它是用户拥有的一组表/ pros /索引等。另一个用户有不同的模式(他/她拥有的表),但是用户也可以看到他们有选择特权的任何模式。因此,一个数据库可以由数百个模式组成,每个模式由数百个表组成。您可以在同一数据库中的不同模式中拥有具有相同名称的表。
表是一个表,一组包含数据的行和列,并且包含在模式中。
例如,SQL Server中的定义可能不同。我不知道这件事。
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.
推荐文章
- 截断Postgres数据库中的所有表
- 什么是分片,为什么它很重要?
- 数据库触发器是必要的吗?
- 为什么我应该使用基于文档的数据库而不是关系数据库?
- 哪个更快/最好?SELECT *或SELECT columnn1, colum2, column3等
- 将值从同一表中的一列复制到另一列
- 什么是数据库池?
- 关于数据库,每个开发人员应该知道些什么?
- "where 1=1"语句
- 是使用各有一个模式的多个数据库更好,还是使用一个数据库有多个模式更好?
- 如何从Oracle的表中获取列名?
- 如何检查表上持有哪些锁
- 在MongoDB中查找重复的记录
- 模式、表和数据库之间的区别是什么?
- 我看到VARCHAR(255)如此频繁地使用(而不是其他长度),有什么好的原因吗?