Question

Given the following requirements: we need to construct a database that manages the hospital data. The...

Given the following requirements: we need to construct a database that manages the hospital data. The hospital contains four departments (Department of Internal Medicine, Orthopedic department, pediatric department, surgery department), each department has several doctors; each department receives and treats several patients. Each doctor has an ID number (unique); Full Name; Gender; Department ID number, each patient has an ID number (unique); Full Name; Gender; Department ID number; Condition (admitted or not), The doctor in charge; the described medications (serial number of the medicine ) where the patients can take more than one medicine. Each patient is treated by one doctor. The hospital medicine storages have several medicines where each has a serial number, type, and name. This is a group project. Therefore, constitute groups of three students each, and do the following: 1- Produce the ER diagram the represents these requirements. (3 marks) 2- Map the ER that you produce into a relational schema. (3 marks) 3- Design the database tables. For each column in a table, identify its name, data type, size, Null allowed or not, primary key or not, check constraints, unique constraint, and foreign key constraints. (3 marks) 4- Implement the database including all tables and constraints using Sqlserver, and then input enough sample data for each table. (6 marks) 5- Be ready for presentation and discussion of your work through Microsoft teams. During the discussion, you may sked to write SQL queries to retrieve or manipulate data. (5 marks)

0 0
Add a comment Improve this question Transcribed image text
Answer #1

From the given above information we are going to learn about the following topics: 1. ER diagram.    2. SQL. 3. how to retrieve and manuplate data.

1. So first let us see about ER diagram based on the given above data. sol: ER is defined as Entity Relational diagram, which is used to transform data into simple designed database.it is also easily understandable about the data by using the diagram. So for the real world ER diagrams plays a crucial role in database. ER some what looks like flow chart and its includes of entities, attributes, relationships which helps in clear understanding.

ER diagram includes three basic parts: 1. entity 2. attributes. 3.relationships.

1. Entity is defined as the main thing which explains about the most important topics in the data. 2. Attributes are defined as the sub parts which helps in explaining about the entities. 3. Relationship is used to connect the data with there functioning.

entities are explained in top of the box; attributes are explained in that box as sub part and relationship is explained with diamond shape.   

Now let us see the how will be the ER diagram from the given above data

.

so from the above diagram Entities are: Doctor, medicine, patient.

   attributes are for Doctor: ID, Full name, Gender Medicine: Serial No, Type, Name Patient: Medicine Serial number, Doctor, Department Id, Admitted/not.

  Relationship is From Doctor to Patient One-to-one so it is symbolized as single line   For Patient to medicine One-to-Many So it is symbolized as Single line and line with side triangle.

2. now let us see Tables in sql :

sol: SQL is defined as structured query language. which is used to store data easily by using tables.

so now from the given information we need to create three tables:(i will data in tables as example.)

for table1: name it as Doctors.

CREATE TABLE Doctors (Doctor_ID INT NOTNULL PRIMARY KEY, Name VARCHAR, Gender VARCHAR);

INSERT INTO Doctors (Doctor_ID INT NOTNULL PRIMARY KEY, Name VARCHAR, Gender VARCHAR) values (111, xxx, male);   INSERT INTO Doctors (Doctor_ID INT NOTNULL PRIMARY KEY, Name VARCHAR, Gender VARCHAR) values (222, yyy, male); INSERT INTO Doctors (Doctor_ID INT NOTNULL PRIMARY KEY, Name VARCHAR, Gender VARCHAR) values (333, zzz, female);

doctors table is created . now let us see about patient table.

Table 2; name it as Patient.

CREATE TABLE Patient (Doctor_Name VARCHAR, MedicineSerial_no INT, DepartmentID INT, Admitted VARCHAR);

INSERT INTO Patient (Doctor_Name VARCHAR, MedicineSerial_no INT, DepartmentID INT, Admitted VARCHAR) values (aaa, 12112, 0001, YES); INSERT INTO Patient (Doctor_Name VARCHAR, MedicineSerial_no INT, DepartmentID INT, Admitted VARCHAR) values (bbb, 12132, 0002, YES);    INSERT INTO Patient (Doctor_Name VARCHAR, MedicineSerial_no INT, DepartmentID INT, Admitted VARCHAR)   values (ccc, 12112, 0002, YES);

patient table is created; now let us see about medicine table.

Table 3: name it as medicine:

