欧美亚洲中文,在线国自产视频,欧洲一区在线观看视频,亚洲综合中文字幕在线观看

      1. <dfn id="rfwes"></dfn>
          <object id="rfwes"></object>
        1. 站長資訊網(wǎng)
          最全最豐富的資訊網(wǎng)站

          MySQL如何操作數(shù)據(jù)表

          MySQL操作數(shù)據(jù)表的方法并不復(fù)雜,下面將為您詳細(xì)介紹MYSQL添加字段、修改字段、刪除字段、 獲取表名等操作的實現(xiàn)方法,希望對您學(xué)習(xí)MySQL添加字段方面會有所幫助。

          MySQL如何操作數(shù)據(jù)表

          MySQL添加字段的方法并不復(fù)雜,下面將為您詳細(xì)介紹MYSQL添加字段和修改字段等操作的實現(xiàn)方法,希望對您學(xué)習(xí)MySQL添加字段方面會有所幫助。

          1添加表字段

          alter table table1 add transactor varchar(10) not Null; alter table   table1 add id int unsigned not Null auto_increment primary key

          添加到特定字段后面的語句例子:

          ALTER TABLE <表名> ADD <新字段名><數(shù)據(jù)類型>[約束條件]; ALTER TABLE MyTableName ADD newDBField varchar(30) NULL AFTER existDBField; ALTER TABLE tableName001 ADD WebAdminPass varchar(30) NULL AFTER Result;

          2.修改某個表的字段類型及指定為空或非空

          alter table 表名稱 change 字段名稱 字段名稱 字段類型 [是否允許非空]; alter table 表名稱 modify 字段名稱 字段類型 [是否允許非空]; alter table 表名稱 modify 字段名稱 字段類型 [是否允許非空];

          3.修改某個表的字段名稱及指定為空或非空

          alter table 表名稱 change 字段原名稱 字段新名稱 字段類型 [是否允許非空

          4如果要刪除某一字段,可用命令:

          ALTER TABLE mytable DROP 字段名;

          mysql SQL獲取表名&字段名的查詢語句

          1:查詢數(shù)據(jù)庫中所有表名

          select table_name   from information_schema.tables   where table_schema='csdb' and table_type='base table'; table_schema:數(shù)據(jù)庫名稱      information_schema 表示系統(tǒng)庫。    table_type='base table‘:限定只查詢基表。

          2:查詢指定數(shù)據(jù)庫中指定表的所有字段名column_name

             select column_name      from information_schema.columns      where table_schema='csdb' and table_name='users';   table_schema:數(shù)據(jù)庫名      table_name:表名

          工作用到例子:

          select count(*) from information_schema.columns where table_schema='yanfa' and table_name='tableName001' and column_name='Result1';  #select table_name from information_schema.tables where table_schema='yanfa' and table_type='base table';

          相關(guān)學(xué)習(xí)推薦:mysql教程(視頻)

          贊(0)
          分享到: 更多 (0)
          網(wǎng)站地圖   滬ICP備18035694號-2    滬公網(wǎng)安備31011702889846號