Get percent of columns that completed by calculating null values

Viewed 17888

I have a table with a column that allows nulls. If the value is null it is incomplete. I want to calculate the percentage complete.

Can this be done in MySQL through SQL or should I get the total entries and the total null entries and calculate the percentage on the server?

Either way, I'm very confused on how I need to go about separating the variable_value so that I can get its total results and also its total NULL results.

SELECT
    games.id
FROM 
    games
WHERE 
    games.category_id='10' AND games.variable_value IS NULL

This gives me all the games where the variable_value is NULL. How do I extend this to also get me either the TOTAL games or games NOT NULL along with it?

Table Schema:

id (INT Primary Auto-Inc)

category_id (INT)

variable_value (TEXT Allow Null Default: NULL)

3 Answers
Related