0

So i have created this table in MySQL Workbench called iOwe. It has a column called Pass(Y/N) on which i'd like to have a check constrain incorporated, which takes only the values "Y" or "N". I understand that check constrains don't work on MySQL, and that is why there are triggers (please correct me if I am wrong). Could you please help me to create one, if that is the case, or tell me how to go about creating a check constrain, if possible. i Googled the same question, but nothing helped me so far.

Your help is greatly appreciated.

Thanks in advance :)

Anonymous Person
  • 1,437
  • 8
  • 26
  • 47

1 Answers1

1

You can use an ENUM datatype for the Y/N column to only accept "Y" and "N". MySQL will not accept any other value for this column then. See the MySQL documentation for ENUM for details.

Mike Lischke
  • 48,925
  • 16
  • 119
  • 181