From Database System Concepts, by Silberschatz et al:
4.5.7 Schemas, Catalogs, and Environments
Like early file systems, early database systems also had a single name space for all relations. Users had to coordinate to make sure they did not try to use the same name for different relations. Contemporary database systems provide a three-level hierarchy for naming relations. The top level of the hierarchy consists of catalogs, each of which can contain schemas. SQL objects such as relations and views are contained within a schema. (Some database implementations use the term “database" in place of the term catalog.)
In order to perform any actions on a database, a user (or a program) must first connect to the database. The user must provide the user name and usually, a password for verifying the identity of the user. Each user has a default catalog and schema, and the combination is unique to the user. When a user connects to a database system, the default catalog and schema are set up for the connection; this corresponds to the current directory being set to the user’s home directory when the user logs into an operating system.
To identify a relation uniquely, a three-part name may be used, for example, catalog5.univ schema.course We may omit the catalog component, in which case the catalog part of the name is considered to be the default catalog for the connection. Thus if catalog5 is the default catalog, we can use univ schema.course to identify the same relation uniquely.
- A relation has a schema, which is the collection of all the attributes of the relation. The "schema" in the above quote seems to correspond to more than one relations. Does "schema" in the above quote mean the same as the schema of a relation?
- What is the relation between catalogs and databases? Is the relation between catalogs and databases one-to-one?
- What do the catalogs and schemas look like in mysql, postgresql, or SQL Server?
Thanks.