I am going to create own File based database system.(In this we use flat .txt files to store our data.)
Please tell me how can I verify my query in java against the sysntax. Currently I am thinking to use regular expression for queries to be verified but its is too hard to write the regular expression for all queries. Please tell me another way to do this or provide me the regular expression for queries if its possible.
ANTLR will no doubt parse SQL. You should look at this rather than reinventing the wheel with reqular expressions.
I don't know your driver for this requirement, but databases are complex beasts. If I were writing this my area of concern would be how to implement transactional behaviour properly in a concurrent environment. Parsing SQL queries is a far easrier job than that. Would it not be safer to just use an existing relational database?
In addition to using a parser (like Antlr, SableCC or JavaCC) you might check out what the eminent Java DBs are doing. Specifically HSQLDB and Derby are open source; it shouldn't be too hard to find out what they do and how they do it. License permitting, you might even be able to lift some code from them. (Of course, as Paul said, you could just use these DBs to begin with.)