Which of the following notations is better?
SELECT id,name,data FROM table WHERE id = X
OR
SELECT id,name,data FROM table WHERE id = X LIMIT 1
I think it should not have "LIMIT".
Thanks!
If there is a unique constraint on id
then they will be exactly the same.
If there isn't a unique constraint (which I would find highly surprising on a column called id
) then which is better depends on what you want to do:
LIMIT
.LIMIT 1
.