Set constraint on column type?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • srichmond
    New Member
    • Nov 2010
    • 1

    #1

    Set constraint on column type?

    Hi, sorry for what I'm sure is a really stupid question but I've just recently started using Oracle.

    Basically, I have a table called products containing the details of various products (mobile phones etc.) and each product is to have a rating between 1 and 5. I have a column called product_rating of type number(1,0) but don't know how to restrict it to between 1 and 5.

    Thanks in advance for your help :)
  • rski
    Recognized Expert Contributor
    • Dec 2006
    • 700

    #2
    Use 'check constraint', see here
    This Oracle tutorial explains how to use the check constraints in Oracle with syntax and examples. A check constraint allows you to specify a condition on each row in a table.

    Comment

    Working...