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)

  • 相关阅读:
    Scrapy settings 并发数更改
    tp5 规避 [ error ] 未定义数组索引
    967. Numbers With Same Consecutive Differences
    846. Hand of Straights
    1103. Distribute Candies to People
    559. Maximum Depth of N-ary Tree
    1038. Binary Search Tree to Greater Sum Tree
    538. Convert BST to Greater Tree
    541. Reverse String II
    1551. Minimum Operations to Make Array Equal
  • 原文地址:https://www.cnblogs.com/sea-stream/p/11300363.html
Copyright © 2011-2022 走看看