Answered step by step
Verified Expert Solution
Question
1 Approved Answer
ANSWER IN SQL: Find patients who have seen every doctor whose specialty is cardiology in the same city where the patient lived in, assume the
ANSWER IN SQL: Find patients who have seen every doctor whose specialty is cardiology in the same city where the patient lived in, assume the patients and doctors didn't move.
SCHEMA:
Bolded words are primary keys
patient(pid, name, gender, street, city, state)
doctor(did, name, gender, street, city, speciality)
visit(pid, did, month, year, BP, weight, disease, medication)
Example Data: Patient: Street Berkeley Gende state California Name Atlanta Stratford Drive Mc Clintock Irvine Marcel Georgia Female California 258 354 Frank Rachel Alpharetta Atlanta Harvard Ave Irvine Stanford Georgia California California Female Doctor State California California Georgia Georgia Gender specialt Orthopedic Cardiologist Radiologist Neurologist Name 2005 9453 6758 7834 Irvine Irvine Atlanta Atlanta William Harold Female Visit PID DID | Month | Year | BP | weight Disease 98 94531 98 9453 2 198 94533 210 2005 5 98 9453 7 198 9453 8 210 67586 210 6758 11 258 94535 258 94536 210 78349 medication 2017 160 67 2017151 67 2017 140 67 2018 120 70 2018157 65 2018 145 65 2018 110 68 2018115 61 2016 155 78 2016 158 78 2018 115 65 HvpertensionDiovan HypertensionDiovan HypertensionDiovan Arthritis HypertensionDiovan HypertensionDiovan Bone Cancer Folex Bone Cancer Folex HvpertensionDiovan HvpertensionDiovan NervousS breakdown Nervous breakdown Hypertension Bystolic HypertensionBystolic Remad Anti- depressant Anti- depressant 354 78346 2016 120 67 354 94531 354 9453 9 2018 148 67 2018 130 68Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started