【資料庫】】MySQL之desc查看錶結構的詳細資料

來源:互聯網
上載者:User

標籤:意思   例子   type   dex   creat   sql   person   efault   詳細資料   

在mysql中如果想要查看錶的定義的話;有如下方式可供選擇

  1、show create table 語句:

show create table table_name;

  2、desc table_name 語句:

create table person(    id int not null auto_increment primary key,    name varchar(8),    index ix__person__name (name));desc person;+-------+------------+------+-----+---------+----------------+| Field | Type       | Null | Key | Default | Extra          |+-------+------------+------+-----+---------+----------------+| id    | int(11)    | NO   | PRI | NULL    | auto_increment || name  | varchar(8) | YES  | MUL | NULL    |                |+-------+------------+------+-----+---------+----------------+

由這個例子可以看出:

    Field:欄位表示的是列名

  Type:欄位表示的是列的資料類型

    Null :欄位表示這個列是否能取空值

    Key :在mysql中key 和index 是一樣的意思,這個Key列可能會看到有如下的值:PRI(主鍵)、MUL(普通的b-tree索引)、UNI(唯一索引)

    Default: 列的預設值

    Extra :其它資訊

【資料庫】】MySQL之desc查看錶結構的詳細資料

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.