SELECT country,city
FROM customers
GROUP BY country
ORDER BY city DESC

Answers were Sorted based on User's Feedback



SELECT country,city FROM customers GROUP BY country ORDER BY city DESC ..

Answer / prajakta

this is right coz here order by clause is at the end of
query...

Is This Answer Correct ?    21 Yes 3 No

SELECT country,city FROM customers GROUP BY country ORDER BY city DESC ..

Answer / nitin

is right or not

Is This Answer Correct ?    18 Yes 4 No

SELECT country,city FROM customers GROUP BY country ORDER BY city DESC ..

Answer / manoj pandey

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

SELECT country,city FROM customers GROUP BY country ORDER BY city DESC ..

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

SELECT country,city FROM customers GROUP BY country ORDER BY city DESC ..

Answer / vardhan rao

This Query will delete the duplicate values in GROUP BY clause

Is This Answer Correct ?    3 Yes 5 No

Post New Answer

More MySQL Interview Questions

How to write after insert event update trigger on the same table in mysql?

0 Answers  


what programming language which is used for testing and developement in sql?

3 Answers  


How to validate email addresses in mysql?

0 Answers  


How many rows can be inserted in mysql at a time?

0 Answers  


How many sql dml commands are supported by 'mysql'?

0 Answers  






Where is mysql data stored?

0 Answers  


In the below example, how many String Objects are created? String s1="I am Java Expert"; String s2="I am C Expert"; String s3="I am Java Expert";

1 Answers  


What is pragma autonomous_transaction?

0 Answers  


How to use like conditions?

0 Answers  


Explain the difference between delete and truncate.

0 Answers  


Is mysql same as sql?

0 Answers  


What are the difference between and myisam and innodb?

0 Answers  


Categories