I am using a current version of MySQL
I have created a table:
CREATE TABLE IF NOT EXISTS `Uniq_Entity` (
`id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
`ein` VARCHAR (50) NULL ,
UNIQUE KEY `uq_ein` (ein)
ENGINE = InnoDB;
I just was asked to prevent the ein field from having any value other than this pattern:
We are importing the data from a csv file using LOAD DATA LOCAL INFILE .
How do I modify the CREATE TABLE so any attempt to INSERT or UPDATE ein with data that does not match this pattern gets rejected?
Alternatively, how would I modify the INSERT or UPDATE query that would ignore any field that fails to match?
Thanks in advance!