Multiple choice technology databases

Which of the following will be a consequence of defining the column IDCOL2 in TABLE2 as a foreign key referencing the primary key (IDCOL1) of TABLE1?

  1. DB2 will no longer allow updating the value of IDCOL1 in TABLE1.

  2. When inserting a row in TABLE2, the only values that DB2 will allow for IDCOL2 are the existing values of IDCOL1.

  3. When inserting a row in TABLE2, DB2 will only allow foreign values for IDCOL2, that is values which do not exist in IDCOL1.

  4. When a SELECT statement joins TABLE1 with TABLE2, DB2 will automatically add the condition TABLE1.IDCOL1=TABLE2.IDCOL2 if not specified in the statement

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

A foreign key constraint ensures that when inserting a row into TABLE2, the value for IDCOL2 must match an existing value in the referenced primary key IDCOL1 of TABLE1. This is referential integrity - preventing orphaned references. Option A is incorrect because IDCOL1 can be updated if cascade rules are defined. Option C describes the opposite behavior. Option D is incorrect - joins don't automatically add conditions.