SELECT t.id, t.name, t.temp AS phone_number FROM (SELECT id, name, REPLACE(phone_number,'-','') AS phone_number, phone_number AS temp FROM contacts) t where ((LENGTH(t.phone_number) = 10 AND LOCATE('-', t.temp) = 0) OR (t.temp LIKE '___-___-____')) AND SUBSTRING(t.phone_number,1,1) != 0 ORDER BY t.i...