All layers in ArcGIS need a unique identifier. Therefore, your query layer must contain a unique identifier.
In most cases, though, you create query layers to access feature classes and tables in a database. It is standard practice for database tables to contain a unique identifier field; therefore, your database tables will likely already contain a field you can use as a unique identifier.
To be used as a unique identifier in ArcGIS, a field must be not null, contain unique values, and be one of the following data types:
- Integer (positive values only)
- String
- GUID
- Date
Since the value in the unique identifier field uniquely identifies a row or feature object within ArcGIS, values in that field must always be unique and not null. It is your responsibility to guarantee that values in this field meet this requirement.