Question

Hospital Patient Reglstration System Hospltal Patient Registration System Part 2: Relational Schema: Description of Tables 1)In this part of the project you are required to implement your database on MySQL. Your implementation should include the foll

Hospital Patient Reglstration System Hospltal Patient Registration System Part 2: Relational Schema: Description of Tables 1) 2) Patient Table: Contains detail information about patients. Patient Address: Contains list of patients addresses. Each Patient can have more than one Address. However, an address can belong to only one patient. DOD DATETM 3) Provider Table: Contains detail information about Service Provider's, 4) Provider Address: Contains list of provider's addresses. 5) Provider Department: Contains information about which provider are in which department. Provider Schedule: Contains provider work schedule records. 6) Provider iditN VARCHAR,粉 . Each Provider can have more than one Provider Address, can be a member of more than one provider department, and can have more than Provider work schedule in a certain period However, a provider address, provlder department, and provider work schedule can belong to only one Provider 7) Payor Table: Contain Patient insurance information. .Each patient can have more than one Payor. However, Payor can be belonging to only to one Patlent a) Diagnosis Group Table: Contain the list of diagnosis kind or type. 9) List of Diagnosis Table: Contain list of diagnosis that belong in each diagnosis's type and price. .In Each Diagnosis group can have more one kind of diagnosis. However a list of Diagnosis can belong to only one Diagnosis type. 10)Task Process Table: Contain detail information about what kind of service 008 CATETIME that requested by the patient. In Each Task process can have (might request) more than one kind of diagnosis. And also, In each diagnosis can have more than list of diagnasis. However, each diagnosis and diagnosis list belong to specific requester patient
In this part of the project you are required to implement your database on MySQL. Your implementation should include the following: 1- Create all the tables that you specified in your relational schema (Part 2, of Step 2). Make sure to include primary keys and foreign keys 2- Populate all tables with data of your choice. Make sure that each table includes at least 10 rows Design and clearly explain at least ten query scenarios that may be useful on your database. You may include the scenarios or questions you described in Step 1 question#4 Write SQL syntax to answer each query. A query like this: select count(*) from tableOne, can only be used as one of the ten. . . .Strongly suggested to include some queries using Table Joins, Aggregates (at least 2) Group By, Order By, and Having (In other words have a good variety that incorporates the material we have been learning) At least one query must use a view (that you created from your application tables) in the FROM clause Note: the SELECT used for in the creation of the view, does not count as one of the 10 queries. What to submit: 1- A word document to explain your query scenarios. Think about the business that you are representing for these scenarios. Also need to create SQL syntax to answer these queries a. SQL statements to create the tables (from Part 1 above) b. SQL statements to populate tables with data (from Part 1 above) c. SQL statements for your query scenarios (from Part 2) d. SQL used to create the view (from Part 2)
0 0
Add a comment Improve this question Transcribed image text
Answer #1

Answer a) some of the attributes is not clear in the image so i have not included in table column.

CREATE TABLE Patient (
PatientID int ,
PayerId int,
FirstName varchar(255),
LastName varchar(255),
Gender varchar(255),
Phonenumber varchar(255),
PRIMARY KEY (PatientID),
FOREIGN KEY (PayerId) REFERENCES Payer(PayerId)
);
--------------------------------------------------------------
CREATE TABLE Payer (
PayerId int,
PayerCode varchar(255),
PayerName varchar(255),
PRIMARY KEY (PayerId)
);
----------------------------------------------------------
CREATE TABLE PatientAddress (
PatientID int ,
PatientAddress varchar(255),
City varchar(255),
State varchar(255),
zipcode int,
AssignmentNumber int,
FOREIGN KEY (PatientID ) REFERENCES Patient(PatientID)
);
--------------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------------
CREATE TABLE Provider (
ProviderID int ,
DeptId int,
Provider_FirstName varchar(255),
Provider_LastName varchar(255),
DOB date,
salary double,
PRIMARY KEY (ProviderID),
FOREIGN KEY (DeptId) REFERENCES Department(DeptId )
);
-------------------------------------------------------------
CREATE TABLE Department(
DeptId int,
Discription varchar(255),
specialization varchar(255),
PRIMARY KEY (DeptId)
);
--------------------------------------------------------------------------
CREATE TABLE ProviderAddress (
ProviderID int,
ProviderStreet varchar(255),
City varchar(255),
State varchar(255),
zipcode int,
FOREIGN KEY (ProviderID) REFERENCES Provider(ProviderID)
);
-----------------------------------------------------------------------------
CREATE TABLE ProviderSchedule (
ProviderID int NOT NULL,
startDate date,
startime time,
endtime time,
FOREIGN KEY (ProviderID) REFERENCES Provider(ProviderID)
);
---------------------------------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------------------------------

