Page 1 of 1

Consider the following relational database schema (primary keys are underlined, foreign keys are in italic, referring th

Posted: Mon Jun 06, 2022 5:50 pm
by answerhappygod
Consider The Following Relational Database Schema Primary Keys Are Underlined Foreign Keys Are In Italic Referring Th 1
Consider The Following Relational Database Schema Primary Keys Are Underlined Foreign Keys Are In Italic Referring Th 1 (131.53 KiB) Viewed 29 times
Consider the following relational database schema (primary keys are underlined, foreign keys are in italic, referring the same attribute in a different table): Medical Centres (cid, centre, address) Patients (pid, name, date_of_birth, insurance) Appointments (aid, cid, pid, date, time, vaccination, payment) On this schema, the following two SQL queries are given: Q1: SELECT centre FROM Medical Centres M, Appointments A WHERE M. cid = A.cid; Q2: SELECT centre FROM Medical Centres M WHERE M.cid IN (SELECT A.cid FROM Appointments A ); Although these queries Q1 and Q2 seem to ask for the same information, they actually can produce different answers, especially for medical centres with many appointments. Describe in your own words what each query is doing, ideally using a small example. How do the results of queries Q1 and Q2 differ?