Explain basic SQL queries with SELECT from where Order By,
Group By-Having?
Answers were Sorted based on User's Feedback
Answer / swapna
Order by clause is used to sort information of a table into
specific order either ascending or descending order.
syntax:select stmt order by column;
ex:select * from emp order by sal;
Group by clause is used to divide entire group into
subgroups based on the common values columns.we can use
group by clause along with group functions.
syntax:select group by(exp 1),group by(exp 2),....from
table name group by column name;
select max(sal),min(sal) from emp group by deptno;
Group by clause can allow where clause.
Having:is used to restrict information of the atble based
on condition.
syntax:select group by (exp 1) ,group by (exp 2) from table
name group by column having (condition).
Having and Group by clauses can interchange their positions.
but when using having along with order by clause having
should be placed before order by clause.
Is This Answer Correct ? | 25 Yes | 4 No |
Answer / ranjan
In above select stmnt city must be in group by clause. Otherwise it'll sho error.
Is This Answer Correct ? | 3 Yes | 1 No |
Answer / nitin
sory i m satisfied with idea.actualy i want to know is this
query is right or not.plz inform me.
SELECT country,city
FROM customers
GROUP BY country
ORDER BY city DESC
Is This Answer Correct ? | 7 Yes | 19 No |
What is the template in sql?
Can you create a logon trigger in sql server 2005 express edition?
explain query execution plan
Explain how dts is used to extract, transform and consolidate data?
Do you know clustered and non-clustered index?
What is Pointer ?
3 Answers Cap Gemini, CarrizalSoft Technologies,
Distinguish between nested subquery and correlated subquery?
How to connect ms access to sql servers through odbc?
Explain what are sparse columns?
in the physical file layout, where should the transaction log be stored in relation to the data file? : Sql server administration
explain declarative management framework (dmf) in sql server 2008?
Can we insert data into a view?