mysql 語法 mysql的刪除語法

2021-08-20 02:04:17 字數 1061 閱讀 8513

刪除資料庫

drop

database test;

刪除表

drop

table

ifexists test;

刪除表資料

delete

from test /* where id =1 */; #不會減少表或索引所占用的空,可以加where條件,可以進行rollback回滾

truncate

table test; #執行速度快,刪除所有的資料,並不把單獨的刪除操作記錄記入日誌儲存,刪除行是不能恢復的,並且在刪除的過程中不會觸發與表有關的刪除觸發器

刪除表字段

alter

table test drop

column name;

刪除檢視

drop

view

ifexists v_test;

刪除函式

drop function if

exists f_test;

刪除儲存過程

drop

procedure

ifexists f_test;

刪除觸發器

drop

trigger

ifexists f_test;

刪除事件

drop event if

exists f_test;

mysql修改 刪除表的語法

首先都以alter開頭 修改表名 alter teble 舊表名 rename to 新錶名 修改字段資料型別 alter table 表名 modify 欄位名 資料型別 修改欄位名 alter table 表名 change 舊表名 新錶名 新資料型別 新增字段 alter table 表名 a...

mysql 的基本語法 MYSQL基本語法

資料庫 可視為電子化的檔案櫃 儲存電子檔案的處所 為什麼使用資料庫 持久化 方便管理資料 結構化查詢 非結構化查詢 net start 程式 啟動 net stop 程式 結束 mysql uroot p3307 p 新建資料庫 create database 資料庫名 使用資料庫 use 資料庫名...

mysql的基本語法 mysql的基本語法

正文本篇文章主要是記錄一些常用的mysql語法,方便使用時候進行查閱。linux上常用命令 命令都以 結尾 1,登入mysql mysql u賬號 p密碼 2,檢視幫助 help 或者 h 3,檢視有哪些資料庫 show databases 4,進入某個資料庫 use databasename 5,...