Does the order we select the columns affect anything?

Question

In the context of this exercise, does the order we select the columns affect anything?

Answer

No, the order that columns are selected does not affect anything other than what order the columns are shown in the result set.

So, whether you selected the columns as
SELECT col1, col2
or
SELECT col2, col1,

if the rest of the SQL statement is the same, then the only difference is the column order.

Usually, columns are selected based on a logical and meaningful order. For instance, when selecting user information, the first column is usually some identifier, like user_id, or name, followed by the rest of the information.

4 Likes