You are on page 1of 3

Roll 6524

No:
NAME Arpit Santosh Dubey
1 Create table student(rollno,name,addr,class,marks) with following constraints 
1. Make rollno primary key
2. Name should not accept repeated values.
3. Addr can not accept blank values
4. Class if not enter
5. ed should be “mumbai”.
6. Marks should accept only positive values.

Ans. Create table student_6524(

Rollno number primary key,

Name char(20) unique,

Addr varchar(20) Not null,

Class char(10) default=’SYCS’,

Marks number where marks>=0

);

2 Insert 3 records in it.

Ans: Insert into student_6524 values(


123,’Arpit’,’vashi’,’Sycs’,50,
111,’Ankit’,’kharghar’,’tycs’,60,
333,’Aman’,’panvel’,’FYCS’,100
);
3 Display details of students.

Ans: Select * from student_6524;


4 Display students rollno,name 

Ans: Select rollno,name from student_6524;


5 Display students whose addr is either vashi,panvel or kharghar.

Ans: Select * from student_6524 where addr in (vashi,panvel ,kharghar);


6 Display students addr whisc has “#” sign in it.

Ans: Select * from student_6524 where addr like’#*’;


7 Display student whose name begins with ‘S’ character.
Ans: Select * from student_6524 where name like ‘S+’;
8 Increase marks of all students by 4.

Ans: Update student_6524 set (marks=marks+4);


9 Change address of ‘ravi’ as ‘vashi’.

Ans: Update student_6524 set addr=’vashi’ where name=’ravi’;


10 Remove students whose marks is below 5.

Ans: Delete student_6524 where marks<5;


11 Display students whose marks is between 50 -90.

Ans: Select * from student_6524 where marks between 50 and 90;


12 Find students whose marks are more than Ans:50.

Ans: Select * from student where marks >50;


13 Display student name whose marks is not specified.

Ans: Select * from student_6524 where marks =null;


14 Display students whose rollno is greater than 10,addr is vashi and marks below
40.

Ans: Select * from student_6524 where rollno>10 and addr=’vashi’ and marks<40;
15 Add new column grade in it.

Ans Alter table student_6524 add column grade;


16 Display all columns.

Ans: Select * from student_6524;


17 Remove newly added column …(grade)

Alter table student_6524 drop column grade;


18 Save your work 

Commit table student_6524;


19 Remove rows by using truncate.

Alter table student_6524 truncate rows;


20  Remove entire table

Delete table student_6524;


Only for B div
21 Display highest marks of students.

Select max(marks) from student_6524;


22 Display total ,average marks of students.

Select sum(marks) and Avg(marks) from student_6524;


23 Display highest marks of each class.

Select max(marks) from student_6524;


24 Create savepoint S1.

Insert into student_6524 values (111,’Arpit’,’panvel’,’vashi’,’sycs’,80);


Savepoint s1;
25  Rollback your work till savepoint s1.

Rollback to s1;

You might also like