Saturday, 15 September 2012

mysql - SQL data constraints doubts -


In SQL, can you set a column that will be unique to the null value Allows?

What happens if there are several rows for that column in the null value?

If you specify a foreign key for that column in another table, and there is a null value for the foreign key in a tube in the reference table?

/ div>

You want a column set with a unique index as null There may be several rows with in the Mysql check the table below:

  create table 'test1' (`id` int (11) unsigned null atangment,` null Qualified 'et' (11) default null, primary key (`ID`), unique key 'null qualified' (` faucetable ')) engine = InDebbi default charge = UTF8; In the values ​​(1, zero), (2, faucet), (3, zero) in `test1` (` id`, `tapable ');  

You can add as many records as you would like to make this table with a tap in faucetable field.

I think I have the name faucet :).


No comments:

Post a Comment