You started a MySQL command –line session with sq1_ mode (empty), and created the
person table with the structure:
Mysql> DESC person;
You issue:
INSERT INTO person VALUES (‘casper’, ‘undefined’)
What is the effect?
A.
‘Casper’ and ‘ undefined values are inserted into the ‘name’ and gender’ column.
B.
The server returns an error indicating that ‘undefined’ cannot be inserted into a column of
ENUM type
C.
The server returns a warning and the empty string is inserted to the ‘gender’ column.
D.
The server returns a warning and the first specified value ,”male” is inserted to the gender
column.
C
C.
set sql_mode= ”;
select @@sql_mode;
create table person
(
`name` varchar(30) default null,
gender enum(‘male’,’female’) default null
);
INSERT INTO person VALUES (‘casper’, ‘undefined’);
1 row(s) affected, 1 warning(s): 1265 Data truncated for column ‘gender’ at row 1
select * from person;
name, gender
‘casper’, ”
C
C because sql mode is empty otherwise B