sql - NULL vs DEFAULT NULL vs NULL DEFAULT NULL in MYSQL column creation? -


following sql table definition illustrated 1 of create table statement mysql database developed former developer of company.

drop table if exists `classifieds`.`category_vehicles`; create table `classifieds`.`category_vehicles`( `adv_id_ref` bigint unsigned not null, `category_id_ref` tinyint unsigned not null, `forsale_status` tinyint (1) not null, `vehicle_type_id_ref` tinyint unsigned not null, `price` double null default null,  primary key (`adv_id_ref`) ) engine = innodb charset = latin1 collate = latin1_swedish_ci ; 

in there @ statement price double null default null,

normally using

price double null;

if want enable column accept null values.

so differences between these 3 statements?

1) price double null;

2) price double default null;

3) price double null default null;

thank much.

there no difference. null default null implicit default.

from create table documentation:

  • if neither null nor not null specified, column treated though null had been specified

from "data type default values" chapter:

  • if column definition includes no explicit default value, mysql determines default value follows: if column can take null value, column defined explicit default null clause.

Comments

Popular posts from this blog

php - Submit Form Data without Reloading page -

linux - Rails running on virtual machine in Windows -

php - $params->set Array between square bracket -