CREATE TABLE Ship (Ship_ID INT, Name TEXT, Type TEXT, Built_Year FLOAT, Class TEXT, Flag TEXT)
CREATE TABLE captain (Captain_ID INT, Name TEXT, Ship_ID INT, age TEXT, Class TEXT, Rank TEXT)

A stacked bar graph shows the total number of captains categorize by ranks of different classes, I want to order by the how many class in desc.
SELECT Class, COUNT(Class) FROM captain GROUP BY Rank, Class ORDER BY COUNT(Class) DESC
SELECT "Class", COUNT("Class") FROM "captain" GROUP BY "Rank", "Class" ORDER BY COUNT("Class") DESC NULLS LAST