CREATE TABLE diagnosisGroup(
diagnosisID int,
Discription varchar(255),
diagnosisName varchar(255),
PRIMARY KEY (diagnosisID)
);
----------------------------------------------------------------------------

CREATE TABLE diagnosisList(
diagnosisID int,
diagnosisListID int,
diagnosisListName varchar(255),
diagnosisPrice int,
PRIMARY KEY (diagnosisListID ),
FOREIGN KEY (diagnosisID ) REFERENCES diagnosisGroup(diagnosisID )
);

--------------------------------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------------------------------

TASK PROCESS TABLE

CREATE TABLE TASKProcess(
TASKProcessID int,
diagnosisID int,
PatientID int,
diagnosisListID int,
DateOFProcess DATE,
PRIMARY KEY (TASKProcessID ),
FOREIGN KEY (diagnosisID ) REFERENCES diagnosisGroup(diagnosisID ),
FOREIGN KEY (PatientID) REFERENCES Patient(PatientID ),
FOREIGN KEY (diagnosisListID ) REFERENCES diagnosisList(diagnosisListID)
);

mysql show tables; i Tables_in_hospital department diagnosisgroup i diagnosislist ordePs patient patientaddress payer provide

i 1 i i 1 mysqǐ〉 desc patient; Field Type Null Key DefaultExtra PatientIDint (11 PayerId FirstNamevarchar 255 YES Last Name G

*************************************************************************************************************************************

Answer b)

i mysql> select * from patient; PatientID PayerId i FirstName LastNameGender Phonenumber 100 Gaurau 104 Renu 100 Kancharn 100

******************************************************************************************************************************************

Answer c)

Below is basic query

nysql select count*from patient; count< 10 1 row in set 〈0.00 sec nysql select FirstName from patient where PatientID -10; Fi

SELECT * FROM patientaddress
WHERE city IN ('basti');

nysql select from patientaddress where city in(basti; iPatientID PatientAddress City State zipcode AssignmentNumber 51 56 2

query using like keyword

SELECT * FROM patient
WHERE FirstName LIKE 'a%';

inner join query

SELECT Patient.FirstName,Patient.PatientID,Payer.Name
FROM patient,payer
INNER JOIN ON patient.patientID= payer.PatientID;

groupBy clause

SELECT count(*)
FROM patientaddress
WHERE patient id <500
GROUP BY city;

***********************************************************************************************************************

Answer d) create view example

In SQL, a view is a virtual table based on the result-set of an SQL statement.

A view contains rows and columns, just like a real table. The fields in a view are fields from one or more real tables in the database.

CREATE VIEW PatientDetail
SELECT FirstName, LastName,PatientID
FROM Patient
WHERE PatientID= 100;

Now the PatientDetail will be view table

SELECT * FROM PatientDetail ;

*********************************************************************************************************************************************

