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

What is union and union all keyword in sql?

0 Answers  


What is sql exception?

0 Answers  


Explain the select statement in sql?

0 Answers  


Is sql low level language?

0 Answers  


What is Difference Between Unique and Primary Key Constraints?

0 Answers   Wipro,






What is different between union and minus?

7 Answers   Accenture, TCS,


i have a customer table. trans_id trans_date trans_amt debit_credit_indicator 001 01-JAN-13 1099 cr 001 12-JAN-13 500 db 002 24-FEB-13 400 db 002 23-MAR-13 345 cr 001 18-APR-13 800 cr 002 15-MAR-13 600 db 001 12-FEB-13 200 cr i want like this output. trans_id trans_amt debit_credit_indicator i want get highest credit amount and lowest credit amount and highest debit amount and lowest debit amount for each trans_id. pls give me answer. i want urgent

3 Answers  


How do I install microsoft sql?

0 Answers  


How many scalar data types are supported in pl/sql?

0 Answers  


What is the primary key?

0 Answers  


how to saw triggers output in pl/sql database?

1 Answers  


What is left join in postgresql?

0 Answers  


Categories