SELECT * or SELECT column1, colum2, column3, etc

SELECT * or SELECT column1, colum2, column3, etc
December 20, 2018 No Comments Development Pushpendra Kumar



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. FROM TABLE.

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 🙂vHappy Coding


Tags
About The Author
Pushpendra Kumar I am passionate about mobile application development and professional developer at Colour Moon Technologies Pvt Ltd (www.thecolourmoon.com). This website I have made so that I can meet with new challenges and can share here.

Leave a reply

Your email address will not be published. Required fields are marked *