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 |
How do you clear the screen in sql?
Write a query to get 2nd maximum salary in an employee table ?
69 Answers Accenture, BirlaSoft, Letse, Logica CMG, Qwest, Rheal Software, Saagam, Semantic Space, Tailor Solution, TCS, TinyERP,
What is sql profiling in oracle?
what is acid property in database? : Sql dba
What is a constraint? Tell me about its various levels.
what are the advantages and disadvantages of views in a database? : Sql dba
how to calculate expressions with sql statements? : Sql dba
When is the explicit cursor used ?
Can you have a foreign key without a primary key?
i have a table eno dno sal 1 10 200 2 10 150 3 10 100 4 20 75 5 20 100 i want to get sal which is less than the avg sal of thri dept. eno dno sal 2 10 150 3 10 100 4 20 75
Which clause of an UPDATE statement allows you to affect only certain rows of a table? 1. The WHERE clause 2. The SET clause 3. The ROWS AFFECTED clause 4. The ORDER BY clause
What is union, minus and interact commands?