FROM
FROM is a keyword in SQL that is used to specify the table from which to retrieve data. It is part of the SQL SELECT statement and is used preceding the table name.
Example
SELECT *FROM Employees;
Output
+--------+-----------+------------+| emp_id | emp_name | emp_email |+--------+-----------+------------+| 1 | Smith | s@xyz.com || 2 | Johnson | j@xyz.com || 3 | Williams | w@xyz.com || 4 | Brown | b@xyz.com || 5 | Jones | j@xyz.com |+--------+-----------+------------+
Explanation
The FROM
clause in SQL is used to specify the table from which to retrieve data. In this example, the FROM
clause specifies the Employees
table. The SELECT *
statement is used to select all columns from this table. It retrieves and displays an entire table of data. The output is a list of employees with their respective emp_id
, emp_name
and emp_email
columns.
Example
SELECT nameFROM authors;
Output
name----------J.K. RowlingGeorge R.R. MartinWilliam Shakespeare
Explanation
In the given SQL query, FROM
is used to specify the table authors
from which to retrieve the data. The SELECT
statement is then used to specify the name
column to be included in the result set.
Example
SELECT FirstName, LastNameFROM Employees;
Output
FirstName | LastName---------------------John | DoeJane | Smith
Explanation
The example SQL query is pulling the ‘FirstName’ and ‘LastName’ from a table named ‘Employees’. The output is then displaying the first and last names of each record in the ‘Employees’ table as separate columns.
Example
SELECT *FROM Employees;
Output
EMPLOYEE_ID | FIRST_NAME | LAST_NAME1 | Steve | Jobs2 | Bill | Gates3 | Elon | Musk
Explanation
The FROM
clause in Oracle SQL is used to specify the table from which to retrieve data. The code “SELECT * FROM Employees;” retrieves all columns (signified by the *) from the table named “Employees”. The resultant table consists of all records from the “Employees” table.
Example
SELECT nameFROM student;
Output
JohnJaneBob
Explanation
The SQL code selects and returns all entries from the ‘name’ column in the ‘student’ table.