Which statement creates a new user in ORACLE?
2013
Which statement creates a new user in ORACLE?
- A.
CREATE USER Susan;
- B.
CREATE OR REPLACE USER Susan;
- C.
CREATE NEW USER Susan DEFAULT;
- 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 viaIDENTIFIED BY. This is the standard way to create a local user.
Why the other statements fail
CREATE USER Susan;— omits the requiredIDENTIFIEDclause, so Oracle has no authentication method and rejects it.CREATE OR REPLACE USER Susan;— Oracle has noCREATE OR REPLACEform for users (that syntax is for views, procedures, etc.), and it still lacksIDENTIFIED.CREATE NEW USER Susan DEFAULT;—NEW USERand a trailingDEFAULTare 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.