0

I have table in MySql database want to limit some column value,

is it possible to make a column in table to take specified value such as (value <= 3) ?

Sermed mayi
  • 531
  • 4
  • 15

1 Answers1

1

you need to use a constraint named check which will be defined on table creation and check the value before insert .

CREATE TABLE table_name (          
    value INT ,
    CHECK(value <= 3)
)
HijenHEK
  • 1,043
  • 1
  • 3
  • 11