Mysql数据库常用指令
Create table Table2 (Select * from Table1);//新建一個表從table1中所有數據
alter table table1 add pid int unsigned not null auto_increment primary key;//添加主鍵
update table1 set pid=0 where pid=6;
insert table1 (transactor,name_new,pid) values("xiaohong","hahha",0);
select max(RangeIndex) from Package_tbl//查找最大值
//*********************
? string sqlStr = "select max(RangeIndex) from Package_tbl";
? ? ? ? ? ? ? ? DataTable res = dtb.SelectSQL(sqlStr);
? ? ? ? ? ? ? ? int maxIndex = Convert.ToInt32(res.Rows[0][0]);
? ? ? ? ? ? ? ? ?maxIndex +=1;
ALTER TABLE table_name DROP COLUMN field_name;//刪除列
?insert into Package_tbl (RangeIndex,Package_Name,AntiBody_Name,I_StateFlg,UpdateTime) values ('0','p16兩項','Ki67(ZM0166)','0','2019-11-20 11:00:00');
//*********************************
alter table IMBIBITION_tbl add column INJECT_SPEED_AIR INT not null after AIR_COLUMN;
alter table IMBIBITION_tbl add column AIR_COLUMN_INJECT INT not null after INJECT_SPEED_AIR;//指定字段后加入字段
ALTER TABLE contacts ADD email VARCHAR(60) FIRST;//表最前加入字段
?ALTER table Section_tbl ADD column RangeIndex INT not null;
?
總結
以上是生活随笔為你收集整理的Mysql数据库常用指令的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 解决 : Could not commi
- 下一篇: Mysql安装问题汇总