I am pleasantly surprised that Vertica SQL supports
WITH clause, as documented here.
WITH syntax as a standard is only defined in SQL-99, also called Common Table Expressions.
Therefore, I do not usually expect
WITH clause since it is a fairly recent feature in most SQL dialects.
WITH clause support is only added into SQLite since Feb 2014.
In summary, the
WITH clause allows us to arrange sub-queries in a SQL query in order of human logic.
This will make our query much easier to read: we can read from top to bottom like reading a story (i.e., literate programming).