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:
id | first_name | last_name | department | salary |
101 | bryan | walker | sales | 50,000 |
102 | alex | carpenter | accounts | 55,000 |
103 | sam | white | sales | 60,000 |
104 | john | barry | sales | 54,000 |
105 | bill | wood | accounts | 65,000 |
106 | robert | hopkins | support | 70,000 |
107 | david | lee | support | 72,000 |
108 | jack | sears | support | 65,000 |
109 | tom | young | sales | 55,000 |
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.