Sigmoid interview question

SQL query based problem mostly