Consider the following relation tables fields with underline
Consider the following relation tables (fields with underline is primary keys): Author(Name, Country) Book(ISBN, Title, Publisher, Subject) Writes(Name, ISBN) Write the relational algebra for the following query: Give the titles of all books with \"Art\" subject Give the name of all authors who publish with \"Harding\" Give the name of all authors who have written books with \"Science\" subject Give the titles of all books written by U.S. authors Give the titles, ISBNs, and publishers of all books with \"Art\" subject whose authors live in the US.
Solution
a) select title from books where subject = \'Art\';
b) select a.name from authors a
join writes w on a.name=w.name
join books b on b.isbn = w.isbn
where b.publisher = \'Harding\';
c) select a.name from authors a
join writes w on a.name=w.name
join books b on b.isbn = w.isbn
where b.subject = \'Science\';
d) select b.title from books b
join writes w on b.isbn = w.isbn
join authors a on a.name=w.name
where a.country =\'U.S.\';
e) select b.title,b.ISBN,b.publisher from books b
join writes w on b.isbn = w.isbn
join authors a on a.name=w.name
where a.country =\'U.S.\' and b.subject=\'Art\';
