The usual approach
SQL is one of the hardest languages to parse correctly. Every database engine ships its own dialect. Every dialect extends the standard differently. Off-the-shelf parser generators produce subpar code, and hand-writing a parser for even one SQL dialect takes years.