1z1-882 無料問題集「Oracle Certified Professional, MySQL 5.6 Developer」
You have two tables:
CREATE TABLE department (
Department_ID int unsigned NOT NULL auto_increment PRIMARY KEY,
Department _Name varchar(12) NOT NULL
) ENGINE=InnoDB
CREATE TABLE employee (
Employee_Number int unsigned NOT NULL PRIMARY KEY,
Employee_Name varchar(10) NOT NULL,
Department_ID int unsigned DEFAULT NULL,
FOREIGN KEY (Department ID) REFERENCES Department (Department_ID)
ON UPDATE SET NULL ON DELETE CASCADE
)ENGINE= InnoDB
The tables have the data:
Department

You execute the statement:
REPLACE INTO department (Department_ID, Department_Name) VALUES (1, 'Admin');
What data is in the employee table after the statement?

CREATE TABLE department (
Department_ID int unsigned NOT NULL auto_increment PRIMARY KEY,
Department _Name varchar(12) NOT NULL
) ENGINE=InnoDB
CREATE TABLE employee (
Employee_Number int unsigned NOT NULL PRIMARY KEY,
Employee_Name varchar(10) NOT NULL,
Department_ID int unsigned DEFAULT NULL,
FOREIGN KEY (Department ID) REFERENCES Department (Department_ID)
ON UPDATE SET NULL ON DELETE CASCADE
)ENGINE= InnoDB
The tables have the data:
Department

You execute the statement:
REPLACE INTO department (Department_ID, Department_Name) VALUES (1, 'Admin');
What data is in the employee table after the statement?

正解:C
解答を投票する
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 TABLE 'warehouseitem' (
'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?
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 TABLE 'warehouseitem' (
'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?
正解:A、C
解答を投票する