- Consider The Following Relational Database Schema Primary Keys Are Underlined Foreign Keys Are In Italic Referring Th 1 (131.53 KiB) Viewed 27 times
Consider the following relational database schema (primary keys are underlined, foreign keys are in italic, referring th
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am
Consider the following relational database schema (primary keys are underlined, foreign keys are in italic, referring th
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?