add sql query and export