Marc Hoover Marc Hoover - 5 months ago 38
MySQL Question

Setting column so only 1 of 2 values are allowed

Is it possible to set a column so it can only have 1 out of 2 different values. Example, right now the type is varchar(8), but I want it so that only valid values accepted are the words "Bitcoin" or "Paypal". I know I can do this with PHP, but is it possible with MySQL?


Please replace with your table name and with your cloumn name

ALTER TABLE <table name>
    CHANGE COLUMN <column name> ENUM('Bitcoin','Paypal') NOT NULL;