Primary Keys Wizard (DB2 LUW)

From RapidSQL
Jump to: navigation, search

Go Up to IBM DB2 for Linux, Unix, and Windows Object Wizards

A primary key is a column or group of columns that you can use to identify or access one or more specific rows in a table. A primary key is ‘constrained’ in that no values can be null and no two values are equal. You can only create one primary key for any table. The Create Primary Key Constraint dialog lets you create a primary key without knowing the underlying commands.

When you create a primary key, specify the table owner and the table on which you want to place the primary key constraint. You name the constraint and select the column(s) you want to include.

To create a new primary key using a wizard:

  1. Open a creation wizard for a primary key. For details, see Opening an Object Wizard.
  2. Use the following topics as a guide to setting properties and performing tasks as you pass through the wizard panels:
  3. Finally, use the Execute button to create the object. For more information, see Previewing the DDL Generated to Create the New Object.

Primary Keys (DB2 LUW) - Properties

When creating or editing a primary key, this tab/panel lets you work with the following settings:

Setting Description

Table Schema and Table Name

Choose the owner and name of the table in which the primary key is being created.

Name

Choose the owner and name of the primary key being created.

Time period policy

This setting is for use with tables set up as business-time tables. For more information, see Tables (DB2 LUW v10) - Temporal Properties. When selected, a BUSINESS_TIME WITHOUT OVERLAPS option is specified against the column or columns defining the constraint, in the generated DDL. This ensures that values for the constraint columns are unique with respect to the time for the BUSINESS_TIME period. When you select this option, columns specified as business-time begin period and end period are not available as candidates on the Columns tab/panel.

Primary Keys (DB2 LUW) - Columns

From the Column dropdown, select a column for the primary key and specify a Sort option. To add more columns, click the New button and then follow the steps in the last instruction. Use the Delete button to drop columns.

Personal tools