我一直在第2行的创建表附近得到语法错误。请我能做些什么。我已经尝试和搜索到我所知道的一切。
CREATE TEMPORARY TABLE #percentpopulationvaccinated
(
continent VARCHAR(200),
location VARCHAR(200),
date DATE,
population INT,
new_vaccinations NUMERIC,
currentPeopleVaccinated NUMERIC
)
INSERT INTO #percentpopulationvaccinated
SELECT dea.continent, dea.location, dea.date, dea.population, vac.new_vaccinations, SUM(CAST(vac.new_vaccinations as unsigned)) OVER (Partition By dea.location ORDER BY dea.location, dea.date) AS currentPeopleVaccinated
FROM portfolioproject.coviddeaths dea
INNER JOIN portfolioproject.covidvaccinations vac
ON dea.location = vac.location
AND dea.date = vac.date
WHERE dea.continent is not null
SELECT*, (currentPeopleVaccinated/population)*100
FROM #percentpopulationvaccinated
2条答案
按热度按时间k3bvogb11#
MySQL客户端将
#
及其后面的文本视为注解,这意味着就MySQL所知,您已经编写了以下查询:临时表没有名称,难怪会出现语法错误!
有关MySQL注解语法的信息,请参见https://dev.mysql.com/doc/refman/8.0/en/comments.html。
50pmv0ei2#
对于临时表,请尝试使用以下命令: