Learn SQL

Want to learn SQL? Our free online SQL tutorial teaches you the SQL commands you need to query your SQL database. We provide examples of SQL syntax so you can learn SQL quickly. Our SQL tutorial is a great SQL command reference.

Table of Contents

Retrieving Multiple Columns

You can use SQL to retrieve multiple columns.

Syntax:

Select fieldname, fieldname, fieldname
from tablename;

Explanation:

  • When retrieving multiple columns, specify each field name. 
  • A comma must separate field names. 
  • The columns will display in the order you select them. 
  • Numbers display in scientific notation.
Example:

Retrieve the vendor ID, name, and current balance for each record:

  1. In the SQL text box, type:

Select VendId, Name, CurrBal
from TrnVendor; 

  1. Execute the command by clicking on First, the Run button located to the right of the SQL text box. The results will display on the screen.
  2. Use the vertical scroll bar to move up and down the screen.
  3. Click on Stop to return to the original screen
Results:
 
VendId Name CurrBal
TV001 Wet Off Towels 1.31300E+001
TV002 The Games All Here 4.53170E+002
TV003 BedMakers Linen 5.00000E+002
TV004 Bed Room Furniture, Inc. 3.21700E+002
TV005 Ray Block 1.00123E+003
TV006 Mosquito No Bite 9.67240E+002
TV007 Spot Out 1.60654E+003
TV008 Big Tree Landscaping 3.42980E+002
TV009 Hit the Deck 2.34500E+001
TV010 The Soda Factory 0.00000E+000
TV011 The Freelance -1.09230E+002
TV012 Paper People 6.17000E+002
TV013 Softer Software 9.87367E+003
TV014 Counter Productive 4.28900E+001
TV015 No Waste Disposal 1.72098E+003
TV016 Music Maker 4.10914E+003
TV017 Food Four 6.42980E+002
TV018 Computer Bytes 3.45090E+002
TV019 Bayshore Consulting 4.98050E+002
TV020 BayCon Group 5.10000E+001
TV021 Cooperative Operatives 2.00000E+001
TV022 Legal Lookup 3.21516E+003
TV023 World Wide Learning U 7.71060E+002
TV024 Enterprise Transport 1.23498E+003
TV025 Against the Tide 6.47200E+001
TV026 Clampet Oil 0.00000E+000
TV027 Narrow Nest 1.60900E+003
TV028 Distant Horizons 2.69800E+001
TV029 Paltry Play 1.00000E+003
TV030 Make Shift Tilts 1.79323E+003
Table of Contents

Legal Dot Privacy