主要笔记来源mysql帮助文档
http://dev.mysql.com/doc/refman/5.1/zh/sql-syntax.html
1,比较常见的创建mysql表的方法; drop table if exists `tablname` ; create table `tablename` ([create_defination ])[table_options]
a. create table if not exists `tablename` like `odd_tablename`;
b.create table if not exists `tablename` (`id` int(10) unsigned not null auto_increment,
`name` char(30) not null,
`nickname` char(30) not null,
primary key(`id`)
)ENGINE=MyISAM DEFAULT CHARSET=utf8;
2.插入数据表insert语法;
a. insert into `tablename` set `col_name1`=val1, `col_name2`=val2;
b. insert into `tablename` (`col_name1`, `col_name2`, `col_name3`) values ( val1, val2, val3);
c. insert into `tablename` values(val1, val2, val3);
3.更新数据表update语法;
a. update `tablename` set `col_name1` = val1, `col_name2` = val2, `col_name3` = val3;
3.删除数据表drop语法;
a. drop table `tablename`;
4.删除数据表记录保持数据表结构delete语法;
a. delete from `tablename` where [where_definiton] [group by] [limit]
5.更改表结构alte;
a. alter table `tablename` add column `new_col_name` (colname_definition);
b. alter table `tablename` add index `new_index_name` (`col_name`);
c. alter table `tablename` add unique key (`col_name`);
d.alter table `tablename` alter column `col_name` (col_name_definition);
e.alter table `tablename` drop colum `col_name`;
f. alter table `tablename` drop index `index_name`;