Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

What would be the result of the following query: INSERT INTO Patient VALUES (2,

ID: 3776843 • Letter: W

Question

What would be the result of the following query: INSERT INTO Patient VALUES (2, 'Adam'. T, 12345) One record will be inserted Query will be rejected Cannot tell from the information given What would be the result of the following query: INSERT INTO Patient VALUES (2, 'Ben', I) One record will be inserted Query will be rejected Cannot tell from the information given What would be the result of the following query: INSERT INTO Patient VALUES (2, T, 'O', 67890) One record will be inserted Query will be rejected Cannot tell from the information given What would be the result of the following query: DELETE FROM Physician WHERE ID = 12345; One record will be deleted Query will be rejected Cannot tell from the information given What would be the result of the following query: INSERT INTO Patient (Name, ID) VALUES ('Ben', 2); One record will be inserted Query will be rejected Can't tell from the information given What would be the result of the following query: UPDATE Physician SET ID = 11111 WHERE ID = 12345

Explanation / Answer

Physician Table: ID is the Primary Key

Patient Table: PID is the primary key, PHY_ID is the foreign key referencing Physician Table's ID column

5) (a) query will execute successfully, and one record will be inserted in table patient, as syntax and datatypes of values are correct, the primary key being entered is not already there in the patient table and a record with physician ID 12345, already exists in the physician table. Maybe, this means that a physician with ID 12345 has 2 patients with the same name and different CODE. Thus, the table looks like.

6) (b) Query will be rejected as the since the last value corresponding to the PHY_ID is missing.

7) (a) One record will be inserted as the query is executed for the originally shown tables (top 2 tables) (since, the queries are independent). If it were run after the (5) query, then that would be rejected as the PID 2 already exists in the patient table. The patient table would look like this:

8) (b) Query will be rejected. Here the query is trying to delete a record with ID=12345 from the physician table. But there is a record present in patient table which has 12345 in the PHY_ID column. Thus, the query will be rejected.

9) (b) Query will be rejected as the values corresponding to the CODE column and PHY_ID column are missing. Note, if the column were assigned autofill values, then the query would have been accepted.

10) Query will be rejected as we are trying to change the record with ID=12345 when there already exists a record in the patient table which refers to this particular record ID.

ID NAME 12345 First Physician 67890 Second Physician
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote