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,
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,
The cleanest way of doing this is probably to define an enum type:
CREATE TABLE my_table (
my_column ENUM('YES', 'NO')
);
tinyint(1) with a value of 1 or 0 will also work, but which is more optimized?set sql_mode='STRICT_ALL_TABLES'; then otherwise no error will be raised in case of wrong value