mardi 28 février 2017

MySQL columns json vs joins

I am stuck with database design of holiday package inventory project which contains a main table packages for storing package information.

Here is the fields

  1. id PK
  2. package_name varchar
  3. attractions json eg-field: ['super','funny'],
  4. inclusions json eg-field: ['hello','cool']

One package may have many attractions and inclusions so that's why i choose a json field.

So is this a slandered way or keep the attractions and inclusions in another table with foreign key relation??.

if i choose second method(ie different tables for attractions and inclusions) what about searching a package with particular attraction think that search requires a join query (Search with join is a bad practice??.).

But in the first method we can apply a json search (MySQL-version >5.7 supports json search).



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire