如何在 BIgQuery 中创建 TABLE?
How to CREATE TABLE in BIgQuery?
我正在尝试在 BigQuery 上创建临时 table,但错误不断出现。 Portfolio_Covid_Data 是数据集,percentage_population_vaccinated 是我正在创建的 table。我 运行 的代码是:
DROP TABLE IF EXISTS Portfolio_Covid_Data.percentage_population_vaccinated
CREATE TABLE Portfolio_Covid_Data.percentage_population_vaccinated
(dea.continent STRING,
dea.location STRING,
dea.date DATE,
dea.population NUMERIC,
vac.new_vaccinations NUMERIC,
rolling_people_vaccinated NUMERIC)
INSERT INTO Portfolio_Covid_Data.percentage_population_vaccinated
SELECT
dea.continent,
dea.location,
dea.date,
dea.population,
vac.new_vaccinations,
SUM(vac.new_vaccinations) OVER (PARTITION BY dea.location ORDER BY dea.location,dea.date ) AS rolling_people_vaccinated
FROM
`big-dataset.Portfolio_Covid_Data.covid_deaths` AS dea
JOIN
`big-dataset.Portfolio_Covid_Data.covid_vaccinations` AS vac
ON dea.location = vac.location
AND dea.date = vac.date
SELECT
*,
ROUND((rolling_people_vaccinated/population)*100,2) AS percentage_population_vaccinated
FROM
Portfolio_Covid_Data.percentage_population_vaccinated
dea
和 vac
在您的 CREATE TABLE 语句中指的是什么?
这对我有用
CREATE TABLE Portfolio_Covid_Data.percentage_population_vaccinated
(continent STRING,
location STRING,
date DATE,
population NUMERIC,
new_vaccinations NUMERIC,
rolling_people_vaccinated NUMERIC)
我正在尝试在 BigQuery 上创建临时 table,但错误不断出现。 Portfolio_Covid_Data 是数据集,percentage_population_vaccinated 是我正在创建的 table。我 运行 的代码是:
DROP TABLE IF EXISTS Portfolio_Covid_Data.percentage_population_vaccinated
CREATE TABLE Portfolio_Covid_Data.percentage_population_vaccinated
(dea.continent STRING,
dea.location STRING,
dea.date DATE,
dea.population NUMERIC,
vac.new_vaccinations NUMERIC,
rolling_people_vaccinated NUMERIC)
INSERT INTO Portfolio_Covid_Data.percentage_population_vaccinated
SELECT
dea.continent,
dea.location,
dea.date,
dea.population,
vac.new_vaccinations,
SUM(vac.new_vaccinations) OVER (PARTITION BY dea.location ORDER BY dea.location,dea.date ) AS rolling_people_vaccinated
FROM
`big-dataset.Portfolio_Covid_Data.covid_deaths` AS dea
JOIN
`big-dataset.Portfolio_Covid_Data.covid_vaccinations` AS vac
ON dea.location = vac.location
AND dea.date = vac.date
SELECT
*,
ROUND((rolling_people_vaccinated/population)*100,2) AS percentage_population_vaccinated
FROM
Portfolio_Covid_Data.percentage_population_vaccinated
dea
和 vac
在您的 CREATE TABLE 语句中指的是什么?
这对我有用
CREATE TABLE Portfolio_Covid_Data.percentage_population_vaccinated
(continent STRING,
location STRING,
date DATE,
population NUMERIC,
new_vaccinations NUMERIC,
rolling_people_vaccinated NUMERIC)