<button id="qvlbh"><button id="qvlbh"></button></button>
<xmp id="qvlbh"><xmp id="qvlbh"><xmp id="qvlbh"><address id="qvlbh"><output id="qvlbh"></output></address>
<xmp id="qvlbh"><legend id="qvlbh"></legend>
<xmp id="qvlbh"> <address id="qvlbh"><output id="qvlbh"></output></address>
<address id="qvlbh"><button id="qvlbh"></button></address>
<button id="qvlbh"><samp id="qvlbh"></samp></button>
<address id="qvlbh"><button id="qvlbh"></button></address><address id="qvlbh"></address>
<address id="qvlbh"><legend id="qvlbh"></legend></address>
<samp id="qvlbh"><xmp id="qvlbh"><legend id="qvlbh"></legend>
中國站
幫助中心 > 數據庫 > 云數據庫MySQL > 最佳實(shí)踐 > 為無(wú)主鍵表添加主鍵

為無(wú)主鍵表添加主鍵

查看無(wú)主鍵表

執行如下命令,查看是否有無(wú)主鍵表。

  1. select table_schema,table_name from information_schema.tables
  2. where (table_schema,table_name) not in(
  3. select distinct table_schema,table_name from information_schema.columns where COLUMN_KEY='PRI'
  4. )
  5. and table_schema not in (
  6. 'sys','mysql','information_schema','performance_schema'
  7. );

查找無(wú)主鍵表

添加主鍵

添加隱式主鍵

  1. 執行如下命令,查看參數implicit_primary_key的值是否為ON。

    1. show global variables like 'implicit_primary_key';

    查看隱式主鍵是否啟用

  2. 執行如下命令,修改無(wú)主鍵表。

    1. alter table <表名> engine=innodb;

直接添加主鍵

執行如下SQL語(yǔ)句,為無(wú)主鍵表添加主鍵。

  1. ALTER TABLE <表名> ADD PRIMARY KEY (<需要設為主鍵的列名>);
国产精品香港三级|日韩精品无码免费专区网站|熟女一区二区三区|一本伊大人香蕉久久网|jzzijzzij亚洲乱熟无码
<button id="qvlbh"><button id="qvlbh"></button></button>
<xmp id="qvlbh"><xmp id="qvlbh"><xmp id="qvlbh"><address id="qvlbh"><output id="qvlbh"></output></address>
<xmp id="qvlbh"><legend id="qvlbh"></legend>
<xmp id="qvlbh"> <address id="qvlbh"><output id="qvlbh"></output></address>
<address id="qvlbh"><button id="qvlbh"></button></address>
<button id="qvlbh"><samp id="qvlbh"></samp></button>
<address id="qvlbh"><button id="qvlbh"></button></address><address id="qvlbh"></address>
<address id="qvlbh"><legend id="qvlbh"></legend></address>
<samp id="qvlbh"><xmp id="qvlbh"><legend id="qvlbh"></legend>