There are instances where you may not need to see all the data at one time. For example, you may want to just see the customer’s email address to send out a marketing campaign email. To select only email addresses, instead of using the *, we can list out the column that we would like to display. Looking at the column list under the schema browser, we can see the list of columns:
The eighth column contains the email addresses that we want to display. Using the SELECT statement, we can alter the SELECT clause to display just the email addresses instead of all columns by replacing the * with the specific column name. The query statement would be changed to:
SELECT email FROM customer;
Running this statement displays only email addresses:
This is useful, but perhaps we would like to also include their first and last name. If we want to select more than one column, we need to separate out the column list using commas. For example:
SELECT first_name, last_name, email FROM customer;
This would return the result set that looks like the following:
You can switch the column list in any order that you would like displayed:
SELECT email, last_name, first_name FROM customer;
You could even have the same column twice:
SELECT email, email FROM customer;
This query returns:
This may not appear useful now, but when we focus on calculations in SELECT statements, we will revisit the purpose of having columns listed more than once.
Source: Vincent Tran