So if I run
SELECT full_name AS 'Full Name', sum(age) AS 'Years Old' FROM friends;
I understand the sum(age) makes no sense, but I’m using it as an example here. If I want to reference the sum(age) in my WHERE clause I can do it 2 was. The first way is to write
WHERE sum(age) > 21;
The other I know is to remove the space in my as statement.
SELECT full_name AS 'Full Name', sum(age) AS 'yearsOld' FROM friends WHERE yearsOld > 21;
Is there a way to reference ‘Years Old’ in the WHERE statement?