Explain the concept of the DUAL table.
- On installing Oracle database, DUAL table is present by default.
- It is a special table with just one row.
- It has a single column called DUMMY.
- The data type of this column in VARCHAR2(1). It has a value "X".
- It is most commonly used to select pseudo columns in Oracle like sysdate:
Select sysdate from dual
- It is a table automatically created by Oracle Database along with the data dictionary.
- It is in the schema of the user SYS but is accessible by the name DUAL to all users.
- 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.
- Alternatively, you can select a constant, pseudocolumn, or expression from any table, but the value will be returned as many times as there are rows in the table.