MySQL Desc指令相关
MySQL Desc指令相关
2011-08-09 11:25:50| 分类: my基本命令 |举报 |字号 订阅
1、desc tablename;
例如 :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
|
|
+------------------+---------------------+------+-----+---------------------+----------------+
|
使用MySQL数据库desc 表名时,我们看到Key那一栏,可能会有4种值,即' ','PRI','UNI','MUL'。 |
查看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 Desc指令相关的更多相关文章
- MySQL常用指令,java,php程序员,数据库工程师必备。程序员小冰常用资料整理
MySQL常用指令,java,php程序员,数据库工程师必备.程序员小冰常用资料整理 MySQL常用指令(备查) 最常用的显示命令: 1.显示数据库列表. show databases; 2.显示库中 ...
- mysql数据库内容相关操作
第一:介绍 mysql数据内容的操作主要是: INSERT实现数据的插入 UPDATE实现数据的更新 DLETE实现数据的删除 SELECT实现数据的查询. 第二:增(insert) 1.插入完整的数 ...
- Mysql查看连接数相关信息
MySQL查看连接数相关信息在 数据库:INFORMATION_SCHEMA 表:PROCESSLIST 表结构如下: mysql> desc PROCESSLIST; +---------+- ...
- MySQL的日志相关内容
本篇文章介绍一下mysql的备份和日志,由于备份时需要用到日志,所以在讲备份前,如果日志内容篇幅过长,将会把日志和备份分开单独来讲,先简单介绍一下mysql的日志相关内容. MySQL日志 日志是my ...
- Ubuntu Mysql 常用指令
mysql 常用指令及中文乱码解决 *:first-child { margin-top: 0 !important; } body>*:last-child { margin-bottom: ...
- 【风马一族_mysql】mysql基本指令
船停在港湾是很安全的,但那不是造船的目的! 用户 创建用户 mysql>grant 权限(select,insert,update,delete) on 数据库.数据表 to 用户名@电脑 ...
- python操作mysql数据库的相关操作实例
python操作mysql数据库的相关操作实例 # -*- coding: utf-8 -*- #python operate mysql database import MySQLdb #数据库名称 ...
- MySql性能优化相关
原来使用MySql处理的数据量比较少,小打小闹的,没有关注过性能的问题.最近要处理的数据量飙升,每天至少20W行的新增数据,导致MySql在性能方面已经是差到不可用的地步了,必须要重视MySql的优化 ...
- PHP对MySQL数据库的相关操作
一.Apache服务器的安装 <1>安装版(计算机相关专业所用软件---百度云链接下载)-直接install<2>非安装版(https://www.apachehaus.com ...
随机推荐
- MVC使用Gantt Chart实现甘特图,管理事情进度
借助"甘特图",可以直观地了解任务.活动.工作的进度.dhtmlxGantt是一个开源的Javacirpt库,能帮助我们快速创建"甘特图",本篇体验在MVC中的 ...
- 爱普生Me330 打印机改装连供系统计划
Me330想改装连供得大家可以看一下,本文是我的亲生经历,现分享给大家,希望能给你们提供帮助,如果有不懂的地方可以联系我Email: 事先说明,我不买连供,也不卖这款机子,购买的话,请不要打扰我!& ...
- mORMot
mORMot GITHUB: https://github.com/synopse/mORMot Synopse mORMot framework An Open Source Client-Serv ...
- Extjs 文件上传
function fromExcel(){ var dxjgdm_sel = Ext.get("dxjgdm").getValue(); var dxjglx_sel = Ext. ...
- LR杂记-nmon+analyser监控linux系统资源
1.查看linux具体版本号信息 file /sbin/init 2.下载相应nmon版本号 http://pkgs.repoforge.org/nmon/ 3.安装 rpm -ivh nmon-14 ...
- shader内置变量
内置变量都在UnityShaderVariables.cginc文件中声明 变换矩阵 All these matrices arefloat4x4 type. Name Value UNITY_MAT ...
- DELIMITER关键词作用 替换结束符号
注意:“DELIMITER //”语句的作用是将MYSQL的结束符设置为//,因为MYSQL默认的语句结束符为分号;,为了避免与存储过程 中SQL语句结束符相冲突,需要使用DELIMITER 改变存储 ...
- tomcat配置manager
tomcat-users.xml配置 <role rolename="manager-gui"/><user username="tomcat" ...
- Python3.6学习笔记(四)
错误.调试和测试 程序运行中,可能会遇到BUG.用户输入异常数据以及其它环境的异常,这些都需要程序猿进行处理.Python提供了一套内置的异常处理机制,供程序猿使用,同时PDB提供了调试代码的功能,除 ...
- Strings of Power
B. Strings of Power Volodya likes listening to heavy metal and (occasionally) reading. No wonder Vol ...