In a select-statement I need to get only if there are any responses, not what the responses are. It is to ensure that I don't insert or update anything wrong. Simply I need something simular to TRUE or FALSE, telling me if the statement did return anything or not. I have looked at the methods below:
SELECT count(id) FROM test WHERE name = 'kalle';
SELECT id FROM test WHERE name = 'kalle';
SELECT first(id) FROM test WHERE name = 'kalle';
The first and second options have to go through the whole database before returning anything. The third seems to be good, but of course I get a result back. It is of course a possibility, but is there anything that is better (as in takes less time to execute or less time to handle in PHP)?