Oracle Interview Question
Applications DevelopersCountry: India
Interview Type: Phone Interview
select a acount,b bcount, c ccount from (select count(name) a from countme where name='a'),(select count(name) b from countme where name='b'),(select count(name) c from countme where name='c')
Not sure if this is okay, since it's using nested queries.
SQL>select (select count(*) from test1 where tblColumn='a') as ACOUNT, (select count(*) from test1 where tblColumn='b') as BCOUNT, (select count(*) from tblTest where tblColumn='c') as CCOUNT from dual;
No Kevin, Please look into the qstn, you need to provide the result in three different columns not in a single column.
The above answer is absolutely right. The group by clause will do the sorting out for you and the count will give the desired results.The practical demonstration shows the same too.
- HR July 26, 2012