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
Answer Posted / 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 |
Post New Answer View All Answers
What are the 3 types of behavioral triggers?
what is a database lock ? : Sql dba
Explain what is sql?
What are different categories of sql commands?
What is the unique index?
How would you pass hints to the sql processor?
How do I quit sql?
What trigger means?
What are few of the schema objects that are created using PL/SQL?
What is asqueryable?
What is snowflake sql?
Why do we need sharding?
Can we want to pass a parameter payroll_id to this external pl/sql function, how do we do it?
What are the events on which a database trigger can be based?
What is a dirty read sql?