CS FundamentalsVery hardGATE CS (PYQ pattern)
An ER diagram has a supertype PERSON(pid, name) with disjoint, total specialisation into STUDENT(gpa) and TEACHER(salary). Using the 'one table per subtype, no supertype table' mapping, how many tables hold the data and what is the PRIMARY KEY of each?
- A. 3 tables, with pid as the key of PERSON only
- B. 2 tables, keyed by name
- C. 2 tables, STUDENT(pid, name, gpa) and TEACHER(pid, name, salary), each keyed by pid
- D. 1 table with pid and a type column
Correct answer: C. 2 tables, STUDENT(pid, name, gpa) and TEACHER(pid, name, salary), each keyed by pid
For a disjoint total specialisation, each subtype table copies the supertype attributes (pid, name) plus its own, and pid remains the key; no PERSON table is needed because every person is a student or a teacher.
More DBMS and SQL questions
- Relations R(A, B, C) with key A and S(C, D) with key C, where R.C is a foreign key to S. A row of S that is referenced by some R rows is…
- PA(id, k): (1,1), (2,2), (3,2), (4,3), (5,NULL), (6,4). PB(k, z): (1,9), (2,9), (2,8), (NULL,7). Let p = rows of SELECT FROM PA LEFT JOIN…
- GB(id, v): (1,5), (2,12), (3,18), (4,25), (5,31), (6,39), (7,NULL). The query SELECT v / 10, COUNT() FROM GB GROUP BY v / 10 uses integer…
- Three transactions each execute R(A) followed by W(A) on the same item A. Among all interleavings of the six operations (each…
- T1: R(A), W(A), R(B) and T2: R(B), W(B), R(A), each in that order. Of the C(6,3) = 20 interleavings, how many are conflict-serializable?
- T1: W(A) W(B) and T2: W(B) W(A) run under strict 2PL (exclusive locks held until the transaction ends; a schedule counts only if no…