0% found this document useful (0 votes)
16 views2 pages

Exp 11

The document outlines SQL commands for managing user privileges, including granting and revoking SELECT access on tables. It also details data manipulation operations such as inserting, updating, and rolling back records in the Agent and Client tables. Additionally, it discusses the use of savepoints and the management of AutoCommit settings.

Uploaded by

kiranjagdale444
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)
16 views2 pages

Exp 11

The document outlines SQL commands for managing user privileges, including granting and revoking SELECT access on tables. It also details data manipulation operations such as inserting, updating, and rolling back records in the Agent and Client tables. Additionally, it discusses the use of savepoints and the management of AutoCommit settings.

Uploaded by

kiranjagdale444
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/ 2

SQL> -- Grant SELECT privilege on Client table to User2

SQL> GRANT SELECT ON Client TO User2;

Grant succeeded.

SQL> -- Grant SELECT privilege on all tables to PUBLIC (all users)


SQL> GRANT SELECT ON Agent TO PUBLIC;

Grant succeeded.

SQL> GRANT SELECT ON Client TO PUBLIC;

Grant succeeded.

SQL> -- Revoke SELECT privilege on Client table from User2


SQL> REVOKE SELECT ON Client FROM User2;

Revoke succeeded.

SQL> INSERT INTO Agent (AgentID, Name, Phone, Email, Address)


2 VALUES (4, 'Priya Sharma', '9876123456', '[email protected]', '789
Green St, Bangalore')
;

1 row created.

SQL>
SQL> INSERT INTO Client (ClientID, Name, Phone, Email, Address)
2 VALUES (4, 'Vikas Patel', '9123456789', '[email protected]', '567 Yellow
St, Kolkata');

1 row created.

SQL>
SQL> -- Commit the transaction (permanently save changes)
SQL> COMMIT;

Commit complete.

SQL> INSERT INTO Agent (AgentID, Name, Phone, Email, Address)


2 VALUES (5, 'Amit Verma', '8765432109', '[email protected]', '101 Blue St,
Hyderabad');

1 row created.

SQL>
SQL> -- Rollback the transaction (undo this insertion)
SQL> ROLLBACK;

Rollback complete.
SQL> INSERT INTO Client (ClientID, Name, Phone, Email, Address)
2 VALUES (5, 'Neha Joshi', '9871234560', '[email protected]', '301 Red St,
Chennai');

1 row created.

SQL>
SQL> -- Set a savepoint
SQL> SAVEPOINT BeforeUpdate;

Savepoint created.

SQL>
SQL> UPDATE Client SET Phone = '9998887776' WHERE ClientID = 5;

1 row updated.

SQL>
SQL> -- Rollback to the savepoint (undo the update but keep the insertion)
SQL> ROLLBACK TO BeforeUpdate;

Rollback complete.

SQL>
SQL> -- Commit the remaining changes
SQL> COMMIT;

Commit complete.

SQL> -- Enable AutoCommit (each statement is automatically committed)


SQL> SET AUTOCOMMIT ON;
SQL>
SQL> -- Disable AutoCommit (explicit COMMIT needed)
SQL> SET AUTOCOMMIT OFF;
SQL>

You might also like