我想创建一个列值大于 0 并且可以为空的表。
当我在创建表列时这样做
CREATE TABLE Ship
(
SITE_ID INTEGER NOT NULL,
Ship_CATEGORY VARCHAR2(50) CHECK (WRECK_CATEGORY IN ('Military','Government','Passenger', 'Unknown', 'Commercial')),
Ship_TYPE VARCHAR2(100) ,
Ship_TONNAGE INTEGER CHECK ((WRECK_TONNAGE>0) AND WRECK_TONNAGE IS NULL) ,
Ship_CAUSE VARCHAR2(100) NULL CHECK (WRECK_CAUSE IN ('Fire', 'Collision','Unknown',' Deliberate', 'Explosion',' Attack', 'Other')),
Ship_DATESUNK DATE NULL,
Ship_CONDITION VARCHAR2(50) NULL CHECK (WRECK_CONDITION IN ('Excellent', 'Moderate','Poor', 'Very Poor')),
CONSTRAINT SHIPWRECK_PK PRIMARY KEY (SITE_ID)
);
在“Ship_TONNAGE INTEGER CHECK ((WRECK_TONNAGE>0) AND WRECK_TONNAGE IS NULL)”行中,当我向该列插入空值时,它违反了约束。我如何创建满足条件的表?谢谢