I am trying to set up a numeric column in a postgresql table. This column may only contain a number between 1 and 5.
How should i specify this in my postgresql?
You want a constraint
CREATE TABLE mytable (
constraint_col integer CHECK (constraint_col > 0 and constraint_col < 6)
);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With