mysql删表和建表语句:
DROP TABLE IF EXISTS `t_blog_user`;
CREATE TABLE `t_blog_user` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`user_name` varchar(128) NOT NULL,
`pass_word` varchar(128) NOT NULL,
`email` varchar(128) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=utf8;
DROP TABLE IF EXISTS `t_blog_post`;
CREATE TABLE `t_blog_post` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`user_name` varchar(128) NOT NULL,
`title` varchar(128) NOT NULL,
`create_time` DATE NOT NULL,
`post` varchar(256) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=utf8;
mysql 去重查询:
select DISTINCT(col_name) from table_name;
DISTINCT将返回col_name字段唯一不同的值。
MySQL更新某个字段的值为原来的值加1:
update student set score=score+1 where id = 1