better logic, test cases
broken test case in mysql, mysql2