You can do the same thing with csvsql from csvkit: https://towardsdatascience.com/analyze-csvs-with-sql-in-comm...
Since csvkit comes with so many other tools, I'm not sure I see a reason to use q over csvsql
Since csvkit comes with so many other tools, I'm not sure I see a reason to use q over csvsql