数值表达式用于在任何查询中执行任何数学运算。
句法:
SELECT numerical_expression as OPERATION_NAME
[FROM table_name
WHERE CONDITION] ;
这里,数值表达式用于数学表达式或任何公式。下面是一个简单的示例,展示了SQLNDigitic表达式的用法:
SQL> SELECT (15 + 6) AS ADDITION
+----------+
| ADDITION |
+----------+
| 21 |
+----------+
1 row in set (0.00 sec)
有几个内置函数,如avg()、sum()、count()等,用于对表或特定表列执行所谓的聚合数据计算。
SQL> SELECT COUNT(*) AS "RECORDS" FROM CUSTOMERS;
+---------+
| RECORDS |
+---------+
| 7 |
+---------+
1 row in set (0.00 sec) |