top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

What is the result of the following SQL?

+1 vote
376 views

Select 1 from dual
UNION
Select 'A' from dual;

posted Jan 12, 2015 by Suchithra

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

+1 vote
 
Best answer

In SQL it shows error Dual is not found any table

But without dual

Select 1
UNION
Select 'A'

OutPut:

Number of Records: 2
1
1
A

answer Jan 12, 2015 by Manikandan J
what will be the output with dual and reason please
DUAL is a table 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. 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.

e.g. select sysdate from dual;

Ans:
 1
A

two row will be created
Similar Questions
+1 vote

How many rows will the following SQL return :

  Select * from emp Where rownum = 10;
+1 vote

How many rows will the following SQL return :

Select * from emp Where rownum < 10;
+1 vote

which of the following is better to find the number of rows in a table?
1. count(1)
2. count(*)
3. count(rowid)

...