I am new to SQL and I know how to use filter in sql with decimal type, but this time I am working with string type.
- I need to filter anything greater than “3 hrs” or “180 min”
- I was able to get it to filter anything greater than “3 hrs”
- But not able to filter anything greater than 180 mins
here is screenshot of output for this table.

Here is SQL select statement and it is working
SELECT EVENTID,
STARTDATETIME,
F_NAME,
DURATIONHM,
NUM_PEOPLE
FROM EVENT_FACT
where DURATIONHM > '3 hrs'
You can’t write the query the way that you want to. You need to store the duration in minutes, as a number, and then use:
You can, with a bunch of effort, create a view that parses the string to get the minutes. In some databases, you can also convert such a string into a time or interval data type, which gets you further along.
However, what you have discovered is that storing the duration as a string does not meet the query requirements that you have on the field. (You would discover the same thing if you tried to order by duration.)