How do you get your SQL result? Are you using database connector, oql,…
If you can get your data into a datagrid, you can add the export to csv button. If not, you can store it and use the excel exporter module.
Are you working directly on the database? You can do that with a tool like pgadmin
Yes, it is! You will have to use excel exporter: https://docs.mendix.com/howto/integration/using-the-excel-exporter