SQL query to calculate a percentage of a particular string in a column out of all rows
08:07 25 May 2023

I have a very simple table that contains Status_var and description. You can see example here: http://sqlfiddle.com/#!18/3e0d1/5

I need to be able to count how many 'Pass' string occurences are in Status_var column and calculate percentage.

Example table shown here:

enter image description here

In the above example, we have 2 "Pass" and 1 "Fail" occurences. The result should be 66%.

I have found a very similar solution to this problem in this post: https://dba.stackexchange.com/questions/311416/mysql-getting-the-percentage-of-an-occurrence

And I tried to implement it in sqlfiddle: http://sqlfiddle.com/#!18/3e0d1/22

But it does not work

enter image description here

sql mysql