Combing complete solution into SQL2