要在Statement对象stmt上执行SELECT语句“select*fromAddress”,可以使用________。
A: stmt.execute("select*fromAddress");
B: stmt.executeQuery("select*fromAddress");
C: stmt.executeUpdate("select*fromAddress");
D: stmt.query("select*fromAddress");
A: stmt.execute("select*fromAddress");
B: stmt.executeQuery("select*fromAddress");
C: stmt.executeUpdate("select*fromAddress");
D: stmt.query("select*fromAddress");
B
举一反三
- 要执行str="select * from customer"语句,假设Statement对象stmt,执行SQL语句的代码哪个正确? A: stmt.executeQuery(str) B: stmt.executeUpdate(str) C: stmt.executeSelect(str) D: stmt.executeDelete(str)
- 假定已经获得一个数据库连接,使用变量conn来表示。下列语句中能够正确获得结果集的有__1__。(选择两项)[br][/br] A.Statement stmt = conn.createStatement()__2__;[br][/br] ResultSet rs = stmt.executeQuery(“SELECT * FROM STUDENT”);[br][/br] B.Statement stmt = conn.createStatement(“SELECT * FROM STUDENT”);[br][/br] ResultSet rs = stmt.executeQuery()__3__;[br][/br] C.PreparedStatement stmt = conn.prepareStatement()__4__;[br][/br] ResultSet rs = stmt.executeQuery(“SELECT * FROM STUDENT”);[br][/br] D.PreparedStatement stmt = conn.prepareStatement(“SELECT * FROM STUDENT”);[br][/br] ResultSet rs = stmt.executeQuery()__5__;
- 下列代码生成了一个结果集 conn=DriverManager.getConnection(uri,user,password); stmt=conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_READ_ONLY); rs=stmt.executeQuery("select * from book"); 下面哪项对该rs描述正确
- 在查询数据库中的某个表时,Statement对象要调用( )方法 A: executeUpdate("select * from table1") ; B: executInsert("select * from table1") ; C: executeDelete("select * from table1") ; D: executeQuery("select * from table1") ;
- stmt为Statement对象,执行String sqlStatement = "delete from book where bid='tp1001' ";语句后,删除数据库表的记录需要执行stmt.executeUpdate ( )语句
内容
- 0
下面关于Statement接口中,用于执行SQL中的select语句的方法是() A: executeUpdate(Stringsql) B: executeQuery(Stringsql) C: execute(Stringsql) D: executeDelete(Stringsql)
- 1
接口Statement中将SQL查询语句提交给RDBMS执行的方法是( )。 A: executeQuery() B: executeUpdate() C: SELECT D: UPDATE
- 2
SELECT语句至少包含的部分是: A: 、仅SELECT B: SELECT,FROM C: 、SELECT,GROUP D: SELECT,INTO
- 3
stmt 为Statement对象,执行String sqlStatement=”delete from book where bid=’tp1001’”;语句后,删除数据库表的记录需要执行____语句
- 4
使用sql语句进行备份数据库使用下列命令中的() A: select into table B: select into database C: select into file D: select into outfile