You can use a SQL Select String query to communicate with the external database and identify Primary and Secondary Keyword Values when users trigger an AutoFill Keyword Set during indexing or re-indexing.
To create a SQL statement to enable External Keyword Data Sets:
See the following Example of a SQL Select String Used to Enable External AutoFill Keyword Sets.