code: public static void main(String[] args) throws Exception {
  
  		// set up execution environment
  		ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
  		BatchTableEnvironment tEnv = BatchTableEnvironment.create(env);
  
  		DataSet<WC> input = env.fromElements(
  			new WC("Hello", 1),
  			new WC("Ciao", 1),
  			new WC("Hello", 1));
  
  		// register the DataSet as table "WordCount"
  		tEnv.registerDataSet("WordCount", input, "word, frequency");
  
  		// run a SQL query on the Table and retrieve the result as a new Table
  		Table table = tEnv.sqlQuery(
  			"SELECT word, SUM(frequency) as frequency FROM WordCount GROUP BY word");
  
  		DataSet<WC> result = tEnv.toDataSet(table, WC.class);
  
  		result.print();
  	}
docs: *************************************************************************