Add a comment
Know the answer?
Add Answer to:
Hospital Patient Reglstration System Hospltal Patient Registration System Part 2: Relational Sche...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • The following tables form part of a database held in a relational DBMS: Hotel (hotelNo, hotelName,...

    The following tables form part of a database held in a relational DBMS: Hotel (hotelNo, hotelName, city) Room (roomNo, hotelNo, type, price) Booking (hotelNo, guestNo, dateFrom, dateTo, roomNo) Guest (guestNo, guestName, guestAddress) where Hotel contains hotel details and hotelNo is the primary key; Room contains room details for each hotel and (roomNo, hoteINo) forms the primary key; Booking contains details of bookings and (hoteINo, guestNo, dateFrom) forms the primary key; Guest contains guest details and guestNo is the primary key....

  • Prepare and execute each of the queries listed using the "Adventureworks2012" database in SQL: Server: http://msftdbprodsamples.codeplex.com/releases/view/93587...

    Prepare and execute each of the queries listed using the "Adventureworks2012" database in SQL: Server: http://msftdbprodsamples.codeplex.com/releases/view/93587 When all of your queries are complete, cut and paste the SQL Syntax into a word document. In order to see what the column names are, you need to click on the table and then Columns to see the field names. Make sure to include column headings that make sense in the queries (use the as “Field Name” after the field selected). Multi-table Queries...

  • The relational schema for the Academics database is as follows DEPARTMENT(deptnum, descrip, instname, deptname, state,...

    The relational schema for the Academics database is as follows DEPARTMENT(deptnum, descrip, instname, deptname, state, postcode) ACADEMIC(acnum, deptnum*, famname, givename, initials, title) PAPER(panum, title) FIELD(fieldnum, id, title) INTEREST(fieldnum* acnumk, descrip) Some notes on the Academics database An academic department belongs to one institution (instname) and often has many academics. An academic only works for one department. Research papers (PAPER) are often authored by several academics, and of course an academic often writes several papers (AUTHOR) A research field (FIELD) often...

  • The relational schema for the Academics database is as follows DEPARTMENT(deptnum, descrip, instname, deptname, state, postcode)...

    The relational schema for the Academics database is as follows DEPARTMENT(deptnum, descrip, instname, deptname, state, postcode) ACADEMIC(acnum, deptnum*, famname, givename, initials, title) PAPER(panum, title) FIELD(fieldnum, id, title) INTEREST(fieldnum* acnumk, descrip) Some notes on the Academics database An academic department belongs to one institution (instname) and often has many academics. An academic only works for one department. Research papers (PAPER) are often authored by several academics, and of course an academic often writes several papers (AUTHOR) A research field (FIELD) often...

  • The relational schema for the Academics database is as follows: DEPARTMENT(deptnum, descrip, instname, deptname, state, postcode)...

    The relational schema for the Academics database is as follows: DEPARTMENT(deptnum, descrip, instname, deptname, state, postcode) ACADEMIC(acnum, deptnum*, famname, givename, initials, title) PAPER(panum, title) AUTHOR(panum*, acnum*) FIELD(fieldnum, id, title) INTEREST(fieldnum*, acnum*, descrip) Some notes on the Academics database: ● An academic department belongs to one institution (instname) and often has many academics. An academic only works for one department. ● Research papers (PAPER) are often authored by several academics, and of course an academic often writes several papers (AUTHOR). ●...

  • Exercise 3 [12.5 marks] Given the Restaurant management system database that contains the following tables (primary...

    Exercise 3 [12.5 marks] Given the Restaurant management system database that contains the following tables (primary keys are underlined and foreign keys are preceded with #): Customer (customerID,customerFirstName,customerLastName,customerAddress) Oreder (orderID,orderDate, #customerID,#menuItemID,#staffID) MenuItem(menuItemID, menuItemName,ingredients,type,availability) Staff(staffID, staffName, staffPhoneNumber, staffRole ) OrderPayment(paymentID,paymentAmount,#orderID,#staffID) 1) Without using DISTINCT, write the SQL query equivalent to the following one:[1.5 marks] SELECT DISTINCT menuItemName FROM MenuItem WHERE type = ‘Vegetarian’ OR availability= ‘Yes’; 2) Express the following queries in SQL: a) Find the number of orders placed by...

  • Tables: Create table Item(                 ItemId                 char(5) constraint itmid_unique primar

    Tables: Create table Item(                 ItemId                 char(5) constraint itmid_unique primary key,                 Decription           varchar2(30),                 Unitcost               number(7,2)); Create table Customer(                 custID                   char(5) constraint cid.unique primary key,                 custName          varchar2(20),                 address                                varchar2(50)); Create table Orderdata( orderID                char(5) constraint oid_uniq primary key,                 orderdate           date,                 shipdate              date,                 ItemId                  char(5) references Item.ItemId,                 No_of_items     number(4),                 Unitcost               number(7,2),                 Order_total        number(7,2),                 custID                   char(5) references customer.custID); Insert Into Item values(‘A123’,’Pencil’,2.5); Insert Into Item values(‘B123’,’Pen’,15); Insert Into...

  • Topic: Inventory Manangement Part A. Database Creation Your database should have a minimum of 4 tables...

    Topic: Inventory Manangement Part A. Database Creation Your database should have a minimum of 4 tables and include both one-to-many and many-to-many relationships. Be sure to include some numeric and/or date fields. Define all appropriate constraints, using the proper naming conventions (see Structure Notes below). Populate your database with at least 30 records in the main table(s), and whatever is needed in related tables. Submit the following: • a short description of the purpose of the database and what the...

  • Please help me to solve Please, No handwriting COURSE; introduction to database Q- write a query ...

    Please help me to solve Please, No handwriting COURSE; introduction to database Q- write a query SQL by Using the info below A. Normalize the Tables (in 3NF at least) B. Create the Normalized Tables and Populate them with at least 5 Rows C. Write the Wholesale Management System requested Queries & Execute them VERY IMPORTANT Screenshots from MySQL (or any other software you use) of all the tables after queries result. - Database system for a Wholesale Management System...

  • Deliverable 1. Simple SQL Statements Caution: Read the instructions carefully! Each question is based on a...

    Deliverable 1. Simple SQL Statements Caution: Read the instructions carefully! Each question is based on a single SQL statement, and the single SQL statement might contain sub-queries (additional SELECT statements) within the statement. Provide a list all of the Customer ID, Customer Names, and States and sort the list in alphabetical order by Customer Name. Provide a list of all of the Customer ID, Customer Names, and States, and sort the list by state with the Customer Names in alphabetical...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT