Why is SELECT *
bad practice? Wouldn\'t it mean less code to change if you added a new column you wanted?
I understand that SELECT COUNT(*)
Think of it as reducing the coupling between the app and the database.
To summarize the 'code smell' aspect:
SELECT *
creates a dynamic dependency between the app and the schema. Restricting its use is one way of making the dependency more defined, otherwise a change to the database has a greater likelihood of crashing your application.