Jump to content

Does this query from my book make any sense?


eindoofus

Recommended Posts

I took the following query out of the book "Peachprint Press PHP 6 and MySQL 5 for Dynamic Web Sites 2007":

 

SELECT first_name, last_name FROM users ORDER BY last_name ASC, first_name ASC;

 

I don't  understand the point of having "first_name ASC" at the end. As far as I know SQL organizes the table by rows and maintains the relationship within each row.

 

Doesn't SQL just ignore any statement that would follow "last_name ASC"? If it didn't then the relationships within a table would get scrambled, wouldn't they? Would there ever be a reason to include more than one statement after an "ORDER BY"?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.