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 form using a master detail relationship

Select the form and switch between the views (Forms, Layout, and Design) to change the properties or the form's appearance as desired.

  Description of vulnerability, exploit and attack software

Describe the vulnerability that the attack exploits, including how or why the vulnerability exists; what versions of software are vulnerable.

  Determine the commissions paid to specific employees of sale

Design a query that will allow the finance department to determine the commissions paid to specific employees of the sales department for the month of December.

  Display all the lastnames from the customers table

Display all the LastNames from the Customers table and any associated OrdersIDs from the Orders Table. Show the LastName even if they do not have any associated orders. Order the results by LastName in ascending order.

  Write an sql statement to display breed and type of all pets

Write an SQL statement to display the breed and type of all pets. Save as AllBreeds. Write an SQL statement to display the breed, and DOB of all pets having the type Cat. Save as Cats.

  Relational schema of a firm database - write a sql query

Display the vendor ID and vendor name of the items whose item quantity is the largest and display the item ID and item quantity of all items whoseitem quantity is less than the average quantity. Also display the average quantity

  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?

  Write a queries for a list of all clubs and their details

Write a queries for A list of all clubs and their details. Members of the clubs attending the meeting then apply to take part in their chosen events. Forms are available at each club for this purpose.

  Which is better to use, a sub query or a join

Please include example of each to support your reasoning. Also, please include references.

  Data processing of an international based organization

Imagine that you have been hired as a consultant to assist in streamlining the data processing of an international based organization that sells high-end electronics. The organization has various departments such as payroll, human resources, finan..

  Create an sql query that uses an uncorrelated subquery

Create an SQL query that USES AN UNCORRELATED SUBQUERY2 AND NO JOINS3 to display the descriptions for products provided by a vendor in area code 615.

  Prior to the adoption of sql as a standard

Prior to the adoption of SQL as a standard by the American National Standards Institute (ANSI), each database management system (DBMS) had its own unique command language and syntax. SQL was adopted as an ANSI standard in 1986. The International S..

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