Great job! There is one function that is very similar to
ST_Contains behaves just like
ST_Within, except the order of arguments is simply reversed.
Suppose we want to find the name of the district in which Nebula Hotel is located. We can use the following query:
FROM sf_planning_districts sfn
JOIN sf_hotels sfh
WHERE sfh.name = 'Nebula Hotel'
It's important to remember that
ST_Contains(geometryA, geometryB is the same as
ST_Within(geometryB, geometryA). Use whichever version makes the query more readable in your particular case.