Explain basic SQL queries with SELECT from where Order By,
Group By-Having?
Answer Posted / 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 |
Post New Answer View All Answers
What is a bit datatype?
What is the difference between mysql and sql server?
Are there issues when exporting SSRS reports into Microsoft Excel? When my users are trying to export a SSRS report into Microsoft Excel, one or two columns in the report appear to merge together. Why might this be?
What is the optimization being performed in oracle and SQL Server?
What is SQL Azure Fabric?
What is a hint?
How to view existing indexes on an given table using sp_help?
Why use update_statistics command in sql server?
What are the limitations/drawbacks or ssrs 2008 r2?
What happens if null values are involved in comparison operations?
Explain what are the restrictions while creating batches in sql server?
How does the report manager work in SSRS?
Define left outer join?
What does nvl stand for?
Explain an automatic checkpoint