Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Databases

Michael Timbs
Michael Timbs
15,761 Points

PHP > Using PHP with MySQL > Limiting Records in SQL Queries > Using LIMIT with Descending Order

You are consistently using the following query in these videos

SELECT name, price, img, sku, paypal

Why not use the simple SELECT * query instead of manually typing every column in the table for each query? Is it in case the schema changes at a later date? Is this likely?

3 Answers

In my experienced ,

When your database is very large like you stored a tons of information when you called all the table inside . It can lessen the performance.

and sometime it load the data that you didn't intend to use .

Such as loading blob which cause bloat in memory and slow down process.

There are some text you can learn more.

Sorry , I am new to this forum and I am quite bad at english

Michael Timbs
Michael Timbs
15,761 Points

I understand not using SELECT * for large tables but in the course videos there are only 5 columns in the table and he is manually selecting all the columns instead of just using SELECT *

Yea. May be He should use Select * . It is a lot easier

Sorry for misreading. I am too rush for the answer T^T

Michael Timbs
Michael Timbs
15,761 Points

Not a problem. Perhaps they are just trying to get people to use good practice in the event the table changes in the future or if someone watching the course is trying to work with larger tables.

;) . Great man