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 you will Show unique records.
What is difference between oracle sql and mysql?
Is mysql deprecated?
How do I disconnect mysql workbench?
The table tbl_sites contains the following data: ----------------------------------------------------- Userid sitename country ------------------------------------------------------ 1 sureshbabu indian 2 PHPprogrammer andhra 3 PHP.net usa 4 PHPtalk.com germany 5 MySQL.com usa 6 sureshbabu canada 7 PHPbuddy.com pakistan 8. PHPtalk.com austria 9. PHPfreaks.com sourthafrica 10. PHPsupport.net russia 11. sureshbabu australia 12. sureshbabu nepal 13. PHPtalk.com italy Write a select query that will displayed the duplicated site name and how many times it is duplicated?
What is view in mysql?
What is mysqlcommand?
How large can a mysql table be?
How to execute mysql query in php?
What is deterministic in mysql?
Should I use pdo or mysqli?
What is the maximum length of a table name, database name, and fieldname in MySQL?
3 Answers Accenture, Pioneer, TISL,
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)