NOT NULL
and DEFAULT
values
ENUM
and SET
Normally you will get an error when you try to INSERT
/
UPDATE
a row that causes a primary key, unique key or foreign key
violation. If you are using a transactional storage engine, like
InnoDB, MySQL will automatically roll back the transaction. If you are
using a non-transactional storage engine MySQL will stop at the wrong
row and leave the rest of the rows unprocessed.
To make life easier MySQL has added support for the IGNORE
directive to most commands that can cause a key violation (like
INSERT IGNORE ...
). In this case MySQL will ignore any key
violation and continue with processing the next row. You can get
information of what MySQL did with the mysql_info()
API function
and in later MySQL 4.1 version with the SHOW WARNINGS
command. See section 9.1.3.29 mysql_info()
. See section 4.5.7.9 SHOW WARNINGS | ERRORS
.
Note that for the moment only InnoDB
tables support foreign keys.
See section 7.5.5.2 Foreign Key Constraints.
Foreign key support in MyISAM
tables is scheduled for inclusion
in the MySQL 5.0 source tree.