正在加载图片...
JDBC Code (Cont.) Update to database try stmt.executeUpdate( "insert into instructor values('77987',Kim',Physics', 98000)"); catch(SQLException sqle) { System.out.println("Could not insert tuple."sqle); Execute query and fetch and print results ResultSet rset stmt.executeQuery( "select dept_name,avg (salary) from instructor group by dept_name"); while (rset.next()){ System.out.printin(rset.getString("dept_name")+"" rset.getFloat(2)); } Database System Concepts-6th Edition 5.9 @Silberschatz,Korth and SudarshanDatabase System Concepts - 6 5.9 ©Silberschatz, Korth and Sudarshan th Edition JDBC Code (Cont.) Update to database try { stmt.executeUpdate( "insert into instructor values(’77987’ , ’Kim’ , ’Physics’ , 98000)"); } catch (SQLException sqle) { System.out.println("Could not insert tuple. " + sqle); } Execute query and fetch and print results ResultSet rset = stmt.executeQuery( "select dept_name, avg (salary) from instructor group by dept_name"); while (rset.next()) { System.out.println(rset.getString("dept_name") + " " + rset.getFloat(2)); }
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有