You just learn as you go. For something like SQL, unless they’re doing something doing a query that’s never been done before , the majority of one’s issues is a Google search away of a function or thing they didn’t know they could do before.
I never make it a task to know completely what a language could do. I just try to familiarize my self with the basics (syntax) it’s novelty features (the reason why it even exists as opposed to other solutions) and pray what I think the best solution for a given problem is doable via research (Google & Stackoverflow)