zoukankan      html  css  js  c++  java
  • 04_mysql增删改操作

    1 插入数据记录

    1.1 插入完整数据记录

    insert into student value(1,'zhaodi',25,1,97);
    insert into student(stu_no,stu_name,stu_age,stu_sex,stu_score) VALUE(3,"zhaodi",24,1,99);
    

    1.2 插入部分数据记录

    insert into student(stu_no,stu_name) VALUE(2,"zhaodi2");
    

    1.3 插入多条记录

    insert into student VALUES(4,"zhaodi",34,0,55),(5,'zhaodi',45,4,55);
    

    1.4 插入查询结果

    INSERT into student select * from student where stu_no = 1;
    
    注意的是,插入的字段和select 的字段必须完全相同
    

    2 更新数据记录

    • 更新特定的数据记录
    update student set stu_name = 'zhaodi', stu_sex = 1 where stu_no = 1;
    
    • 更新所有的数据记录
    update table_name set field = value,.... ,where condition;
    

    3 删除数据记录

    • 删除特定的数据记录
    delete from table_name where condition;
    
    • 删除所有的数据记录
    一个小小的程序员
  • 相关阅读:
    省选后蛤蛤纪事
    About me
    第一篇blog
    震惊!山东一高中生学习锯木板,原因竟是...
    斯特林数相关
    省选后数学学习
    SDOI 2020游记
    奶茶推荐
    Goodbye 2019
    golang 并发锁的陷阱
  • 原文地址:https://www.cnblogs.com/zhaod/p/8366212.html
Copyright © 2011-2022 走看看