Dual table:
- DUAL table is a dummy table which
contains one row and one column and
by default it is present in
database.It contains a single
VARCHAR2(1) column known as DUMMY
with a value "X".
- It can be accessed by all users but
the owner of DUAL table is SYS. We
can use this table to perform some
calculation and we can also display
system date.
- It is used when we are interested in
result only.
We can see the structure of the DUAL table using the following query:
DESC DUAL;
Output will be like this:
Name Null? Type
--------------------------- ------
DUMMY VARCHAR2(1)
We can see the data of dual table using the following query:
SELECT * FROM DUAL;
Output will be like this:
DUMMY
----------
X
Query to check the system date using dual table:
SELECT sysdate FROM DUAL ;
Output will be like this:
SYSDATE
---------
25-JAN-16
Query to perform some calculation using dual table:
SELECT 25+10-25*25/25 FROM DUAL;
Output will be like this:
25+10-25*25/25
---------------------
10.0000
0 Comment(s)