SQL Tutor

Looking for a SQL tutor? Our free online SQL tutorial teaches you SQL. We provide examples of SQL syntax so you can learn SQL quickly. Our SQL tutorial is also a great SQL command reference.

Table of Contents

Ordering Rows

Data is stored in Scalable SQL in no particular sequence. If you want to see your data displayed in sequence, you must add an Order By clause to your Select statement.


Select */fieldname<mask> ...
from tablename
order by fieldname;


  • The Order By clause tells SQL you want the specified fields displayed in ascending order (ordered from A to Z, 1 to 100).

Retrieve the city, vendor Id, and name from the TrnVendor table. Order your data by city:

  1. In the SQL text box type:

Select City, VendId, Name
from TrnVendor
order by City; 

  1. Execute the SQL statement.
City VendId Name
Bayshore TV019 Bayshore Consulting
Burlington TV020 BayCon Group
Chicago TV003 BedMakers Linen
Chicago TV016 Music Maker
Chicago TV028 Distant Horizons
Chicago TV029 Paltry Play
Chicago TV030 Make Shift Tilts
Dallas TV021 Cooperative Operatives
Dallas TV026 Clampett Oil
Detroit TV005 Ray Block
Detroit TV007 Spot Out
Freeport TV017 Food Four
Freeport TV023 World Wide Learning U
Freeport TV024 Enterprise Transport
Houston TV022 Legal Lookup
Mercer TV004 Bed Room Furniture, Inc.
Mercer TV011 The Freelance
Monroe TV008 Big Tree Landscaping
Monroe TV013 Softer Software
New York TV012 Paper People
Orlando TV010 The Soda Factory
Orlando TV025 Against the Tide
Park Ridge TV006 Mosquito No Bite
Park Ridge TV015 No Waste Disposal
Toledo TV001 Wet Off Towels
Toledo TV009 Hit the Deck
Toledo TV014 Counter Productive
Toledo TV027 Narrow Nest
Warren TV002 The Games All Here
Youngstown TV018 Computer Bytes
Table of Contents

Legal Dot Privacy