nerdexam
Oracle

1Z0-882 · Question #64

You attempt to create two new tables: CREATE TABLE warehouse' ( id' int (11) NOT NULL AUTO_INCREMENT, name' varchar (20) NOT NULL, phone' varchar (20) NOT NULL, PRIMARY KEY ( id) ) ENGINE=MyISAM…

The correct answer is C. The foreign key clause must be reversed: FOREIGN KEY warehouse(1)REFERENCES D. The data types of the `warehouse'.'id' and ` warehouseitem.warehouse_is columns must match. See the full explanation below for the reasoning.

Question

You attempt to create two new tables:

CREATE TABLE warehouse' ( id' int (11) NOT NULL AUTO_INCREMENT, name' varchar (20) NOT NULL, phone' varchar (20) NOT NULL, PRIMARY KEY (id) ) ENGINE=MyISAM CREATE TABLEwarehouseitem' ( warehouse_id' bigint (11) NOT NULL, item_id' int (11) NOT NULL, count' int(11) NOT NULL DEFAULT 0', KEY "warehouse_id' (`warehouse-id) , FOREIGN KEY (warehouse_id) REFFERENCES warehouse (id) ) ENGINE= InnoDB You get this error :

ERROR 1215 ( HYooo): cannot add foreign key constraint Which two changes are required to permit these statements to execute without any error?

Options

  • AThe `warehouseitem' table must be managed by the MySAm storage engine.
  • BThe `warehouse-table must be managed by the InnoDB storage engine.
  • CThe foreign key clause must be reversed: FOREIGN KEY warehouse(1)REFERENCES
  • DThe data types of the warehouse'.'id' and warehouseitem.warehouse_is columns must match.
  • EThe warehouse_id' column must be renamed id' to match the definition on the warehouse' table.
  • FA UNIQUE key must be defined for the columns (`item_id','warehouse_id').

How the community answered

(49 responses)
  • A
    12% (6)
  • B
    4% (2)
  • C
    78% (38)
  • E
    4% (2)
  • F
    2% (1)

Community Discussion

No community discussion yet for this question.

Full 1Z0-882 Practice