human
I have 2 tables with the follow schema: 
Patient: 
- Patient ID -
 First Name 
- Last Name 
- Year of Birth 
- Year of Death 
- Sex 
- Zip Code 
DIagnosis: 
- Patient ID
 - Encounter date 
- Diagnosis code 
- Diagnosis code type 
- Diagnosis date 
- Is Primary Diagnosis
Please generate a sql query to generate a table that has the Patient Ids of patients that have a primary diagnosis of diabetes type 2 based on ICD 10 code type, and have age greater than or equal to 18. Include all the patients whether dead or alive. Please create a CTE for each step.
gpt
--- Reasoning ---
1. Is the question multiple-choice question?
No
2. Is it implied multiple-choice question?
No
3. If two experts were independently asked the question, will the final answer be exactly the same?
No

--- Answer ---
open