GATE / CS ARCHIVE

GATE CSE 1995 / QUESTION 27(b)

Selecting authors of a named publisher

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

GATE 1995, Q27(b) Descriptive
Report issue

Relational Algebra & Calculus

Question 27(b), GATE 1995: AUTHOR(ANAME,INSTITUTION,ACITY,AGE), PUBLISHER(PNAME,PCITY), BOOK(TITLE,ANAME,PNAME). Use relational algebra SELECT, PROJECT, JOIN and/or DIVIDE. Obtain all AUTHOR attributes of authors who have published a book with PNAME='TECHNICAL PUBLISHERS'.
Question 27(b), GATE 1995: AUTHOR(ANAME,INSTITUTION,ACITY,AGE), PUBLISHER(PNAME,PCITY), BOOK(TITLE,ANAME,PNAME). Use relational algebra SELECT, PROJECT, JOIN and/or DIVIDE. Obtain all AUTHOR attributes of authors who have published a book with PNAME='TECHNICAL PUBLISHERS'.
Tap to enlarge
Answer & solution

Answer: π_ANAME,INSTITUTION,ACITY,AGE(AUTHOR ⋈ σ_PNAME='TECHNICAL PUBLISHERS'(BOOK)). (no official key was published)

First identify the relevant books using selection: T=σ_PNAME='TECHNICAL PUBLISHERS'(BOOK). This keeps tuples whose publisher name matches the specified literal, while retaining TITLE and ANAME so that authors can be linked. Next compute AUTHOR⋈T. The only shared attribute name is ANAME, so this natural join matches each qualifying book to its author record. Finally project ANAME,INSTITUTION,ACITY,AGE to return exactly the attributes requested from AUTHOR.

Thus the complete expression is π_ANAME,INSTITUTION,ACITY,AGE(AUTHOR⋈σ_PNAME='TECHNICAL PUBLISHERS'(BOOK)). Equivalently, first project ANAME from the selected books, then join that name relation to AUTHOR; the result already has exactly the AUTHOR schema.

An author with several matching books still appears only once in classical set relational algebra after projection. An author with no such book is excluded because there is no matching join tuple. Joining PUBLISHER is not needed: the condition is already expressible using BOOK.PNAME. The expression uses the association specified by the schema, namely ANAME as the author link; it does not infer that names uniquely identify people outside this database model. DIVIDE would express a universal requirement and would be inappropriate for the existential condition 'has published a book'.

Original paper, page 8