Consider the following relational database schema and example database instance (primary keys are underlined; foreign ke

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

Consider the following relational database schema and example database instance (primary keys are underlined; foreign ke

Post by answerhappygod »

Consider The Following Relational Database Schema And Example Database Instance Primary Keys Are Underlined Foreign Ke 1
Consider The Following Relational Database Schema And Example Database Instance Primary Keys Are Underlined Foreign Ke 1 (68.25 KiB) Viewed 28 times
Consider the following relational database schema and example database instance (primary keys are underlined; foreign keys are in italic, referring to the same attribute in a different table): Medical Centres (cid, centre, address, suburb) Patients (pid, name, day_of_birth, insurance) Appointments (aid, cid, pid, date, time, vaccination, payment) Medical Centres cid centre address 100 MyHealth Medical Centre George Street 101 Pyrmont Doctors Union Street Patients 1 Steve Smith 2 Cathy Freeman 3 Timothy Cahill Appointments aid cid 1001 100 1002 100 1003 101 1004 100 pid name 1 2 3 NULL pid 01/06/1989 16/02/1973 06/12/1979 date 05/05/2022 16/05/2022 16/05/2022 17/05/2022 date_of_birth 10:00 11:00 11:15 11:00 time Medibank HFC NIB suburb Sydney Pyrmont insurance vaccination flu measles flu covid19 payment 20.00 35.00 20.00 NULL

What is the output of the following SQL query on the given example database instance? SELECT A.time, COUNT (A.pid), SUM(payment) FROM Medical Centres M, Appointments A WHERE A.cid = M.cid AND M.centre 'MyHealth Medical Centre' GROUP BY A.time; O (10:00, 1, 20.00) (11:00, 1, 35.00) O (10:00, 1, 20.00) (11:00, 2, NULL) O (10:00, 1, 20.00) (11:00, 2, 35.00) O (10:00, 1, 20.00) (11:00, 2, 35.00) (11:15, 1, 20.00)
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply