0% found this document useful (0 votes)
4 views1 page

SQL Student Table Creation and Queries

The document outlines the creation of a table named 'Student01' with various fields including registration number, roll number, class, date of birth, and subject scores. It includes SQL commands for inserting records, querying data based on specific conditions, and updating the total score based on subject scores. The document also provides examples of SQL queries to retrieve and manipulate data from the 'Student01' table.
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)
4 views1 page

SQL Student Table Creation and Queries

The document outlines the creation of a table named 'Student01' with various fields including registration number, roll number, class, date of birth, and subject scores. It includes SQL commands for inserting records, querying data based on specific conditions, and updating the total score based on subject scores. The document also provides examples of SQL queries to retrieve and manipulate data from the 'Student01' table.
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

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