Answer the question
In order to leave comments, you need to log in
How to create a statement in MySQL?
There are 4 fields in the table: id, workday, dayoff, sumdays
I want to add a check that the sum of workday + dayoff recorded in sumdays is no more than 365. I wrote:
CREATE ASSERTION Limitdays CHECK (
NOT EXISTS (
SELECT `workday`, `dayoff`, `sumdays`
FROM `worker`
WHERE id=id
AND `sumdays` < 367
)
);
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question