MySQL Forums
Forum List  »  Newbie

Re: Using a variable to create a table name
Posted by: Peter Brawley
Date: October 29, 2017 02:29PM

> I can set up a column for each country
> Title China Estonia Germany
> title y
> title x
> title z

Oy. Read again. It's an egregious design error to map detail instances to additional columns in a table like that.

To model articles and their countries of edit, you need a master-detail design, something like ...

articles( artID, url, language, ...

derived_articles( devartID, artID, language, ... )

where each derived_articles.artID references one articles row identified by on articles.artID. Then you find all the other-language versions of an article with a query like ...

select d.title
from articles a
join derived_articles d using (art_id)
where a.title="How to design a database of articles";

Options: ReplyQuote




Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.