insert operation
the insert operation provides a list of attribute values for a new tuple
that is to be inserted into a relation
. insert can violate any of the four types of constraints.
domain constraints can be violated if an attribute value is given that does not appear in the corresponding domain or is not of the appropriate data type. key constraints can be violated if a key value in the new tuple
already exists in another tuple in the relation
. entity integrity can be violated if any part of the primary key of the new tuple
is NULL. referential integrity can be violated if the value of any foreign key in
refers to a tuple that does not exist in the referenced relation.
if an insertion violates one or more constraints, the default option is to reject the insertion. in this case, it would be useful if the dbms could provide a reason to the user as to why the insertion was rejected. another option is to attempt to correct the reason for rejecting the insertion, but this is typically not used for violations caused by Insert; rather, it is used more often in correcting violations for delete and update.
[cite:@elmasri_db_2015 chapter 5.3.1 the insert operation]
domain constraints can be violated if an attribute value is given that does not appear in the corresponding domain or is not of the appropriate data type. key constraints can be violated if a key value in the new tuple
if an insertion violates one or more constraints, the default option is to reject the insertion. in this case, it would be useful if the dbms could provide a reason to the user as to why the insertion was rejected. another option is to attempt to correct the reason for rejecting the insertion, but this is typically not used for violations caused by Insert; rather, it is used more often in correcting violations for delete and update.
[cite:@elmasri_db_2015 chapter 5.3.1 the insert operation]