IBM Books

SQL Getting Started


Schemas

A schema is a collection of named objects and provides a logical classification of objects in the database. A schema may contain database objects such as tables and views.

A schema itself is also considered to be an object in the database. It is created implicitly when you create a table or a view. Or, you can create it explicitly using the CREATE SCHEMA statement.

When you create an object, you can qualify its name with the name of the particular schema. Named objects have two-part names, where the first part of the name is the name of the schema to which the object is assigned. If you do not specify a schema name, the object is assigned to the default schema whose name is the authorization ID of the user executing the statement. For interactive SQL, the method used to execute the examples in this book, authorization ID is the userid specified with the CONNECT statement. For example, if the name of the table is STAFF, and the userid specified in the CONNECT statement is USERID, then the qualified name is USERID.STAFF. See Connecting to a Database for details on the CONNECT statement.

Some schema names are reserved. For example, built-in functions are in the SYSIBM schema while the preinstalled user-defined functions belong to the SYSFUN schema. Refer to the SQL Reference for details on the CREATE SCHEMA statement.


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]

[ DB2 List of Books | Search the DB2 Books ]