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

Let us suppose we have a table with structure in order empno empname empdesig empcountry and now i want to re-organize the columns of this table to empno empdesig empname empcountry how can i do this with queries ? assume that table contains the data.

3 Answers  


How do I make my sql query run faster?

0 Answers  


Is sql developer case sensitive?

0 Answers  


Is sqlite thread safe?

0 Answers  


What is offset in sql query?

0 Answers  






What is sql rowcount?

0 Answers  


what are the types of join and explain each? : Sql dba

0 Answers  


What is the difference between sql and t sql?

0 Answers  


What is the difference between having clause and where clause?

0 Answers  


What is a record in a database?

0 Answers  


What is the meaning of disabling a trigger?

0 Answers  


Name three sql operations that perform a sort.

0 Answers  


Categories