CompTIA DataSys+ (DS0-001)Database FundamentalsEasy
A database administrator needs to create a new user account named 'report_reader' and grant it privileges to only read data from the `Sales` and `Customers` tables, but not modify or delete any records. Which SQL DDL statement is used to assign these specific permissions?
- ACREATE USER
- BALTER USER
- CGRANT
- DREVOKE
Show answer & explanationAnswer & explanation
Correct answer: C. GRANT
The GRANT statement is a Data Control Language (DCL) command used to assign specific privileges (like SELECT, INSERT, UPDATE, DELETE) on database objects to users or roles.
Why the other options are wrong
- A. CREATE USER is used to define a new user account, not to assign permissions.
- B. ALTER USER is used to modify properties of an existing user, such as a password, but not to grant object-level permissions.
- D. REVOKE is used to remove previously granted permissions, not to assign them.
SQL GRANT Statement
A Data Control Language (DCL) command used to assign specific database object privileges (e.g., SELECT, INSERT, UPDATE, DELETE, EXECUTE) to users or roles.
- Manages database security by controlling access rights.
- Can grant privileges on tables, views, stored procedures, etc.
- Complements the REVOKE statement for permission management.
Memory trick: DCL: Grant access, Revoke access.