What is the best way to find out if a primary key with a certain value already exists in a table?
I can think of:
SELECT key FROM table WHERE key = 'value';
and count the results, or:
SELECT SQL_CALC_FOUND_ROWS key FROM table WHERE key = 'value' LIMIT 1;
SELECT FOUND_ROWS();