Code segment questions
In code questions, you might be asked to fill in the missing sections of the code or to identify the right set of the code from multiple choices. Let's look at an example.
Column security
Let's assume that you have a Customer
table with sensitive information in it. You want to hide the Social Security Number (SSN) details from LowPrivUser
. Here is the table definition:
CREATE TABLE Customer ( CustomerID VARCHAR (20), Name VARCHAR (200), SSN VARCHAR (9) NOT NULL, Phone VARCHAR (12) NULL, );
Complete the following code snippet:
GRANT ___________ Customer (CustomerID, Name, Phone) TO LowPrivUser';
[ Options: ALTER ON
, SELECT ON
, MASK ON
, ENCRYPT ON
]
Solution
SELECT ON
Explanation
- SELECT ON – Gives permission to run the
SELECT
queries only onCustomerID
,Name
, andPhone
, which is what is required in this use case. - ALTER ON –...