Reputation: 14554
Like an unsigned field but only for negative numbers.
I'm just curious.
Upvotes: 1
Views: 949
Reputation: 24316
This can be accomplished with a before-insert
trigger.
CREATE DEFINER=`root`@`localhost` trigger triggerName
BEFORE INSERT ON tableA
FOR EACH ROW BEGIN
IF(value > 0) THEN
STOP ACTION
END IF;
Upvotes: 6
Reputation: 146499
You could just use an unsigned int and a minus sign on every insert, update and select.
Upvotes: 4