增加记录:
注:null关键字与auto_increment限制条件相结合,可以为字段自动赋值;字段必须全,且一一对应;字符型用单引号;
mysql> insert into test values('sunshine_habit','hello_world_lyq@163.com'
-> ,1558888888,null);
输出:
Query OK, 1 row affected (0.10 sec)
增加记录,给指定字段赋值:
mysql> INSERT INTO SHOP (id,name,price,sort) VALUES(13,'sugar',22.00,'A');
Query OK, 1 row affected (0.08 sec)
查询记录:
mysql> select * from test where name='sunshine_habit';
输出:
+----------------+-------------------------+--------------+----+
| name | email | phone_number | id |
+----------------+-------------------------+--------------+----+
| sunshine_habit | hello_world_lyq@163.com | 1558888888 | 1 |
+----------------+-------------------------+--------------+----+
1 row in set (0.00 sec)
修改记录:
mysql> update test set name='Sam' where name='sunshine';
输出:
Query OK, 1 row affected (0.06 sec)
Rows matched: 1 Changed: 1 Warnings: 0
删除记录
mysql> delete from test where name='Snow White';
Query OK, 1 row affected (0.08 sec)