0
0
PostgreSQLquery~5 mins

Column-level permissions in PostgreSQL - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What are column-level permissions in a database?
Column-level permissions control access to specific columns in a table, allowing users to read or modify only certain columns instead of the entire table.
Click to reveal answer
beginner
How do you grant SELECT permission on specific columns in PostgreSQL?
Use the GRANT command with the column names listed after the table name, for example: GRANT SELECT (column1, column2) ON table_name TO user_name;
Click to reveal answer
intermediate
Why might you use column-level permissions instead of table-level permissions?
To protect sensitive data by restricting access to certain columns while still allowing access to other parts of the table.
Click to reveal answer
intermediate
Can you update specific columns using column-level permissions in PostgreSQL?
Yes, you can grant UPDATE permission on specific columns by specifying them in the GRANT statement, like: GRANT UPDATE (column1) ON table_name TO user_name;
Click to reveal answer
intermediate
What happens if a user has SELECT permission on a table but not on a specific column?
The user can query the table but will not see data from the restricted column; attempts to access it will result in an error.
Click to reveal answer
Which SQL command is used to give column-level SELECT permission in PostgreSQL?
ACREATE PERMISSION ON column_name FOR user_name;
BGRANT SELECT (column_name) ON table_name TO user_name;
CALTER TABLE table_name ADD PERMISSION column_name;
DSET PERMISSION SELECT ON column_name TO user_name;
If a user has UPDATE permission on only one column, what can they do?
ADelete rows from the table.
BUpdate any column in the table.
CUpdate only that specific column in the table.
DInsert new rows into the table.
What is a main benefit of using column-level permissions?
AAllows fine control over sensitive data access.
BImproves query speed.
CAutomatically backs up data.
DSimplifies table structure.
Which of the following is NOT true about column-level permissions?
AThey can restrict INSERT access on columns.
BThey can restrict UPDATE access on columns.
CThey can restrict SELECT access on columns.
DThey can restrict DELETE access on columns.
How do you revoke column-level SELECT permission in PostgreSQL?
AREVOKE SELECT (column_name) ON table_name FROM user_name;
BDROP PERMISSION ON column_name FROM user_name;
CREMOVE SELECT ON column_name FROM user_name;
DALTER USER user_name REVOKE SELECT ON column_name;
Explain what column-level permissions are and why they are useful in databases.
Think about how you might hide some information but show other parts of a table.
You got /4 concepts.
    Describe how to grant and revoke SELECT permission on specific columns in PostgreSQL.
    Focus on the GRANT and REVOKE commands with column lists.
    You got /4 concepts.