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 name
FROM authors;

Output

name
----------
J.K. Rowling
George R.R. Martin
William 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, LastName
FROM Employees;

Output

FirstName | LastName
---------------------
John | Doe
Jane | 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_NAME
1 | Steve | Jobs
2 | Bill | Gates
3 | 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 name
FROM student;

Output

John
Jane
Bob

Explanation

The SQL code selects and returns all entries from the ‘name’ column in the ‘student’ table.

For in-depth explanations and examples SQL keywords where you write your SQL, install our extension.