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
Suppose i have a table that contains 5 columns like col1,col2...colm5.I want to import only two column through BCP utility.How to do same through BCP in sybase.
what is the difference in login security modes between v6.5 and 7.0? : Sql server database administration
Where are sql server user names and passwords stored in sql server?
What are joins in sql and what are the different types of joins?
What are the main sources of data?
What is resource governor in sql server?
Can you explain what is the use of custom fields in report?
How do I install sql server?
What are the parts of a function?
What are cursors? Explain the different types of cursors Enlist a few disadvantages of cursors.
What is implicit cursors?
What are the different SQL Server Versions you have worked on?
What are .mdf files?
what is a transaction? : Sql server database administration
Define synonym?