Difference between a statement and a query in SQL

后端 未结 6 910
暗喜
暗喜 2020-12-14 00:14

I still live in this ambiguity: conceptually what\'s the difference between a statement and a query in SQL? Can anybody give a definition f

6条回答
  •  佛祖请我去吃肉
    2020-12-14 00:22

    From Wikipedia - SQL Language Elements

    The SQL language is sub-divided into several language elements, including:

    • Clauses, which are constituent components of statements and queries. (In some cases, these are optional.)[9]
    • Expressions, which can produce either scalar values or tables consisting of columns and rows of data.
    • Predicates, which specify conditions that can be evaluated to SQL three-valued logic (3VL) or Boolean (true/false/unknown) truth values and which are used to limit the effects of statements and queries, or to change program flow.
    • Queries, which retrieve data based on specific criteria.
    • Statements, which may have a persistent effect on schemas and data, or which may control transactions, program flow, connections, sessions, or diagnostics.
      • SQL statements also include the semicolon (";") statement terminator. Though not required on every platform, it is defined as a standard part of the SQL grammar.
    • Insignificant whitespace is generally ignored in SQL statements and queries, making it easier to format SQL code for readability.

提交回复
热议问题