If a dual table has 4 records. Which one will be display?
NOTE : [This question was asked by nagurtilak]
If a dual table has 4 records. Which one will be display?
NOTE : [This question was asked by nagurtilak]
Dual Table is a special kind of table..It has only one row and one column...So it always display one record which is first....
-------------------
suresh
Lokesh M,
Can you show a DUEL table with 4 rows.
Just give the SQL statement.
Thanks in advance
Members,
Kindly note these questions are not mine, They have been asked by site visitors, I am just posting them at appropriate place.
Few Questions might be incomplete, Few may be wrong, Lets clarify and share what we know...
Thanks for all your comments anyway
Suresh is right. DUAL has only a single row and single column. It is usually used for arithmatic manipulations as a dummy table.
[COLOR="Blue"][SIZE="2"]"If you are not living on the edge of your life, you are wasting space"[/SIZE][/COLOR]
Someone says "Impossible is nothing". The man next him says "Let me see you licking your elbow tip!"
hi,
Dual is very special table, one row and one column. well see it below:
SQL> desc dual;
Name Null? Type
------------------------------- -------- ----
DUMMY VARCHAR2(1)
well as u can see the structure of table DUAL, name of the column is DUMMY, and datatype is varchar2(1). (this is very imp. question in interview).
SQL> select * from dual;
D
-
X
and here as u can see, it will always have X.
=> in the real time it will be used in coding.
lets see one scenario, suppose i want the sysdate.
yes we can use the sysdate the in-built function, it will give the date. but in sql we have to give some tablename after FROM clause. so which table to use, in that case we use dual. and in this case dual is not doing anything, all the operation is done with the sysdate function. so the query we write is :
sql> select sysdate from dual;
and more thing friends, i do not think that, dual does any arithmatic manipulations. it never does. its just a coplementary for FROM clause.
well u can see with this example:
SQL> select 2+3 from dual;
2+3
---------
5
so, the result is correct as expected(beleiving that arithmatic operations are done in dual, then this select stmnt. should fail if we use any other table after FROM). so lets see what happens, i am using other table:
SQL> select 2+3 from emp;
2+3
---------
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
20 rows selected.
see here also we got the result. so its clear dual does not does any calculations, it only complements FROM clause. and logically also its not possible, just ask a simple question, Can we do any type of calculation inside any field of a record? and the answer is no. so the same thing is applicable for DUAL.
regards,
RSY
how it possible more than one record in dual table