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>
    <‘孫策’,‘江東集團(tuán)’,‘56.34’>
    <‘曹操’,‘宦官后裔’,‘10.12’>

二、改 更新某表的某列

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

三、刪 刪除某表的某行數(shù)據(jù)

  • 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;
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

  • 一.MySQL 中的約束 1.約束類型 非空約束(not null) 唯一性約束(unique) ...
    珂and超閱讀 362評論 0 0
  • 1、查看插入表數(shù)據(jù) select * from 表名 2、(1)增 insert into (1)完全插入 ins...
    末版車閱讀 539評論 0 0
  • 1、查看插入表數(shù)據(jù)select * from 表名2、(1)增 insert into(1)完全插入insert ...
    dream_seeker閱讀 390評論 0 0
  • 注:自己整合的資料,非原創(chuàng) insert(增)# 1.insert用于向一個已有的表中插入新行。 INSERT [...
    黑夜與繁星閱讀 516評論 0 1
  • 來邢臺前把家里養(yǎng)的花都送人了,當(dāng)時覺得一身輕松,不用再存水澆花。出遠(yuǎn)門也不必?fù)?dān)心花會不通風(fēng),會饑渴。不用擔(dān)心花瓣枯...
    16effd649a81閱讀 409評論 0 3

友情鏈接更多精彩內(nèi)容