n 行の列があります。各行には、その値として 1 つの単語があります。例「こんにちは」、「そこに」などそして、m行の別の列があります。各行には、最初の列の各行と後の列のすべての行を比較する必要がある巨大な段落があります。基本的に、段落内の特定の単語を見つけて、最初の列の行に単語が 1 つでもある行を特定する必要があります。
3 に答える
Not sure if this is what you want... My example count occur. or word 'world' in the string. There two occur., so it it will return 2.
SELECT count(*) word_count FROM
(
SELECT Distinct(Instr('Hello world! So happy to meet you world!', 'world', LEVEL)) str_cnt
FROM dual
CONNECT BY LEVEL < length('Hello world! So happy to meet you world!')
)
WHERE str_cnt > 0
/
This will return 4:
SELECT REGEXP_COUNT('Hello world world! So happy to meet you world world!', 'world') word_count
FROM dual
/
If any of your rows have count of word more then 0-zero then you got a winner - you identified such row as you wrote in your description.
内部結合と同様の条件を実行します。
ある単語が別の単語の一部である場合、問題が発生することがあります。たとえば、「the」という単語は「there」に含まれているため、「the」という単語が出現しなくても、「there」という単語が段落にある場合は常に「%the%」に対するクエリが真になります。これを防ぐために単語の前後にスペースを使用しますが、(a) 段落テーブルに先頭と末尾のスペースを格納するか、(b) 文字列連結を使用しない限り、段落の最初と最後の単語が失われます。これは、パフォーマンスに影響を与える可能性があります (または影響しない可能性があります)。
select *
from word_table
inner join paragraph_table
on ' ' || paragraph_table.paragraph || ' ' like '% ' || word_table.word || ' %'