MySQL增删改查

一、增 在某表添加一行:

  • 只插入行中某些列:
    insert into class
    <name,gender,salary>
    value
    <'枫耀',‘男’,8765.43>;
  • 插入行中所有列:
    insert into class
    values
    <'枫耀',‘男’,'22',8765.43>;
  • 同时插入多行:
    insert into class
    <name ,gender ,salary>
    values
    <'刘备',‘皇室成员’,15.28>
    <‘孙策’,‘江东集团’,‘56.34’>
    <‘曹操’,‘宦官后裔’,‘10.12’>

二、改 更新某表的某列

  • update class
    set gender=‘男’ ,fanbu='212'
    where id =6;

三、删 删除某表的某行数据

  • delete from class
    where salary>8800;
  • delete from class
    where salary>8000 and gender='女';

四、查 查找哪个表的哪些列

  • select name,company,salary
    from class
    where id=6;
  • 暴力查找class表的全部:
    select * from class;
  • select * from class
    where id>3;
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • 一.MySQL 中的约束 1.约束类型 非空约束(not null) 唯一性约束(unique) ...
    珂and超阅读 343评论 0 0
  • 1、查看插入表数据 select * from 表名 2、(1)增 insert into (1)完全插入 ins...
    末版车阅读 488评论 0 0
  • 1、查看插入表数据select * from 表名2、(1)增 insert into(1)完全插入insert ...
    dream_seeker阅读 360评论 0 0
  • 注:自己整合的资料,非原创 insert(增)# 1.insert用于向一个已有的表中插入新行。 INSERT [...
    黑夜与繁星阅读 480评论 0 1
  • 来邢台前把家里养的花都送人了,当时觉得一身轻松,不用再存水浇花。出远门也不必担心花会不通风,会饥渴。不用担心花瓣枯...
    16effd649a81阅读 381评论 0 3