# Alternative keys

In addition to the standard 'id' key that is typical in a database table, any other unique field can be added as an alternative key (opens new window). This can then be used to reference an entity.

The properties that should be used as alternative keys can be "tagged" using this example. Here the entity type airport is retrieved. The name property then has its alternativeKey property set.

$airportType = Lodata::getEntityType('airport');
$airportType->getProperty('code')->setAlternativeKey();
1
2

With this in place, an airport can be queried with its code using the request style:

http://localhost:8000/odata/Airports(code='elo')
1