SQL> create
table student (rollno number, name varchar2(20),aggr number(10,2));
Table created.
SQL> insert
into student values(&rollno,'&name',&aggr);
Enter value for
rollno: 1
Enter value for
name: akshay
Enter value for
aggr: 98.5
old 1: insert into student
values(&rollno,'&name',&aggr)
new 1: insert into student
values(1,'akshay',98.5)
1 row created.
SQL> /
Enter value for
rollno: 2
Enter value for
name: shruthi
Enter value for
aggr: 97.4
old 1: insert into student
values(&rollno,'&name',&aggr)
new 1: insert into student
values(2,'shruthi',97.4)
1 row created.
SQL> /
Enter value for
rollno: 3
Enter value for
name: venkat
Enter value for
aggr: 87.6
old 1: insert into student
values(&rollno,'&name',&aggr)
new 1: insert into student values(3,'venkat',87.6)
1 row created.
SQL> select *
from student;
ROLLNO NAME AGGR
----------
-------------------- ----------
1 akshay 98.5
2 shruthi 97.4
3 venkat 87.6
SQL> alter
table student add addr varchar2(10);
Table altered.
SQL> select *
from student;
ROLLNO NAME AGGR ADDR
----------
-------------------- ---------- ----------
1 akshay 98.5
2 shruthi 97.4
3 venkat 87.6
SQL> desc
student;
Name Null? Type
-----------------------------------------
-------- ----------------------------
ROLLNO
NUMBER
NAME
VARCHAR2(20)
AGGR NUMBER(10,2)
ADDR
VARCHAR2(10)
SQL>
update student set addr='hyd';
3 rows updated.
SQL> select *
from student;
ROLLNO NAME AGGR ADDR
----------
-------------------- ---------- ----------
1 akshay 98.5 hyd
2 shruthi 97.4 hyd
3 venkat 87.6 hyd
SQL> update
student set addr='chennai' where rollno=1;
1 row updated.
SQL> update
student set name='ravi',addr='delhi' where rollno=2;
1 row updated.
SQL> select *
from student;
ROLLNO NAME AGGR ADDR
----------
-------------------- ---------- ----------
1 akshay 98.5 chennai
2 ravi 97.4 delhi
3 venkat 87.6 hyd
SQL> update
student set aggr=99.9 where rollno=1 and name='akshay';
1 row updated.
SQL> select *
from student;
ROLLNO NAME AGGR ADDR
----------
-------------------- ---------- ----------
1 akshay 99.9 chennai
2 ravi 97.4 delhi
3 venkat 87.6 hyd
SQL> update
student set addr='bangalore' where aggr>90 or addr='hyd';
3 rows updated.
SQL> update
student set aggr=aggr+5 where rollno=3;
1 row updated.
SQL> update
student set name='calvin' ,addr='goa' where rollno=1 or aggr>95;
2 rows updated.
SQL> select *
from student;
ROLLNO NAME AGGR ADDR
----------
-------------------- ---------- ----------
1 calvin 99.9 goa
2 calvin 97.4 goa
3 venkat 92.6 bangalore
SQL> select *
from student;
ROLLNO NAME AGGR ADDR
----------
-------------------- ---------- ----------
1 calvin 99.9 goa
2 calvin 97.4 goa
3 venkat 92.6 bangalore
SQL> delete
from student where rollno=1;
1 row deleted.
SQL> delete
from student;
2 rows deleted.
SQL> select *
from student;
no rows selected
SQL> rollback;
Rollback
complete.
SQL> select *
from student;
ROLLNO NAME AGGR ADDR
----------
-------------------- ---------- ----------
1 akshay 98.5
2 shruthi 97.4
3 venkat 87.6
SQL> drop
table student;
Table dropped.
SQL> create table student(rollno number,name
varchar2(20));
Table created.
SQL> insert
into student values(10,'askhay');
1 row created.
SQL> insert
into student values(20,'ravi');
1 row created.
SQL> select *
from student;
ROLLNO NAME
----------
--------------------
10 askhay
20 ravi
SQL> commit;
Commit complete.
SQL> savepoint
p;
Savepoint
created.
SQL> update
student set name='madhu' where rollno=1;
0 rows updated.
SQL> update
student set name='madhu' where rollno=10;
1 row updated.
SQL> select *
from student;
ROLLNO NAME
----------
--------------------
10 madhu
20 ravi
SQL> rollback
to p;
Rollback
complete.
SQL> select *
from student;
ROLLNO NAME
----------
--------------------
10 askhay
20 ravi