SQL方言参考
完成条件
无表的 SELECT 语句
有时需要在没有表上下文的情况下执行 SQL 标量表达式,即执行一个行为类似于普通 SELECT 操作符的查询,计算给定的逗号分隔的表达式,并返回一个包含单行和一列或多列的表(每个单独的表达式对应一列)。显然,由于没有表,表达式不能引用任何表中的列。
一个例子是使用 Oracle 语法确定一个数学函数的值:
Select without tables
Sometimes one needs to execute SQL scalar expressions without table context, i.e. make a query that would act as normal SELECT operator, evaluate given comma-separated expressions and return a table with single row and one or multiple columns (one for every individual expression). Obviously, expressions can't reference any columns from the tables, as there are none.
An example is determining the value of a mathematical function, using Oracle syntax:
SQL> select 4*atan(1) as "Arc tangent of 1 times 4" from dual;
Arc tangent of 1 times 4
------------------------
3.14159265
Standard | ? |
---|---|
DB2 |
|
Firebird | SELECT expressions FROM rdb$database |
Ingres | SELECT expressions |
Linter | SELECT expressions |
MonetDB |
|
MSSQL |
|
MySQL |
|
Oracle | SELECT expressions FROM dual |
PostgreSQL |
|
SQLite |
|
Virtuoso | ? |
最后修改: 2025年04月11日 星期五 11:26