| 28 | } |
| 29 | |
| 30 | public void view() { |
| 31 | String SQL = "CREATE VIEW market_orders_2 AS " |
| 32 | + "SELECT " |
| 33 | + " val->>'symbol' AS symbol, " |
| 34 | + " (val->'bid_price')::float AS bid_price " |
| 35 | + "FROM (SELECT text::jsonb AS val FROM market_orders_raw_2)"; |
| 36 | |
| 37 | try (Connection conn = connect()) { |
| 38 | Statement st = conn.createStatement(); |
| 39 | st.execute(SQL); |
| 40 | System.out.println("View created."); |
| 41 | st.close(); |
| 42 | } catch (SQLException ex) { |
| 43 | System.out.println(ex.getMessage()); |
| 44 | } |
| 45 | } |
| 46 | |
| 47 | public static void main(String[] args) { |
| 48 | App app = new App(); |