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 ...
随机推荐
- 相比xib 使用代码编排view 的一个明显的好处就是可以更好地重复使用已有代码,减少代码冗余。
相比xib 使用代码编排view 的一个明显的好处就是可以更好地重复使用已有代码,减少代码冗余.
- C#编程(六)------------枚举
原文链接:http://blog.csdn.net/shanyongxu/article/details/46423255 枚举 定义枚举用到的关键字:enum public enum TimeOfD ...
- gflags摘记
projcet url: https://github.com/schuhschuh/gflags usage: commandline flags processing DEFINE: Defini ...
- SQL:查询学习笔记
SQL 查询命令 SELECT 语法 SELECT "column_name" FROM "table_name"; 返回一列 SELECT Username ...
- struts2点滴记录
1.s:textfield 赋值方法 <s:textfield name="Tname" value="%{#session.Teacher.name}" ...
- Python已成为网络攻击的首选编程语言
Python已成为网络攻击的首选编程语言 最新的调查数据表明,Python已经变成了世界上最热门的编程语言了,而Python的热门风也刮到了信息安全领域中.Python,摇身一变,也变成了黑客开发网络 ...
- Bash,Vim,gdb&git常用命令
Bash 目录 pwd //查看当前目录 mkdir dir1 dir2 //创建目录 tree dir1 mv test1.cpp test2.cpp dir1 dir //移动文件/目录到目 ...
- Python、Lua和Ruby比较——脚本语言大P.K.
译者按:Python.lua和ruby在C/C++是日渐式微的情况下,在java/.net的围歼中努力抗争的三个当红小生.在Tom Gutschmidt的著作<Game Programmng w ...
- 计算Fisher vector和VLAD
This short tutorial shows how to compute Fisher vector and VLAD encodings with VLFeat MATLAB interfa ...
- @Java虚拟机之对象访问
建立对象是为了使用对象,我们的java程序需要通过栈上的reference数据来操作堆上的具体对象. 对象访问会涉及到Java栈.Java堆.方法区这三个内存区域. 如下面这句代码: Object o ...