Download java programming of javat point and more Exercises Java Programming in PDF only on Docsity!
PRACTICAL : 4
Create the following table and insert the following records in
it. Perform queries for DCL Commands like, GRANT AND
REVOKE in it and Locks.
Table like that:
Create table on SQLyog. a. Click on table. b. Select create table. c. Enter detail of table. d. Then insert data on this table. Player id Name Country UserName 1 Sachin Tendulkar India BCCI_USER 2 Rahul Dravid India BCCI_USER 3 Anil Kumble India BCCI_USER 4 Ricky Ponting Australia CA_USER 5 Shane Warne Australia CA_USER
Execute DCL command.
First create user like this. CREATE USER ‘usernm’ IDENTIFIED BY ‘pwd’
Then give the grants like select, insert, and all etc…
Syntax like this: GRANT SELECT,INSERT ON databasenm. tablenm TO usernm;
And revoke all privileges.
Same as procedure and function. [GRANT & REVOKE]
Procedure [grant]:
procedure [revoke]:
function [grant]:
give the privileges. And click save changes.
you can also give grant option of user.
• LOCK
You can lock on table with write and read mode.
Syntax like this: LOCK TABLES players WRITE;
Syntax like this: LOCK TABLES players READ;
You can also lock multiple tables
Syntax like this: LOCK TABLES players READ , user WRITE;