新聞中心
這里有您想知道的互聯(lián)網(wǎng)營銷解決方案
MySQL常用命令整理匯總
以下的文章主要介紹的是MySQL 常用命令以及對MySQL 常用命令的整理 ,我們大家都知道MySQL 常用命令在實際應(yīng)用中應(yīng)用的比例是比較多的,今天我們就像大家詳細介紹一下MySQL 常用命令與其整理。

站在用戶的角度思考問題,與客戶深入溝通,找到秭歸網(wǎng)站設(shè)計與秭歸網(wǎng)站推廣的解決方案,憑借多年的經(jīng)驗,讓設(shè)計與互聯(lián)網(wǎng)技術(shù)結(jié)合,創(chuàng)造個性化、用戶體驗好的作品,建站類型包括:成都網(wǎng)站制作、成都網(wǎng)站設(shè)計、外貿(mào)營銷網(wǎng)站建設(shè)、企業(yè)官網(wǎng)、英文網(wǎng)站、手機端網(wǎng)站、網(wǎng)站推廣、主機域名、雅安服務(wù)器托管、企業(yè)郵箱。業(yè)務(wù)覆蓋秭歸地區(qū)。
是否存在
- MySQL> use imss;
- MySQL> select if(exists(select * from information_schema.columns where table_name =
'imss_righttemplate' and column_name='id_righttemplate'),'yes','no') as cz ;
MySQL 常用命令整理 :主鍵
- MySQL> alter table tabelname add new_field_id int(5) unsigned default 0 not null auto_increment ,add primary key (new_field_id);
增加一個新列
- MySQL> alter table t2 add d timestamp;
- MySQL> alter table infos add ex tinyint not null default '0';
刪除列
- MySQL> alter table t2 drop column c;
重命名列
- MySQL> alter table t1 change a b integer;
改變列的類型
- MySQL> alter table t1 change b b bigint not null;
- MySQL>alter table infos change list list tinyint not null default '0';
MySQL 常用命令整理 :重命名表
- MySQL> alter table t1 rename t2;
加索引
- MySQL> alter table tablename change depno depno int(5) not null;
- MySQL> alter table tablename add index 索引名 (字段名1[,字段名2 …]);
- MySQL> alter table tablename add index emp_name (name);
加主關(guān)鍵字的索引
- MySQL> alter table tablename add primary key(id);
加***限制條件的索引
- MySQL> alter table tablename add unique emp_name2(cardnumber);
刪除某個索引
- MySQL>alter table tablename drop index emp_name;
增加字段
- MySQL> ALTER TABLE table_name ADD field_name field_type;
修改原字段名稱及類型
- MySQL> ALTER TABLE table_name CHANGE old_field_name new_field_name field_type;
刪除字段
- MySQL> ALTER TABLE table_name DROP field_name;
以上的相關(guān)內(nèi)容就是對MySQL 常用命令整理的介紹,望你能有所收獲。
分享文章:MySQL常用命令整理匯總
當(dāng)前路徑:http://fisionsoft.com.cn/article/dpdopos.html


咨詢
建站咨詢
