1.命令行进入数据库
net start mysql
mysql -uroot -p
(输入你的数据库密码)
show databases;
use (你所使用的数据库);
2.创建表
mysql> CREATE TABLE hero (
-> id int(11) AUTO_INCREMENT,
-> name varchar(30) ,
-> hp float ,
-> damage int(11) ,
-> PRIMARY KEY (id)
-> ) DEFAULT CHARSET=utf8;
将主键设为id
默认字符编码为utf8
3.增
insert into hero values(null,'盖伦',616,100);
4.查
select * from hero;
select * from hero where id =1;
5.改
update hero set hp=818 where id=1;
6.删
delete from hero where id=1;