SQL security setup: which command is used to create a new database user (a principal that can own objects and connect)?

Difficulty: Easy

Correct Answer: CREATE USER

Explanation:


Introduction / Context:
Managing identities is a core administrative task. Before granting privileges, you must create a user (or role/login depending on the RDBMS). The canonical DDL for this action in many SQL dialects uses the CREATE USER statement with options for authentication and default schema/roles.


Given Data / Assumptions:

  • We need the command that establishes a new user principal.
  • Vendor syntax varies, but the generic keywording is consistent.
  • We are not asking about granting permissions or mapping logins.


Concept / Approach:
CREATE USER is the standard DDL verb phrase. Examples: PostgreSQL (CREATE USER name WITH PASSWORD '...), Oracle (CREATE USER name IDENTIFIED BY ...), MySQL (CREATE USER 'name'@'host' IDENTIFIED BY ...). Fake commands like “ADD USER TO DATABASE” or “MK USER” are not valid SQL statements across mainstream engines.


Step-by-Step Solution:

Identify the action: define a new user principal.Match to SQL DDL: CREATE USER.Choose “CREATE USER.”


Verification / Alternative check:
Vendor docs and examples consistently demonstrate CREATE USER before GRANT statements, confirming this is the correct command to establish an account.


Why Other Options Are Wrong:

ADD USER TO DATABASE: resembles a GUI action, not SQL syntax.MK USER: not an SQL statement.All/None: incorrect because CREATE USER exists.


Common Pitfalls:
Confusing CREATE USER with CREATE ROLE (some systems treat users as roles); mixing server logins with database users (e.g., SQL Server).


Final Answer:
CREATE USER

More Questions from Database Systems

Discussion & Comments

No comments yet. Be the first to comment!
Join Discussion