public DbCommand parse (String query) {
        query = query.trim().replaceAll(" +", " ").replaceAll(" +,", ",").replace(";", "").replaceAll("\n", "");
        String firstWord = query.split(" ", 2)[0].toUpperCase();
        if (firstWord.equals("CREATE")) {
            String secondWord = query.split(" ", 3)[1].toUpperCase();
            if (secondWord.equals("TABLE")) {
                if (Checkers.CheckCreateTable(query)) {
	                return parseCreateTable(query);
                }
                else {
                    System.out.println("Error: incorrect syntax");
                    return null;
                }
            }
            if(secondWord.equals("INDEX")) {
                return parseCreateIndex(query.split("INDEX", 2)[1].trim());
            }
        }
        if (firstWord.equals("INSERT")) {
            String secondWord = query.split(" ", 3)[1].toUpperCase();
            if (secondWord.equals("INTO")) {
                if (Checkers.CheckInsertInto(query)) {
	                return parseInsertInto(query);
                }
            }
        }
        if (firstWord.equals("SELECT")) {
            if (Checkers.CheckSelect(query)) {
	            return parseSelect(query);
            }
        }
        return null;
    }