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)

  • 相关阅读:
    第三篇:python函数
    第二篇:数据类型
    第一篇:初识python
    PyTorch教程之Autograd
    PyTorch教程之Tensors
    如何解决Python.h:No such file or directory
    如何解决conda install:command not found问题
    Linux 安装Anaconda 4.4.0
    Linux安装pytorch的具体过程以及其中出现问题的解决办法
    Writing Science 7.10 (The Opening and The Funnel)
  • 原文地址:https://www.cnblogs.com/sea-stream/p/11300363.html
Copyright © 2011-2022 走看看