GATE / CS ARCHIVE

GATE CSE 1995 / QUESTION 27(c)

Authors with a publisher in Madras

Database Management Systems · Relational Algebra & Calculus · Full GATE CSE 1995 paper

GATE 1995, Q27(c) Descriptive
Report issue

Relational Algebra & Calculus

Question 27(c), GATE 1995: AUTHOR(ANAME,INSTITUTION,ACITY,AGE), PUBLISHER(PNAME,PCITY), BOOK(TITLE,ANAME,PNAME). Use relational algebra SELECT, PROJECT, JOIN and/or DIVIDE. Obtain the names of all authors who have published a book for any publisher located in Madras.
Question 27(c), GATE 1995: AUTHOR(ANAME,INSTITUTION,ACITY,AGE), PUBLISHER(PNAME,PCITY), BOOK(TITLE,ANAME,PNAME). Use relational algebra SELECT, PROJECT, JOIN and/or DIVIDE. Obtain the names of all authors who have published a book for any publisher located in Madras.
Tap to enlarge
Answer & solution

Answer: π_ANAME(AUTHOR ⋈ BOOK ⋈ σ_PCITY='Madras'(PUBLISHER)). (no official key was published)

Select publishers by their city: M=σ_PCITY='Madras'(PUBLISHER). Join BOOK to M on the common attribute PNAME. This keeps exactly books whose publisher is among the Madras publishers. Join the result to AUTHOR on ANAME, and finally project ANAME. A full expression is π_ANAME(AUTHOR⋈BOOK⋈σ_PCITY='Madras'(PUBLISHER)). Natural joins are unambiguous here: BOOK and PUBLISHER share PNAME, while AUTHOR and BOOK share ANAME. ACITY and PCITY are different attributes.

The test is on the publisher's city PCITY, not the author's city ACITY. An author outside Madras qualifies if at least one book has a Madras publisher. Conversely an author living in Madras does not qualify solely because of that residence. The word 'any' here is existential: one matching publisher is enough, so use selection and join rather than division.

Under an assumed foreign-key constraint BOOK.ANAME references AUTHOR.ANAME, the AUTHOR join can be omitted and π_ANAME(BOOK⋈M) is equivalent. Since that referential constraint is not explicitly stated, retaining AUTHOR is the safer literal expression for names of stored authors. Projection removes repetitions caused by multiple qualifying books or publishers under set semantics. Exact comparison uses the displayed city value 'Madras', not a silently substituted modern place-name string.

Original paper, page 8