This question has just came in to my mind, and I’m not in a position to answer it.
Let’s say you are developing a news page for a website. In your table you would have the following fields:
ID, Title, Subject, Content, Time, Author, Keywords
On the actual page that the user will see, you may only want to display the following:
Title, Content, Keywords
Now, when you go to write the SQL statement, would it be better to write it as this:
SELECT Title, Content, Keywords FROM newstable;
Or as this:
SELECT * FROM newstable;
I always thought that using the former example would be far more efficient and quicker to use. However, I’m now thinking it might be quicker and easier to just use the select all statement.
Is either way right, or does it really matter how they are written?
Yes, it matters for performance and other reasons.