And i have to solve this question "How can you produce a list of the start times for bookings for tennis courts, for the date '2012-09-21'? Return a list of start time and facility name pairings, ordered by the time."
The query down below works fine
select bks.starttime as start, facs.name as name
from
cd.facilities facs
inner join cd.bookings bks
on facs.facid = bks.facid
where
facs.name in ('Tennis Court 2','Tennis Court 1') and
bks.starttime >= '2012-09-21' and
bks.starttime < '2012-09-22'
order by bks.starttime
But this query down below with to_char() doesn't work. What is the issue here?
select starttime,name
from cd.bookings, cd.facilities
where cd.bookings.facid = cd.facilities.facid
and cd.facilities.name like 'Tennis Court%'
and to_char(cd.bookings.starttime,'YYYY-MM-DD') = '2012-09-21'
order by cd.bookings.starttime
I am practicing this exercise on this url: https://pgexercises.com/questions/joins/simplejoin2.html