Fork me on GitHub

Is there some write-up somewhere, preferably with examples, giving a good idea of the kinds of queries expressible in datalog that cannot be expressed in SQL/relational algebra? I believe that the canonical example is queries involving 'paths', e.g. ancestor/descendant queries from parent/child relationships in the data.


Datalog is computationally equivalent in power to sql + recursion. Any datalog query that doesn't involve a recursive rule is more or less equivalent to some SQL query. So yes, path related queries, like ancestor descendant relationships, are a prime example of something Datalog can do that SQL cannot (without external iteration/recursion).