ResultSet MetaData
The result of running a SELECT statement using the executeQuery() method is a ResultSet object, which contains the resulting rows of the SELECT statement. Information about the rows in the ResultSet is obtained when the statement is first created by invoking the getResultSetMetadata() method of the Statement object.
This information includes the number of columns in a result row, each column's data type, the label given to the column, the name of the column from the table, and the name of the table for each column. If a label was not specified for a column, the name of the column from the table is used as the label. If a column is not from a table, but is an expression that is calculated as part of the result, the entire expression string is used as the label. It is always safest to access a column of a ResultSet by its label as a ResultSet column always has a label, but might not necessarily have a name from a table.