Skip to main content

SELECT Statement: the FROM

In the previous outcome you used the basic format of the SELECT command, i.e.

SELECT *

FROM tablename;

This selected all the data from all the columns from each data row.

For example:

SELECT *

FROM employee; -- select all the employee details

SELECT *

FROM student; -- select all the student details

This is useful if you want a report on the full data content of a table. However, often you are only interested in specific columns and/or rows.

Selecting Columns

Selecting specific columns is possible by using the following syntax of the SQL SELECT command:

SELECT column, column, ....

FROM tablename;

For example:

SELECT employee_number, forename, surname, salary

FROM employee;

Note: The selected columns do not have to be in the same order as defined in the table.

Next: SELECT Statement: the WHERE Clause