Specifying the Order of Columns

The order in which you list the column names determines the order in which the columns appear in the output. The following examples show how to find and display the publisher names and identification numbers from the publishers table. The first example prints pub_id first, followed by pub_name. The second example reverses that order.

SELECT pub_id, pub_name
FROM publishers

pub_id pub_name              
------ ---------------------
0736   New Moon Books        
0877   Binnet & Hardley      
1389   Algodata Infosystems  
1622   Five Lakes Publishing 
1756   Ramona Publishers     
9901   GGG&G                 
9952   Scootney Books        
9999   Lucerne Publishing    

(8 row(s) affected)


SELECT pub_name, pub_id
FROM publishers

pub_name             pub_id  
---------------------------
New Moon Books        0736
Binnet & Hardley      0877
Algodata Infosystems  1389
Five Lakes Publishing 1622
Ramona Publishers     1756
GGG&G                 9901
Scootney Books        9952
Lucerne Publishing    9999

(8 row(s) affected)