美文网首页
数据库schema 知识

数据库schema 知识

作者: 逍遥的石头 | 来源:发表于2023-01-22 15:34 被阅读0次

        在数据库中,schema(发音 “skee-muh” 或者“skee-mah”,中文叫模式)是数据库的组织和结构,schemas 和schemata都可以作为复数形式。模式中包含了schema对象,可以是(table)、(column)、数据类型(data type)、视图(view)、存储过程(stored procedures)、关系(relationships)、主键(primary key)、外键(foreign key)等。数据库模式可以用一个可视化的图来表示,它显示了数据库对象及其相互之间的关系

MySQL:

Conceptually, a schema is a set of interrelated database objects, such as tables, table columns, data types of the columns, indexes, foreign keys, and so on. These objects are connected through SQL syntax, because the columns make up the tables, the foreign keys refer to tables and columns, and so on. Ideally, they are also connected logically, working together as part of a unified application or flexible framework. For example, theINFORMATION_SCHEMA and performance_schema databases use “schema” in their names to emphasize the close relationships between the tables and columns they contain.

In MySQL, physically, aschema is synonymous with adatabase. You can substitute the keywordSCHEMA instead ofDATABASE in MySQL SQL syntax, for example using CREATE SCHEMA instead of CREATE DATABASE.

Some other database products draw a distinction. For example, in the Oracle Database product, aschema represents only a part of a database: the tables and other objects owned by a single user.

MySQL官方文档指出,从概念上讲,模式是一组相互关联的数据库对象,如表,表列,列的数据类型,索引,外键等等。但是从物理层面上来说,模式与数据库是同义的。你可以在MySQL的SQL语法中用关键字SCHEMA替代DATABASE,例如使用CREATE SCHEMA来代替CREATE DATABASE。

SQL Server:

The names of tables, fields, data types, and primary and foreign keys of a database.

SQL Server官方文档指出,schema中包含了数据库的表,字段,数据类型以及主键和外键的名称。

Oracle Database

A schema is a collection of logical structures of data, or schema objects. A schema is owned by a database user and has the same name as that user. Each user owns a single schema.

Oracle官方文档指出,schema是数据或模式对象的逻辑结构的集合,由数据库用户拥有,并且与该用户具有相同的名称,也就是说每个用户拥有一个独立的schema。

相关文章

网友评论

      本文标题:数据库schema 知识

      本文链接:https://www.haomeiwen.com/subject/wwbwrrtx.html