Question: Hello, I need help optimizing the following sql queries. Q1: SELECT p.PublisherName as Publisher, Sum(i.OnHand) as TotalBooks FROM Publisher p, Book b, Inventory i, Branch

Hello, I need help optimizing the following sql queries.

Q1: SELECT p.PublisherName as Publisher, Sum(i.OnHand) as TotalBooks FROM Publisher p, Book b, Inventory i, Branch r WHERE p.PublisherCode = b.PublisherCode and b.BookCode = i.BookCode and i.BranchNum = r.BranchNum and r.BranchLocation = 'Eastshore Mall' GROUP BY p.PublisherName;

Q2:

SELECT Title FROM Book b, Wrote w, Author a WHERE b.BookCode = w.BookCode and w.AuthorNum = a.AuthorNum and a.AuthorLast = 'Rowling' UNION SELECT Title FROM Book b, Inventory i, Branch r WHERE b.BookCode = i.BookCode and i.BranchNum = r.BranchNum and r.BranchName = 'Henry Brentwood' and i.OnHand > 0;

Q3:

SELECT PublisherName FROM Publisher p, Book b, Wrote w, Author a WHERE p.PublisherCode = b.PublisherCode and b.BookCode = w.BookCode and w.AuthorNum = a.AuthorNum and a.AuthorLast = 'King' and w.Sequence = 1;

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!