SQL Exercises: Display customer name, city and grade by highest grade
SQL Formatting Output: Exercise-8 with Solution
Write a SQL statement to display customer name, city and grade in such a manner that, the customer holding highest grade will come first.
Sample table: customer
SELECT cust_name,city,grade FROM customer ORDER BY 3 DESC;
Output of the Query:
cust_name city grade Brad Guzan London Fabian Johnson Paris 300 Julian Green London 300 Brad Davis New York 200 Jozy Altidor Moscow 200 Graham Zusi California 200 Nick Rimando New York 100 Geoff Cameron Berlin 100
Pictorial presentation :
Have another way to solve this solution? Contribute your code (and comments) through Disqus.
Previous: Write a SQL statement to make a report with salesman ID, order date and highest purchase amount in such an arrangement that, the smallest salesman ID will come first along with their smallest order date.
Next: Write a SQL statement to make a report with customer ID in such a manner that, the largest number of orders booked by the customer will come first along with their highest purchase amount.
What is the difficulty level of this exercise?
- New Content published on w3resource:
- Scala Programming Exercises, Practice, Solution
- Python Itertools exercises
- Python Numpy exercises
- Python GeoPy Package exercises
- Python Pandas exercises
- Python nltk exercises
- Python BeautifulSoup exercises
- Form Template
- Composer - PHP Package Manager
- PHPUnit - PHP Testing
- Laravel - PHP Framework