Sei sulla pagina 1di 3

1)The chairmen of the hospital wants to know the

list of oncallsdoctor.so,write a query to display


details of oncallsdoctor?
A)create table ONCALLSDOCTOR(DOC_NO int,D_NAME text,QUALIFICATION text,SALARY
int,ADDRESS text,PH_NO int,dateofjoining text,feespercall int, paymentdue int);
INSERT INTO ONCALLSDOCTOR VALUES(30699,'venkat','Neuroradiology',100000,'benz
circle',125525,'12/01/2010',15000,10000);
INSERT INTO ONCALLSDOCTOR VALUES(31255,'Narayan','PATHOLOGY',150056,'benz
circle',701376,'10/02/2011',45252,78952);
INSERT INTO ONCALLSDOCTOR VALUES(31335,'loki','Diagnostic',100000,'benz
circle',789466,'15/08/2012',15222,54555);
INSERT INTO ONCALLSDOCTOR VALUES(31271,'devesh','Anesthesiology',181000,'benz
circle',468555,'12/06/2013',15822,45678);
INSERT INTO ONCALLSDOCTOR VALUES(31222,'vishal','Medicalgenetics',152255,'benz
circle',485625,'16/12/2000',48568,55868);
Select * from oncallsdoctor.
2)A Patient whose number is 9056 was discharged
from the hospital.so,move the details from the
discharge list and remove from the admit list?
A)create table patientadmit(patientnumber INT,advancepayement INT,modeofpayment
TEXT,roomnumber INT,departmentname TEXT,admittedon TEXT,intitialcondition
TEXT,Treatment TEXT,attendednumber int);
INSERT INTO patientadmit VALUES(3377,10000,'Net banking',108,'outpatient
dept','24/01/2010','legpain','Immobilization',4567);
INSERT INTO patientadmit VALUES(5839,12000,'Credit card',207,'Inpatient
service','14/02/2010','heartpain','Surgery',4789);
INSERT INTO patientadmit VALUES(9056,13000,'Debit card',308,'medical
dept','18/03/2010','teethproblem','fluoride',1456);
INSERT INTO patientadmit VALUES(2731,14000,'Paytm',408,'Nursing
dept','05/04/2010','skin allergy','Oatmealbaths',2578);
INSERT INTO patientadmit
VALUES(4599,15200,'UPI',508,'Paramedical','27/05/2010','bone
deficiency','nutritional supplements',4568);
delete from patientadmit
where patientnumber=9056;
select * from patientadmit;
create table patientdischarge(patientnumber integer,treatment text,paymentmade
integer,modeofpayment text,dateofdischarge text);
insert into patientdischarge values(3377,'leg fracture',20000,'Net
banking','07/03/2010');
insert into patientdischarge values(5839,'heart problem',100000,'Credit
card','26/05/2010');
insert into patientdischarge values(2731,'skin
allergy',2000,'Paytm','07/04/2010');
insert into patientdischarge values(4599,'bone
deficiency',7000,'UPI','27/06/2010');
insert into patientdischarge
values(9056,'rottenteeth',5000,'Debitcard','28/03/2010');
select * from patientdischarge;
3)A room whose number is 612 was occupied by patient
so,write a query to change the status of the room?
create table roomdetails(roomnumber int,roomtype text,status text);
insert into roomdetails values(108,'General','Yes');
insert into roomdetails values(207,'Private','No');
insert into roomdetails values(308,'General','Yes');
insert into roomdetails values(408,'Private','Yes');
insert into roomdetails values(508,'General','No');
insert into roomdetails values(612,'Private','No');
insert into roomdetails values(725,'Genaral','Yes');
insert into roomdetails values(826,'Private','Yes');
insert into roomdetails values(956,'General','No');
insert into roomdetails values(1025,'Private','Yes');
UPDATE roomdetails set status='YES'
WHERE roomnumber=612;
SELECT * FROM roomdetails;
4)The billing incharge want to know the details of the
patients whose paymentmade is less than 100000 in the
discharge section.so,write a query for above scenario?
A)create table patientdischarge(patientnumber integer,treatment text,paymentmade
integer,modeofpayment text,dateofdischarge text);
insert into patientdischarge values(3377,'leg fracture',20000,'Net
banking','07/03/2010');
insert into patientdischarge values(5839,'heart problem',100000,'Credit
card','26/05/2010');
insert into patientdischarge values(9056,'rotten teeth',5000,'Debit
card','28/03/2010');
insert into patientdischarge values(2731,'skin
allergy',2000,'Paytm','07/04/2010');
insert into patientdischarge values(4599,'bone
deficiency',7000,'UPI','27/06/2010');
select * from patientdischarge where paymentmade< 100000;
5)write a query to print the details of the patient whose
name ending with 'a'?
A) create table patiententry(patientname text,age int,sex text,address text,city
text,phonenumber bigint,entrydate text,doctorname text,diagnosis text,deptname
text);
insert INTO patiententry
VALUES('siva',18,'Male','Vidhyadharapuram','vijayawada',9398424465,'2010-01-
23','Murali','leg fracture','outpatient');
insert INTO patiententry
VALUES('venkat',55,'male','Benzcircle','vijayawada',9985247978,'2010-02-
23','ramu','heart problem','inpatient service');
insert into patiententry
values('sandeep',34,'male','bhavanipuram','vijayawada',3984628908,'2010-03-
12','mohan','rotten teeth','medicaldept');
insert into patiententry
values('sanjana',23,'female','nagralu','guntur',9282919222,'2010-04-
23','narendra','skin allergy','nursing');
insert into patiententry
values('pushkala',18,'female','ringroad','guntur',7542034162,'2010-05-
23','sandy','bone defficiency','paramedical');
select * from patiententry where patientname like '%a';
6)write a query to arrange the details of the patients in
ascending order based on patientnumber from patientadmit table?
create table patientadmit(patientnumber INT,advancepayement INT,modeofpayment
TEXT,roomnumber INT,departmentname TEXT,admittedon TEXT,intitialcondition
TEXT,Treatment TEXT,attendednumber int);
INSERT INTO patientadmit VALUES(3377,10000,'Net banking',108,'outpatient
dept','24/01/2010','legpain','Immobilization',4567);
INSERT INTO patientadmit VALUES(5839,12000,'Credit card',207,'Inpatient
service','14/02/2010','heartpain','Surgery',4789);
INSERT INTO patientadmit VALUES(9056,13000,'Debit card',308,'medical
dept','18/03/2010','teethproblem','fluoride',1456);
INSERT INTO patientadmit VALUES(2731,14000,'Paytm',408,'Nursing
dept','05/04/2010','skin allergy','Oatmealbaths',2578);
INSERT INTO patientadmit
VALUES(4599,15200,'UPI',508,'Paramedical','27/05/2010','bone
deficiency','nutritional supplements',4568);
select * from patientadmit ORDER BY patientnumber ASC;
7)write a query to print the details of the patients in the
patient entry whose doctornames are equal in regulardoctors?
create table DOC_REG(DOC_NO int,doctor text,QUALIFICATION text,SALARY int,address
text,PH_NO int,dateofjoining text);
INSERT INTO DOC_REG VALUES(30083,'Murali','physician',100000,'benz
circle',78943323,'28/01/2010');
INSERT INTO DOC_REG VALUES(30646,'ramu','cardiologist',110000,'benz
circle',7855625,'13/02/2010');
INSERT INTO DOC_REG VALUES(30360,'mohan','dentist',1000000,'benz
circle',89850545,'07/03/2010');
INSERT INTO DOC_REG VALUES(30348,'Narendra','skin',120000,'benz
circle',78952233,'01/04/2010');
INSERT INTO DOC_REG VALUES(31117,'sandy','orthopedician',150000,'benz
circle',75556855,'12/05/2010');
SELECT * from DOC_REG;
create table patiententry(patientname text,age int,sex text,addres text,city
text,phonenumber bigint,entrydate text,doctorname text,diagnosis
text,departmentname text);
insert INTO patiententry
VALUES('siva',18,'Male','Vidhyadharapuram','vijayawada',9398424465,'2010-01-
23','Murali','leg fracture','outpatient');
insert INTO patiententry
VALUES('venkat',55,'male','Benzcircle','vijayawada',9985247978,'2010-02-
23','ramu','heart problem','inpatient service');
insert into patiententry
values('sandeep',34,'male','bhavanipuram','vijayawada',3984628908,'2010-03-
12','mohan','rotten teeth','medicaldept');
insert into patiententry
values('sanjana',23,'female','nagralu','guntur',9282919222,'2010-04-
23','narendra','skin allergy','nursing');
insert into patiententry
values('pushkala',18,'female','ringroad','guntur',7542034162,'2010-05-
23','sandy','bone defficiency','paramedical');
select * from patiententry;
select
patientname,age,sex,addres,city,phonenumber,entrydate,doctorname,diagnosis,departme
ntname from DOC_REG,patiententry
where DOC_REG.doctor=patiententry.doctorname;

Potrebbero piacerti anche