Databases SQL Reporting by Example Orientation: Selecting Data Finding the ID

Teacher Russell
Teacher Russell
16,869 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

KRIS NIKOLAISEN
KRIS NIKOLAISEN
54,331 Points

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
PRO
kevin hudson
Pro Student 9,652 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.