Computer Science, asked by fasilayele28, 2 months ago

hoose the appropriate action (reject, cascade, set to NULL, set to default, check, unique) for each referential integrity constraint, both for the deletion of a referenced tuple and for the update of a primary key attribute value in a referenced tuple. Justify your choices.

Answers

Answered by harika79
1

Answer:

foreign key is a column (or combination of columns) in a table whose values must match values of a column in some other table. FOREIGN KEY constraints enforce referential integrity, which essentially says that if column value A refers to column value B, then column value B must exist.

For example, given an orders table and a customers table, if you create a column orders.customer_id that references the customers.id primary key:

Each value inserted or updated in orders.customer_id must exactly match a value in customers.id, or be NULL.

Values in customers.id that are referenced by orders.customer_id cannot be deleted or updated, unless you have cascading actions. However, values of customers.id that are not present in orders.customer_id can be deleted or updated.

Similar questions