Write an anonymous PL/SQL block that will delete all patients for doctors that works in the Family Practice Verify that patients have been deleted accordingly. Then do a select * from patients where doc_id = (select doc_id from doctor where area = ‘Family Practice’. You should get no rows.

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question
100%

INFO 2303  Database Programming

Assignment  : PL/SQL Practice

 

Note: PL/SQL can be executed in SQL*Plus or SQL Developer or Oracle Live SQL.

 

Write an anonymous PL/SQL block that will delete all patients for doctors that works in the Family Practice Verify that patients have been deleted accordingly. Then do a select * from patients where doc_id = (select doc_id from doctor where area = ‘Family Practice’. You should get no rows.

DROP TABLE PATIENT cascade constraints;
DROP TABLE BILLING cascade constraints;
DROP TABLE DOCTOR cascade constraints;
DROP TABLE RENTAL cascade constraints;
DROP TABLE MOVIE cascade constraints;
DROP TABLE CUSTOMER cascade constraints;
CREATE TABLE DOCTOR
(DOC_ID
DOC NAME
DATEHIRED
NUMBER(3),
VARCHAR2(9),
DATE,
NUMBER(12),
VARCHAR2(20),
NUMBER(3),
NUMBER(3),
NUMBER(5),
SALPERMON
AREA
SUPERVISOR_ID
CHGPERAPPT
ANNUAL BONUS
CONSTRAINT DOCTOR_DOC_ID_PK PRIMARY KEY
(DOC_ID));
CREATE TABLE PATIENT
(PT_ID
PT LNAME
PT FNAME
PTDOB
DOC ID
NEXTAPPTDATE
LASTAPPTDATE
NUMBER(3),
VARCHAR2(15),
VARCHAR2(15),
DATE,
NUMBER(3),
DATE,
DATE,
CONSTRAINT PATIENT_PT_ID PK PRIMARY KEY
(PT_ID),
CONSTRAINT PATIENT_DOC_ID_FK FOREIGN
KEY(DOC_ID)
REFERENCES DOCTOR);
Transcribed Image Text:DROP TABLE PATIENT cascade constraints; DROP TABLE BILLING cascade constraints; DROP TABLE DOCTOR cascade constraints; DROP TABLE RENTAL cascade constraints; DROP TABLE MOVIE cascade constraints; DROP TABLE CUSTOMER cascade constraints; CREATE TABLE DOCTOR (DOC_ID DOC NAME DATEHIRED NUMBER(3), VARCHAR2(9), DATE, NUMBER(12), VARCHAR2(20), NUMBER(3), NUMBER(3), NUMBER(5), SALPERMON AREA SUPERVISOR_ID CHGPERAPPT ANNUAL BONUS CONSTRAINT DOCTOR_DOC_ID_PK PRIMARY KEY (DOC_ID)); CREATE TABLE PATIENT (PT_ID PT LNAME PT FNAME PTDOB DOC ID NEXTAPPTDATE LASTAPPTDATE NUMBER(3), VARCHAR2(15), VARCHAR2(15), DATE, NUMBER(3), DATE, DATE, CONSTRAINT PATIENT_PT_ID PK PRIMARY KEY (PT_ID), CONSTRAINT PATIENT_DOC_ID_FK FOREIGN KEY(DOC_ID) REFERENCES DOCTOR);
Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY