with tmp as ( select *,RIGHT(CAST(emp_no AS CHAR), 1) as lasts from employees) select emp_no,birth_date,first_name,last_name,gender,hire_date from tmp where lasts % 2 = 1 and last_name != 'Mary' order by hire_date desc;