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
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 |
Can we join tables without foreign key?
What are tables and fields?
What is the process of copying data from table a to table b?
Why procedure is used in sql?
What is the life of an sql statement?
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.
Is subquery faster than join?
Define commit, rollback and savepoint?
What is the order of sql select?
What are the sql aggregate functions?
What is a database event trigger?
How can you tell the difference between an index and a view?