Which code segments display the entire content of the result set assuming that columns EmployeeID and Extension are of SQL type SMALLINT and column Name is of SQL type VARCHAR?

Refer to the exhibit to answer the question.

Consider the Employees relation defined in the exhibit and the Java code segment defined below:
Statement s = con.createStatement();
ResultSet rs = s.executeQuery(“SELECT * FROM Employees ” +
“WHERE EmployeeID >= 10002 AND ” +
“EmployeeID <= 10004”);
Which code segments display the entire content of the result set assuming that columns
EmployeeID and Extension are of SQL type SMALLINT and column Name is of SQL type
VARCHAR?

Refer to the exhibit to answer the question.

Consider the Employees relation defined in the exhibit and the Java code segment defined below:
Statement s = con.createStatement();
ResultSet rs = s.executeQuery(“SELECT * FROM Employees ” +
“WHERE EmployeeID >= 10002 AND ” +
“EmployeeID <= 10004”);
Which code segments display the entire content of the result set assuming that columns
EmployeeID and Extension are of SQL type SMALLINT and column Name is of SQL type
VARCHAR?

A.
do
{
System.out.println(rs.getString(“EmployeeID”));
System.out.println(rs.getString(“Name”));
System.out.println(rs.getString(“Extension”));
} while (rs.next())

B.
do
{
System.out.println(rs.getShort(“EmployeeID”));
System.out.println(rs.getString(“Name”));
System.out.println(rs.getShort(“Extension”));
} while (rs.next())

C.
while (rs.next())
{
System.out.println(rs.getString(1));
System.out.println(rs.getString(2));
System.out.println(rs.getString(3));
}

D.
while (rs.next())
{
System.out.println(rs.getString(“EmployeeID”));
System.out.println(rs.getString(“Name”));
System.out.println(rs.getString(“Extension”));
}

E.
while (rs.next())
{
System.out.println(rs.getString(0));
System.out.println(rs.getString(1));
System.out.println(rs.getString(2));
}



Leave a Reply 0

Your email address will not be published. Required fields are marked *