CREATE TABLE Medicine (Medicine_type VARCHAR, MedicineSerial_no INT, Medicine_NameVARCHAR);

INSERT INTO Medicine (Medicine_type VARCHAR, MedicineSerial_no INT, Medicine_NameVARCHAR)   values (pediatrics, 12112, adcdef ); INSERT INTO Medicine (Medicine_type VARCHAR, MedicineSerial_no INT, Medicine_NameVARCHAR) values (gynecology, 12132, sdefr); INSERT INTO Medicine (Medicine_type VARCHAR, MedicineSerial_no INT, Medicine_NameVARCHAR)       values (orthopedics, 12114, swedrft);

medicine table is created.

now table4: let name the table as Internal_Medicine_Departments.

CREATE TABLE Internal_Medicine_Departments (Patient_Name VARCHAR, Doctor_Name VARCHAR, Medicine_Serial_no INT);

INSERT INTO Internal_Medicine_Departments (Patient_Name VARCHAR, Doctor_Name VARCHAR, Medicine_Serial_no INT)

values (somex, somea, 67934 ) INSERT INTO Internal_Medicine_Departments (Patient_Name VARCHAR, Doctor_Name VARCHAR, Medicine_Serial_no INT) values (somey, someb, 75684)  INSERT INTO Internal_Medicine_Departments (Patient Name VARCHAR, Doctor_Name VARCHAR, Medicine_Serial_no INT)       values (somez, somec, 12114);

now table5: let name the table as Orthopedic_Departments.

CREATE TABLE Orthopedic_Departments (Patient_Name VARCHAR, Doctor_Name VARCHAR, Medicine_Serial_no INT);

INSERT INTO Orthopedic_Departments (Patient_Name VARCHAR, Doctor_Name VARCHAR, Medicine_Serial_no INT)

values (joshey, manesey, 334455 ) INSERT INTO Internal_Medicine_Departments (Patient_Name VARCHAR, Doctor_Name VARCHAR, Medicine_Serial_no INT) values (messey, masasae, 44848)  INSERT INTO Orthopedic_Departments (Patient Name VARCHAR, Doctor_Name VARCHAR, Medicine_Serial_no INT)       values (psped, soede, 22002);

now table6: let name the table as Pediatric_Departments.

CREATE TABLE Pediatric_Departments (Patient_Name VARCHAR, Doctor_Name VARCHAR, Medicine_Serial_no INT);

INSERT INTO Pediatric_Departments (Patient_Name VARCHAR, Doctor_Name VARCHAR, Medicine_Serial_no INT)

values (sohey, daney, 334455 ) INSERT INTO Pediatric_Departments (Patient_Name VARCHAR, Doctor_Name VARCHAR, Medicine_Serial_no INT) values (dera, kara, 44748)  INSERT INTO Pediatric_Departments (Patient Name VARCHAR, Doctor_Name VARCHAR, Medicine_Serial_no INT)       values (qwerd, pede, 22102);

now table6: let name the table as Surgery_Departments.

CREATE TABLE Surgery_Departments (Patient_Name VARCHAR, Doctor_Name VARCHAR, Medicine_Serial_no INT);

INSERT INTO Surgery_Departments (Patient_Name VARCHAR, Doctor_Name VARCHAR, Medicine_Serial_no INT)

values (piney, laene, 341455 ) INSERT INTO Surgery_Departments (Patient_Name VARCHAR, Doctor_Name VARCHAR, Medicine_Serial_no INT) values (raiey, sohey, 46848)  INSERT INTO Surgery_Departments (Patient Name VARCHAR, Doctor_Name VARCHAR, Medicine_Serial_no INT)       values (maery, dore, 92002);

3. Now let us know about how to retrieve data.

sol: Retrieving data means selecting from part of the data from particular database. to retrieve data SELECT statement is used.

so from any of the above table lets consider medicine table if you want to retrieve data of medicine name for medicine serial no OF 12132 then the syntax will be like

SELECT Medicine_Name, MedicineSerial_no FROM Medicine:

so by using this command you can retrieve the data all medicine serial numbers and medicine names from medicine table.

hope you got all of your answers. and please rate it

