DUAL table

DUAL table

The DUAL table is a special one-row table present by default in all Oracle database installations. It is suitable for use in selecting a pseudocolumn such as SYSDATE or USER. The table has a single VARCHAR2(1) column called DUMMY that has a value of 'X'.

Contents

Example use

Oracle's SQL syntax requires the FROM clause but some queries don't require any tables - DUAL can be readily used in these cases.

SELECT 1+1
FROM DUAL;
 
SELECT SYSDATE 
FROM   DUAL;
 
SELECT USER 
FROM   DUAL;

History

The DUAL table was created by Charles Weiss of Oracle corporation to provide a table for joining in internal views:

I created the DUAL table as an underlying object in the Oracle Data Dictionary. It was never meant to be seen itself, but instead used inside a view that was expected to be queried. The idea was that you could do a JOIN to the DUAL table and create two rows in the result for every one row in your table. Then, by using GROUP BY, the resulting join could be summarized to show the amount of storage for the DATA extent and for the INDEX extent(s). The name, DUAL, seemed apt for the process of creating a pair of rows from just one.[1]

The original DUAL table had two rows in it (hence its name), but subsequently it only had one row.

Optimization

DUAL was originally a table and the database engine would perform disk IO on the table when selecting from DUAL. This disk IO was usually logical IO (not involving physical disk access) as the disk blocks were usually already cached in memory. This resulted in a large amount of logical IO against the DUAL table.

Later versions of the Oracle database have been optimized and the database no longer performs physical or logical IO on the DUAL table even though the DUAL table still actually exists.

In other database systems

MySQL allows DUAL to be specified as a table in queries that do not need data from any tables.[2]

Notes

External links


Wikimedia Foundation. 2010.

Игры ⚽ Поможем решить контрольную работу

Look at other dictionaries:

  • Dual — may refer to: Dual (mathematics), a notion of paired concepts that mirror one another Dual (category theory), a formalization of mathematical duality . . . see more cases in Category:Duality theories Dual (grammatical number), a… …   Wikipedia

  • Dual (grammatical number) — Dual (abbreviated du) is a grammatical number that some languages use in addition to singular and plural. When a noun or pronoun appears in dual form, it is interpreted as referring to precisely two of the entities (objects or persons) identified …   Wikipedia

  • Dual-Cell HSDPA — (also known as: Dual Carrier HSPA or Dual Cell HSPA) is a wireless broadband standard based on HSPA that is defined in 3GPP UMTS release 8. Dual Cell (DC )HSDPA is the natural evolution of HSPA by means of carrier aggregation in the downlink[1].… …   Wikipedia

  • Table de constantes mathematiques — Table de constantes mathématiques Cet article donne une liste de certaines constantes mathématiques. Typiquement, une constante en mathématique est un élément du corps des nombres réels ou des nombres complexes. À la différence des constantes… …   Wikipédia en Français

  • Dual (Heroes) — Dual Heroes episode Claire guards Angela against Sylar …   Wikipedia

  • Table apple — Table apples or dessert apples are a group of apple cultivars grown for eating raw as opposed to cooking or cidermaking. Table apples are usually sweet and the most prized exhibit particular aroma variations that differentiate them from other… …   Wikipedia

  • Dual quaternion — The set of dual quaternions is an algebra that can be used to represent spatial rigid body displacements.[1] A dual quaternion is an ordered pair of quaternions  = (A, B) and therefore is constructed from eight real parameters. Because rigid… …   Wikipedia

  • Dual Spires — Psych episode …   Wikipedia

  • Table DUAL — La table DUAL est une table spéciale d une seule colonne présente par défaut dans toutes les installations du SGBD Oracle. Elle est utilisée généralement comme pseudo colonne pour les requêtes du genre SYSDATE ou USER. La table contient une seule …   Wikipédia en Français

  • Dual-Layer — Speichermedium DVD DVD Logo Allgemeines Typ Optisches Speichermedium Kapazität 4,7 GB[1] (Single Layer) 8,5 GB (Dual Layer) …   Deutsch Wikipedia

Share the article and excerpts

Direct link
Do a right-click on the link above
and select “Copy Link”