Saviynt interview question

SQL question based on joins, group by and having