I'm creating a new database table which will be used to store pictures of products. I'd like to identify the product "type" represented in the picture. Say we have 3 general categories for all the products:
- tables,
- chairs,
- and lamps.
Am I better off creating 3 boolean columns, is_table
, is_chair
, and is_lamp
?
Or am I better off creating an enumeration, and then using a single column for that enum:
CREATE TYPE product_type AS ENUM ('table', 'chair', 'lamp' );
(Note that with the engineering product pictures we're storing, it is guaranteed a product/picture will never qualify as 2 types. It must always be 1 very specific type.)