0

I want to create a table which has 2 columns that would only allow one of them to have value in the same row.

I tried with CHECK constraint but it not working correctly

Ex: SQL Fiddle schema example

thanks in advance

2

The CHECK clause is parsed but ignored by all storage engines.

http://dev.mysql.com/doc/refman/5.7/en/create-table.html Use trigger instead.

  • I can't add triggers or procedures in mysql server :( , I'll check this constraint in the application side. – Darii Petru Jun 6 '16 at 10:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.