简体   繁体   中英

BigQuery View Difficulty

Hello I am trying to create a view, but I keep getting an error no matter what I do. Additionally, I'm using BigQuery.

The error is: Unexpected string literal "DeathCountPerCountry" at [1:13], or with backticks or Table "DeathCountPerCountry" must be qualified with a dataset (eg dataset.table). I'm a beginner and I'm stuck please help!

Create View "DeathCountPerCountry" 
AS
SELECT Location, MIN(cast(total_deaths AS integer)) AS lowestdeathcount
FROM `sql-covid-project.covid_data.covid_worldwide`
WHERE continent is not null
Group by location 
## order by lowestdeathcount desc

Detailed above I tried backticks and "" and neither let me make the view.

you need a dataset into which to place your view. It looks like you have a dataset called covid_data so try this


Create View covid_data.DeathCountPerCountry 
AS
SELECT Location, MIN(cast(total_deaths AS integer)) AS lowestdeathcount
FROM `sql-covid-project.covid_data.covid_worldwide`
WHERE continent is not null
Group by location 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM