database - Should I be storing this information as the attribute of an entity and then retrieve it? Or simply query it with instances of association? -
structure of database problem:
tv_shows tv_show_id, tv_show_title, tv_show_description, network, status episodes episode_id, tv_show_id, episode_title, episode_description, air_date
hi,
i unsure of what’s best here. output number of episodes of tv_show1, should make attribute of tv_shows table , include it? (i.e. “”no_of_episodes”) or count number of episodes there’s occurrence of id tv_show1 in episodes table query?
that’s not all...something else riddling me task. if wanted premiere date of tv_show1, make attribute in tv_shows table? or retrieve querying earliest instance of episode’s air_date?
both solutions work have no idea what's correct
the basic rule of thumb in database design: only store each piece of information in 1 place.
while system might run faster if store each count, have adjust counts each time add or remove episode. consequently, it's better count records each time query.
Comments
Post a Comment