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 SQL Reporting by Example Orientation: Selecting Data Finding the ID

Teacher Russell
Teacher Russell
16,873 Points

Finding the ID

Any reason not to use SELECT ID FROM students ...... rather than SELECT * FROM students WHERE FIRST_NAME = "Yvette" AND LAST_NAME = "Levy"; ?

2 Answers

In a program SELECT ID may be used so that you are not selecting more data than you need. But for purposes of an instruction video including the name (and other fields) may help confirm the selection was correct.

kevin hudson
PLUS
kevin hudson
Courses Plus Student 11,987 Points

Since you are returning exactly one row of data then select all is preferred in order to have all column information present just in case you didn't know the table at all.