Home » Other » Training & Certification » OCP Questions
OCP Questions [message #133266] Thu, 18 August 2005 05:32 Go to next message
nirmalnarayan
Messages: 261
Registered: April 2005
Location: India
Senior Member
Hi,

I found these questions in the forum.

Question No. 01: Which clause excludes the group function?
a. WHERE
b. FROM
c. HAVING
d. GROUP BY
e. ORDER BY

Question No. 02: Select ROUND (TRUNC (MOD (1600, 10), -1), 2) from dual;
a. 0
b. 0.00
c. Error


Can any one help me with answers and explanations ?

Thanks and Regards,
Nirmal N
Re: OCP Questions [message #134496 is a reply to message #133266] Thu, 25 August 2005 04:50 Go to previous messageGo to next message
nileshmanav
Messages: 1
Registered: August 2005
Location: Chennai
Junior Member
the answer of 1st question is "where" and for 2nd question is "0"


Re: OCP Questions [message #134835 is a reply to message #133266] Sat, 27 August 2005 15:50 Go to previous messageGo to next message
Michael Hartley
Messages: 110
Registered: December 2004
Location: West Yorkshire, United Ki...
Senior Member



1.e. because you can't orderby after applying a groupby,or you can't groupby after orderby. Groupby defines the columns that are not summed in the select list
eg.

select col1, col2, count(*)
from table
where col3='somevalue'
groupby col1, col2;

In other words, for each distinct col1, col2 tuple find the count of the occurances of this tupple.

2.c I think trunc(x,-1) would fail with an error because -1 is incorrectly identifying a number of decimal places.

Re: OCP Questions [message #134848 is a reply to message #134835] Sun, 28 August 2005 03:02 Go to previous message
tarundua
Messages: 1080
Registered: June 2005
Location: India
Senior Member


I think u got the answer for the first question and the second is 0 cos ---

SQL> select mod(1600,10) from dual;

MOD(1600,10)
------------
0

applying a function on 0 returns 0.

and
Quote:

trunc(x,-1) would fail with an error


It is not so ..

SQL> select trunc(545,1) from dual;

TRUNC(545,1)
------------
545

SQL> select trunc(545,-1) from dual;

TRUNC(545,-1)
-------------
540

SQL> select trunc(545,-2) from dual;

TRUNC(545,-2)
-------------
500


Now i think the picture is clear.

regards,
tarun
Previous Topic: Looking for oracle certification? Help me!
Next Topic: ORACLE TRAINING IN ALL MODULES
Goto Forum:
  


Current Time: Fri Apr 19 14:49:28 CDT 2024