PostgreSQL – FROM Clause

In SQL, FROM clause is used in the select statement to list the tables from which the data is being queried.

Consider an employee table as shown below:

idfirst_namelast_namedepartmentsalary
101bryanwalkersales50,000
102alexcarpenteraccounts55,000
103samwhitesales60,000
104johnbarrysales54,000
105billwoodaccounts65,000
106roberthopkinssupport70,000
107davidleesupport72,000
108jacksearssupport65,000
109tomyoungsales55,000
employee

Below is the SQL query to return data from the employee table.

SELECT * FROM employee;

id first_name last_name department salary
--- --------- --------- ---------- -------
101 bryan      walker    sales      50000
102 alex       carpenter accounts   55000
.
.
.

FROM clause is always followed by the data source. In this scenario, FROM clause is followed by the employee table.

See also  PostgreSQL - Get current user