Sqlite Create Table with Check column from other table
Looking up a value from another table would require a subquery, but the documentation says:


  The expression of a CHECK constraint may not contain a subquery.


There is no such restriction on a trigger's WHERE clause:

CREATE TRIGGER employee_salary_check
BEFORE INSERT ON employee
WHEN NEW.salary &lt; (SELECT min FROM position WHERE id_position = NEW.id_position)
  OR NEW.salary &gt; (SELECT max FROM position WHERE id_position = NEW.id_position)
BEGIN
  SELECT RAISE(FAIL, "invalid salary");
END;