Custom Query to export category details

Custom Query to export category details

Hi,

Can anyone help me with some custom queries for the below scenarios:
1. Needs to export all category , service categories, subcategories and items.
2. Needs to exports all incident and service catalogs under all the service categories

Servicedesk version: 10.5 Build 10513
Database : pgsql

Thanks
Ahamed