Can someone convert these sql queries into relational algebra format?   1. SELECT no_of_copies     FROM ((BOOK NATURAL JOIN BOOK_COPIES) NATURAL JOIN LIBRARY_BRANCH)    WHERE title='The Lost Tribe' AND BranchName='Sharpstown' ;     2. SELECT Branch_name, no_of_copies    FROM ((BOOK NATURAL JOIN BOOK_COPIES) NATURAL JOIN LIBRARY_BRANCH)    WHERE title='The Lost Tribe';          3. SELECT  B.Name      FROM BORROWER B    WHERE NOT EXIST (SELECT * FROM BOOK_LOANS L WHERE B.Card_no = L.Card_no);

Oracle 12c: SQL
3rd Edition
ISBN:9781305251038
Author:Joan Casteel
Publisher:Joan Casteel
Chapter12: Subqueries And Merge Statements
Section: Chapter Questions
Problem 19MC
icon
Related questions
Question

Can someone convert these sql queries into relational algebra format?

 

1. SELECT no_of_copies 
   FROM ((BOOK NATURAL JOIN BOOK_COPIES) NATURAL JOIN LIBRARY_BRANCH)
   WHERE title='The Lost Tribe' AND BranchName='Sharpstown' ;
   
2. SELECT Branch_name, no_of_copies
   FROM ((BOOK NATURAL JOIN BOOK_COPIES) NATURAL JOIN LIBRARY_BRANCH)
   WHERE title='The Lost Tribe';
    
   
3. SELECT  B.Name  
   FROM BORROWER B
   WHERE NOT EXIST (SELECT * FROM BOOK_LOANS L WHERE B.Card_no = L.Card_no);
   
   

4.   SELECT BOOK.Title, BORROWER.Name, BORROWER.Address
     FROM BOOK, BORROWER, BOOK_LOANS, LIBRARY_BRANCH
     WHERE LIBRARY_BRANCH.Branch_name = 'Sharpstown' AND LIBRARY_BRANCH.Branch_id = BOOK_LOANS.Branch_id AND BOOK_LOANS.Due_date='today' AND BOOK_LOANS.Card_no = BORROWER.Card_no AND BOOK_LOANS.Book_id = BOOK.Book_id;
     

5.   SELECT LIBRARY_BRANCH.Branch_name, COUNT(*) AS 'total number of books loaned out'
     FROM BOOK_LOANS, LIBRARY_BRANCH
     WHERE BOOK_LOANS.Branch_id=LIBRARY_BRANCH.Branch_id
     GROUP BY  LIBRARY_BRANCH.Branch_name;   
 
6.  SELECT Name, Address, count(Book_Id)
FROM BORROWER b join BOOK_LOANS l
ON b.card_no = l.card_no
JOIN BOOK_COPIES c
ON c.book_id = l.book_id
GROUP BY Name, Address
HAVING count(Book_Id) > 5;

7.SELECT Title, count(Book_Id)
FROM BOOK b join book_copies c on b.book_id = c.book_id
join book_authors a on a.book_id = b.book_id join book_loans l on l.book_id=a.book_id
join library_branch br on br.branch_id = l.branch_id
where author_name = 'Stephen King'
and branch_name = 'Central';

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
SQL Query
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Recommended textbooks for you
Oracle 12c: SQL
Oracle 12c: SQL
Computer Science
ISBN:
9781305251038
Author:
Joan Casteel
Publisher:
Cengage Learning
A Guide to SQL
A Guide to SQL
Computer Science
ISBN:
9781111527273
Author:
Philip J. Pratt
Publisher:
Course Technology Ptr
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781305627482
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781285196145
Author:
Steven, Steven Morris, Carlos Coronel, Carlos, Coronel, Carlos; Morris, Carlos Coronel and Steven Morris, Carlos Coronel; Steven Morris, Steven Morris; Carlos Coronel
Publisher:
Cengage Learning