0% found this document useful (0 votes)
5 views9 pages

practical 6

The document outlines a series of SQL commands executed in SQL*Plus, demonstrating the creation and manipulation of a 'player' table. It includes inserting, selecting, updating, deleting records, and using transactions with commits and rollbacks. The final state of the table shows only two players, Virat and Dhoni, after several operations and rollbacks.

Uploaded by

nehabamane6
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views9 pages

practical 6

The document outlines a series of SQL commands executed in SQL*Plus, demonstrating the creation and manipulation of a 'player' table. It includes inserting, selecting, updating, deleting records, and using transactions with commits and rollbacks. The final state of the table shows only two players, Virat and Dhoni, after several operations and rollbacks.

Uploaded by

nehabamane6
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 9

SQL*Plus: Release 10.2.0.1.

0 - Production on Mon Aug 12 13:08:17

2024 Copyright (c) 1982, 2005, Oracle. All rights reserved.

SQL> conn

Enter user-name: system

Enter password:
Connected.

SQL> create table player(rank number, name varchar2(10), best


number); Table created

SQL> insert into player values(1,'Virat',183);

1 row created.

SQL> insert into player values(2,'dhoni',184);

1 row created.

SQL> insert into player values(3,'Rohit',185);

1 row created.
SQL> select * from player;

RANK NAME BEST

---------- ---------- ----------

1 Virat 183
2 dhoni 184
3 Rohit 185

Close the sql…Then again open…

SQL*Plus: Release 10.2.0.1.0 - Production on Mon Aug 12 15:47:52

2024 Copyright (c) 1982, 2005, Oracle. All rights reserved.

SQL> conn

Enter user-name: system


Enter password:

Connected.

SQL> select * from player;

no rows selected

SQL> insert into player values(1,'Virat',175);

1 row created.

SQL> insert into player values(2,'Dhoni',176);


1 row created.

SQL> select * from player;

RANK NAME BEST

---------- ---------- ----------


1 Virat 175

2 Dhoni 176

SQL> commit;

Commit complete.

After this again close the sql window. Again open it.

SQL*Plus: Release 10.2.0.1.0 - Production on Mon Aug 12 15:56:38

2024 Copyright (c) 1982, 2005, Oracle. All rights reserved.

SQL> conn

Enter user-name: system


Enter password:

Connected.

SQL> select * from player;

RANK NAME BEST

---------- ---------- ----------

1 Virat 175

2 Dhoni 176
SQL> rollback;

Rollback complete.

SQL> select * from player;


RANK NAME BEST

---------- ---------- ----------


1 Virat 175

2 Dhoni 176

SQL> insert into player

values(3,'Rohit',177); 1 row created.

SQL> select * from player;

RANK NAME BEST

---------- ---------- ----------

1 Virat 175
2 Dhoni 176

3 Rohit 177

SQL> rollback;

Rollback complete.

SQL> select * from player;


RANK NAME BEST

---------- ---------- ----------

1 Virat 175
2 Dhoni 176
SQL> update player set name='Kohali' where

rank=1; 1 row updated.

SQL> select * from player;

RANK NAME BEST

---------- ---------- ----------


1 Kohali 175

2 Dhoni 176

SQL> rollback;

Rollback complete.

SQL> select * from player;

RANK NAME BEST

---------- ---------- ----------

1 Virat 175
2 Dhoni 176

SQL> delete from player where rank=2;


1 row deleted.

SQL> select * from player;


RANK NAME BEST

---------- ---------- ----------


1 Virat 175

SQL> rollback;

Rollback complete.

SQL> select * from player;

RANK NAME BEST

---------- ---------- ----------


1 Virat 175

2 Dhoni 176

SQL*Plus: Release 10.2.0.1.0 - Production on Mon Aug 12 16:07:34

2024 Copyright (c) 1982, 2005, Oracle. All rights reserved.

SQL> conn

Enter user-name: system


Enter password:

Connected.

SQL> select * from player;


RANK NAME BEST

---------- ---------- ----------

1 Virat 175
2 Dhoni 176

SQL> savepoint A;

Savepoint created.

SQL> insert into player

values(3,'Rohit',177); 1 row created.

SQL> insert into player

values(4,'Dhawan',178); 1 row created.

SQL> insert into player

values(5,'Sachin',179); 1 row created.

SQL> savepoint B;

Savepoint created.

SQL> insert into player

values(6,'Pandya',180); 1 row created.


SQL> insert into player

values(7,'Bumrah',181); 1 row created.

SQL> savepoint C;

Savepoint created.

SQL> select * from player;

RANK NAME BEST

---------- ---------- ----------

1 Virat 175
2 Dhoni 176

3 Rohit 177
4 Dhawan 178
5 Sachin 179

6 Pandya 180
7 Bumrah 181

7 rows selected.

SQL> rollback to A;

Rollback complete.

SQL> select * from player;


RANK NAME BEST
---------- ---------- ----------

1 Virat 175

2 Dhoni 176

SQL> rollback to B;

rollback to B

ERROR at line 1:
ORA-01086: savepoint 'B' never established

SQL> rollback to C;

rollback to C
*

ERROR at line 1:
ORA-01086: savepoint 'C' never established

SQL> select * from player;

RANK NAME BEST

---------- ---------- ----------

1 Virat 175
2 Dhoni 176

SQL> select * from player;

You might also like