user表:

+-------+-------------+------+-----+---------+-------+
| Field | Type        | Null | Key | Default | Extra |
+-------+-------------+------+-----+---------+-------+
| id    | int         | YES  |     | NULL    |       |
| name  | varchar(20) | YES  |     | NULL    |       |
| age   | int         | YES  |     | NULL    |       |
+-------+-------------+------+-----+---------+-------+
3 rows in set (0.00 sec)

插入数据

插入一条数据

insert into user values(1, "panghu", "100");

根据字段插入一条数据

insert into user (id, name, age) values (2, "yemo", "100");

查看数据

查看表数据

select *|字段 from 表;

查看全部字段

select * from user;

查看name字段

select name from user;

查看id为1的name

select name from user where id = 1;

更新数据

namepanghu的更新为go

update user set name = "go" where name = "panghu";

删除数据

namego的删除

delete from user where name = "go";