[SOLVED] Create "div_by_ten" a boolean columns based on condition in mysql


Consider a table consisting the marks of students in a mathematics test along with their unique student_id. Write a query to determine which students got the marks that is divisible by 10 and which students did not. Make sure that the output is ordered by student_id.

enter image description here


select *,
when mod(marks,10) = 0 then ‘yes’
else ‘no’
end as ‘div_by_ten’
from marks
order by student_id;

Answered By – kundan kaushik

Answer Checked By – Clifford M. (BugsFixing Volunteer)

Leave a Reply

Your email address will not be published. Required fields are marked *