0

I am trying to create a table in mysql. I want to store future dates in that table. I am trying following query:
SQL:

create table dates(submission _date date check(submission _date>curdate));

But this check Clause is not working properly. It accept all dates. Please give me solution.

  • MySQL only parses the check constraint, but does not enforce them. You need insert / update triggers to perform such checks. – Shadow Mar 06 '17 at 14:30
  • 4
    Possible duplicate of [CHECK constraint in MySQL is not working](http://stackoverflow.com/questions/2115497/check-constraint-in-mysql-is-not-working) – Shadow Mar 06 '17 at 14:31
  • Probably you want the following answer from the duplicate topic, since it raises exception from the trigger: http://stackoverflow.com/a/14248038/5389997 – Shadow Mar 06 '17 at 14:37
  • Then what should I do to make in working so that in accept only future dates? – Abhishek Patil Mar 06 '17 at 14:37
  • Check out the duplicate link I gave you, specifically, the answer I marked in my previous comment. – Shadow Mar 06 '17 at 14:41
  • Ok.. I will try.. Thank you. – Abhishek Patil Mar 06 '17 at 14:44

0 Answers0