The world of development
SELECT * or SELECT column1, colum2, column3, etc
Which is faster/best? in PHP
I’ve heard that
SELECT * is generally bad practice to use when writing
SQL commands because it is more efficient to
SELECT columns you specifically need. If I need to
SELECT every column in a table, should I use
SELECT * FROM TABLE or SELECT column1, colum2, column3, etc.
So this question does the efficiency really matter in this case? I’d think
SELECT * would be more optimal internally if you really need all of the data, but I’m saying this with no real understanding of database.
One reason that selecting specific columns is better is that it raises the probability that SQL Server can access the data from indexes rather than querying the table data.
It’s also less fragile to change, since any code that consumes the data will be getting the same data structure regardless of changes you make to the table schema in the future.
So finally follow this
SELECT Field1, Field2 FROM SomeTable WHERE.
Also Refer How to upload image in PHP function
Wish you good luck 🙂