Consider the following schema: Publisher (name, phone, address), PK: name. Book
ID: 672467 • Letter: C
Question
Consider the following schema:
Publisher (name, phone, address), PK: name.
Book (ISBN, title, year, published_by, previous_edition), PK: ISBN, FK: published_by refs Publisher, previous_edition refs Book.
Author (SSN, first_name, last_name, address, income), PK: SSN.
Write(aSSN, bISBN), PK: (aSSN, bISBN), FK: aSSN refs Author, bISBN refs Book.
Author_Editor(aeSSN, works_for), PK: aeSSN, FK: aeSSN refs Author, works_for refs Publisher.
Give relational algebraic expressions or SQL statements for the following plain English language queries based on the above schema.
7. Provide the SSN and the income of every author, as well as the name of the publisher that the author works for if he/she is also an editor.
Explanation / Answer
select auth.SSN,auth.income,pub.name from Author auth, Author_Editor authe, Publisher pub
where auth.SSN=authe.aeSSN and authe.works_for=pub.name;