Topic: SQL*Plus and PL/SQL >> sql queries
|
Disclaimer: The purpose of all dbapool forums including OCP and Other Oracle Certification forums is to help each other with specific issues but not to share dump and copyrighted exam content, materials or intellectual property.
You may review the entire Oracle Certification Program Candidate Agreement online Here.
|
|
|
|
| jeeva |
Posted: Oct 31, 2007 04:16:59 AM |
Total Post: 11
Joined: Oct, 2007
|
create table table1(A number(5),B number(5));
insert into table1(A,B) values(3,7);
insert into table1(A,B) values(1,5);
insert into table1(A,B) values(null,4);
insert into table1(A,B) values(2,6);
1> select * from table1 orderby null;
2> select "*" from table1;
3> select a,count(a) from table1 groupby(a);
4> select 'a'+'b' from table1;
5> select "a"+"b" from table1;
6> select sum(0) from table1;
7> select sum(1) from table1;
8> select sum(null) from table1;
9> select all rows from the table1 using "join" clause
10> select 'b' 'a','a' 'b' from table1 orderby 1;
11> select sum(a+b) from table1;
12> select avg(0) from table1;
can any one give the o/p of each query?.
|
|
|
snehalatha |
| Posted: Nov 06, 2007 01:27:25 AM | |
|
Total Post: 169
Joined: Apr, 2006
|
1) select * from table1 order by null;
Ans:A constant expression was encountered in the ORDER BY list,
position 1.
2)select "*" from table1;
Ans : * is invalid column
3)select a,count(a) from table1 group by(a);
Ans:
NULL 0
1 1
2 1
3 1
4) select 'a'+'b' from table1;
Ans:
ab
ab
ab
ab
5) select "a"+"b" from table1;
Ans:
10
6
NULL
8
6) select sum(0) from table1;
Ans: 0
7) select sum(1) from table1;
Ans: 1
8) select sum(null) from table1;
Ans: Operand data type void type is invalid for sum operator.
9) select 'b' 'a','a' 'b' from table1 order by 1;
Ans:
b a
b a
b a
b a
10) select sum(a+b) from table1;
Ans:24
11) select avg(0) from table1;
Ans:0
|
|
|
|
|
jeeva |
| Posted: Nov 06, 2007 08:20:55 AM | |
|
Total Post: 11
Joined: Oct, 2007
|
Thank u for ur reply
I think i got the correct answer
|
|
|
|
|
| Time Zone: EDT |
Send this thread to your friend |
|
|
|
|
Forum Rules & Description
Who Can Read The Forum? Any registered user or guest
Who Can Post New Topics? Any registered user
Who Can Post Replies? Any registered user
|
| |
Get FREE Magazines
|
Top 10 Forum User
|
| Murtuja Khokhar | 843 |
| Mohammed Taj | 746 |
| positive fanatic | 483 |
| Jayanta Sur | 479 |
| Vigyan Kaushik | 386 |
| Gitesh Trivedi | 322 |
| Gopu Gopi | 268 |
| neeraj sharma | 252 |
| Ramesh Jois | 245 |
| Bishal Khetan | 207 |
|
|