I am not entirely sure if the distinct service is justified here, but in my own work, I've found that regular Chatgpt is great in writing queries. And usually I post the '\d ' output to it to describe my schema, and ask in regular language what i want. I don't think i encountered yet cases when it didn't work. The only thing I had to occassionally ask is to rewrite the query from nested query to CTE.