![](/img/trans.png)
[英]How to extract all (including int and float) numerical values in a string column in Google BigQuery?
[英]How to extract all numerical values from a string column in a big query table and insert them in new numerical columns?
假设我有一张像temp_table
这样的表:
CREATE TABLE `YOUR_DATASET.temp_table` (
`F1` STRING,
`F2` INT64,
`F3` STRING,
);
此表包含一些数据:
INSERT `YOUR_DATASET.temp_table` (F1, F2, F3)
VALUES('45FG67', 10, 'This stri98ng includes 10/15 numbers .9'),
('45FG67', 10, 'This string includes 100 and 0'),
('95pp7', 30, 'This string includes .8 and 1_number'),
('45FG67', 12, '45'),
('45FG67', 12,NULL),
('95pp7', 30, NULL),
('95pp7', 5, '10 & 54.2')
这会将temp_table
创建为:
SELECT * FROM `YOUR_DATASET.shc_core_2021.temp_table`
我想编写一个大查询脚本来提取F3
和 append 中的所有数值作为temp_table
的新数值列。 新数值列的数量应等于F3
中数值的最大数量。 在这个示例表temp_table
中,应该有 4 个新的数值列添加到表中,因为第 5 行的F3
是This stri98ng includes 10/15 numbers.9
个数字。9 和 int 包括 4 个数值:98、10、15、0.9。 作为另一个示例,第 6 行的这 4 个数字列的值将是 45、null、null、null。
注意, 在这里我问了一个类似的问题。 该解决方案适用于我在那里提出的一般问题,但不适用于我上面描述的问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.