Sigmoid Interview Question

SQL query based problem mostly