Query based on portion of artist and work to get the complete matched name

I am trying to create a query based on both artist and work of the artist.

For example :
If I use select * from artist WHERE NAME::text ILIKE '%beethoven%'; it will return the list of artists whose name has “beethoven” as part of their name.

Also if I use select * from work WHERE NAME::text ILIKE '%rammenta%'; this will return works which have “rammenta” as part of works name.

In reality, "Ah, rammenta", WoO 99 No. 6 is the work of Ludwig van Beethoven . I need to get this complete work name and the corresponding artist name if a part of artist name and work name is given as input. Is it possible to query like this

select artist.name, work.name
from artist
inner join l_artist_work
on artist.id=l_artist_work.entity0
inner join work
on l_artist_work.entity1=work.id
where artist.name::text ilike '%beethoven%' and work.name::text ilike '%rammenta%'