I did solve the question but my approach was a bit different, Just wanted to know if it is correct or not . QUERY : SELECT date,count(sent) AS "totatl_sent",count(sent_accepted) AS "total_accepted" ,(count(sent_accepted)/count(sent))*100 AS "Accepteance rate" FROM (SELECT date, CASE WHEN (actions = "sent" AND LEAD(actions) OVER( ORDER BY user_id_sender) = "accepted" ) THEN "sent_accepted" END AS sent_accepted, CASE WHEN actions = "sent" THEN "sent" END AS "sent" FROM facebook) a GROUP BY date; P.s : I've learnt a lot from you. Thank you so much for your continuous efforts towards teaching.
wow nice u also solved this query
Clearly explained
damn best explanation i have ever seen .
I did solve the question but my approach was a bit different, Just wanted to know if it is correct or not .
QUERY :
SELECT date,count(sent) AS "totatl_sent",count(sent_accepted) AS "total_accepted" ,(count(sent_accepted)/count(sent))*100 AS "Accepteance rate" FROM
(SELECT date,
CASE WHEN (actions = "sent" AND LEAD(actions) OVER( ORDER BY user_id_sender) = "accepted" ) THEN "sent_accepted" END AS sent_accepted,
CASE WHEN actions = "sent" THEN "sent" END AS "sent"
FROM facebook) a
GROUP BY date;
P.s : I've learnt a lot from you. Thank you so much for your continuous efforts towards teaching.