Showing entries 31 to 32
« 10 Newer Entries
Displaying posts with tag: Pop Quiz (reset)
MySQL Pop Quiz #2

Yesterday’s Pop Quiz seemed quite popular, I got some personal responses and a couple of funny comments.

So here’s another one:

The table t is defined thusly on a MySQL server with no sql modes set:

  CREATE TABLE t (
   id INT NOT NULL PRIMARY KEY AUTO_INCREMENT
  );

You now do…

  INSERT INTO t (id) VALUES (NULL);
  SELECT * FROM t WHERE id IS NULL

What will be the result of the SELECT?

Spanish translation by Marcos Besteiro
(more…)

MySQL Pop Quiz

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?
Spanish translation by Marcos Besteiro
(more…)

Showing entries 31 to 32
« 10 Newer Entries