SELECT expression FROM [schema_name.]table_name WHERE condition_1 AND condition_2;
- Name of the schema to which the table belongs. It is optional.
- Name of the table from which you want to fetch data. It is mandatory.
- Condition_1, condition_2 etc. filters the query data.
- An expression denotes a single column, multiple columns, standard functions or calculations that you want to fetch.
- To retrieve specific columns from the table
SELECT emp_id, emp_name FROM employees WHERE dept_number = 10;
Here, employee id and employee name belonging to department number 10 will be fetched.
- Below query retrieve all columns from the table
SELECT * FROM employees;
Here, * retrieves all the columns of table employees.
As we have not mentioned any condition, all the table data will be retrieved.
- To retrieve standard function from the table
SELECT SYSDATE FROM DUAL;
This query retrieves the current date.
- Below query retrieves calculation output
SELECT 4+5 “Addition of 4 and 5” FROM DUAL;
The output of this query is 9.
- Calculations of columns retrieved as below
SELECT salary + hike_percent “Salary increment” FROM employees;
Above query returns increment in salary by adding salary to hike_percent,
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!