Which statement creates a new user in ORACLE?

2013

Which statement creates a new user in ORACLE?

  1. A.

    CREATE USER Susan;

  2. B.

    CREATE OR REPLACE USER Susan;

  3. C.

    CREATE NEW USER Susan DEFAULT;

  4. D.

    CREATE USER Susan IDENTIFIED BY blue;

Attempted by 22 students.

Show answer & explanation

Correct answer: D

Concept

In Oracle, a user account is created with the CREATE USER statement, and the syntax requires stating how the account will authenticate: CREATE USER username IDENTIFIED { BY password | EXTERNALLY | GLOBALLY }, or — for a schema-only account with no login — NO AUTHENTICATION. Oracle needs one of these: an authentication clause or an explicit NO AUTHENTICATION, so a bare CREATE USER name; that supplies neither is not a complete, valid statement.

Application

  • CREATE USER Susan IDENTIFIED BY blue; — well-formed: it names the user and supplies password authentication via IDENTIFIED BY. This is the standard way to create a local user.

Why the other statements fail

  • CREATE USER Susan; — omits the required IDENTIFIED clause, so Oracle has no authentication method and rejects it.

  • CREATE OR REPLACE USER Susan; — Oracle has no CREATE OR REPLACE form for users (that syntax is for views, procedures, etc.), and it still lacks IDENTIFIED.

  • CREATE NEW USER Susan DEFAULT;NEW USER and a trailing DEFAULT are not valid Oracle DDL keywords here.

Cross-check

Per the Oracle SQL reference, CREATE USER requires either an IDENTIFIED clause (BY password, EXTERNALLY, or GLOBALLY) or an explicit NO AUTHENTICATION — none of which the other three statements in this question supply. Among the four given, only the one using IDENTIFIED BY blue is syntactically complete and creates an authenticatable local account.

Explore the full course: Btsc Lab Assistant