Apologies for the vagueness of the title but I cannot see a way to sum this up in a title...
I have a table storing the individual words of sentences.
Think one column is for a sentence id, the other is for a word in that sentence. So there are 6 rows with sentence id 1, if and only if that sentence has 6 words.
What is the query to get back all sentences (I mean, as ids) containing, say, three given words?
I've thought of a couple of ways:
1. Search the three words separately and intersect the results together.
2. Use subselects to narrow down the search results gradually. So the outermost one might search the first search term but only taking into account sentence ids returned by the subselect etc etc.
These both sound a bit inefficient IMHO.
Is there a better way?