I have one field named type in a database table. I want this field to contain a value from a list of pre-defined values. If I use set as the datatype of this field, then it can contain more than one values from the list.
What datatype to use, so that It can contain only one value from the list of values (pre-defined)?
For mySQL, you want ENUM.
MS SQL does not have a ENUM type as far as I know. (Correct me if I’m wrong.) You would usually use integer values, and resolve them in the application. To limit the range of possible values, the CHECK constraint can be used.