• Python学习第二十二课——Mysql 表记录的一些基本操作 (增删改)


    记录基本操作:

    增:(insert into)

    基本语法:

    insert into 表名(字段) values(对应字段的值);

    例子1

    insert into employee(id,name,age,salary) values(1,"憨憨",24,5000);   指定添加
    insert into employee values(2,"憨憨",0,24,"技术部",5000); 对应添加
    insert into employee set name="玫玫"; 

     添加多条:

    insert into employee(name,age,salary) values("憨憨",24,500),
    ("憨",24,5000),
    ("玫玫",24,50),
    ("阿妹",24,5); 添加多条

    删(delect from)

    基本语法: delect from 表名 where 字段=“根据什么字段删除”

    DELETE from employee where id=2;  删除一条 
    DELETE from employee where id=2 or id=3; 删除多条

    改 (update set)

    基本语法:update 表明 set 字段=“修改值” where 字段=“根据那个字段修改”

    例子:

    update employee set salary=20000 where id=1;
    update employee set department="销售部" where name="玫玫";

  • 相关阅读:
    mongodb数据库shell
    PLINK pca
    xgboost 安装
    tensorflow之损失函数
    php,mysql存储过程的简单例子
    ECharts初体验
    mysql常用连接查询
    php流程控制
    php循环
    高效率php注意事项
  • 原文地址:https://www.cnblogs.com/pyhan/p/12331816.html
Copyright © 2020-2023  润新知