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 |
How do I open port 1433?
how to copy sysdatabase file from c: Drive to D: Drive in SQL Server.
What are the disadvantages of primary key and foreign key in SQL?
Explain what are page splits? : SQL Server Architecture
Can I know,how to Execute Funcion and Trigger through command(Manualy Execution) in MS SQL/SERVER 2005,give me answer with Example.
Explain trigger and trigger types?
please differentiate between delete and truncate?
what is normalization? Explain different levels of normalization? : Sql server database administration
How many databases instances are there in sql server 2000?
How to return the date part only from a sql server datetime datatype?
How to create new tables with "select ... Into" statements in ms sql server?
How can we Use Linked Server? Uses of Linked server
Oracle (3259)
SQL Server (4518)
MS Access (429)
MySQL (1402)
Postgre (483)
Sybase (267)
DB Architecture (141)
DB Administration (291)
DB Development (113)
SQL PLSQL (3330)
MongoDB (502)
IBM Informix (50)
Neo4j (82)
InfluxDB (0)
Apache CouchDB (44)
Firebird (5)
Database Management (1411)
Databases AllOther (288)