% A "normal" lookup city('New York', Cityid), usr(Cityid, Name, Id). % An id-less query. Maybe the engine notices the join and transforms this into the prior behind the scenes. % Maybe an invented built-in like references/4 cause the transformation. :- references( 'USR', 'CITY_ID', 'USR', 'CITY_ID' ). usr( city( 'New York' ), Name ).