With the standard preface that this isn't how you would really do this sort of thing in the real world...
You would realistically need to use a statement-level trigger here. If you don't mind the performance hit of checking every room every time
CREATE OR REPLACE TRIGGER Living_AIUD
AFTER INSERT OR UPDATE OR DELETE
ON Living
DECLARE
Count NUMBER;
BEGIN
FOR x IN (SELECT rid, count(*) cnt
FROM living
GROUP BY rid
HAVING COUNT(*) < 3)
LOOP
RAISE_APPLICATION_ERROR(-20002, 'Too few people in room ' || x.rid);
END LOOP;
END Living_AIUD;
If you don't want to check this for every room every time, you'd need a package with a collection of rid
values, a before statement trigger that initialized the collection, and a row-level trigger that added the :new.rid
value to the collection. Your after statement trigger would then iterate over the elements in the collection and check the number of people in just those rooms.