SQL gives you all the solutions to query by default unless you limit them right?
A relation (table) in SQL is conceptually a predicate that holds for all tuples (rows) therein. You can AND the predicates with "NATURAL JOIN". You can OR them with "UNION"
This is all true, but only for the small subset of Prolog that happens to be introduced on that web page. This analogy breaks down as soon as you have more complex data, not just atoms, or as soon as you introduce recursive rules.
Prolog tutorials really do Prolog a disservice by introducing it as a database query language, which is then misunderstood (or misremembered) by many as "it's only a database query language".
SQL can do recursive rules too. SQL tutorials often do SQL a disservice by introducing it as a database query language rather than relational algebra :)
example=# select * from move;
place | method | newplace
---------+--------+----------
home | taxi | halifax
halifax | train | gatwick
gatwick | plane | rome
(3 rows)
example=# create view on_route as with recursive on_route(place, newplace, length, path) as (select place, newplace, 1 as length, place as path FROM move UNION select on_route.place, move.newplace, on_route.length + 1, path || '->' || move.place as path FROM move JOIN on_route ON on_route.newplace = move.place) SELECT place, newplace, length, path || '->' || newplace as path FROM on_route;
CREATE VIEW
example=# select distinct true from on_route WHERE place = 'home' and newplace = 'rome';
bool
------
t
(1 row)
example=# select path from on_route WHERE place = 'home' and newplace = 'rome';
path
------------------------------
home->halifax->gatwick->rome