09.10.2017, 18:50
Why not just use INSERT IGNORE INTO syntax and set Name as UNIQUE index? This way, it will check if rows were affected (a successful row was inserted) or otherwise (nothing affected) returned an error for duplicate and ignored (skipped) the query.