O'Reilly logo

Database Systems: Concepts, Design and Applications by S. K. Singh

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

11.3. Syntax Analyser

The syntax analyser takes the query from the users, parses it into tokens and analyses the tokens and their order to make sure they comply with 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 returned to the user.

A simple form of language grammar that could be used to implement a SQL statement is given below:

QUERY:= SELECT_CLAUSE + FROM_CLAUSE + WHERE_CLAUSE
SELECT_CLAUSE:= ‘SELECT’ + <COLUMN_LIST>
FROM_CLAUSE := ‘FROM’ + <TABLE_LIST>
WHERE_CLAUSE := ‘WHERE’ + VALUE1 OP VALUE2
VALUE1:= VALUE / COLUMN_NAME
VALUE2:= VALUE / COLUMN_NAME
OP:= +, -, /, * =

The above grammar can be used to implement ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required