Besides a declarative language, is SQL a functional language?

后端 未结 8 1283
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-12-29 03:22

Why yes or why not?

8条回答
  •  别那么骄傲
    2020-12-29 04:14

    I think SQL and functional languages are very different from each other. In a functional language computation is done by evaluating functions. Functions do not mutate state. All they do is compute a value from their arguments. I other words, functions do not cause side-effects. Functional languages are general purpose.

    SQL is a language designed for dealing with relational database management systems. It can be viewed as a Domain Specific Language. It is designed to work on "sets" of data. It can mutate global state (i.e, the database) by using commands like UPDATE. There is no concept of functions getting evaluated to a value. As far as I understand, SQL is not even Turing complete.

提交回复
热议问题