0
CREATE TABLE item(id int, number1 float, number2 float, number3 float, number 4 float, PRIMARY KEY(id),
CONSTRAINT valid_numbers CHECK(
(number1 BETWEEN -1 and 1) AND
(number2 BETWEEN -1 and 1) AND
(number3 BETWEEN -1 and 1) AND
(number4 BETWEEN -1 and 1)
));
列號number1,number2,number3和number4都是相似的,因爲它們是需要介於-1和1之間的浮點數;然而他們的價值觀是不同的。檢查BETWEEN的多個列的約束條件
我該如何簡單地表達這種說法?例如,如果一直到15號。我不想說「BETWEEN -1 and 1
」15次,我只想說一次。
,MySQL的支持是外鍵的唯一限制。 – Barmar
MySQL還強制執行'不NULL'約束和一些固有的「約束」爲每個數據類型(INT,DATE,ENUM等) – spencer7593
我的意思,它遵循的唯一'CONSTRAINT'條款。 – Barmar