search
尋找貓咪~QQ 地點 桃園市桃園區 Taoyuan , Taoyuan

MySQL 資料表與欄位註解內容MySQL 寫入/讀取 資料表 與 欄位 註解 內容 – jashliao部落格

MySQL 寫入/讀取 資料表 與 欄位 註解 內容

資料來源:http://fannys23.pixnet.net/blog/post/30008933

 

01.建立註解語法:

    CREATE TABLE 資料表名稱 (
            欄位名稱 資料型別 欄位定義 COMMENT ‘欄位註解內容’,
            …
    ) COMMENT ‘資料表註解內容’;

    ex:
    CREATE TABLE IF NOT EXISTS `authorization_group_detailed` (
      `authorization_group_id` int(11) DEFAULT NULL,
      `data_id` int(11) DEFAULT NULL,
      `data_type` int(11) DEFAULT NULL COMMENT ‘[1]->door_group,[2]->door,[-1]->card_group,[-2]->card’,
      `state` int(11) NOT NULL DEFAULT ‘1’
    ) ENGINE=MyISAM DEFAULT CHARSET=utf8;    
    
02.取得註解
    
    方法1:直接匯出SQL即可    [我都用這個方法,因為我笨]
    方法2:使用phpmyadmin的列印預覽
    方法3:SQL
        — 資料表註解
            select table_schema, table_name, table_comment
            from information_schema.tables
            where table_schema=‘資料庫名稱’;
        — 資料欄位註解
            select table_name, column_name, column_type, column_key, extra, column_comment
            from information_schema.columns
            where table_schema=‘資料庫名稱’;

        ex:
        select table_name, column_name, column_type, column_key, extra, column_comment
        from information_schema.columns
        where table_schema=‘test’;

 

 

 

 



熱門推薦

本文由 jashliaoeuwordpress 提供 原文連結

寵物協尋 相信 終究能找到回家的路
寫了7763篇文章,獲得2次喜歡
留言回覆
回覆
精彩推薦