SELECT
COUNT(CASE WHEN
grade = true
THEN 1 ELSE 0 END )
AS likes,
COUNT(CASE WHEN
grade = false
THEN 1 ELSE 0 END )
AS dislike
FROM grade
SELECT CASE WHEN EXISTS (
SELECT user_id FROM grade
WHERE user_id = 1
) THEN true ELSE false END
FROM grade