mysql查看表结构语句
- 查看mysql表结构的方法有三种:
- 1、desc tablename;
- 例如:
- 要查看jos_modules表结构的命令:
- desc jos_modules;
- 查看结果:
- mysql> desc jos_modules;
- +------------------+---------------------+------+-----+---------------------+----------------+
- | Field | Type | Null | Key | Default | Extra |
- +------------------+---------------------+------+-----+---------------------+----------------+
- | id | int(11) | NO | PRI | NULL | auto_increment |
- | title | text | NO | | NULL | |
- | content | text | NO | | NULL | |
- | ordering | int(11) | NO | | 0 | |
- | position | varchar(50) | YES | | NULL | |
- | checked_out | int(11) unsigned | NO | | 0 | |
- | checked_out_time | datetime | NO | | 0000-00-00 00:00:00 | |
- | published | tinyint(1) | NO | MUL | 0 | |
- | module | varchar(50) | YES | MUL | NULL | |
- | numnews | int(11) | NO | | 0 | |
- | access | tinyint(3) unsigned | NO | | 0 | |
- | showtitle | tinyint(3) unsigned | NO | | 1 | |
- | params | text | NO | | NULL | |
- | iscore | tinyint(4) | NO | | 0 | |
- | client_id | tinyint(4) | NO | | 0 | |
- | control | text | NO | | NULL | |
- +------------------+---------------------+------+-----+---------------------+----------------+
- 2、show create table tablename;
- 例如:
- 要查看jos_modules表结构的命令:
- show create table jos_modules;
- 查看结果:
- mysql> show create table jos_modules;
- jos_modules | CREATE TABLE `jos_modules` (
- `id` int(11) NOT NULL AUTO_INCREMENT,
- `title` text NOT NULL,
- `content` text NOT NULL,
- `ordering` int(11) NOT NULL DEFAULT '0',
- `position` varchar(50) DEFAULT NULL,
- `checked_out` int(11) unsigned NOT NULL DEFAULT '0',
- `checked_out_time` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
- `published` tinyint(1) NOT NULL DEFAULT '0',
- `module` varchar(50) DEFAULT NULL,
- `numnews` int(11) NOT NULL DEFAULT '0',
- `access` tinyint(3) unsigned NOT NULL DEFAULT '0',
- `showtitle` tinyint(3) unsigned NOT NULL DEFAULT '1',
- `params` text NOT NULL,
- `iscore` tinyint(4) NOT NULL DEFAULT '0',
- `client_id` tinyint(4) NOT NULL DEFAULT '0',
- `control` text NOT NULL,
- PRIMARY KEY (`id`),
- KEY `published` (`published`,`access`),
- KEY `newsfeeds` (`module`,`published`)
- ) ENGINE=MyISAM AUTO_INCREMENT=145 DEFAULT CHARSET=utf8
- 3、use information_schema;select * from columns where table_name='tablename'
- 例如:
- 要查看jos_modules表结构的命令:
- use information_schema;
- select * from columns where table_name='jos_modules';
- 查看结果:
- 略。
- 如果要查看怎么建立数据表的命令用第二种方法最佳。
mysql查看表结构语句相关推荐
- MySQL查看表结构SQL语句
mysql查看表结构命令,如下: desc 表名; show columns from 表名; describe 表名; show create table 表名; use information_s ...
- Mysql查看表结构的三种方法
目录: mysql查看表结构 方法: show create table desc information_schema.COLUMNS 表结构: 获取所有的表结构及备注 根据库名导出所有表信息 根据 ...
- MySQL查看表结构的实际操作命令简介
以下的文章主要是对MySQL查看表结构的实际操作命令的实际操作步骤的描述,下面就是其具体方案的详细解析,希望在你今后的MySQL查看表结构的实际操作命令学习中会在所帮助.以下就是正文的主要内容描述. ...
- mysql查看表结构命令
原文:http://www.blogjava.net/etlan/archive/2007/07/12/129794.html mysql查看表结构命令 mysql查看表结构命令,如下: desc 表 ...
- MYSQL查看表结构
MYSQL查看表结构 view:是数据库的视图 1.0 show columns from 表的列 [from 数据库] :作用查看表的列的属性,如果不在表的所在库使用需要加上后面的 desc 表 : ...
- mysql查看表结构,字段等命令
mysql查看表结构命令,如下: desc 表名; show columns from 表名; describe 表名; show create table 表名;
- MySQL 查看表结构简单命令。
MySQL 查看表结构简单命令. 一.简单描述表结构,字段类型desc tabl_name;显示表结构,字段类型,主键,是否为空等属性,但不显示外键. 二.查询表中列的注释信息select * fro ...
- MySQL查看表结构及查看建表语句
查看表结构:desc 表名 mysql> use recommend; Database changedmysql> desc user; +--------------+-------- ...
- MySQL 查看表结构相关的几个命令
今天在玩自己装的mysql时,发现自己对查看表结构的命令不熟悉.于是,简单查了一些资料,记录在这. 其实,学会看官网的文档,是最全面.最可靠的,官方文档是最优质的信息来源. 以后,查资料时,一定得有意 ...
最新文章
- 【文字识别小程序】快速识别文字,一款用了就再也离不开的宝藏神器~(出道即巅峰永久免费)
- 开关电源环路的零极点可以在反馈端补偿吗_【干货分享】开关电源环路补偿设计步骤讲解...
- 2018阿里集团中间件Java面试题(4面)
- java 生产者消费者同步_经典线程同步问题(生产者消费者)--Java实现
- CentOS7中解决root用户Operation not permitted
- linux中特殊符号分割,Shell_Linux Shell 中实现字符串切割的几种方法
- 历届奥斯卡获奖影片(1971-2014年)
- IOCCC.1987.korn.c.解析
- 个人网站,添加对方为好友,QQ临时对话设置方法
- Mixly01:米思齐(Mixly)简介
- 某新闻App sign签名算法解析(一)
- getinfo怎么用php,PHP的函数curl-curl_getinfo
- ASP页面中文乱码,已解决!!
- Android 修改系统屏幕亮度
- python最强脚本工具_python脚本工具最百里自瞄
- 题目:给一个不多于5位的正整数,要求:一、求它是几位数,二、逆序打印出各位数字。
- 重拾MFC小细节之动态更新对话框背景图片
- Var,Let和Const –有什么区别?
- USB-CDC-ECM 类设备之USB2.0接口100M以太网芯片 SR9900(A)
- RISC-V:实现ADDI指令