diff options
| author | mo khan <mo.khan@gmail.com> | 2020-03-28 13:47:20 -0600 |
|---|---|---|
| committer | mo khan <mo.khan@gmail.com> | 2020-03-28 13:47:20 -0600 |
| commit | d2f5ebf18131058b5f601fe3022f3bde45b4f5f8 (patch) | |
| tree | 4a783d0119dc305b765a2bb52c66ae9cde6af73c | |
| parent | 4143234685f09a3ba4f271115bff6e961d66e276 (diff) | |
Remove unnecessary sql from assignment
| -rw-r--r-- | assignments/final/README.md | 39 |
1 files changed, 19 insertions, 20 deletions
diff --git a/assignments/final/README.md b/assignments/final/README.md index 2d97283..bcdf69c 100644 --- a/assignments/final/README.md +++ b/assignments/final/README.md @@ -400,44 +400,35 @@ Use Oracle to complete the following tasks. **Create the tables that correspond to these relations in your Oracle home database.** ```sql -\echo '--- Module 3 ---' - -ALTER TABLE IF EXISTS Nurses DROP CONSTRAINT care_centres_fk; -DROP TABLE IF EXISTS Treatments; -DROP TABLE IF EXISTS Physicians; -DROP TABLE IF EXISTS Patients; -DROP TABLE IF EXISTS Care_centres; -DROP TABLE IF EXISTS Nurses; - CREATE TABLE Nurses( nid bigint primary key, - name varchar(255), + name varchar, care_centre_id bigint, - certificate_type varchar(255), - telephone varchar(255), + certificate_type varchar, + telephone varchar, salary decimal ); CREATE TABLE Care_centres( cid bigint primary key, - name varchar(255), + name varchar, location text, nurse_charge_id bigint references Nurses(nid) ); CREATE TABLE Patients( pid bigint primary key, - name varchar(255), + name varchar, address text, - telephone varchar(255), + telephone varchar, care_centre_id bigint references Care_centres(cid) ); CREATE TABLE Physicians( phid bigint primary key, - name varchar(255), - pager_number varchar(255), - specialization varchar(255), + name varchar, + pager_number varchar, + specialization varchar, salary decimal ); @@ -445,15 +436,23 @@ CREATE TABLE Treatments( tid bigint primary key, patient_id bigint references Patients(pid), physician_id bigint references Physicians(phid), - treatment_name varchar(255), + treatment_name varchar, "date" timestamp ); +``` +**If not automatically created by the DBMS, create indexes corresponding to the primary and foreign keys. (6 marks)** + +```sql ALTER TABLE Nurses ADD CONSTRAINT care_centres_fk FOREIGN KEY (care_centre_id) REFERENCES Care_centres (cid); ``` -**If not automatically created by the DBMS, create indexes corresponding to the primary and foreign keys. (6 marks)** **Populate these tables with some sample data, and write SQL queries that show the content of each table after entering the data. (6 marks)** + +```sql +``` + + **For some strategic decisions, the president of the hospital needs summary data about the care centres. For each care centre, s/he needs to know the number of nurses holding an RN certificate, as well as their total and average salaries. Does the following view answer the president’s request? If not, write the correct view that will satisfy the president’s request. (7 marks)** ```sql |
