15

Possible Duplicate:
CHECK constraint in MySQL is not working

I am student and now I have to work out what check means. We've got a little code:

CHECK (CHAR_LENGTH(PLZ) = 4) 

Now I have to find out what exactly it is doing. The problem is that I can't find anything in the internet(or i am doing something totaly wrong using google). I created this code to test it:

CREATE TABLE Test(
    ID CHAR(4),
    CHECK (CHAR_LENGTH(ID) = 4)
);

INSERT INTO Test(ID) VALUES ('12345');

The problem is that I am not able to find any difference wheter I remove the line with the CHECK constraint or not. Now I am asking you? What is the difference wheter I use it or not.

Community
  • 1
  • 1
Florian
  • 5,918
  • 3
  • 47
  • 86

0 Answers0