zoukankan      html  css  js  c++  java
  • Mysql基本命令二

    1. 删除id>10的记录:delete from user where id>10; 
    2. 设置user表的自增字段起始值为10:alter table user anto_increment=10;  设置user表的自增字段起始值为10
    3. 表字段自我复制:insert into user select * from user;
      *如果表有自增字段,自增字段是不能复制的,代码改为:insert into user(name,pass) select name,pass from user;
    4. 更新表字段:update user set name='admin' where name is null;
    5. 添加表字段:alter table user add pid int(11);
    6. 删除表字段:alter table user drop pid;
    7. 显示表的列名信息:show columns from emp
    8. 把user表的password字段md5加密:update user set password=md5('password');  (*这只是更新之前的密码值,新插入的数据仍然是没有加密的,但是可以通过insert into user values(2,'admin',md5('admin'));来实现加密,那么每次插入自动加密应该怎么实现?)
    9. 同表中从一条记录更新另一条记录:update user set name=('select name from art where id=2') where id=1;
    10.  concat函数(连接字符串): select concat(id,",",pid) from goods_type;
      
  • 相关阅读:
    os模块
    sys模块
    time时间模块
    collections模块
    修改Jenkins的主目录步骤
    jenkins管理
    求2个集合的差集
    MVC动态二级域名解析
    解决MVC 时间序列化的方法
    MVC修改视图的默认路径
  • 原文地址:https://www.cnblogs.com/yolo-bean/p/7305764.html
Copyright © 2011-2022 走看看