exam questions

Exam 1z0-082 All Questions

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

Exam 1z0-082 topic 1 question 55 discussion

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

Which four statements are true regarding primary and foreign key constraints and the effect they can have on table data? (Choose four.)

  • A. A table can have only one primary key but multiple foreign keys
  • B. A table can have only one primary key and one foreign key
  • C. The foreign key columns and parent table primary key columns must have the same names
  • D. It is possible for child rows that have a foreign key to remain in the child table at the time the parent row is deleted
  • E. It is possible for child rows that have a foreign key to be deleted automatically from the child table at the time the parent row is deleted
  • F. Only the primary key can be defined at the column and table level
  • G. Primary key and foreign key constraints can be defined at both the column and table level
Show Suggested Answer Hide Answer
Suggested Answer: ADEG 🗳️

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
danito
Highly Voted 4 years, 1 month ago
ADEG i think
upvoted 28 times
Ekos
3 years, 7 months ago
i agree
upvoted 1 times
...
NiciMilo
3 years, 11 months ago
How is D possible?
upvoted 1 times
nhsang
3 years, 11 months ago
In the relational 1-0, you can use ON DELETE SET NULL to keep child-records, but child-keys will be updated to NULL.
upvoted 5 times
ama
3 years, 10 months ago
this means that D is wrong
upvoted 1 times
SimoneF
3 years, 6 months ago
No because the child row stays, just some of its values are nullified.
upvoted 3 times
renzoku
3 years, 4 months ago
D : " have a foreign key to remain in the child table", The foreign key is set null, not remain with his original value
upvoted 1 times
...
...
...
...
...
...
avanand
Highly Voted 3 years, 10 months ago
ADEG in my opinion too... A. A table can have only one primary key but multiple foreign keys --> For sure B. A table can have only one primary key and one foreign key --> There is no such restrictions C. The foreign key columns and parent table primary key columns must have the same names --> There is no such restriction. D. It is possible for child rows that have a foreign key to remain in the child table at the time the parent row is deleted --> Can be achieved by disabling the FK constraint and re enabling with no validate clause after performing delete on parent table. E. It is possible for child rows that have a foreign key to be deleted automatically from the child table at the time the parent row is deleted --> CASCADE option F. Only the primary key can be defined at the column and table level --> No such restrictions G. Primary key and foreign key constraints can be defined at both the column and table level --> True.
upvoted 17 times
LrnsTgh
2 years, 10 months ago
might correct A, B (can have), D, E, G wrong C ("Must"), F (PK,FK, UQ, CK defined at column and table level. only not null in column level). I vote ADEG
upvoted 1 times
...
...
8hyehye8
Most Recent 3 months, 2 weeks ago
Selected Answer: ADEG
ADEG is correct.
upvoted 1 times
...
nautil2
8 months, 2 weeks ago
Selected Answer: ADEG
A - true; quote1: A table or view can have only one primary key., quote2: You can define multiple foreign keys in a table or view. B - false; see quote2 in answer A C - false; example, when names of FK columns and parent table columns are different: ALTER TABLE employees2 ADD CONSTRAINT fk_dept2 FOREIGN KEY (dept_id) REFERENCES departments2(id); D - true; example: ALTER TABLE employees ADD CONSTRAINT fk_dept FOREIGN KEY (dept_id) REFERENCES departments (id) ON DELETE SET NULL; perform INSERT(s) into employees with dept_id=17; DELETE FROM departments WHERE dept_id=17; E - true; example: ALTER TABLE employees ADD CONSTRAINT fk_dept FOREIGN KEY (dept_id) REFERENCES departments (id) ON DELETE CASCADE; F - false; Either primary key, unique constraint, foreign key or check contraints can be defined on both table and column levels. G - true; see answer F
upvoted 3 times
nautil2
8 months, 2 weeks ago
quotes originate in following sources: A - Oracle documentation: Database > Oracle > Oracle Database > Release 19 > SQL Language Reference > 8 Common SQL DDL Clauses > constraint F,G - Oracle documentation: Database > Oracle > Oracle Database > Release 19 > SQL Language Reference > 12 SQL Statements: ALTER SYNONYM to COMMENT > ALTER TABLE
upvoted 2 times
...
...
nautil2
8 months, 3 weeks ago
Selected Answer: ADEG
A - true; You can define multiple foreign keys in a table or view. B - false; see A C - false; a foreign key needn't be based on a primary key, it can be based on unique key, therefore its columns can have different names. D - true; parent row can be deleted, but parrent column cannot be deleted (ORA-12992: cannot drop parent key column) E - true; foreign key must be defined with ON DELETE CASCADE clause F - false; not only primary key, but also other constraints can be defined both on table level and column level, e.g. CREATE TABLE a (b NUMBER UNIQUE) or CREATE TABLE a (b NUMBER, UNIQUE(b)) G - true; e.g. CREATE TABLE child (a number, b number REFERENCES parent(c)) or CREATE TABLE CHILD (a number, b number, FOREIGN KEY (parent_id) REFERENCES parent(c)) Source: A,B,C Oracle documentation: Oracle Database, Release 19, SQL Language Reference, 8 Common SQL DDL Clauses, constraint
upvoted 2 times
...
Oracle2020
11 months ago
The correct answers are A,C,E,G The D is not correct because for referential integrity it does not allow you to delete rows from the parent table and leave related rows in the child tables. The E is correct because effectively when you delete rows from the parent table and you specify on delete cascade in the delete statement, it will delete the related rows in the child tables. If it is not specified, it does not allow deleting records from the parent table if you have related records.
upvoted 2 times
...
zouve
11 months, 1 week ago
Selected Answer: ADEG
AEG are for sure right BFC are definitely wrong so i believe ADEG is the right combination
upvoted 1 times
...
fthusa
1 year, 1 month ago
ADEG are true ,
upvoted 1 times
...
ryuah
2 years, 1 month ago
Selected Answer: ADEG
good choice
upvoted 1 times
...
algerianphoenix
2 years, 2 months ago
ADEG, without a shadow of doubt, just common DB knowledge.
upvoted 1 times
...
Franky_T
2 years, 2 months ago
Selected Answer: ADEG
A is correct. The only restriction is on the PK, a table can have only one. No restrictions exist on the number of FK's a table may have. B is wrong. Tables may have many foreign keys in them, it all depends on the db's relational model. C is wrong. The DB does not care about column names, only data type, size and contents of the PK and FK. D is correct. The FK must be created with the ON DELETE SET NULL option. Without this option ORA-02292 will be raised when attempting to delete a row from the parent table that has child record. E is correct. The FK must be created with ON DELETE CASCADE option. Without this option ORA-02292 will be raised when attempting to delete a row from the parent table that has child record. F is wrong. The only constraint that has to be defined inline (column level) is NOT NULL. G is correct. The only constraint that has to be defined inline (column level) is NOT NULL.
upvoted 1 times
...
casfdsaf
2 years, 4 months ago
Selected Answer: ADEF
adeg is correct
upvoted 1 times
...
ryuah
2 years, 6 months ago
A,D,E,G is correct
upvoted 2 times
...
LongHi
2 years, 7 months ago
ADEG correct
upvoted 1 times
LongHi
2 years, 7 months ago
D: using ON DELETE cascade F: using on delete set null
upvoted 1 times
LongHi
2 years, 7 months ago
sorry error typo: E: using on delete set null
upvoted 1 times
...
...
...
you1234
4 years ago
ACEG is correct answer
upvoted 4 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