Abaixo está uma instrução que descreve uma tarefa de geração de SQL, combinada com uma entrada que fornece mais contexto sobre os esquemas de tabela disponíveis. Escreva o código SQL que responda adequadamente à solicitação
 ###Instrução: Encontre o diagnóstico de saúde mental mais precoce para os pacientes de cada agente comunitário de saúde.
 ###Tabelas: 
CREATE TABLE patient_demographics (id INT, name VARCHAR(50), age INT, gender VARCHAR(10), race VARCHAR(30), ethnicity VARCHAR(30)); INSERT INTO patient_demographics (id, name, age, gender, race, ethnicity) VALUES (1, 'John Doe', 45, 'Male', 'Caucasian', 'Non-Hispanic'); CREATE TABLE mental_health_diagnosis (patient_id INT, diagnosis_date DATE, diagnosis VARCHAR(50), prescriber_id INT); INSERT INTO mental_health_diagnosis (patient_id, diagnosis_date, diagnosis, prescriber_id) VALUES (1, '2022-01-01', 'Depression', 101); CREATE TABLE prescriber_details (id INT, prescriber_name VARCHAR(50), language VARCHAR(20), years_of_experience INT); INSERT INTO prescriber_details (id, prescriber_name, language, years_of_experience) VALUES (101, 'Dr. Smith', 'English', 15); CREATE TABLE community_health_workers (id INT, worker_name VARCHAR(50), language VARCHAR(20), years_in_service INT, district VARCHAR(30)); INSERT INTO community_health_workers (id, worker_name, language, years_in_service, district) VALUES (201, 'Ms. Garcia', 'Spanish', 8, 'Downtown'), (202, 'Mr. Nguyen', 'Vietnamese', 12, 'Uptown');
SELECT C.worker_name, MIN(M.diagnosis_date) as EarliestDiagnosisDate FROM mental_health_diagnosis M JOIN prescriber_details P ON M.prescriber_id = P.id JOIN community_health_workers C ON P.language = C.language GROUP BY C.worker_name;