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) ?

3
  • column value ? wdym Commented May 21, 2021 at 18:56
  • for example : age > 18 ? Commented May 21, 2021 at 18:57
  • 1
    You can use CHECK constraints in MySQL 8.x. Commented May 21, 2021 at 19:00

1 Answer 1

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)
)
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.