Should I turn those into an extra column or should they become seperate tables?
They should definitely be stored in a separate table (say, food_category
) and you should add an appropriately-named foreign key to the table you posted (let's called that food
).
In SQL, you'd use a statement like this to create the tables with the foreign-key relationship in place, note the references
line:
create table food_category (
id serial primary key,
name varchar(32) not null unique
);
create table food (
id serial primary key,
category_id int references food_category(id) not null,
name varchar(32) not null unique,
calories numeric,
cholesterol numeric,
sugar numeric
);