The MySQL Forum has experts who can advise on other appropriate ways too.
For example, the 2nd-normal form of database normalisation requires that you have a separate table called Category that contains only those distinct types.
Then, your table of guys boys and girls would have a CategoryId field instead, which contains the numeric identifier of the Category itself.
CATEGORY
+------------
| Id | Name |
+------------
| 1 | Small |
| 2 | Big |
| 3 | Huge |
+------------
PRODUCTS
+---------------------
| Name | CategoryId |
+---------------------
| Guy 1 | 1 |
| Girl 1 | 1 |
| Boy 7 | 2 |
| Boy 9 | 3 |
+---------------------
Thank you Much appreciated !! And yes, I agree, however, it’s not my call. I’m working for a pre-made MySQL table on someone else’s website. If it were up to me I would do as you suggested.
2NF does not require creating a separate table, and in particular, it does ~not~ mandate the use of a surrogate key
from the wikipedia article:
Specifically: a 1NF table is in 2NF if and only if, given any candidate key and any attribute that is not a constituent of a candidate key, the non-key attribute depends upon the whole of the candidate key rather than just a part of it.
applied to this example, it means that with Name as the key, and Category as the non-key attribute, the value of the Category column in any given row is determined entirely by the value in the Name column
turned around, it says that if i have this table, and you tell me the value of any name (which, since it’s a key, must be unique), therefore i can tell you unequivocably what the value of the category for that name is
again, it’s important to remember that the normal forms in data modelling are completely silent on the use of numeric ids as keys
don’t let anyone tell you that you have to use a numeric id to conform to any normal form