我尝试添加一些约束,但无论我做什么,我都会收到这条消息,我错过了左括号..
1
alter table CUSTOMER
add unique customer.username (username);
2
ALTER TABLE CUSTOMER
ADD CONSTRAINT CHECK customer.credit_type (credit_type,'high','average','low');
有什么想法吗?
提前致谢!
答案 0 :(得分:4)
您似乎正在寻找这种语法:
ALTER TABLE customer
ADD CONSTRAINT username_unique UNIQUE (username);
ALTER TABLE customer
ADD CONSTRAINT check_credit_type CHECK (credit_type IN ('high','average','low'));