如何在查询脚本中同时使用DELETE和INSERT

问题描述 投票:0回答:1

我正在使用Google BigQuery(使用标准SQL),但是我有一个包含一些数据的表。根据表中的数据,我想在该表中插入伪消息行,然后,从该表中删除所有数据(新插入的伪消息),但是我确实担心删除该表中的所有数据。如何正确查询这样的例子?

sql google-bigquery
1个回答
0
投票
CREATE VIEW project.dataset.my_view AS select message from project.dataset.actual_table UNION ALL select 'This is a fake message 1' as message UNION ALL select 'This is a fake message 2' as message

您可以在不更改基础数据的情况下针对该视图进行查询,完成后,只需删除该视图。如果您不清楚自己在做什么,那比处理重要数据要安全得多。

© www.soinside.com 2019 - 2024. All rights reserved.