# java.sql.DatabaseMetaData.getBestRowIdentifier method

The java.sql.DatabaseMetaData.getBestRowIdentifier method looks for identifiers in a specific order. This order might not return a unique row.

The java.sql.DatabaseMetaData.getBestRowIdentifier method looks for identifiers in the following order:

- A primary key on the table
- A unique constraint or unique index on the table
- All of the columns in the table

Note: If the java.sql.DatabaseMetaData.getBestRowIdentifier method does not find a primary key, unique constraint, or unique index, the method must look for identifiers in all of the columns in the table. When the method looks for identifiers this way, the method will always find a set of columns that identify a row. However, a unique row might not be identified if there are duplicate rows in the table.
Parent topic: java.sql.DatabaseMetaData interface
Related reference
DatabaseMetaData result sets
java.sql.DatabaseMetaData.getProcedureColumns method
Parameters to getProcedureColumns
Columns in the ResultSet returned by getProcedureColumns