mrteeth mrteeth - 6 months ago 10x
SQL Question

Time only from datetime column

I have a lecture table with a list of timestamps for lectures.

I want to create a query that lets me filter the time proportion of it. For example, I want to find all the lectures that last for 1 hour (I don't mind which day it is on).

I've created a code so far, but it doesn't bring any results:

select time(lecturetime)
from lecture
where lecturetime >= '12:00:00' and lecturetime < '13:00:00'

Can someone correct this for me?


Don't confuse lecturetime with time(lecturetime)

select time(lecturetime)
from lecture
where time(lecturetime) >= '12:00:00' and time(lecturetime) < '13:00:00'