设为首页 加入收藏

TOP

mysql 简单的增删改查语句
2015-11-21 02:09:30 来源: 作者: 【 】 浏览:2
Tags:mysql 简单 删改 语句
增加记录:
?
注:null关键字与auto_increment限制条件相结合,可以为字段自动赋值;字段必须全,且一一对应;字符型用单引号;
?
1 mysql> insert into test values('sunshine_habit','hello_world_lyq@163.com'
2 ? ? -> ,1558888888,null);
输出:
3 Query OK, 1 row affected (0.10 sec)
查询记录:
?
?
1 mysql> select * from test where name='sunshine_habit';
2 输出:
3 +----------------+-------------------------+--------------+----+
4 | name ? ? ? ? ? | email ? ? ? ? ? ? ? ? ? | phone_number | id |
5 +----------------+-------------------------+--------------+----+
6 | sunshine_habit | hello_world_lyq@163.com | ? 1558888888 | ?1 |
7 +----------------+-------------------------+--------------+----+
8 1 row in set (0.00 sec)
?
?修改记录:
?
1 mysql> update test set name='Sam' where name='sunshine';
输出:
2 Query OK, 1 row affected (0.06 sec)
3 Rows matched: 1 ?Changed: 1 ?Warnings: 0
删除记录
?
1 mysql> delete from test where name='Snow White';
2 Query OK, 1 row affected (0.08 sec)
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
分享到: 
上一篇Ubuntu下MySQL的安装 下一篇MYSQL设计优化

评论

帐  号: 密码: (新用户注册)
验 证 码:
表  情:
内  容: