sql - 语法错误:预期输入结束,但在 bigquery 中的 [11:1] 处出现关键字 INSERT 错误
问题描述
语法错误:预期输入结束,但在 bigquery 中的 [11:1] 处出现关键字 INSERT 错误
create table percentpopulationvaccinated
(
continent string,
Location string,
Date datetime,
population numeric,
new_vaccinations numeric,
peoplevaccinated numeric
)
insert into percentpopulationvaccinated
select
dea.continent, dea.location, dea.date, dea.population,
new_vaccinations,
sum(vac.new_vaccinations) over (partition by dea.location order by dea.location, dea.date) as peoplevaccinated
from
my-protfolio-324718.sql_code.covid_deaths dea
join
my-protfolio-324718.sql_code.covid_vac vac on dea.location = vac.location
and dea.date = vac.date
select
*,
(peoplevaccinated / population) * 100
from
percentpopulationvaccinated
解决方案
create table 是一个查询,insert into 是第二个,最后第三个是 select。在 bigquery 中,您应该使用 a 将它们分开,;
以便解释器可以按顺序运行每一步。
推荐阅读
- mysql - 从两个多态表 Laravel 中查询数据
- server - UDP DNS 和 DHCP 测试本地服务器。欺骗?
- node.js - 如何只允许从 docker 容器发出请求到特定的 url?
- python - 烧瓶我试图添加一个占位符和一个必需的
- javascript - 扩展功能组件的替代方案
- php - 如何对如下编写的 PHP 代码进行去混淆处理?
- stripe-payments - 关闭 Stripe 验证错误消息
- entity-framework - 在实体框架中更新实体时执行操作
- java - 微服务方法中的多个作者和读者
- python - 我们如何在 python 中表示“Riesz 函数”(不使用 Sympy)?