增 ==》 insert into 库. 表 (字段名列表) values(值列表);
- MySQL> create table meinvdb.mm(
- -> id int(4) not null primary key,
- -> name varchar(18) not null
- -> );
- Query OK, 0 rows affected (0.23 sec)
- MySQL> insert into meinvdb.mm (id ,name)values (1,"liuyan"),(2,"yangmi");
- Query OK, 2 rows affected (0.09 sec)
- Records: 2 Duplicates: 0 Warnings: 0
改 ==》 update 表名 set 条件 where 字段名 ="值" ;
- MySQL> update meinvdb.mm set id=1 where name="bingbing";
- Query OK, 0 rows affected (0.00 sec)
- Rows matched: 0 Changed: 0 Warnings: 0
查 ==》select 字段列表 from 表名 where 条件表达式列表;
- MySQL> select name from meinvdb.mm where id=2;
- +--------+
- | name |
- +--------+
- | yangmi |
- +--------+
- 1 row in set (0.00 sec)
删 ==》delete from 表名 where 条件;
- MySQL> delete from meinvdb.mm where id=1;
- Query OK, 1 row affected (0.08 sec)
- MySQL> select * from meinvdb.mm;
- +----+--------+
- | id | name |
- +----+--------+
- | 2 | yangmi |
- +----+--------+
来源: http://www.bubuko.com/infodetail-2853803.html