Query Language
查询语言 是 数据库管理系统 提供给用户和 数据库 交互的工具。
有两种“纯”数据库语言,它们简短、正式,一般作为其他数据库语言的基础:
查询语言 可以归纳为三类:命令式、函数式和声明式。
命令式(Imperative)
用户控制系统一步步执行操作,计算、获取数据。在计算过程中包含了可变的状态变量。
程序式(Functional)
用户调用一系列函数链式执行计算、获取数据。在计算过程中不包含状态变量,无副作用。
声明式(Non-Procedural/Declarative)
用户只声明需要的数据,由 数据库管理系统 实现计算过程并返回数据。
A query language is a language in which a user requests information from the database. Query languages can be categorized as imperative, functional, or declarative.[2]
In an imperative query language, the user instructs the system to perform a specific sequence of operations on the database to compute the desired result; such languages usually have a notion of state variables, which are updated in the course of the computation.[2:1]
In a functional query language, the computation is expressed as the evaluation of functions that may operate on data in the database or on the results of other functions; functions are side-effect free, and they do not update the program state.[2:2]
In a declarative query language, the user describes the desired information without giving a specific sequence of steps or function calls for obtaining that information; the desired information is typically described using some form of mathematical logic. It is the job of the database system to figure out how to obtain the desired information.[2:3]