According to the SQL standard, both catalog and Schema are abstract concepts in the SQL environment. They can be understood as a layer in a container or database object namespace, it is mainly used to solve naming conflicts. Conceptually, a database system contains multiple catalog S, each of which contains multiple schemas, and each schema contains multiple database objects (tables, views, fields, etc ), in turn, a database object must belong to a schema, And the schema must belong to a catalog, so that we can get the fully qualified name of the database object to solve the naming conflict problem; for example, the fully qualified name of the database object table can be expressed as the catalog name. schema name. table name. Note that the SQL standard does not require that the fully qualified names of each database object be unique, just like domain names, each IP Address can have multiple domain names.
From the implementation point of view, the support and implementation methods for catalog and schema vary widely in various database systems. For specific problems, refer to the specific product manual, A simple and common implementation method is to use the database name as the catalog name and the user name as the schema name. For details, see the following table:
Supplier |
Catalog support |
Schema support |
Oracle |
Not Supported |
Oracle user ID |
MySQL |
Not Supported |
Database Name |
Ms SQL Server |
Database Name |
The object owner name, which has changed since version 2005. |
DB2 |
The catalog part is omitted when the database object is specified. |
Catalog owner name |
Sybase |
Database Name |
Database owner name |
Informix |
Not Supported |
No |
Pointbase |
Not Supported |
Database Name |
The last note is the schema word. Its meaning in the SQL environment is completely different from that in the data modeling field. In the SQL environment, schema is a collection of related database objects. The schema name defines a namespace for this group of objects. In the field of data modeling, schema (schema) represents the structure of a database described in a formal language. In short, it can be understood as follows, schema <that is, metadata> of data modeling is saved in a table in the corresponding catalog in the SQL environment under the schema <definition_schema>, you can also query the view under another schema in the catalog <information_schema>. The details are not described in detail.
Catalog & Schema