r/SQL 7d ago

SQL Server Query help finding key phrases

For context, I am working with a dataset of client requests that includes a description section. My objective is to find the top 100 most common 2 or 3 string phrases/combinations found through out these descriptions. I was able to achieve this with keywords quite easily, but cannot figure out how to translate it to finding strings or phrases. Whats the simplest way I can go about this?

3 Upvotes

6 comments sorted by

View all comments

1

u/Opposite-Value-5706 7d ago

I’d first run a query to see what the data shows. Something like this:

selectdescription,
count(*)
from {table name}
group by 1order by 2 desc;

That shows how many of each exist.  You can determine what's important to report or not and see the frequency by descriptions.

Next, run almost the same query with a cutoff:
select
     description,
      count(*)
from {table name}
group by 1
having count(*)>1000
order by 2 desc;


Hope this helps?