SELECT country,city
FROM customers
GROUP BY country
ORDER BY city DESC
Answers were Sorted based on User's Feedback
Answer / prajakta
this is right coz here order by clause is at the end of
query...
| Is This Answer Correct ? | 21 Yes | 3 No |
This is wrong because there is no aggregate function in the
query when a group by clause is used.
The above query could be like:
1. SELECT country, count(city)
2. FROM customers
3. GROUP BY country
4. ORDER BY country DESC
* Correction at line 1 & 4.
| Is This Answer Correct ? | 12 Yes | 9 No |
Answer / rod sohrabi
It will only return 1 row per country and will display only the city that is reverse alphabetical order
| Is This Answer Correct ? | 3 Yes | 2 No |
Answer / vardhan rao
This Query will delete the duplicate values in GROUP BY clause
| Is This Answer Correct ? | 3 Yes | 5 No |
Can you tell how to find the number of rows in a resultset using php?
What is a mysql server?
what is a cursor? : Mysql dba
Why to use char instead of varchar in the database?
How to allow the user "sonia" to connect to the server from localhost using the password "passwd". Login as root. Switch to the mysql db. Give privs. Update privs.
How many sql dml commands are supported by 'mysql'?
is it possible to assign two primary key in a table
Is mysql free download?
What is the difference between float and double?
How to delete the repeated records from a table?
What causes mysql too many connections?
How to create a new table by selecting rows from another table in mysql?
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)