Hi
Isn´t this constraints working in mySQL?
query = "CREATE TABLE Employee (";
query += " EmployeeID INT AUTO_INCREMENT PRIMARY KEY ";
query += " , CivicNr CHAR(11) UNIQUE NOT NULL ";
query += " , Name VARCHAR(50) NOT NULL ";
query += " , Salary INT NOT NULL ";
query += " , CONSTRAINT CivicNr CHECK (CivicNr LIKE '______-____') ";
query += " , CONSTRAINT Salary CHECK (Salary > 12500) ";
query += " ) ";
The table is created but when I insert f.ex Salary = 10000 it´s stored without any messages. Shouldn´t mySQL prevent this and throw an exception?
Thanks in advance, regards GWP
Isn´t this constraints working in mySQL?
query = "CREATE TABLE Employee (";
query += " EmployeeID INT AUTO_INCREMENT PRIMARY KEY ";
query += " , CivicNr CHAR(11) UNIQUE NOT NULL ";
query += " , Name VARCHAR(50) NOT NULL ";
query += " , Salary INT NOT NULL ";
query += " , CONSTRAINT CivicNr CHECK (CivicNr LIKE '______-____') ";
query += " , CONSTRAINT Salary CHECK (Salary > 12500) ";
query += " ) ";
The table is created but when I insert f.ex Salary = 10000 it´s stored without any messages. Shouldn´t mySQL prevent this and throw an exception?
Thanks in advance, regards GWP