283 views
0 0 votes

Consider two relations: $$R(A, B), \quad \quad S(E, C)$$Attribute $A$ is the primary key of relation $R$.  

Attribute $E$ in relation $S$ is a foreign key that references $A$ in $R$.

Which of the following operations will NEVER violate the foreign key constraint?

  1. Delete a record from $R$
     
  2. Delete a record from $S$
     
  3. Insert a record into $R$
     
  4. Insert a record into $S$

1 Answer

2 2 votes

Answer: (B) Delete a record from S & (C) Insert a record into R

 

Explanation

  • (A) Delete a record from R: This operation can violate the foreign key constraint if the record being deleted from table R has its primary key value referenced by one or more records in table S.
  • (B) Delete a record from S: Deleting a record from the referencing table S does not violate the constraint because it removes a reference to a primary key value in R. The referenced value in R still exists.
  • (C) Insert a record into R: Inserting a new record into the referenced table R does not violate the constraint because it introduces a new primary key value that can be referenced by records in S in the future.
  • (D) Insert a record into S: This operation can violate the foreign key constraint if the value inserted into attribute E (the foreign key) does not already exist as a primary key value in attribute A of table R.
Answer:
Position:
Show:

Related questions

0 0 votes
1 1 answer
279
279 views
GO Classes asked Feb 17
279 views
Consider the relation $R(A,B,C,D,E)$ with the following functional dependencies:\[A \rightarrow BC,\qquad CD \rightarrow E,\qquad E \rightarrow A.\]What are the candidate...
0 0 votes
0 0 answers
274
274 views
GO Classes asked Feb 17
274 views
Find correct query for counting Teamsize.SQL Query $1$ SQL Query $2$ SQL Query $3$ SQL Query $4$  
1 1 vote
0 0 answers
261
261 views
GO Classes asked Feb 17
261 views
Consider two relations $R$ and $S$ with attributes $p$ and $s$.The following tuple relational calculus (TRC) query is given:\[\{\, t \mid t \in R \ \land\ (\exists z \in...
0 0 votes
0 0 answers
228
228 views
GO Classes asked Feb 17
228 views
Relational Algebra Question.The query was like, $\pi (\sigma\dots\bowtie\dots)\bowtie(\sigma\dots\bowtie\dots)$Asking : no. of tuples in output.zero tuple one tuple two t...