我可以在数字 MySQL 列(InnoDB)上定义一个约束,只允许某个范围内的值吗?
例如wavelength
此表中的列:
CREATE TABLE spectrumdata
(
valueid INT AUTO_INCREMENT,
spectrumset INT NOT NULL,
wavelength DOUBLE NULL,
intensity DOUBLE NULL,
error INT NOT NULL,
status INT NOT NULL,
PRIMARY KEY (valueid),
INDEX spectrumset_idx (spectrumset),
CONSTRAINT spectrumset_fk FOREIGN KEY (spectrumset)
REFERENCES spectrumsets (setid)
)
COLLATE=utf8_general_ci
ENGINE=InnoDB
ROW_FORMAT=DEFAULT
AUTO_INCREMENT=1;