« Installing MySQL 5.1 on Kubuntu, Ubuntu or Asus EEE | Main | MySQL Pop Quiz #2 »
MySQL Pop Quiz
By Carsten | February 14, 2008
Spanish translation by Marcos Besteiro
The table t is defined thus:
CREATE TABLE t ( id INT NOT NULL, data CHAR(30) DEFAULT NULL, UNIQUE (id, data) );
You now do…
INSERT INTO t VALUES (1, NULL);
Which causes one row to be inserted into the table. Keeping in mind that the UNIQUE index spans across both columns, what would happen if you were to repeat the INSERT command?
February 14th, 2008 at 2:02 am
If a NULL falls in the forest, is it true or false?
February 14th, 2008 at 10:01 am
I suppose that would depend on whether someone is around to hear it falling.
February 14th, 2008 at 2:01 pm
Because modern DBMS is based on three-valued logic which is not very logical.This quiz will has different implementation.
It will inserted again in MySQL,but not Oracle(ORA-00001).
February 14th, 2008 at 8:57 pm
I think MySQL will explode but the remaining bits and pieces will clog together Terminator style and form a lil’ Oracle instance. As they should.
February 14th, 2008 at 10:22 pm
[...] MySQL Pop Quiz [...]
February 21st, 2008 at 12:29 pm
It would do the same in Oracle. However, without the not null constraint on id, inserting (null, null) two times would fail. Would it fail to in MySQL ?
February 28th, 2008 at 2:03 pm
[...] Mysql Test Quiz 1 Original [...]
March 28th, 2008 at 1:50 pm
[...] ???????? [...]