You are on page 1of 1

create table Student01

( reg varchar2(20) Primary key,


roll int,
class varchar2(5),
dob date,
sub1 int,
sub2 int,
sub3 int,
total int
);

insert into student01 values('R-001',1,'VIII',to_date('7/7/2000','dd/mm/yyyy') ,


56,78,41,575)
insert into student01 values('R-
002',2,'IX',to_date('23/04/1999','dd/mm/yyyy'),78,67,65,NULL);
insert into student01(reg,roll,class,dob,sub1,sub2,sub3) values('R-
003',7,'VIII',to_date('23/04/2005','dd/mm/yyyy'),78,54,60);

select * from student01

select * from student01


where reg = 'R-003';

select * from student01


where reg = 'R-003'
or reg = 'R-006';

select * from student01


where class = 'IX';

select * from student01


where class != 'VIII';

select * from student01


where sub1 >=75;

select * from student01


where sub1 >=60
and sub2 <=50;

update Query for total calculation:


===================================

update tablename
set field = new value
where field = old value
and/or field = value;

update student01
set total = sub1+sub2+sub3;

You might also like