CREATE TABLE `user` (`id` BIGINT NOT NULL,`username` TEXT NOT NULL,`email` TEXT NOT NULL,`user_type` TEXT NOT NULL,`some_name` VARCHAR(1000) NOT NULL,`age` BIGINT NULL DEFAULT 0,CONSTRAINT `user_id_pk` PRIMARY KEY (`id`),CONSTRAINT `user_uc` UNIQUE (username,email),CONSTRAINT `user_email_cc` CHECK (email <> '')); CREATE INDEX `user_index` ON user (username,email);delimiter $$
CREATE TRIGGER TriggerName BEFORE INSERT ON user
FOR EACH ROW
BEGIN
            IF NEW.age < 18 THEN
                SIGNAL SQLSTATE '45000'
                SET MESSAGE_TEXT = 'ERROR: AGE MUST BE GREATER THAN OR EQUALS TO 18!';
            END IF;
            END; $$
delimiter;;