Adding a New Table Constraint

Nasza ocena:

5
Wyświetleń: 434
Komentarze: 0
Notatek.pl

Pobierz ten dokument za darmo

Podgląd dokumentu
Adding a New Table Constraint - strona 1

Fragment notatki:

Adding a New Table Constraint
In this example, you add a table constraint to the purchase_orders table that you
created in "Example: Creating a Table" on page 8-11. To enforce the rule that the po_
date_received value must be either the same day as, or later than, the value of po_
date, you add a check constraint.
To add a table constraint to the PURCHASE_ORDERS table:
1. Navigate to the PURCHASE_ORDERS table in the HR schema, following the
instructions in "Viewing Tables" on page 8-10.
2. Right-click the PURCHASE_ORDERS table and select Edit.
The Edit Table dialog box appears.
3. Under the Search box, click Check Constraints.
4. To the right of the Check Constraints section, click Add.
5. In the Name field, enter PO_CHECK_RCVD_DATE. This constraint name that you
specify will overwrite the system-assigned default name that appears in the Check
Constraints text box above the Name field.
6. In the Condition field, enter the following condition for this constraint:
PO_DATE_RECEIVED = PO_DATE
This expression indicates that PO_DATE_RECEIVED must be greater than or equal to
PO_DATE. For date columns, this is equivalent to stating that PO_DATE_RECEIVED
must be on the same day as, or later than, PO_DATE.
... zobacz całą notatkę



Komentarze użytkowników (0)

Zaloguj się, aby dodać komentarz