mysql - Doesn't this script create the same table every time it's run? -


recently i've been trying work databases advance website functionality. keep seeing different ways create tables; 1 of them seems to create table through code.

example:

create table `phone` (     `id` mediumint(8) unsigned not null auto_increment,     `country` decimal(5,0) unsigned not null,     `area` decimal(5,0) unsigned not null,     `number` decimal(8,0) unsigned not null,     `extension` decimal(5,0) unsigned default null,     primary key (`id`) ) engine=innodb auto_increment=0 default charset=utf8; 

i'm confused this. if in php code, every time script run wouldn't try create same table on , over? or work if table not exist?

this sql, mysql not php.

as such information on row types read manual mysql. documented. https://dev.mysql.com/doc/refman/5.5/en/create-database.html

and there way have table created if not exists. typically not trying automate thigns table creation code. i'd suggest getting ide database design. there free mysql gui tools / workbench provided sun.

then doing few beginner tutorials on sql. many, many of them out there.

i don't typically down vote question answer it... maybe jsut close , read more?


Comments

Popular posts from this blog

java - Spring Data JPA: Why findOne(id) executing delete query internally? -

python - Mongodb How to add addtional information when aggregating? -

java - Incorrect order of records in M-M relationship in hibernate -