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

Can we join tables without foreign key?

0 Answers  


What are tables and fields?

0 Answers  


What is the process of copying data from table a to table b?

0 Answers  


Why procedure is used in sql?

0 Answers  


What is the life of an sql statement?

0 Answers  






ex: take one schema in that t1,t2,.....tn tables and you don't no the table name also. write a procedure if enter columns name then display the maching columns .otherwise display the unmatch columns.

1 Answers   Zensar,


Is subquery faster than join?

0 Answers  


Define commit, rollback and savepoint?

0 Answers  


What is the order of sql select?

0 Answers  


What are the sql aggregate functions?

0 Answers  


What is a database event trigger?

0 Answers  


How can you tell the difference between an index and a view?

0 Answers  


Categories