开发者

Specify constraints in the CREATE clause in SQL [closed]

开发者 https://www.devze.com 2023-02-03 11:00 出处:网络
Closed. This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this
Closed. This question needs to be more focused. It is not currently accepting answers.

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 question

I'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)

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号