DB2 Schema quick tutorial

A schema is a logical grouping of database objects. It also is used for name qualifiers, which help naturally organize database objects by their name. The convention for this is <SCHEMA-NAME>.<OBJECT-NAME>. This also allows more than on object to have the same object name as long as each is in a different schema.

For example, if you sold hardware and software, you could have a HARDWARE and SOFTWARE schema. In each of them, you could have an ORDERS table to differentiate between hardware and software orders (HARDWARE.ORDERS and SOFTWARE.ORDERS).

If a schema is not qualified, or explicitly stated when the object is created, the schema name is the user ID of the user who created the object. If I am logged in as db2 user and create a table named TEMP1, the full name of that table would be DB2USER.TEMP1.

Recent Posts

Author: Srini

Experienced software developer. Skills in Development, Coding, Testing and Debugging. Good Data analytic skills (Data Warehousing and BI). Also skills in Mainframe.