doctor

Sai_kiran_rachakonda · updated March 22, 2022
create table Doctor(
  Did int primary key,
  Dname varchar(25),
  specialization varchar(20) default 'general',
  Adhar_no varchar(12) unique,
  consultation_fee numeric(5,2) constraint c1 check(consultation_fee > 50)
);
insert into Doctor values('D_100', 'XYZ', 'ENT', 12334, 150);
insert into Doctor values('D_101', 'PQR', 'ORTHO', 12455, 200);
insert into Doctor values('D_102', 'LMN', 'ENT', 12256, 150);
insert into Doctor values('D_103', 'ABC', 'GEN.MED', null, 150);
insert into Doctor values('D_106', 'KLM', 'PEDIATRIC', 12987, 200);
insert into Doctor values('D_104', 'JACK', 'CARDIAC', 13567, 200);

alter table Doctor add column city varchar(15);

update Doctor set city = 'kollam' where Did = 'D_100';
update Doctor set city = 'kochi' where Did = 'D_101';
update Doctor set city = 'vizag' where Did = 'D_102';
update Doctor set city = 'hyderabad' where Did = 'D_103';
update Doctor set city = 'ongole' where Did = 'D_106';
update Doctor set city = 'khammam' where Did = 'D_104';
select * from Doctor
where consultation_fee > 100 and specialization = 'Accounts' or city = 'kollam';

Output

Comments

Please sign up or log in to contribute to the discussion.