当前位置:网站首页>SQL函数 SQRT
SQL函数 SQRT
2022-08-01 12:02:00 【用户7741497】
SQL函数 SQRT
返回给定数值表达式的平方根的数值函数。
大纲
SQRT(numeric-expression)
{fn SQRT(numeric-expression)}参数
numeric-expression- 解析为计算平方根的正数的表达式。
SQRT 返回 NUMERIC 或 DOUBLE 数据类型。如果 numeric-expression 是数据类型 DOUBLE,则 SQRT 返回 DOUBLE;否则,它返回 NUMERIC。
描述
SQRT 返回 numeric-expression 的平方根。 numeric-expression 必须是正数。负数值表达式(-0 除外)会生成 SQLCODE -400 错误。如果传递 NULL 值,SQRT 返回 NULL。
SQRT 返回一个精度为 36、小数位数为 18 的值。
SQRT 可以指定为常规标量函数或 ODBC 标量函数(使用大括号语法)。
示例
以下示例显示了两种 SQRT 语法形式。两者都返回 49 的平方根:
SELECT SQRT(49) AS SRoot,{fn SQRT(49)} AS ODBCSRoot
7 7以下嵌入式 SQL 示例返回整数 0 到 10 的平方根:
/// d ##class(PHA.TEST.SQLFunction).Sort()
ClassMethod Sort()
{
s a = 0
while a < 11 {
&sql(
SELECT SQRT(:a) INTO :b
)
if SQLCODE '= 0 {
w !,"Error code ",SQLCODE
} else {
w !,"The square root of ",a," = ",b
s a = a + 1
}
}
}DHC-APP>d ##class(PHA.TEST.SQLFunction).Sort()
The square root of 0 = 0
The square root of 1 = 1
The square root of 2 = 1.414213562373095049
The square root of 3 = 1.732050807568877294
The square root of 4 = 2
The square root of 5 = 2.236067977499789697
The square root of 6 = 2.449489742783178098
The square root of 7 = 2.645751311064590591
The square root of 8 = 2.828427124746190098
The square root of 9 = 3
The square root of 10 = 3.162277660168379332边栏推荐
- 关于亚马逊测评,你了解多少?
- 腾讯云原生:Areaki Mesh 在 2022 冬奥会视频直播应用中的服务网格实践
- Aeraki Mesh Joins CNCF Cloud Native Panorama
- CloudCompare&PCL ICP配准(点到面)
- 收藏|机械工程师面试常问问题
- 表连接详解
- 重磅消息 | Authing 实现与西门子低代码平台的集成
- A new generation of ultra-safe cellular batteries, Sihao Airun goes on sale starting at 139,900 yuan
- The four methods of judging JS data type
- redis6 跟着b站尚硅谷学习
猜你喜欢

安装apex报错

A new generation of ultra-safe cellular batteries, Sihao Airun goes on sale starting at 139,900 yuan

Beyond Compare 4 trial period expires

新一代超安全蜂窝电池, 思皓爱跑上市13.99万元起售

Promise to learn several key questions (3) the Promise - state change, execution sequence and mechanism, multitasking series, abnormal penetration, interrupt the chain of Promise

2022 Go ecosystem rpc framework Benchmark

CloudCompare & PCL ICP registration (point to face)

爱可可AI前沿推介(8.1)

ECCV22|只能11%的参数就能优于Swin,微软提出快速预训练蒸馏方法TinyViT

千万级乘客排队系统重构&压测方案——总结篇
随机推荐
一篇文章,带你详细了解华为认证体系证书(2)
将同级数据处理成树形数据
程序员如何优雅地解决线上问题?
通配符SSL证书不支持多域名吗?
万字解析:vector类
如何设计一个分布式 ID 发号器?
MVVM响应式
Flutter Widget 如何启用和屏蔽点击事件
一文带你读懂云原生、微服务与高可用
Istio Meetup China: Full Stack Service Mesh - Aeraki Helps You Manage Any Layer 7 Traffic in an Istio Service Mesh
ACL 2022 | 文本生成的相关前沿进展
What is MNIST (what does plist mean)
【CLion】CLion 总是提示 “This file does not belong to any project target xxx” 的解决方法
表达式引擎在转转平台的实践
易周金融分析 | 银行ATM机智能化改造提速;互联网贷款新规带来挑战
A new generation of ultra-safe cellular batteries, Sihao Airun goes on sale starting at 139,900 yuan
初级必备:单例模式的7个问题
Aeraki Mesh 加入 CNCF 云原生全景图
浏览器存储
mysql进阶(二十二)MySQL错误之Incorrect string value中文字符输入错误问题分析