nerdexam
Oracle

1Z0-052 · Question #10

Examine the command that is used to create a table: SQL> CREATE TABLE orders ( oid NUMBER(6) PRIMARY KEY, odate DATE, ccode NUMBER (6), oamt NUMBER(10,2) ) TABLESPACE users; Which two statements are…

The correct answer is B. A NOT NULL constraint is created on the OID column. D. The ORDERS table and a unique index are created in the USERS tablespace. Defining PRIMARY KEY on a column implicitly creates a NOT NULL constraint and a unique index, both residing in the specified tablespace.

Managing Schema Objects

Question

Examine the command that is used to create a table:

SQL> CREATE TABLE orders ( oid NUMBER(6) PRIMARY KEY, odate DATE, ccode NUMBER (6), oamt NUMBER(10,2) ) TABLESPACE users; Which two statements are true about the effect of the above command? (Choose two.)

Options

  • AA CHECK constraint is created on the OID column.
  • BA NOT NULL constraint is created on the OID column.
  • CThe ORDERS table is the only object created in the USERS tablespace.
  • DThe ORDERS table and a unique index are created in the USERS tablespace.
  • EThe ORDERS table is created in the USERS tablespace and a unique index is created on the OID

How the community answered

(49 responses)
  • A
    12% (6)
  • B
    80% (39)
  • C
    2% (1)
  • E
    6% (3)

Why each option

Defining PRIMARY KEY on a column implicitly creates a NOT NULL constraint and a unique index, both residing in the specified tablespace.

AA CHECK constraint is created on the OID column.

A PRIMARY KEY creates UNIQUE and NOT NULL constraints, not a CHECK constraint - CHECK constraints require explicit definition with a condition expression.

BA NOT NULL constraint is created on the OID column.Correct

A PRIMARY KEY constraint enforces both uniqueness and non-nullability, so Oracle automatically creates an implicit NOT NULL constraint on the OID column.

CThe ORDERS table is the only object created in the USERS tablespace.

Two objects are created: the ORDERS table and a unique index for PRIMARY KEY enforcement, so the table is not the only object in the USERS tablespace.

DThe ORDERS table and a unique index are created in the USERS tablespace.Correct

Oracle creates a unique index to enforce the PRIMARY KEY; because no separate tablespace is specified for the index, it is created in the same USERS tablespace as the table.

EThe ORDERS table is created in the USERS tablespace and a unique index is created on the OID

Choice E does not specify the tablespace for the unique index, making it ambiguous and incomplete - D correctly states that both the table and the unique index are placed in the USERS tablespace.

Concept tested: PRIMARY KEY constraint implicit behavior and index creation

Source: https://docs.oracle.com/en/database/oracle/oracle-database/19/sqlrf/CREATE-TABLE.html

Topics

#PRIMARY KEY constraint#NOT NULL constraint#unique index#tablespace storage

Community Discussion

No community discussion yet for this question.

Full 1Z0-052 Practice