简体   繁体   English

在以下查询中使用 CAST FUNCTION

[英]the USE OF CAST FUNCTION IN THE FOLLOWING QUERY

the thing is to replace whatever observation that hold the number 999.9 as NULL but i dont know the utility of CAST here as i know it helps change the data type but WDSP in the description is STRING事情是要替换任何将数字 999.9 保存为 NULL 的观察,但我不知道 CAST 的实用性,因为我知道它有助于更改数据类型,但描述中的 WDSP 是 STRING

IF(
    wdsp="999.9",
    NULL,
    CAST(wdsp AS Float64)) AS wind_speed,

nothing yet the cast should it come before IF or within IF还没有演员表应该出现在 IF 之前或 IF 之内

The CAST function in being used to convert the wdsp column to a number (specifically FLOAT64 ) instead of returning it as a STRING (which you mention is the declared type). CAST function 用于将wdsp列转换为数字(特别是FLOAT64 )而不是将其作为STRING返回(您提到的是声明的类型)。 This is likely being some so that whatever is issuing the query can get the aliased column wind_speed as a numerical type so that is can be processed as a number and not a string.这可能是一些,因此无论发出查询的是什么,都可以将wind_speed为数字类型,以便可以将其作为数字而不是字符串进行处理。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM