exam questions

Exam 1z0-061 All Questions

View all questions & answers for the 1z0-061 exam

Exam 1z0-061 topic 1 question 44 discussion

Actual exam question from Oracle's 1z0-061
Question #: 44
Topic #: 1
[All 1z0-061 Questions]

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?

  • A. Disable the primary key in the STORES table.
  • B. Use CASCADE keyword with DELETE statement.
  • C. DELETE the rows with STORE_ID = 900 from the SALES table and then delete rows from STORES table.
  • 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.
Show Suggested Answer Hide Answer
Suggested Answer: ACD 🗳️

Comments

Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
ArchieVon
1 month, 1 week ago
The correct Answer is CDE. You cant disable a primary key that has a foreign key referencing it
upvoted 1 times
...
Sugar
5 years, 3 months ago
E is also not possible answer because it would require dropping table and recreate it
upvoted 1 times
...
Sugar
5 years, 4 months ago
Only C D are the correct answers. A would give an error.
upvoted 2 times
...
dineshigdd
5 years, 6 months ago
Answer A is not correct if you use the following syntax to disable the constraint store_id_pk of the store table. alter table stores disable constraint store_id_pk; This will produce an error. The reason is that store_id_fk constraint( Foreign key of sales table) depends on store_id_pk. If you want to disable the primary key ( constraint store_id_pk) you can use the following sql code: alter table stores disable constraint store_id_pk cascade; This will delete the primary key and the dependent foreign key. However, this is out of the scope of this question as this option is not mentioned. Therefore, I would argue the correct choices are C, D, and E.
upvoted 1 times
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...
exam
Someone Bought Contributor Access for:
SY0-701
London, 1 minute ago