Preserve CASE WHEN output as new column in MySQL I am new to MySQL and this question may look silly, but:
I have a dogs table and I categorize their size by their weight:
SELECT *,
    CASE
        WHEN weight &lt; 15 THEN 'Small'
        WHEN weight &lt; 40 THEN 'Medium'
        ELSE 'Big'
    END AS Size
FROM dogs;

This outputs my table with a new column Size at the end.
And I would like to permanently append that column to this table so it's visible when I use SELECT * FROM dogs;
ALTER TABLE dogs
ADD COLUMN Size VARCHAR(6) AS (CASE WHEN weight &lt; 15 THEN 'Small'
                                    WHEN weight &lt; 40 THEN 'Medium'
                                    ELSE 'Big' END) VIRTUAL

MySQL 8.0 Reference Manual  /  ...  /  CREATE TABLE and Generated Columns