How do I Order By on multiple rows in Postgresql I have a table with columns with severities like:
name   | critical | major | trivial 
----------------------------------------
Apache |2         |3      |2
Eclipse|5         |0      |4
TestNg |0         |0      |5
JUnit  |0         |2      |7

I want to list the rows in the order by their severities in descending order - critical, major and trivial.
For the above example, I'd like to get back:
name  | critical | major | trivial 
----------------------------------------
Eclipse|5         |0      |4
Apache |2         |3      |2
JUnit  |0         |2      |7
TestNg |0         |0      |5

critical has highest severity, then comes major and then trivial. Notice eclipse has to come first since 5 &gt; 2 (Critical, internal sorting)
Simply order them  with the right orde4r with DESC for descending
Schema (PostgreSQL v9.6)
CREATE TABLE test (
  &quot;name&quot; VARCHAR(7),
  &quot;critical&quot; INTEGER,
  &quot;major&quot; INTEGER,
  &quot;trivial&quot; INTEGER
);

INSERT INTO test
  (&quot;name&quot;, &quot;critical&quot;, &quot;major&quot;, &quot;trivial&quot;)
VALUES
  ('Apache', '2', '3', '2'),
  ('Eclipse', '5', '0', '4'),
  ('TestNg', '0', '0', '5'),
  ('JUnit', '0', '2', '7');


Query #1
SELECT * FROM test
ORDER BY &quot;critical&quot; DESC, &quot;major&quot; DESC, &quot;trivial&quot; DESC;

| name    | critical | major | trivial |
| ------- | -------- | ----- | ------- |
| Eclipse | 5        | 0     | 4       |
| Apache  | 2        | 3     | 2       |
| JUnit   | 0        | 2     | 7       |
| TestNg  | 0        | 0     | 5       |


View on DB Fiddle