bsmoo
bsmoo

Reputation: 1049

MySQL | data validation

How can i make it so that with a MySQL column you can only input certain options i.e. 'YES', 'NO'

I know this is possible but i can't find how to do this and searching online hasn't helped!

Thank you,

Upvotes: 1

Views: 421

Answers (1)

Mureinik
Mureinik

Reputation: 311088

The cleanest way of doing this is probably to define an enum type:

CREATE TABLE my_table (
    my_column ENUM('YES', 'NO')
);

Upvotes: 3

Related Questions