亚洲最大看欧美片,亚洲图揄拍自拍另类图片,欧美精品v国产精品v呦,日本在线精品视频免费

  • 站長(zhǎng)資訊網(wǎng)
    最全最豐富的資訊網(wǎng)站

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

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

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

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

    1添加表字段

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

    添加到特定字段后面的語(yǔ)句例子:

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

    2.修改某個(gè)表的字段類(lèi)型及指定為空或非空

    alter table 表名稱(chēng) change 字段名稱(chēng) 字段名稱(chēng) 字段類(lèi)型 [是否允許非空]; alter table 表名稱(chēng) modify 字段名稱(chēng) 字段類(lèi)型 [是否允許非空]; alter table 表名稱(chēng) modify 字段名稱(chēng) 字段類(lèi)型 [是否允許非空];

    3.修改某個(gè)表的字段名稱(chēng)及指定為空或非空

    alter table 表名稱(chēng) change 字段原名稱(chēng) 字段新名稱(chēng) 字段類(lèi)型 [是否允許非空

    4如果要?jiǎng)h除某一字段,可用命令:

    ALTER TABLE mytable DROP 字段名;

    mysql SQL獲取表名&字段名的查詢(xún)語(yǔ)句

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

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

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

       select column_name      from information_schema.columns      where table_schema='csdb' and table_name='users';   table_schema:數(shù)據(jù)庫(kù)名      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號(hào)-2    滬公網(wǎng)安備31011702889846號(hào)