Untitled

mail@pastecode.io avatar
unknown
plain_text
2 months ago
1.3 kB
8
Indexable
Never
use first;
create table Student1(
rno int primary Key ,
name varchar(30) not null,
city varchar(255),
marks int not null,
sub varchar(30) not null,
state varchar(255)
);


insert into student values(10,"ram","nashik",45,"python","mh");
insert into student values(11,"anita","pune",67,"java","ch");
insert into student values(12,"sham","nashik",87,"sql","mh");
insert into student values(13,"nikita","nagpur",67,"sql","mh");
insert into student values(14,"yashu","nashik",45,"python","mh");
insert into student values(15,"rohan","nanded",56,"java""ch");
insert into student values(16,"pihu","pune",89,"html""ch");

select * from student;
-- for update stament
update student1 
set name="manoj"
where rno = 102;

update student1 
set state="MP";
-- for delete
delete from student where rno=14;
delete from student ;

-- using limit clause
select  * from student1  limit 5 ;
select  * from student1 order by rno desc limit 5 ;
select  * from student1 where name="nikita" order by rno desc limit 1 ; 

-- min and max
select min(marks) from student1;
select *,  min(marks)from student1;
select min(marks),rno,name from student1;

select max(marks) from student1;
select *,  max(marks)from student1;
select max(marks),rno,name from student1;

select max(marks) as marks,rno,name from student1;

Leave a Comment