From clause is one of the important clauses of the Oracle SQL query.
It helps to retrieve data from a single table or view, multiple tables or views, and in-line queries.
One table is mandatory to be mentioned in the from clause of the query.
If there are multiple tables, they are joined either using standard Oracle standards or ANSI standards.
SELECT * FROM [schema_name.]table_name_1 [, table_name_2...table_name_n] [,in-line query] WHERE condition_1 AND condition_2 ..... ..... AND condition_n;
- Schema name in which the table is present
- Table names to retrieve data from
- Conditions to filter the retrieved data
- In-line query to retrieve data from
- Data retrieved from a single table
SELECT * FROM employees;
This query fetches all records from the employees table in this example.
- Data retrieved from multiple tables using joins
SELECT e.emp_name, d.dept_name FROM employees e, departments d WHERE e.dept_id = d.dept_id;
Joining column dept_id from employees and departments table fetch employee name and department name in this example
- Data retrieved by joining tables and in-line queries
SELECT e.* FROM employees e, (SELECT d.dept_id, d.dept_name FROM departments d) dept WHERE e.dept_id = dept.dept_id;
Joining an in-line query with the employees table fetches all columns of the employees table in this example.
I hope you like the page and find it useful. We highly appreciate comments and feedback.
Hi I am Paras.
Thanks for stopping by at OracleMine.com. Speaking about my brief introduction, I work for a multinational organisation in Oracle related technologies. Being an avid blogger, I would like to inform you about my productivity and motivational blog XpressPlanet.com. Speaking of OracleMine.com, I will try my best to share knowledge on technologies in as simple and understandable manner as possible. You can also contribute your knowledge on OracleMine by writing to us at firstname.lastname@example.org. Again I appreciate your visit. Hope to see you again and again!