

Seu próximo nível começa aqui
Seu desenvolvimento não pode ter limites. Garanta sua Assinatura Ilimitada e libere uma preparação completa com os melhores professores do Brasil.
Considere a seguinte tabela NOTAS e seu conteúdo.
NOTAS | ||
codMatricula | codDisciplina | nota |
1 | 12 | 5,5 |
2 | 21 | 9,0 |
3 | 22 | 10,0 |
4 | 12 | 6,5 |
Statement stmt = null;
String query = "select n.codMatricula, n.nota" +
"from NOTAS n";
try{
stmt = con. c reate Statement();
ResuItSet rs = stmt.executeQuery(query);
float nota = (float)0.0;
while (rs.next()) {
nota += rs.getFloat("nota");
}
System.out.println(nota);
} catch (SQLExceptione) {
e.printStackTrace();
} finally {
if (stmt != nuil) {stmt.close();}
}
Utilizando JDBC, o que o trecho de código Java imprime no console?
31,0
10,0
9,0
6,5
5,5