Question

Lab 7 In the “Care One” hospital each patient is assigned to just one doctor. Each...

Lab 7

In the “Care One” hospital each patient is assigned to just one doctor. Each doctor can visit many or zero patients. The following image illustrates a small part of this hospital. Please create a schema with name of “careone”, then add these two tables. You should insert 4 doctors and 6 patients in this database (just mockup information). All of the creations and insertions should be done by writing queries. The queries should contain the Data Definition, constraints, primary key, foreign key, Data manipulation, etc. ➢ The relationship type should be applied as constraints Please submit your script as a txt file.

CSIT 154. Database

0 0
Add a comment Improve this question Transcribed image text
Answer #1


-- creating schema careone :
create user careone identified by careone;


-- creating table doctors:

CREATE TABLE DOCTORS
(  
DOCTOR_ID NUMBER,
DOCTOR_NAME VARCHAR2(100),
CONSTRAINT DOCTOR_PK PRIMARY KEY (DOCTOR_ID)
);

-- inserting data into DOCTORS table
Insert into DOCTORS (DOCTOR_ID,DOCTOR_NAME) values (101,'JOHN DOE');
Insert into DOCTORS (DOCTOR_ID,DOCTOR_NAME) values (102,'LEWIS DELL');
Insert into DOCTORS (DOCTOR_ID,DOCTOR_NAME) values (103,'MATHEW HARDY');
Insert into DOCTORS (DOCTOR_ID,DOCTOR_NAME) values (104,'JOE FROST');
commit;

-- creating table patients:
CREATE TABLE PATIENTS
(  
PATIENT_ID NUMBER,
PATIENT_NAME VARCHAR2(100 ),
DOCTOR_ID NUMBER,
CONSTRAINT PATIENT_PK PRIMARY KEY (PATIENT_ID),
CONSTRAINT PATIENT_DOCTOR_FK FOREIGN KEY (DOCTOR_ID) REFERENCES DOCTORS (DOCTOR_ID)
);


-- inserting data into PATIENTS table

Insert into PATIENTS (PATIENT_ID,PATIENT_NAME,DOCTOR_ID) values (201,'SAM MATHEW',101);
Insert into PATIENTS (PATIENT_ID,PATIENT_NAME,DOCTOR_ID) values (202,'JOHN PEARSON',101);
Insert into PATIENTS (PATIENT_ID,PATIENT_NAME,DOCTOR_ID) values (203,'MATT JOHNSON',102);
Insert into PATIENTS (PATIENT_ID,PATIENT_NAME,DOCTOR_ID) values (204,'SAIRA LISBETH',103);
Insert into PATIENTS (PATIENT_ID,PATIENT_NAME,DOCTOR_ID) values (205,'KATE JOUNER',104);
Insert into PATIENTS (PATIENT_ID,PATIENT_NAME,DOCTOR_ID) values (206,'ELVIS HOARDING',104);

commit;

Add a comment
Know the answer?
Add Answer to:
Lab 7 In the “Care One” hospital each patient is assigned to just one doctor. Each...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • CHAPTER 1: DATABASES AND DATABASE USERS Given the simple Doctor-Treats_Patient database schema which contains three files...

    CHAPTER 1: DATABASES AND DATABASE USERS Given the simple Doctor-Treats_Patient database schema which contains three files describing information about doctors and patients they treat as follows, answer the following questions with regards to this database.                                                                                                                                                                                 (Total for que 1 is 10 marks) Doctor (DocID: string, DName: string, DAddress: string, Numpatients: integer) Treats (DocId: string, SSN: string, illness: string, day: string, cost: real) Patient (SSN: string, PatientName: string, PAddress: string, Age:integer) Note : DocID, DName, DAddress and Numpatients...

  • Assume that you are working with a hospital and this hospital needs a software system to...

    Assume that you are working with a hospital and this hospital needs a software system to track its patients’ information. Your role in this software development is to design the database. There are many aspects of such a hospital software system to develop. However, in this assignment, you will only address interactions between doctors and patients. Your first step will be to create the relations necessary for this system and identify and describe the constraints that would be appropriate for...

  • Overview This lab provides you the opportunity to insert and update data with the use of SQL comm...

    Overview This lab provides you the opportunity to insert and update data with the use of SQL commands. The lab will utilize the FLIX2YOU problem, the current schema. In order to start this lab, you must have successfully completed Lab # 6. In Lab # 6, you executed a script that was provided to you. This script created 7 of the FLIX2YOU tables as documented in the Entity Relationship Diagram in the FLIX2YOU problem document. The second part of lab...

  • Title: Partners Health Care Systems (PHS): Transforming Health Care Services Delivery through Information Management According to...

    Title: Partners Health Care Systems (PHS): Transforming Health Care Services Delivery through Information Management According to government sources, U.S. expenditures on health care in 2009 reached nearly $2.4 trillion dollars ($2.7 trillion by the end of 2010).[1] Despite this vaunting national level of expenditure on medical treatment, death rates due to preventable errors in the delivery of health services rose to approximately 98,000 deaths in 2009.[2] To address the dual challenges of cost control and quality improvement, some have argued...

  • please Identify the key points and main thesis of the article 2. Describe the skills you...

    please Identify the key points and main thesis of the article 2. Describe the skills you will need to develop to manage the hospital of the future. use critical analysis doing these questions Suggestion for writing assignmemnt make believe the reader has never read the article -what are the key points you would want the reader to know in order to understand the hospital of the future. In addition, managers, executives do not have time to read--so again what key...

  • Using the book, write another paragraph or two: write 170 words: Q: Compare the assumptions of...

    Using the book, write another paragraph or two: write 170 words: Q: Compare the assumptions of physician-centered and collaborative communication. How is the caregiver’s role different in each model? How is the patient’s role different? Answer: Physical-centered communication involves the specialists taking control of the conversation. They decide on the topics of discussion and when to end the process. The patient responds to the issues raised by the caregiver and acts accordingly. On the other hand, Collaborative communication involves a...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT