Consider the following two statements: S1: If a database has two tables T1, T2…
Consider the following two statements:
S1: If a database has two tables T1, T2 and both of these tables have a same column C, then C is a foreign key.
S2: Number of tuples in left outer join of relation r and s is strictly greater than number of tuples in full outer join of r and s.
Which of the following is correct about S1 and S2?
Answer: D. Both S1 and S2 are false — Answer: Both statements are false. Statement S1: Having the same column name in two tables does not make that column a foreign key. A foreign key is a column…
- A.
S1 is true but S2 is false
- B.
S1 is false but S2 is true
- C.
Both S1 and S2 are true
- D.
Both S1 and S2 are false
Attempted by 18 students.
Show answer & explanation
Correct answer: D
Answer: Both statements are false.
Statement S1: Having the same column name in two tables does not make that column a foreign key. A foreign key is a column (or set of columns) in one table that explicitly references a primary key or a unique key in another table. Example: T1(a,b) and T2(a,c) where neither table declares 'a' as a primary or unique key — there is no foreign key relationship just from the name being the same.
Statement S2: A left outer join returns all rows from the left relation plus matching rows from the right. A full outer join returns all rows from both relations, merging matching rows and including non-matching rows from either side. Therefore the full outer join has at least as many rows as the left outer join; it can be equal (if the right relation has no non-matching rows) or greater, but never strictly smaller. Example: if r = {(1)} and s = {}, both joins give 1 row; if s has non-matching rows, the full outer join will have more rows.