SELECT *
   FROM test
   WHERE RIGHT(name, 2) = 'AB';
