mysql+'@'%_mysql

mysql> select * from users;

+-------+-------------+------------------------------------------------------------------+---------------+--------+

| id    | username    | password                                                         | email         | status |

+-------+-------------+------------------------------------------------------------------+---------------+--------+

| 10005 | ??134       | ccb797aae770710012a7b0e5834e7ee5c1994f80a31bc86332b96e1c90015cea | 0             |      0 |

| 10006 | ????        | 31ed43c7ba20fa7b2600b200b064de3c7cdbafe0c32019101daf93203c8ac27b | NULL          |      0 |

| 10007 | ceshiyonghu | 111                                                              | 110000@qq.com |      1 |

| 10008 | liu         |                                                                  | NULL          |      0 |

+-------+-------------+------------------------------------------------------------------+---------------+--------+

查询某个字段

mysql> select id, username from users;

+-------+-------------+

| id    | username    |

+-------+-------------+

| 10005 | ??134       |

| 10006 | ????        |

| 10007 | ceshiyonghu |

| 10008 | liu         |

+-------+-------------+

4 rows in set (0.00 sec)

5. 更新某个字段

mysql> update users set username = 'liu2' where id = 10008;

Query OK, 1 row affected (0.00 sec)

where语句用来定位某几行

mysql> select * from users;

+-------+-------------+------------------------------------------------------------------+---------------+--------+

| id    | username    | password                                                         | email         | status |

+-------+-------------+------------------------------------------------------------------+---------------+--------+

| 10005 | ??134       | ccb797aae770710012a7b0e5834e7ee5c1994f80a31bc86332b96e1c90015cea | 0             |      0 |

| 10006 | ????        | 31ed43c7ba20fa7b2600b200b064de3c7cdbafe0c32019101daf93203c8ac27b | NULL          |      0 |

| 10007 | ceshiyonghu | 111                                                              | 110000@qq.com |      1 |

| 10008 | liu2        |                                                                  | NULL          |      0 |

+-------+-------------+------------------------------------------------------------------

更新多个字段

mysql> update users set username = 'liu2' , password = '222' where id = 10008;

Query OK, 1 row affected (0.00 sec)

mysql> select * from users;

+-------+-------------+------------------------------------------------------------------+---------------+--------+

| id    | username    | password                                                         | email         | status |

+-------+-------------+------------------------------------------------------------------+---------------+--------+

| 10005 | ??134       | ccb797aae770710012a7b0e5834e7ee5c1994f80a31bc86332b96e1c90015cea | 0             |      0 |

| 10006 | ????        | 31ed43c7ba20fa7b2600b200b064de3c7cdbafe0c32019101daf93203c8ac27b | NULL          |      0 |

| 10007 | ceshiyonghu | 111                                                              | 110000@qq.com |      1 |

| 10008 | liu2        | 222                                                              | NULL          |      0 |

+-------+-------------+------------------------------------------------------------------+---------------+--------+

6. 删除记录:

mysql> delete from users where id = 10008;

Query OK, 1 row affected (0.00 sec)

mysql> select * from users;

+-------+-------------+------------------------------------------------------------------+---------------+--------+

| id    | username    | password                                                         | email         | status |

+-------+-------------+------------------------------------------------------------------+---------------+--------+

| 10005 | ??134       | ccb797aae770710012a7b0e5834e7ee5c1994f80a31bc86332b96e1c90015cea | 0             |      0 |

| 10006 | ????        | 31ed43c7ba20fa7b2600b200b064de3c7cdbafe0c32019101daf93203c8ac27b | NULL          |      0 |

| 10007 | ceshiyonghu | 111                                                              | 110000@qq.com |      1 |

+-------+-------------+------------------------------------------------------------------+---------------+--------+

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值