SELECT category, type, AVG(price)
FROM products GROUP BY category, type ORDER BY 1, 2

If there are three distinct categories in the "products"
table, and each one has five different types, how many rows
are returned by the query above?

1. 1 row
2. 3 rows
3. 5 rows
4. 8 rows
5. 15 rows

Answers were Sorted based on User's Feedback



SELECT category, type, AVG(price) FROM products GROUP BY category, type ORDER BY 1, 2 If there..

Answer / vijay

15 rows

Is This Answer Correct ?    9 Yes 2 No

SELECT category, type, AVG(price) FROM products GROUP BY category, type ORDER BY 1, 2 If there..

Answer / sreeharibabu

create table products (category varchar2(30), type varchar2(20) ,price number ) ;

insert into products values('c1','t1',100);
insert into products values('c1','t2',200);
insert into products values('c1','t3',300);
insert into products values('c1','t4',400);
insert into products values('c1','t5',500);

insert into products values('c2','t1',100);
insert into products values('c2','t2',200);
insert into products values('c2','t3',300);
insert into products values('c2','t4',400);
insert into products values('c2','t5',500);

insert into products values('c3','t1',100);
insert into products values('c3','t2',200);
insert into products values('c3','t3',300);
insert into products values('c3','t4',400);
insert into products values('c3','t5',500);

select * from products ;

SELECT category, type, AVG(price)
FROM products GROUP BY category, type ORDER BY 1 ;

3 *5 => 15 rows

Is This Answer Correct ?    1 Yes 0 No

SELECT category, type, AVG(price) FROM products GROUP BY category, type ORDER BY 1, 2 If there..

Answer / hemanth

5 Rows

Is This Answer Correct ?    0 Yes 1 No

Post New Answer

More SQL PLSQL Interview Questions

How do you clear the screen in sql?

0 Answers  


Write a query to get 2nd maximum salary in an employee table ?

69 Answers   Accenture, BirlaSoft, Letse, Logica CMG, Qwest, Rheal Software, Saagam, Semantic Space, Tailor Solution, TCS, TinyERP,


What is sql profiling in oracle?

0 Answers  


what is acid property in database? : Sql dba

0 Answers  


What is a constraint? Tell me about its various levels.

0 Answers  






what are the advantages and disadvantages of views in a database? : Sql dba

0 Answers  


how to calculate expressions with sql statements? : Sql dba

0 Answers  


When is the explicit cursor used ?

0 Answers  


Can you have a foreign key without a primary key?

0 Answers  


i have a table eno dno sal 1 10 200 2 10 150 3 10 100 4 20 75 5 20 100 i want to get sal which is less than the avg sal of thri dept. eno dno sal 2 10 150 3 10 100 4 20 75

12 Answers   IBM,


Which clause of an UPDATE statement allows you to affect only certain rows of a table? 1. The WHERE clause 2. The SET clause 3. The ROWS AFFECTED clause 4. The ORDER BY clause

6 Answers   HCL,


What is union, minus and interact commands?

0 Answers  


Categories