Relations (Include all the necessary integrity constraints):
BILLED
| |
BILL NO
|
NUMBER(5) - PRI KEY
|
PATIENT_NO
|
NUMBER(9)
|
ITEM_CODE
|
NUMBER(5)
|
CHARGE
|
NUMBER(7,2)
|
TREATS
| |
PHY_ID
|
NUMBER(4) - PRI KEY
|
PATIENT_NO
|
NUMBER(4) - PRI KEY
|
PROCEDURE_NO
|
NUMBER(4) - PRI KEY
|
DATE_TREATED
|
DATE - PRI KEY
|
TREAT_RESULT
|
VARCHAR2(50)
|
ITEM
| |
ITEM_CODE
|
NUMBER(4) - PRI KEY
|
DESCRIPTION
|
VARCHAR2(50)
|
NORMAL_CHARGE
|
NUMBER(7,2)
|
PHYSICIANS
| |
PHY_ID
|
NUMBER(4) - PRI KEY
|
PHY_PHONE
|
CHAR(8)
|
PHY_NAME
|
VARCHAR2(50)
|
PATIENT
| |
PATIENT_NO
|
NUMBER(4) - PRI KEY
|
DATE_ADMITTED
|
DATE
|
DATE_DISCHARAGED
|
DATE
|
PAT_NAME
|
VARCHAR2(50)
|
ROOM_LOCATION
|
CHAR(4)
|
ROOM
| |
ROOM_LOCATION
|
CHAR(4) - PRI KEY
|
ROOM_ACCOMODATION
|
CHAR(2)
|
ROOM_EXTENSION
|
NUMBER(4)
|
PROCEDURES
| |
PROCEDURE_NO
|
NUMBER(4) - PRI KEY
|
PROC_DESCRIPTION
|
VARCHAR2(50)
|
Implement the following queries :
1. Get the PATIENT_NO, ITEM_CODE, and CHARGE and from the BILLED table for a specific PATIENT_NO
2. List all of the different charges that are stored to the table
3. Display all columns and all rows from the BILLED table
4. Display all charges greater than Rs. 5.00 for the PATIENT_NO 1116
5. Display all charges for either patient 1116 or patient 1117
6. Count the number of times patient 1116 has been charged for items
7. Display number of DISTINCT procedures performed on a patient
8. Give a meaningful column name for number of DISTINCT procedures in the above query
9. Display a calculated value such as the current charge and the amount that would be charged if the charge were increased by 6% for all rows in the ITEM table
10. List all patients hospitalized more than 6 days
11. List the total charges per patient for expensive medical items (CHARGE greater than Rs100 for an item) where patients owe the hospital a sum (total charges over Rs500)
12. List the patients who had either Dr. Ramu or Dr. Kiran or Dr. Prasad as a physician
13. Show the patient names (PAT_NAME field) and associated physician names (PHY_NAME field) along with the Patient information
14. List the PATIENT_NO and DATE_DISCHARGED from the PATIENT table and the associated CHARGE from the BILLED table.
ReplyDeleteThanks for sharing the descriptive information on SQL. It’s really helpful to me since I'm taking SQL Training. Keep doing the good work and if you are interested to know more on SQL Tutorial, do check this SQL Tutorial.:-https://www.youtube.com/watch?v=2OZQXAsCBvk
Nice information
ReplyDeletedbms interview questions
spring interview questions