There may be a situation where we want to query something that is not from a table. For example, getting the current date or querying a simple arithmetic expression like 2+2.
In Oracle, clause FROM is not exceptional. If we don’t write the FROM clause in Oracle, we’ll get an error.
Example-1: Oracle Query
SELECT SYSDATE;
Output –
ORA-00923: FROM keyword not found where expected
Example-2: Oracle Query
SELECT 'GeeksforGeeks';
Output –
ORA-00923: FROM keyword not found where expected
DUAL :
It is a table that is automatically created by Oracle Database along with the data dictionary. DUAL is in the schema of the user SYS but is accessible by the name DUAL to all users. It has one column, DUMMY, defined to be VARCHAR2(1), and contains one row with a value X.
Example: Oracle Query
SELECT * FROM DUAL ;
Output –
X
Selecting from the DUAL table is useful for computing a constant expression with the SELECT statement. Because DUAL has only one row, the constant is returned only once.
Oracle Query :
SELECT 'GeeksforGeeks' AS NAME FROM DUAL;
Output –
GeeksforGeeks
Oracle Query :
SELECT 2+2 FROM DUAL;
Output :
2+2 = 4
Several other databases, including MS SQL Server, MySQL, PostgreSQL and SQLite, allows the omitting of FROM clause. This exception is the reason there is no dummy table like DUAL in other databases.
Attention reader! Don’t stop learning now. Get hold of all the important CS Theory concepts for SDE interviews with the CS Theory Course at a student-friendly price and become industry ready.
Recommended Posts:
- Difference between Structured Query Language (SQL) and Transact-SQL (T-SQL)
- SQL | Create Table Extension
- How to Get the names of the table in SQL
- SQL | Checking Existing Constraints on a Table using Data Dictionaries
- What is Temporary Table in SQL?
- SQL query to find unique column values from table
- SQL | Declare Local Temporary Table
- SQL | Query to select NAME from table using different options
- Table operations in MS SQL Server
- Table Variable in SQL Server
- Check whether a Table exists in SQL Server database or not
- How to find first value from any table in SQL Server
- SQL | Procedures in PL/SQL
- SQL | Difference between functions and stored procedures in PL/SQL
- Difference between T-SQL and PL-SQL
- Difference between SQL and T-SQL
- How to print duplicate rows in a table?
- How to find Nth highest salary from a table
- PHP | MySQL ( Creating Table )
- Check if Table, View, Trigger, etc present in Oracle
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.

