How to Select Specific Columns in SQL
In most cases you will want to select specific columns in your table as opposed to displaying all columns. To accomplish this task, you itemize the individual columns you want displayed on the output.
To learn how to select specific columns in a table row in an SQL select statement, follow these steps:
- You'll need to setup the MySQL database tables. The instructions for the setup can be found in How to add comments in simple SQL selects. Follow steps 1 through 7 in this topic before proceeding to the next step.
- Now you will learn how to select specific columns for each row of a table.
- Imagine we are required to select the city name and population from the
Citiestable. We will need to itemize the columns on the select statement as shown in the following SQL statement:
You will see in the output the two columns you requested for each row of the