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 |
How to return query output in xml format?
What is the maximum number of columns per table?
Is mysql connect deprecated?
How to dump a table from a database.
How To see all the tables from a database of mysql server.
How to display top 50 rows?
What happens when the column is set to AUTO INCREMENT and you reach the maximum value for that table?
What do we use to remove duplicate records while fetching a data in mysql ?
Write a query to retrieve a hundred books starting from 20th.
Which is faster mongodb or mysql?
How we can copy one table data into another table whose name same as table but in differ database
What is definer 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)