Reputation: 31
I am using the below code:
ALTER TABLE `trim-opus-308402.Covid_Dataset_SQL_Practice_24May21.Percentage vaccine`
ADD COLUMN Vaccine_Coverage numeric AS ((Rolling_vaccination / population)*100)
I am getting error message:
ALTER TABLE ADD COLUMN does not support generated columns yet at [2:12]
Upvotes: 3
Views: 4927
Reputation: 1978
You can add an empty column to your schema using this syntax, but I don't think you can fill it in the same operation. You might consider a two step approach:
ALTER TABLE `trim-opus-308402.Covid_Dataset_SQL_Practice_24May21.Percentage vaccine`
ADD COLUMN Vaccine_Coverage NUMERIC;
UPDATE `trim-opus-308402.Covid_Dataset_SQL_Practice_24May21.Percentage vaccine`
SET Vaccine_Coverage = (Rolling_vaccination / population)*100
WHERE TRUE;
Upvotes: 2