check phpmyadmin database code example
Example: phpmyadmin CHECK
BEGIN
IF (DATEDIFF(CURRENT_DATE(),NEW.birth_date) < 6570) THEN
-- Throw Exception
SIGNAL SQLSTATE '45000'
SET MESSAGE_TEXT = 'Age is less than 18 years!';
END IF; -- A semicolon (delimiter) is missing here
END