zoukankan      html  css  js  c++  java
  • mysql 显示表结构

     例子

    mysql> show columns from table1;
    +------------+------------------+------+-----+---------+----------------+
    | Field      | Type             | Null | Key | Default | Extra          |
    +------------+------------------+------+-----+---------+----------------+
    | name_new   | char(32)         | YES  |     | NULL    |                |
    | transactor | varchar(10)      | NO   |     | NULL    |                |
    | pid        | int(10) unsigned | NO   | PRI | NULL    | auto_increment |
    | order_date | datetime         | YES  |     | NULL    |                |
    +------------+------------------+------+-----+---------+----------------+
    4 rows in set (0.00 sec)

     例子

    mysql> desc table1;
    +------------+------------------+------+-----+---------+----------------+
    | Field      | Type             | Null | Key | Default | Extra          |
    +------------+------------------+------+-----+---------+----------------+
    | name_new   | char(32)         | YES  |     | NULL    |                |
    | transactor | varchar(10)      | NO   |     | NULL    |                |
    | pid        | int(10) unsigned | NO   | PRI | NULL    | auto_increment |
    | order_date | datetime         | YES  |     | NULL    |                |
    +------------+------------------+------+-----+---------+----------------+
    4 rows in set (0.00 sec)

     例子

    mysql> show create table table1;
    +--------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
    | Table  | Create Table                                                                                                                                                                                                                                                            |
    +--------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
    | table1 | CREATE TABLE `table1` (
      `name_new` char(32) DEFAULT NULL,
      `transactor` varchar(10) NOT NULL,
      `pid` int(10) unsigned NOT NULL AUTO_INCREMENT,
      `order_date` datetime DEFAULT NULL,
      PRIMARY KEY (`pid`)
    ) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=latin1 |
    +--------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
    1 row in set (0.00 sec)

  • 相关阅读:
    LeetCode 79. 单词搜索
    LeetCode 1143. 最长公共子序列
    LeetCode 55. 跳跃游戏
    LeetCode 48. 旋转图像
    LeetCode 93. 复原 IP 地址
    LeetCode 456. 132模式
    LeetCode 341. 扁平化嵌套列表迭代器
    LeetCode 73. 矩阵置零
    LeetCode 47. 全排列 II
    LeetCode 46. 全排列
  • 原文地址:https://www.cnblogs.com/sea-stream/p/11300363.html
Copyright © 2011-2022 走看看