Skip to content
Discussion options

You must be logged in to vote

For parsing out SQL queries, you don't need to parse natural language, you can do it in an easier way.

SQL is a context free language, which means it's "easier" to parse. Context free languages are more complicated than regular languages and easier than human languages.

Here's a great resource: Hopcroft and Ullmann Automata Theory book . You're looking for Chapter 3, Context Free Languages.

So basically a context free grammar for SQL queries look sth like this:

select_statement = SELECT column_statement FROM general_statement WHERE condition_statement | SELECT operator_statement FROM general_statement ;
general_statement = select_statement | table_name;
column_statement = * | column_name;

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@RAJUUBHAI
Comment options

Answer selected by RAJUUBHAI
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
usage General spaCy usage
2 participants