Query Analyzer
·
The syntax analyzer takes the query from the users, parses it into
tokens and analyses the tokens and their order to make sure they follow the
rules of the language grammar.
·
If an error is found in the query submitted by the user, it is
rejected and an error code together with an explanation of why the query was
rejected is return to the user.
A
simple form of the language grammar that could use to implement SQL statement
is given below:
- QUERY = SELECT + FROM + WHERE
- SELECT = ‘SELECT’ + <CLOUMN LIST>
- FROM = ‘FROM’ + <TABLE LIST>
- WHERE = ‘WHERE’ + VALUE1 OP VALUE2
- VALUE1 = VALUE / COLUMN NAME
- VALUE2 = VALUE / COLUMN NAME
- OP = >, <, >=, <=, =, <>