title: How to parse an SQL query in Java?
body: <p>If I have a text file called <code>File.txt</code> that contains some data. For instance:</p>
  
  <pre><code>55 90 
  10 45
  33 23
  10 500
  5  2
  </code></pre>
  
  <p>Where the first column is called column <code>C1</code> and second <code>C2</code>.</p>
  
  <p>And then I have another file called <code>Input.txt</code> with two SQL queries:</p>
  
  <pre><code>SELECT *
  FROM File 
  WHERE C2 &gt; 60; 
  
  SELECT C1 
  FROM File;
  </code></pre>
  
  <p>What is one way to parse this file and produce an input that looks like what I would get from a real DBMS?</p>
  
  <p>I've tried this so far:</p>
  
  <pre><code>// 1. Read the file.  
  Main obj = new Main();
  URL url = obj.getClass().getResource("File.txt");
  File file = new File(url.toURI());
  FileReader fileReader = new FileReader(file);
  BufferedReader bufferReader = new BufferedReader(fileReader);
  StringBuffer stringBuffer = new StringBuffer();
  String line;
  while ((line = bufferReader.readLine()) != null) {
      stringBuffer.append(line);
      stringBuffer.append("\n");
  }
  fileReader.close();
  String data = stringBuffer.toString(); //this contains the data from File.text
  String[] list = data.split(" "); //this stores it into a list
  
  // 2. Read the input file. 
  Main input = new Main();
  URL urlInput = input.getClass().getResource("Input.txt");
  File inputFile = new File(urlInput.toURI());
  FileReader fileReaderInput = new FileReader(inputFile);
  BufferedReader bufferedReaderInput = new BufferedReader(fileReaderInput);
  StringBuffer stringBufferInput = new StringBuffer();
  String lineInput;
  while ((lineInput = bufferedReaderInput.readLine()) != null) {
      stringBufferInput.append(lineInput);
      stringBufferInput.append("\n");
  } 
  </code></pre>
  
  <p>But I get lost here... I don't know how to parse the query. My program manages to read both files, but when it comes to processing the query in the input file, I can't seem to figure out the logic for it. </p>