I have an SQLite table as shown below.
students | grades |
---|---|
Nick | 34 |
Nick | 42 |
Nick | 86 |
Nick | Null |
John | 38 |
John | 12 |
John | 74 |
John | Null |
Colin | 87 |
Colin | 23 |
Colin | 46 |
Colin | 42 |
What I want to do is impute Null values with the mean of each student's grades. For example, missing value for Nick will be 54 and for John 41.3. How can I do this in SQL code? I am using SQLite.