Specify constraints in the CREATE clause in SQL [closed]
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 9 years ago.
Improve this questionI'm trying to set the Quantity attribute to limit from 1 to 100. Does anyone know why this code isn't working?
CREATE TABLE REQUEST (
OrderID VARCHAR2(4),
Pr开发者_开发技巧oductID VARCHAR2(2),
Quantity INTEGER,
CONSTRAINT check_quantity CHECK((INTEGER > 0) AND (INTEGER < 101)));
Perhaps you want CHECK((Quantity > 0) AND (Quantity < 101))
?
Equivalently, you could write CHECK(Quantity BETWEEN 1 AND 100)
精彩评论