=========================preview======================
(COMP201)midtermXX_sol.pdf
Back to COMP201 Login to download
======================================================
1.
a)

select B.Title
from Book as B
where No-Of-Copies =
(select count(*)
from Loan as L
where L.ISBN = B.ISBM)

b)
create assertion max-loan-constraint check
(5 >= all (select count(*)
from Loan
group by Student-ID))
c)
select Name
from Student as S
where Student-ID in
(select Student-ID
from Loan)
and not exist
(select ISBN
from Loan as L
where L.Student-ID = S.Student-ID
and L.Due-Date < 20-10-1999)

d)
Name (Due-Date < 20-20-1999)(LOAN join STUDENT)

{t[Name] | STUDENT(t) and exist LOAN(l) (l[Student-ID] = t[Student-ID] and Due-Date <20-10-1999 ) }

2.