Comparing SQL and Prolog -
i've started learning prolog , wondering theoretical difference sql language.
for example:
- both declarative languages
- both support fact-driven knowledge database
- both support question-styled data-retrieving
- both support functional dependencies
any more common points? notable differences?
most of (earlier) answers here reflection of fact people not know sql (its implementation of relational calculus) or means (that it's form of predicate logic). following statements true of both prolog , sql:
- they both logic-driven
- they can both store, express , use relations (logical relationships in prolog)
- they can both store , express complex logical conditions
- they both have facts(data in sql) , can derive conclusions facts
- they both have queries, in fact mean same thing
- they both have data(facts in prolog) , use them similarly
- they both programming languages
- they both turing-complete (though difficult access in both of them)
- etc, etc..
generally, people not aware of these equivalences between them:
- "facts" , "data" same thing. straight out of codd's original paper.
- a "relation" in relational theory same thing "table" in sql, same thing relation or relational function in predicate logic , same thing tuple-set in set theory
- an aliased table-expression (i.e., view, etc.) in sql same thing rule in prolog.
so differences? although operate across same conceptual domains, focuses in different directions. in prolog terms, sql fact , relation(set) engine, whereas prolog rules , inferencing engine. each can other, limited extent, becomes increasingly difficult small increases in complexity. instance, can inferencing in sql, entirely manual in nature , not @ automatic forward-inferencing of prolog. , yes, can store data(facts) in prolog, not @ designed "storage, retrieval, projection , reduction of trillions of rows thousands of simultaneous users" sql is.
plus, sql server-language paradigm, whereas prolog client-language paradigm.
Comments
Post a Comment