A detective is a person who solves crime, investigates and spies for living. Most detectives are police officers. Some are hired by a private person or company. Those are called private investigators. There are many stories about detectives. Some famous fictional (not real) detectives are Sherlock Holmes, Inspector Clouseau, Nancy Drew, The Hardy Boys.
Detectives will search public and private databases, investigate people and examine evidence in order to solve the case.