Statement dependency system
Derby Reference Manual
80
REFERENCES Flights (FLIGHT_ID, SEGMENT_NUMBER)
);
-- add a unique constraint to a column
ALTER TABLE SAMP.PROJECT
ADD CONSTRAINT P_UC UNIQUE (PROJNAME);
-- create a table whose city_id column references the
-- primary key in the Cities table
-- using a column-level foreign key constraint
CREATE TABLE CONDOS
(
CONDO_ID INT NOT NULL CONSTRAINT hotels_PK PRIMARY KEY,
CONDO_NAME VARCHAR(40) NOT NULL,
CITY_ID INT CONSTRAINT city_foreign_key
REFERENCES Cities ON DELETE CASCADE ON UPDATE RESTRICT
);
Statement dependency system
INSERT and UPDATE statements depend on all constraints on the target table.
DELETEs depend on unique, primary key, and foreign key constraints. These statements
are invalidated if a constraint is added to or dropped from the target table.
Column-level-constraint
{
NOT NULL |
[ [CONSTRAINT
]
{
CHECK (
) |
}
}
}
Table-level constraint
[ ,
]* ) |
UNIQUE (
[ ,
]*
)
}
}
References specification
[ (
[ ,
]
[ ON DELETE {NO ACTION | RESTRICT | CASCADE | SET NULL}]
[ ON UPDATE {NO ACTION | RESTRICT }]
|
[ ON UPDATE {NO ACTION | RESTRICT }] [ ON DELETE
{NO ACTION | RESTRICT | CASCADE | SET NULL}]
searchCondition
that meets the requirements specified in
Requirements for search condition
.