Accenture Interview Question

tell me how you do this in SQL