nerdexam
Oracle

1Z0-071 · Question #76

Examine the create table statements for the stores and sales tables. SQL> CREATE TABLE stores(store_id NUMBER(4) CONSTRAINT store_id_pk PRIMARY KEY, store_name VARCHAR2(12), store_address…

The correct answer is C. DELETE the rows with STORE_ID = 900 from the SALES table and then delete rows from STORES D. Disable the FOREIGN KEY in SALES table and then delete the rows. E. Create the foreign key in the SALES table on SALES_ID column with on DELETE CASCADE option. See the full explanation below for the reasoning.

Question

Examine the create table statements for the stores and sales tables. SQL> CREATE TABLE stores(store_id NUMBER(4) CONSTRAINT store_id_pk PRIMARY KEY, store_name VARCHAR2(12), store_address VARCHAR2(20), start_date DATE); SQL> CREATE TABLE sales(sales_id NUMBER(4) CONSTRAINT sales_id_pk PRIMARY KEY, item_id NUMBER(4), quantity NUMBER(10), sales_date DATE, store_id NUMBER(4), CONSTRAINT store_id_fk FOREIGN KEY(store_id) REFERENCES stores(store_id)); You executed the following statement:

SQL> DELETE from stores WHERE store_id=900; The statement fails due to the integrity constraint error:

ORA-02292: integrity constraint (HR.STORE_ID_FK) violated Which three options ensure that the statement will execute successfully?

Options

  • ADisable the primary key in the STORES table.
  • BUse CASCADE keyword with DELETE statement.
  • CDELETE the rows with STORE_ID = 900 from the SALES table and then delete rows from STORES
  • DDisable the FOREIGN KEY in SALES table and then delete the rows.
  • ECreate the foreign key in the SALES table on SALES_ID column with on DELETE CASCADE option.

How the community answered

(20 responses)
  • A
    15% (3)
  • B
    10% (2)
  • C
    75% (15)

Community Discussion

No community discussion yet for this question.

Full 1Z0-071 Practice