A detective is an investigator, either working as part of a law enforcement agency, or independently on behalf of paying clients.
History and specifics
In the Kelvin timeline, Harve Bogenn served as a detective with the homicide division of the San Francisco Police Department from 2237 to at least 2255. (TOS - Starfleet Academy novel: The Delta Anomaly)
Detectives in literature
Detective novels were a mainstay of Earth literature beginning in the late 19th century with the creation of Sherlock Holmes by English author Arthur Conan Doyle. Several other fictional detectives from the 20th century remained popular for centuries after their initial appearances, including: