Mysql : assign integer value to the String values and get the average
mysql
Solution
select avg(case howIsTraining
when 'Excellent' then 5
when 'Very Good' then 4
when 'Good' then 3
when 'Poor' then 2
when 'Pathetic' then 1
else null
end) as avg_rating
from feedback
SQLFiddle: http://sqlfiddle.com/#!2/14a06/1
But you should really think about a better design (e.g. as shown by Jack)
Problem
I am using mysql database. i have a table called feedback which has a field howIsTraining which may have one value out five values "Excellent, Very Good, Good, Poor and Pathetic" i want to write the query which will give average of this value from all the data in following format I want give integer value to each of the values Excellent = 5 Very Good = 4 Good = 3 Poor = 2 Pathetic = 1 if say i have five records in table Excellent,Very Good,Excellent,Good, Poor that means ((5+4+5+3+2)/5) = 3.8 finally it will give result as 3.8