hi guys!,
I am quite familiar with datbase design and SQL, but I need your help to the problem I am facing right now!
I have a table in the database I am building now, in which I store words, their meaning and their etymology. Some of the words are derivatives of words in other records. For example, I may have one main word looking like:
word_id derivative_of word maening etymology
word_id - "analyze" "meaning of the word" "etymology"
word_id "analyze" "analyzable" "meaning of the word" (no etymology)
Whenever I want to get all the words that contain a word in their etymology, I run the proper query and everything goes OK. What I cannot do though, is to return the derivatives of the words along with the main words, when a word in the etymology exists. The main words have etymology only; their derivatives do not, as they are assumed to have the same etymology as their parent!
Do you think of a good design so that I get the word AND its derivtive(s) in one query?
One thought is to run the simple query, then programmatically ask for each derivative according to the returned parent word and then merge the 2 queries.
Another approach would be to store the derivatives in another table and return all the main words as well as the linked derivatives from the other. But this approach would not allow me to query one table when searching for parts in the word field.
Do you have any thoughts of a better design?
Thanks in advance,
Manos