Re: How to store/manage tags?
From: J.O. Aho <user_at_example.net>
Date: Sat, 13 Jul 2019 14:17:39 +0200
Message-ID: <gou0f3FlvfgU1_at_mid.individual.net>
Date: Sat, 13 Jul 2019 14:17:39 +0200
Message-ID: <gou0f3FlvfgU1_at_mid.individual.net>
On 13/07/2019 12.09, ^Bart wrote:
> I need to store tags in a db, for example about restaurants, like
> romantic, sea view, etc., I thought to do something like this:
>
> restaurants
> ---------------
> id_restaurant
> name
>
> tags
> ---------------
> id_tag
> name
>
> restauranttags
> --------------
> id_restauranttag
> FK_id_restaurant
> FK_id_tag
>
> Do you have other ideas?
I would drop the id_restauranttag, it's pointless, you have already the restaurant and the tag which together would be the primary key.
If you want to "edit" a tag in the restauranttags, you remove the old tag and add the new tag.
-- //AhoReceived on Sat Jul 13 2019 - 14:17:39 CEST