MySQL Forums
Forum List  »  Newbie

Re: Using a variable to create a table name
Posted by: Peter Brawley
Date: October 26, 2017 06:48PM

> I have 269 tables, one per Wikipedia language. Within each language table are edits ...

Is an "edit" a text that resulted from an edit of a Wikipedia page? Or what?

> ... from different countries. For example, for the title "David Bowie" in the English table, there
> are edits from Germany, U.S., Britain, etc. In the German table, there are edits to the German
> article "David Bowie" in Germany, Austria, etc. Each one of these edits is its own record.

And each "edit" is, what, a block of text in a table, or a pointer (url) to such text?

> I have linked the title in each language to the equivalent English title if there is one.

"Linked" how, exactly?

> For the final product that I'm going to analyze for my dissertation (I'm in Geography),
> I need to do two things: 1) get a list of articles per country of articles ...

Articles in any of your 269 tables?

> ... found only in that country,

You mean these articles exist only in the table for that country?

> 2) get a list of the 100 titles that were edited in the most countries.

There your 269-tables model breaks down. You can't query 269 tables.

Trying to make sense of what you've said so far: you have a trove of texts or pointers to them, each with a title and text in one of 269 languages. Some are edits of (presumably) the same article, (you've not said this, but you've implied it), some might be translations of the same article from some other language.

If that's so, I can't fathom why there aren't just two tables, one for articles, one for languages ...

articles (id primary key, title, date, url, language_id, text)

languages ( language_id, language_name )

... where each articles.language_id refers to one row in the languages table. And, if there's a need to model the fact that some articles are edited versions of other articles, then the articles table would also need a version_of_id column pointing to the articles row containing the earlier version or translation of a particular article, so the table would thus consist of a set of edge lists (or linked lists).

> 1. I need a table or whatever for each country of what titles are edited there regardless of language.

Then in this model, you could easily query for articles with a language_id for German and a version_of_id pointing at an article row with a language_id for English.

> 2. I need a table for the world of the 100 titles that were edited in the most countries.

This question conflates country and language. I can write or edit in German or Chinese whilst living in France. But with a model like the above, you can easily tabulate language_id instances in the articles table.

Is this your requirement?

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.