Check constraint using a sub-select to make sure that not more than 10 employees are in one department
create table employees
(
emp_id integer not null primary key,
last_name varchar(100) not null,
first_name varchar(100),
dept_id integer not null,
constraint check_dept_size
check ( (select count(*) from emp e where e.dept_id = dept_id) <= 5 )
);