Add a comment
Know the answer?
Add Answer to:
Given the following requirements: we need to construct a database that manages the hospital data. The...
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
  • Given the following requirements: we need to construct a database that manages the hospital data. The...

    Given the following requirements: we need to construct a database that manages the hospital data. The hospital contains four departments (Department of Internal Medicine, Orthopedic department, pediatric department, surgery department), each department has several doctors; each department receives and treats several patients. Each doctor has an ID number (unique); Full Name; Gender; Department ID number, each patient has an ID number (unique); Full Name; Gender; Department ID number; Condition (admitted or not), The doctor in charge; the described medications (serial...

  • Consider the following information about a patient database: A patient is identified by patient id, and...

    Consider the following information about a patient database: A patient is identified by patient id, and admission date. A patient must be either an Emergency patient or a resident patient. We must record the checkback date for Emergency patient. Only resident patient is assigned to one room. Room has a unique number, degree, and floor number. For each room there are a number of beds each of which has a bed number, specification. If a room is deleted, you need...

  • Question 3 refers to the relational database with a schema described below: The hospital database contains...

    Question 3 refers to the relational database with a schema described below: The hospital database contains information about the treatments of patients performed by the doctors. The database also contains information on the prescriptions ordered by the doctors. The schemas of relational tables, the meanings of attributes and specifications of primary, candidate, and foreign keys are given below. HOSPITAL HospitalCd Name Address Estate PostalCode EstablishedDate Hospital Code Name of the hospital Address of the hospital The estate where the hospital...

  • Consider the following set of requirements for a university database that is used to keep track...

    Consider the following set of requirements for a university database that is used to keep track of students' transcripts The university keeps track of each student's name, student number, social security number, address and phone, birthdate, gender, `, and degree program (bachelor, Masters, PhD.). Both social security number and student number have unique values for each student. Each department is described by a name, department code, office number, office phone. Both name and code have unique values for each department....

  • Consider the following relations for a database that keeps track of student enrollment in courses and the books adopted for each course.

    Question: Consider the following relations for a database that keeps track of student enrollment in courses and the books adopted for each course. 1- Draw an ER diagram of ONLINE COURSE REGISRATION database, that captures all the given below requirements. Specify key attribute(s) of each entity set. For each relationship set, specify structural constraints and participation constraints. a. For each USER, the portal maintains user ID, Name, E-mail. Each user has a unique ID. Name is a Composite attributes with Frame, Midname,...

  • Lab 7 In the “Care One” hospital each patient is assigned to just one doctor. Each...

    Lab 7 In the “Care One” hospital each patient is assigned to just one doctor. Each doctor can visit many or zero patients. The following image illustrates a small part of this hospital. Please create a schema with name of “careone”, then add these two tables. You should insert 4 doctors and 6 patients in this database (just mockup information). All of the creations and insertions should be done by writing queries. The queries should contain the Data Definition, constraints,...

  • Question 1: University Database Consider the following set of requirements for a UNIVERSITY database that is...

    Question 1: University Database Consider the following set of requirements for a UNIVERSITY database that is used to keep track of students' transcripts. The university keeps track of each student's name, student number, social security number current address and phone, permanent address and phone, birth date, sex, class (freshman, sophomore,., graduate), major department, minor department (if any), and degree program (B.A., B.S.,..., Ph.D.). Some user applications need to refer to the city, state, and zip of the student's permanent address,...

  • Design the entity relationship conceptual schema. Depict the ER diagram you have designed, outlining the entity...

    Design the entity relationship conceptual schema. Depict the ER diagram you have designed, outlining the entity types, relationship types, their respectives attributes, keys, structual constraints, and role names. In designing the entity relationship schema, make the initial conceptual design and the neccessary refinements after that. This will be a hospital database hospital, include patients, each patient will be either inpatient or outpatient and have a unique ID, first name, last name, address, city, zip code, phone number, and room number....

  • Problem 1 Consider the following set of requirements for a university database that is used to...

    Problem 1 Consider the following set of requirements for a university database that is used to keep track of students' transcripts. (a) The university keeps track of each student's name, student number, social security number, current address and phone, permanent address and phone, birthdate, sex, class (freshman, sophomore, -, graduate), major department, minor department (if any), and degree program (B.A., B.S., ...., Ph.D.). Some user applications need to refer to the city, state, and zip of the student's permanent address,...

  • Assume that you are working with a hospital and this hospital needs a software system to...

    Assume that you are working with a hospital and this hospital needs a software system to track its patients’ information. Your role in this software development is to design the database. There are many aspects of such a hospital software system to develop. However, in this assignment, you will only address interactions between doctors and patients. Your first step will be to create the relations necessary for this system and identify and describe the constraints that would be appropriate for...

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