COMP 266 Lecture Notes - Lecture 1: Foreign Key, Unique Key, Oracle Database
![](https://new-preview-html.oneclass.com/WvR8zlZx0rEdQvn5BRldQ7aoMA1J3K9D/bg1.png)
Question: Consider the following relations:
Patients (pid, ...
Bookmark
Show transcribed image text
Expert Answer
ď‚·
praveenkumar answered this
Was this answer helpful?
0
0
802 answers
According to the above relations I just giving the table creation quesries by putting only
one connection i.e. foreign key relation between patients and Nurses relations as those are
the only common column names across all the relations.
1. create table patients(pid number(3),name varchar2(10),address varchar2(20),telephone
number(11),care_centre_id number(5) primary key);
2.create table care_centres(cid number(3), name varchar2(10), location
varchar2(10),nurse_charge_id number(3));
3.create table treatments(tid number(3), patient_id number(3),physician_id
number(3),treatment_name varchar2(10), tdate date);
4.create table nurses(nid number(3),name varchar2(10),care_centre_id number(5),
certificate_type varchar2(10),telephone number(11), salary number(7), FOREIGN
KEY(care_centre_id) REFERENCES patients(care_centre_id));
find more resources at oneclass.com
find more resources at oneclass.com