IN SQL DEVELOPER Create a table UserPermissions (provide create and insert state
ID: 3787183 • Letter: I
Question
IN SQL DEVELOPER
Create a table UserPermissions (provide create and insert statements code)
Document
UserName
Policy
SYSTEM
Menu
JDOW
W2
USAM
Permissions
SYSTEM
W2
JDOW
Form 1040
USAM
Policy
JDOW
W2
SYSTEM
Write a PL/SQL stored function that takes username as input and returns number of documents that user has permissions to view. If username is not in the table, your procedure should return “user not found”.
Document
UserName
Policy
SYSTEM
Menu
JDOW
W2
USAM
Permissions
SYSTEM
W2
JDOW
Form 1040
USAM
Policy
JDOW
W2
SYSTEM
Explanation / Answer
1. The sql command for creating table named "UserPermissions"
CREATE TABLE UserPermissions
(
UserName varchar(255),
Document varchar(255)
);
2. The multiple insert commands for filling the table with data are.
INSERT INTO UserPermissions VALUES ('SYSTEM', 'Policy' );
INSERT INTO UserPermissions VALUES ('JDOW', 'Menu' );
INSERT INTO UserPermissions VALUES ('USAM', 'W2' );
INSERT INTO UserPermissions VALUES ('SYSTEM', 'Permissions' );
INSERT INTO UserPermissions VALUES ('JDOW', 'W2' );
INSERT INTO UserPermissions VALUES ('USAM', 'Form 1040' );
INSERT INTO UserPermissions VALUES ('JDOW', 'Policy' );
INSERT INTO UserPermissions VALUES ('SYSTEM', 'W2' );