0% found this document useful (0 votes)
9 views2 pages

Patient &bed

Uploaded by

Shravani Saste
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views2 pages

Patient &bed

Uploaded by

Shravani Saste
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

create table patient22(

pcode number(10)primary key,


pname varchar(20),
addr varchar(20)not null,
dis varchar(20));

create table bed22(


bno number(10)primary key not null,
rno number(20),
loc varchar(20),
check(bno>rno),
pcode number references patient22(pcode));

insert into patient22 values(1,'mr roy','pimparigurav','maleria');


insert into patient22 values(2,'mr ram','bmt','dengu');
insert into patient22 values(3,'mr ram','pune','corona');

select* from patient22;

PCODE PNAME ADDR DIS


1 mr roy pimparigurav maleria
2 mr ram bmt dengu
3 mr ram pune corona

insert into bed23 values(11,102,'first',1);


insert into bed23 values(12,105,'second',2);
insert into bed23 values(14,101,'fourth',1);

select* from bed23;

BNO RNO LOC PCODE


11 102 first 1
12 105 second 2
13 102 second 1
14 101 fourth 1

select*
from patient22
where addr='pimparigurav';

PCODE PNAME ADDR DIS


1 mr roy pimparigurav maleria

delete
from patient22
where pcode in(select bno from bed23 where bno=11 and rno=105);

select count(patient22.pcode)
from patient22,bed23
order by rno;

COUNT(PATIENT22.PCODE)
12

select pname
from patient22,bed23
where patient22.pcode=bed23.pcode and rno=101;

PNAME
mr roy

select dis
from patient22,bed23
where patient22.pcode=bed23.pcode and bno=12;

DIS
dengu

select bno,rno
from patient22,bed23
where patient22.pcode=bed23.pcode and pname='mr roy';

BNO RNO
11 102
13 102
14 101

select*
from patient22,bed23
where patient22.pcode=bed23.pcode and loc='second' and rno=102;

PCODE PNAME ADDR DIS BNO RNO LOC PCODE


1 mr roy pimparigurav maleria 13 102 second 1

You might also like