Choosing column data

You can choose columns from a table. To do so, list the names of the desired table columns after SELECT in the statement, before noting the table after the FROM clause.

The FROM clause can name only one table. To retrieve data from a child table, use dot notation, such as parent.child.

To choose all table columns, use the asterisk (*) wildcard character as follows:

sql-> SELECT * FROM Users; 

The SELECT statement displays these results:

 
 +----+-----------+----------+-----+--------+
 | id | firstname | lastname | age | income |
 +----+-----------+----------+-----+--------+
 |  3 | John      | Morgan   |  38 |   NULL |
 |  4 | Peter     | Smith    |  38 |  80000 |
 |  2 | John      | Anderson |  35 | 100000 |
 |  5 | Dana      | Scully   |  47 | 400000 |
 |  1 | David     | Morrison |  25 | 100000 |
 +----+-----------+----------+-----+--------+

5 rows returned 

To choose specific column(s) from the table Users, include the column names as a comma-separated list in the SELECT statement:

sql-> SELECT firstname, lastname, age FROM Users;
 +-----------+----------+-----+
 | firstname | lastname | age |
 +-----------+----------+-----+
 | John      | Morgan   |  38 |
 | David     | Morrison |  25 |
 | Dana      | Scully   |  47 |
 | Peter     | Smith    |  38 |
 | John      | Anderson |  35 |
 +-----------+----------+-----+

5 rows returned