I have a table with columns:
IdNum, NameEmployee, IdInsurance, NameInsurance, num_employees_not_insured
Some employees don't have insurance so
NameInsurance are null.
I want to count how many employees don't have insurance and put that in the last column.
UPDATE MajorTable2 SET num_employees_not_insured = (SELECT COUNT(*) FROM MajorTable2) WHERE 'IdInsurance' IS NULL);
and next I tried "saving the result of counting null rows to a variable" like (but I'm guessing what's in single quotes does not count as a variable):
SELECT COUNT(*) AS 'NULL_values_in_IdInsurance' FROM `MajorTable2` WHERE `IdInsurance` IS NULL; UPDATE MajorTable2 SET num_employees_not_insured = 'NULL_values_in_IdInsurance';
How can I fix my logic and syntax? I know some Python but my SQL is super rusty.