CSE2DBF Database Fundamentals Assignment Problem

Assignment Help PL-SQL Programming
Reference no: EM132382401

CSE2DBF Database Fundamentals
La Trobe University
CSE2DBF 2019 Semester 2
Assignment 2 (20%)

AIMS AND OBJECTIVES:
• to perform queries on a relational database system using SQL;
• to demonstrate an advanced knowledge of stored procedures, stored functions and triggers.
Implement the following tasks using ORACLE SQL*Plus.

Task 1

Download the file NATURALTHERAPY.sql from the LMS site and run it on ORACLE SQL*Plus. This file contains all the CREATE and INSERT statements you will need for this assignment.

NOTE: YOU DO NOT NEED TO INSERT MORE DATA INTO THE TABLES.

The list of tables available for this assignment is the following:

MetabolicCategory (categoryNo, name)
FamilyDoc (GPNo, name, contactNo )
MedicalPractitioner (PractionerNo, name, contactNo, speciality)
Naturopath (NaturopathNo, name, contactNo, officeStartTime, officeEndTime, emailAddress)
RelevantCondition(conditionId, name) MedicalCondition(conditionId, name) Habits(conditionId, name)
Patient(patientId, name, gender, DoB, address, state,postcode, homePhone, businessPhone, maritalStatus, occupation, duration,unit, race, registrationDate , GPNo, NaturopathNo)
MetabolicFunction (functionNo, name, categoryNo)
Visit (visitNo, visitDate, time, amountPaid, receiptNo, service, medication, chiefComplaints, patientId)
PatientMetabolic (functionNo, patientId, score) PatientPractitioner (patientId, practionerNo) PatientRelCon (patientId, conditionId, notes)
PatientHabit (patientId, conditionId, year, average, unit, notes)
PatientMedCon (patientId, conditionId, notes)
RelevantConDetail (patientid, conditionId, specify)

NOTE: PK is printed bold and underlined, FK is printed italic, PK that is also FK is printed bold, italic, and underlined.
Using the tables provided above, provide SQL statements for the following queries.

(a) Display the number of patients referred to by each medical practitioner in the database.

(b) Find out which occupation has the greatest number of patients with high blood pressure.

(c) Display the area postcodes that have at least two patients under the age of 7 years old suffering from asthma.

(d) Display the details of the patient (i.e. Name, Gender, Address, Postcode, DOB) who smokes and has the highest (most severe) total of metabolic functions.

(e) Display the details of patients (i.e. Name, Gender, Address, Postcode, DOB) who haven't visited the naturopath in the last 6 months and who are suffering from a severe heart problem (the total score > 9 for Heart in metabolic screening questionnaire).

(f) Display the details of patients (i.e. Name, Gender, Address, Postcode, DOB) who smoke, have diabetes and high blood pressure. List these patients in an increasing order of their age.

(g) For each patient who has at least an allergy, display the patient's name together with his/her metabolic functions that have the total score >3.

(h) Display the details of all patients in the database (i.e. Name, Gender, Address, Postcode, DOB) together with the referring family doctor of that patient (if any).

(i) Display the average number of patients registered into the database each month.

(j) Display the most popular naturopath that has been visited by the patients.

Task 2

Provide the implementation of the following stored procedures and function. For submission, please include both the PL/SQL code and an execute procedure/SQL statement to demonstrate the functionality.

(a) Write a stored procedure that receives a date as input and displays as the output the list of patients who visited the naturopath on that day.

(b) Write a stored procedure that accepts as input a particular medical problem (from the past medical history), and as the output displays the number of patients suffering from that problem, grouped by the 3 age groups (children 0 - 12 years, teenagers over 12 - 20 years, and adult >20 years).

(c) Write a stored function that uses a patient's id as input and calculates the total amount paid to date by that patient. You also need to show an SQL statement to display the total amount paid by all of the patients in the database.

Task 3

Provide the implementation of the following triggers. For submission, please include both the PL/SQL code and an insert statement to demonstrate the trigger functionality.

(a) A trigger that is activated if the combination of a patient's name, DOB and living address (including address, state, postcode) already exists in the database.
(b) A trigger that is activated whenever a new medication given to a patient matches any one of the patient's allergy list.

Reference no: EM132382401

Questions Cloud

CHNG5006 Advanced Wastewater Engineering Assignment : CHNG5006 Advanced Wastewater Engineering Assignment Help and Solution - The University of Sydney, Australia - Summarises the likely position of that stakeholder
Check stage of the pdca cycle to monitor : Describe how you can use the Check stage of the PDCA cycle to monitor and review progress of the customer service improvement processes.
Define the term team norm : Define the term "team norm". List 5 aspects that might be considered a norm at a company or organization
Discuss internal vs external recruitment practices : Today's HRMs more so than ever before are relying on e-recruiting techniques. What qualities of electronic recruiting do you think contribute
CSE2DBF Database Fundamentals Assignment Problem : CSE2DBF Database Fundamentals Assignment help and solution, La Trobe University, Assessment help - perform queries on a relational database system using SQL
What explains google innovation mindset : Entrepreneurs often take the risks necessary to innovate new products and or enter new markets. What explains Google's innovation mindset?
Do you agree or disagree with this assertion : Do you agree or disagree with this assertion? Why? Give specific examples from your work or personal experiences to support your opinion.
How much will each brother have available : When retirement beckons at age 65, how much will each brother have available?
How do you see fwas affecting a company bottom line : 1. Do you think only certain individuals are attracted to flexible work arrangements (FWAs)? Why or why not?

Reviews

Write a Review

PL-SQL Programming Questions & Answers

  Create a database model

Create a database model and Submit the table creation statements for the Database Model.

  Write pl-sql procedures and functions

Write PL/SQL procedures and functions to populate and query that database

  Sql questions

Write a query to display using the employees table the EMPLOYEE_ID, FIRST_NAME, LAST_NAME and HIRE_DATE of every employee who was hired after to 1 January, 1995.

  Run the lab_03_01.sql script

Run the lab_03_01.sql script in the attached file to create the SAL_HISTORY table. Display the structure of the SAL_HISTORY table.

  Write sql queries

Write a query to display the last name, department number, and salary of any employee whose department number and salary both match the department number and salary of any employee who earns a commission.

  Explaining sql insert statement to insert new row in cds

Write down a SQL insert statement to insert new row in "CDS" table.

  Write down name of actors in ascending order

Write down actors (or actress, your choice, but not both) who have won at least two (2) Academy Awards for best actor/actress. Provide the actor name, movie title & year. Order the result by actor name."

  What is an sql injection attack

What is an SQL injection attack? Explain how it works, and what precautions must be taken to prevent SQL injection attacks.What are two advantages of encrypting data stored in the database?

  Determine resonant frequency in series rlc resonant circuit

Given the series RLC resonant circuit in the figure, operating at variable frequency, determine: The resonant frequency ω o ,  The circuit’s quality factor Q , The cut-off frequencies, f 1  & f 2  and the bandwidth BW

  Query that uses cube operator to return lineitemsum

Write summary query which uses CUBE operator to return LineItemSum (which is the sum of InvoiceLineItemAmount) group by Account(an alias for AccountDesciption).

  Query to show customers were missing for existing orders

As DBA, your manager called a meeting and asked why there are so many orders for customers that don't exist in the customer table. Write query which would shows which customers were missing for existing orders. Use a join or a subquery.

  Sql query into a relational algebra statement

Turn this SQL query into a relational algebra statement? SELECT Request.reqfor, Ordering.invamt, Ordering.invnbr, Ordering.invdat

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd