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

A stacked bar graph shows the total number of captains categorize by ranks of different classes, and I want to order total number from low to high order please.
SELECT Class, COUNT(Class) FROM captain GROUP BY Rank, Class ORDER BY COUNT(Class)
SELECT "Class", COUNT("Class") FROM "captain" GROUP BY "Rank", "Class" ORDER BY COUNT("Class") NULLS FIRST