just wonder is it possible to create a trigger to check on a specify constraint base on monthly basis.
eg.
table rent
|ID|Member|book|
———————-
1 | John |fairytale|
2 | John |friction|
3 | John |comic|
4 | John |magazine|
constraint : member are only allow to borrow 4 books monthly.
i thought of using count(book) <= 4 but does not know how to implement the monthly basis constraint.
Any suggestion?
using a trigger, whilst it seems to work, is a dangerous way of doing it, as sessions running in parallel wont see the inserted data from the inprogress session.
you can do it via a materilized view: