讲解:CIS 330、To-Be System、SQL、SQLR|Processing

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

©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 205,033评论 6 478
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 87,725评论 2 381
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 151,473评论 0 338
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 54,846评论 1 277
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 63,848评论 5 368
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 48,691评论 1 282
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 38,053评论 3 399
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 36,700评论 0 258
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 42,856评论 1 300
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 35,676评论 2 323
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 37,787评论 1 333
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 33,430评论 4 321
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 39,034评论 3 307
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 29,990评论 0 19
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 31,218评论 1 260
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 45,174评论 2 352
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 42,526评论 2 343

推荐阅读更多精彩内容

  • By clicking to agree to this Schedule 2, which is hereby ...
    qaz0622阅读 1,433评论 0 2
  • pyspark.sql模块 模块上下文 Spark SQL和DataFrames的重要类: pyspark.sql...
    mpro阅读 9,446评论 0 13
  • Chapter 1 In the year 1878, I took my degree of Doctor of...
    foxgti阅读 3,644评论 0 6
  • 先解决情绪再解决问题,带着情绪去解决问题我看只会越来越糟糕,愤怒的情绪会使人远离真理,世上很少有因为愤怒就使问获得...
    03721aa71f9f阅读 26评论 0 0
  • 半生戎马半生国,小窗低语忍离歌。但使一片丹心在,豪杰何妨为情魔?
    3浮生几何阅读 29评论 0 1