CVS Health interview question

SQL query for group summarizing