I\'ve started learning Prolog and wondering about the theoretical difference from the SQL language.
For example:
You are correct: Prolog and SQL are theoretically related (you asked specifically about theoretical differences).
I want to complement RBarryYoung's answer, giving you some hints to understand the connection, so that you have a starting point to study and understand the technicalities.
Prolog and SQL share a core: every query expressible in a subset of Prolog can be expressed in a subset of SQL and viceversa, i.e. these subsets are logically equivalent.
To understand how this can be true, you need to examine on what theoretical underpinnings both Prolog and SQL are based:
Of course something out of these subsets needs more translation effort.
Nonetheless, I think the claim that equivalence in expressive power of the two subsets is more than an appeal to Turing equivalence4 when considering Prolog-to-SQL translation.
Notes:
1) Unfortunately SQL can be used in contrast to RDBMS theoretical foundations (relational algebra-calculi); for example, SQL tables are not necessarily relations - as per RA - i.e. they can be without a (primary) key, so duplicate rows are permitted. Such tables are not sets but multisets (aka bags) of tuples. In such context, all theoretical results for RA, where relations are sets, are not necessarily valid.
2) For a translation from SQL to TRC, see A note on the translation of SQL to tuple calculus, also here (postscript paper).
3) For more on the differences between Datalog and Prolog see What You Always Wanted to Know About Datalog (And Never Dared to Ask) (pdf paper - links directly to page 6, heading H. Datalog and Prolog).
4) For the record: RA (and so their equivalents safe TRC and safe Datalog w/o recursion) is not Turing complete on purpose, to avoid never ending queries.
Historical note: Prolog and Codd's Relational Algebra were conceived around the same time (end of '60s early '70s) in different contexts - Colmerauer conceived Prolog for natural language processing and Codd conceived RA as a theoretical foundation of Relational DBMS. So, any theoretical connection between Prolog-Datalog-RA-SQL was necessarily established a posteriori and is implicit in the fact that they are all based on first-order predicate calculus (aka first order logic).