One way to achieve this is to use to Create CSV table with Custom Headers from Sql connector Get rows (V2) action and then convert it to Excel using 3rd party connector Plumsail's Csv to Excel action to transform the results of it into pdf using Convert Excel to PDF action of Adobe PDF services Connector.
Below is the flow of my logic app where I receive a sorted csv's pdf in my email attachments.

RESULTS:
TABLE IN SQL DATABASE

RESULT IN LOGIC APP

RESULT IN MAIL

To reproduce the same in your logic app, you can use below code view
{
"definition": {
"$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
"actions": {
"Convert_Excel_to_PDF": {
"inputs": {
"body": {
"$content-type": "multipart/form-data",
"$multipart": [
{
"body": "EXCEL_TO_PDF",
"headers": {
"Content-Disposition": "form-data; name=\"intent\""
}
},
{
"body": "pdfFile.xlsx",
"headers": {
"Content-Disposition": "form-data; name=\"inputFileName\""
}
},
{
"body": "@body('Csv_to_Excel')",
"headers": {
"Content-Disposition": "form-data; name=\"InputFile0\""
}
}
]
},
"headers": {
"x-api-key": "PowerAutomate"
},
"host": {
"connection": {
"name": "@parameters('$connections')['adobepdftools']['connectionId']"
}
},
"method": "post",
"path": "/operation/v1/createPDFFromExcel"
},
"runAfter": {
"Csv_to_Excel": [
"Succeeded"
]
},
"type": "ApiConnection"
},
"Create_CSV_table": {
"inputs": {
"columns": [
{
"header": "BillNo",
"value": "@item()?['billNo']"
},
{
"header": "OrderedDate",
"value": "@item()?['orderedDate']"
},
{
"header": "OrderValue",
"value": "@item()?['orderValue']"
}
],
"format": "CSV",
"from": "@body('Get_rows_(V2)')?['value']"
},
"runAfter": {
"Get_rows_(V2)": [
"Succeeded"
]
},
"type": "Table"
},
"Csv_to_Excel": {
"inputs": {
"body": {
"content": "@{base64(body('Create_CSV_table'))}",
"hasHeaderRecords": true
},
"host": {
"connection": {
"name": "@parameters('$connections')['plumsail_3']['connectionId']"
}
},
"method": "post",
"path": "/flow/v1/Documents/jobs/Csv2Xlsx"
},
"runAfter": {
"Create_CSV_table": [
"Succeeded"
]
},
"type": "ApiConnection"
},
"Get_rows_(V2)": {
"inputs": {
"host": {
"connection": {
"name": "@parameters('$connections')['sql']['connectionId']"
}
},
"method": "get",
"path": "/v2/datasets/@{encodeURIComponent(encodeURIComponent('default'))},@{encodeURIComponent(encodeURIComponent('default'))}/tables/@{encodeURIComponent(encodeURIComponent('[dbo].[Invoices]'))}/items",
"queries": {
"$orderby": "billNo asc"
}
},
"runAfter": {},
"type": "ApiConnection"
},
"Send_an_email_(V2)": {
"inputs": {
"body": {
"Attachments": [
{
"ContentBytes": "@{body('Convert_Excel_to_PDF')?['fileContent']}",
"Name": "@body('Convert_Excel_to_PDF')?['fileName']"
}
],
"Body": "<p>This is a sample email</p>",
"Importance": "Normal",
"Subject": "Sample",
"To": "<TO_MAIL_ID>"
},
"host": {
"connection": {
"name": "@parameters('$connections')['office365_1']['connectionId']"
}
},
"method": "post",
"path": "/v2/Mail"
},
"runAfter": {
"Convert_Excel_to_PDF": [
"Succeeded"
]
},
"type": "ApiConnection"
}
},
"contentVersion": "1.0.0.0",
"outputs": {},
"parameters": {
"$connections": {
"defaultValue": {},
"type": "Object"
}
},
"triggers": {
"Recurrence": {
"evaluatedRecurrence": {
"frequency": "Minute",
"interval": 3
},
"recurrence": {
"frequency": "Minute",
"interval": 3
},
"type": "Recurrence"
}
}
},
"parameters": {
"$connections": {
"value": {
"adobepdftools": {
"connectionId": "/subscriptions/<SUB_ID>/resourceGroups/<RG>/providers/Microsoft.Web/connections/adobepdftools-4",
"connectionName": "adobepdftools-4",
"id": "/subscriptions/<SUB_ID>/providers/Microsoft.Web/locations/centralus/managedApis/adobepdftools"
},
"office365_1": {
"connectionId": "/subscriptions/<SUB_ID>/resourceGroups/<RG>/providers/Microsoft.Web/connections/office365-1",
"connectionName": "office365-1",
"id": "/subscriptions/<SUB_ID>/providers/Microsoft.Web/locations/centralus/managedApis/office365"
},
"plumsail_3": {
"connectionId": "/subscriptions/<SUB_ID>/resourceGroups/<RG>/providers/Microsoft.Web/connections/plumsail-3",
"connectionName": "plumsail-3",
"id": "/subscriptions/<SUB_ID>/providers/Microsoft.Web/locations/centralus/managedApis/plumsail"
},
"sql": {
"connectionId": "/subscriptions/<SUB_ID>/resourceGroups/<RG>/providers/Microsoft.Web/connections/sql",
"connectionName": "sql",
"id": "/subscriptions/<SUB_ID>/providers/Microsoft.Web/locations/centralus/managedApis/sql"
}
}
}
}
}