DUAL

DUAL is a pseudo-table that is automatically created by Oracle Database. It consists of exactly one row and one column, thereby ensuring that a SELECT statement against DUAL will always return a single row. DUAL is primarily used for calculations, calls to functions, or other operations where a table is required in the FROM clause. However, DUAL doesn't store any data itself and instead, it's used to return a result without relating to any other database tables.

Example

SELECT 'Hello, World!' FROM DUAL;

Output

+---------------+
| Hello, World! |
+---------------+
| Hello, World! |
+---------------+

Explanation

The DUAL is a special one-row, one-column table present by default in MySQL and other databases. In the example, we selected a string ‘Hello, World!’ from the DUAL table. As DUAL only contains one row and one column, a single value will be returned.

Example

SELECT 'Hello, World!' FROM DUAL;

Output

'Hello, World!'

Explanation

The DUAL is a one-row, one-column table present by default in Oracle and other database installations. In this example, the DUAL table is utilized to select a static text string. The result is a single row with a single column that contains the string ‘Hello, World!’.

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