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 |
What do we use to remove duplicate records while fetching a data in mysql ?
How do I edit a table in mysql?
What does TIMESTAMP ON UPDATE CURRENT_TIMESTAMP data type do?
Query to select passwords from a table having a column "Password" Whose length is b/w 8 &15 and having 'A' as the first character in the password irrespective of case.
What is the default port for mysql and how it can change?
What is a mysql view?
How do I restore a mysql database?
How to filter data from a mysql database table with php?
how many fields can be updated using set in a mysql query?
What are the types of queries?
What are the 5 r's of managing behaviors?
what are the different tables present in mysql? : Mysql dba