MySQL Forums
Forum List  »  Newbie

Re: How to view number of available books in a library DB?
Posted by: Peter Brawley
Date: December 14, 2021 10:13AM

?! Nothing stops you from writing table specs in English.

Given tables books(bid, n, ...) and lent((lid,bid,lentdate,returndate,...) where lent.bid refers to books.bid, is this what you mean?

select b.bid, count(*)
from books b
join lent l using(bid)
where l.returndate is null
group by b.bid
order by b.bid;

Options: ReplyQuote


Subject
Written By
Posted
Re: How to view number of available books in a library DB?
December 14, 2021 10:13AM


Sorry, only registered users may post in this forum.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.