Hi, I know that I am not good at learning something new. Yesterday I studied my second day about MySQL data types and I realize that I do not know how to use "Enum" and "Set" data types. Please help me
enum aka (ENUMERATION) it's for seting options like 'yes','no' and that's all you can insert into that field set - similar to enum but less restrictive
If you had a form that is auto-filled from a database. The possible values could be Yes, No, Maybe. These could be stored in an ENUM type column. This would save space, increase query speed, and would restrict the values that could be entered into the column. You could also use it for numerical keys like: 0,1,2,3. Same thing, the values that can be entered would be restricted. Alternately you could use a tinyint, but a user could enter 6, 9 4, or something that has no meaning to your application. ENUM prevents bad data while increasing performance in many cases. You wouldn't want to use enum on large sets, as then the overhead for storing the enum data outweighs the benefits, but for small sets of values, it's a great way to restrict user input.