mysqlenumsrating

MySQL 5-star rating datatype?


Would ENUM('1','2','3','4','5') be a sensible datatype for a product rating which must be between 1 and 5?

Thanks!


Solution

  • Yes, that would be an appropriate data type since it enforces your domain.

    If you are going to add (or do any other mathematical operation) them together, however, a numeric data type might be better.