Alerts from simple query

I have a PostgreSQL query "select count(*) from where > now() - interval ‘10 minutes’

then I selected Format as “Table”

the goal is that if the count is zero, meaning no rows on the table for some time (30 minutes) then I would like to send an alert.

I skipped “expressions”

For “Evaluate every” I choose 10 minutes and 30 minutes. So my understanding is Grafana will check three times, once every 10 minutes, and after 30 minutes if there were no rows then the alert will get trigger.

I did created contact point and notifications policies that I know do work because I’m using them for other alerts, but for this one I’m struggling.

This is a simple query and not a time series.

I can’t figure it out how to get “No Data” since my output is not null. It is always 0 or bigger that zero and I need to alert on zero.

Any ideas?

Regards