mysql基本功能 增,刪,改,查
增 ==》 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 |
+----+--------+