1

I have this table:

CREATE  TABLE `sold` (
`part_ID` INT(11) NOT NULL ,
`date` DATE NOT NULL ,
 PRIMARY KEY (`part_ID`, `date`) ,
 FOREIGN KEY (`part_ID` )
 REFERENCES `part` (`part_ID` );

This table represent parts sold each day, constraint says number of sales should be at least 25 and at most 100. How can I implement this constraint?

I think it should start with something like this:

CHECK ( NOT EXISTS ...
hamid
  • 1,909
  • 4
  • 18
  • 38

1 Answers1

1

try below

CONSTRAINT chk_sales CHECK (columnName>=25 AND columnName <=100)

Also refer this link

DevelopmentIsMyPassion
  • 3,441
  • 4
  • 32
  • 55