Saturday, 17 August 2013

DB2 Schemas

A collection of database objects such as tables, views, indexes, or triggers that define a database. A database schema provides a logical classification of database objects.
A schema is a database object used to logically group other database objects. Every database object name has two parts:
schema_name.object_name
When you create an object, it is always created within a schema, even if you do not explicitly specify the schema name.
When you do not specify the schema name, DB2 uses the authorization ID (the ID used to connect to the database) as the object's schema. If you connect to a database as peter and in a query specify a table simply as tab1, DB2 will interpret this as peter.tab1.
To create the schema user1, use the CREATE SCHEMA statement as follows:
CREATE SCHEMA user1

Created with Artisteer

No comments:

Post a comment