Enhancing the As-Is Hospital DatabaseCreating an Improved To-Be SystemFor this assignment, you will enhance the Hospital database (the as-is system) based on the results ofrequirements elicitation, which is described below. You will also submit an ER diagram based on yourmodified database design. You are already familiar with the as-is system, which you used in the first twoSQL assignments. You will be designing, implementing, and modeling a to-be system, based on clientrequirements.Imagine that you are a consultant for the company using this database. Your client has been using thedatabase for some time, and wants some improvements to the as-is system. Your task is to take the resultsof a requirements elicitation process (this takes place mostly during the analysis and planning phases ofthe SDLC) and create both the conceptual model and the implemented database that satisfies the users’requirements. The following section includes notes from requirements elicitation. A systems analyst (afellow consultant) took these notes based on interviews with the client, as well as studying HospitalDDLand HospitalDML script files, and existing SQL query results from SQL_1 and SQL_2 assignments. All ofthese contribute to your understanding of the as-is system.Requirement Elicitation NotesThe following are notes taken by your colleague, based on interviews with the client:Client wants to expand the database by including information about physicians. A new table should becreated, and populated with the following data (please be exact):Physicians make diagnoses on patients, and also prescribe medicine. Client wants to keep track of eachdiagnosis that any physician does for any patient. Also, client wants to keep track of all prescriptions doneby a physician for a patient.For this you must create intersection tables connecting physicians to patients. These tables should bepopulated in order to show the following specific information about diagnoses and prescriptions.Diagnoses data (be exact):Prescriptions data (be exact):Client wants all meds given to be associated with the correct prescription. This requires modifying both thestructure and the content of the MEDSGIVEN table. This table will need a foreign key to the prescription.Of course, you don’t want to lose existing data, so you should not drop and re-create the table. Instead, youwill need to alter the table to accomplish this.After doing this, you will need to find the most efficient way, using the least possible number of updatestatements, to associate the meds to the correct prescription, by matching the text of the medication to theprescription’s text. When this is done, a query of the medsgiven table that shows the correct prescriptionto-medicationmatchup would look like this:NOTE: I accomplished the task of putting proper foreign key values using only two update statements.Your grade on this task depends both on getting the correct values in prescription ID and doing it with thefewest possible update statements.After changes have been done to the database, client wants the following new queries:1. Show details about each med given. This includes information about the prescription, the physicianwho gave the prescription, the nurse and patient involved, and the details about the med given. Inaddition, for any medication that was administered after the prescription’s end date, you should markthis as Late. The results should like below:A couple notes about this query. For the most part it’s a simple join of five tables. The LATE?column should conditionally show “Late” based on whether or not the prescription end date isbefore the date given. For this, you can make use of a CASE expression. SQL CASE expressionsare explained on page 308 in chapter 7 of the textbook.Secondly, you can control the width of a column using the column format command in SQL Plus.For example if you precede your query with a command like CIS 330作业代做、代写To-Be System作业、代写SQL语言作业、代做SQL课程设计作业 帮做R语言编程|代this: “column fieldname formatA25”, this will make the width of the column called fieldname to have a width of 25 characters. Iencourage you to experiment with this for improving the look of your output.2. Client wants a query that shows details of the highest paid nurse for each unit in the hospital. Thisquery will involve a correlated subquery, and should produce these results:3. Client wants to see all patients whose first or last name is in another patient’s reason forhospitalization. In addition, client wants to see all patients who refer to another patient in their ownreason for hospitalization. Results should look like below. This query also involves a correlatedsubquery.4. Client wants to see a breakdown of nurse visits and of meds given based on the time period (AM vs.PM). This also involves a subquery, and produces this result. Note, yours may vary based on when youfirst created your database, but make sure the results are correct for your database.Of course, you will need to test the validity of your new database implementation, so you’ll also do otherqueries and database update attempts to verify data integrity of the design and correct values in certainfields.Required Database ScriptI’ve provided a script file that contains Prompt commands displaying what is expected at each step alongthe way. If you run the script file in Oracle SQL*Plus you will see an output that gives seventeen (17)prompts. Each of these prompts is a step for you to take as you work on this project.Note: the SQL*Plus Prompt command is useful in that it displays as output any text you’d like to presentto the user.You will modify the provided script file and turn this is in to Canvas as part of your final deliverable. Foreach Prompt in the provided script, you should do the necessary DDL or DML statement (or SQL*Pluscommand) that gives the desired results.You should place the statements and commands for each Prompt between the Prompt line and thefollowing Prompt with asterisks. For example, here’s what you do with the first Prompt:Prompt 1) CREATE PHYSICIANS TABLEYour CREATE TABLE statement goes herePrompt *************PromptBy doing these tasks you are performing database activities usually associated with the design andimplementation phases of the SDLC. Via this script, you use the results of requirements elicitation in orderto transform the as-is system into the desired to-be system. Some of the tasks involve creating or alteringtables. Some involve displaying table metadata. Some involve inserting new data or changing existing data.Some involve validating the integrity and content of the data. And some involve providing additionalinformation (via queries) that the client desires.I suggest that you do these tasks in the order I give them (i.e. the order given by the Prompt statements).Complete one task before moving on to another. Each task builds on another.To fully test out your script, you should start with the database built from HospitalDDL and HospitalDML.Then start the script file.I’ve included a text file showing the results of my script file’s execution in SQL*Plus. If your script runssuccessfully, the results on the SQL*Plus screen should look just like mine.One more note. You may need to completely remove your hospital database and re-create it. To removeyour database, you can do this SQL statement in the SYSTEM account:DROP USER HOSP CASCADE;Then you can rebuild it.Final DeliverablesYou will turn two files in to Canvas:1) A Visio or draw.io ER diagram for the changed database, based on your redesign. You cancapture the image of this and upload it to Canvas. I don’t want the Visio file itself. But use asoftware tool for this, don’t hand-draw it. Be as precise as possible with your entities, attributes,and relationships in this diagram.2) Your completed HospitalToBeScript file with all your SQL statements and SQL*Pluscommands.转自:http://ass.3daixie.com/2018120312605672.html