MySQL--資料的增刪改(查在下一節單講)

來源:互聯網
上載者:User

標籤:mysql--資料的增刪改(查在下一節單講)

- 增加insert into ... values(...) insert into 表名;values()要包含全部的資料; insert into 表名(欄位);values()只需要列舉對應的資料;| 全列插入insert into studentsvalues(0,‘郭靖‘,1,‘蒙古‘,‘2016-1-2‘);| 部分插入insert into students (name, birth)values ("王二", “2008-08-08”);| 多行插入insert into students (name, birth)values ("劉備", "1000-08-08"),("張飛", "1000-08-08");- 修改(更新)| 根據where後面的條件,修改欄位update 表名 set 列1=值1... where 條件(相同的資料)update students set age=21;update students set age=18 where id=1;update students set age=10,gender=4 where id=1;- 刪除| 物理刪除delete from 表名 where 條件;delete from students where id=1;| 邏輯刪除# 資料沒有真實刪除,# 只是添加了一個是否在使用中的標記--添加一個is_delete欄位,資料類型為二進位alter table students add is_delete bit;--給欄位添加預設值alter table students add is_delete bit;--修改欄位的值,來正確標記是否在使用中alter table students set is_delete=1 where id=1;

MySQL--資料的增刪改(查在下一節單講)

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.