-- 查看表结构desc 表名;
-- 查看表中字段的结构信息select table_name,column_name,column_comment from information_schema.columns where table_schema =‘表所在的库‘ and table_name = ‘要查的表‘;
-- 查看库里面表的结构信息select table_name,table_comment from information_schema.tables where table_schema = ‘表所在的库‘ and table_name =‘要查的表‘;
-- 查看表的DDL语句show create table 表名;mysql - 查...
MySQL查看表结构SQL语句
=
mysql查看表结构命令,如下:desc 表名;
show columns from 表名;
describe 表名;
show create table 表名;use information_schema; #切换到information_schema数据库
select * from columns where table_name=‘表名‘; #查看表信息顺便提下MySQL常用语句:
show databases;
use 数据库名;
show tables;
另外Oracle几个有用的语句:
select *
from v$database;
select * from all_users;
select * fr...
show create table t_s_territory;
alter table t_s_territory convert to character set utf8 COLLATE utf8_unicode_ci;
mysql查看表的编码,修改编码标签:本文系统来源:http://my.oschina.net/u/914897/blog/424747
`TABLES`.`TABLE_SCHEMA`, `TABLES`.`TABLE_NAME`
FROM`information_schema`.`TABLES`
查看所有数据库中所有基本表的数据库名和表名SELECT`TABLES`.`TABLE_SCHEMA`, `TABLES`.`TABLE_NAME`
FROM`information_schema`.`TABLES`WHERE`TABLES`.`TABLE_TYPE` = ‘base table‘;
查看test1数据库中t1表中的所有列信息
其中order by `ORDINAL_POSITION`指按照表中原有列的顺序 SELECT *
FROM`information_schema`.`COLUMNS` where `TABL...
mysql> show index from tblname;
mysql> show keys from tblname;
Table
表的名称。
Non_unique
如果索引不能包括重复词,则为0。如果可以,则为1。
Key_name
索引的名称。
Seq_in_index
索引中的列序列号,从1开始。
Column_name
列名称。
Collation
列以什么方式存储在索引中。在MySQL中,有值‘A’(升序)或NULL(无分类)。
Cardinality
索引中唯一值的数目的估计值。通过运行ANALYZE TABLE或myisamchk -a可以更新。基...
desc tabl_name;
显示表结构,字段类型,主键,是否为空等属性,但不显示外键。
二、查询表中列的注释信息
select * from information_schema.columns
where table_schema = ‘db‘ #表所在数据库
and table_name = ‘tablename‘ ; #你要查的表
三、只查询列名和注释
select column_name, column_comment from information_schema.columns where table_schema =‘db‘ and table_name = ‘tablename‘ ;
四、#查看表的注释...
describe tablename;show columns tablename;show create table tablename; 1,2,3展示的是+-------------+-------------+------+-----+---------+----------------+| Field | Type | Null | Key | Default | Extra |+-------------+-------------+------+-----+---------+----------------+| id | int(11) | NO | PRI | NULL | auto_increment || uid | int(11) | NO | ...
mysql查看表结构命令标签:本文系统来源:http://www.cnblogs.com/flish/p/5607984.html
一、简单描述表结构,字段类型
desc tabl_name;
显示表结构,字段类型,主键,是否为空等属性,但不显示外键。
例如:desc table_name二、查询表中列的注释信息
select * from information_schema.columnswhere table_schema = ‘db‘ #表所在数据库and table_name = ‘tablename‘ ; #你要查的表
例如:可以自动选择你需要信息
三、只查询列名和注释select column_name, column_comment from information_schema.columns where ta...
建表命令:
CREATE TABLE `t_sold_order` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`dt` date DEFAULT NULL COMMENT ‘日期‘,
`hour` tinyint(2) DEFAULT ‘0‘ COMMENT ‘小时‘,
`hour_order` int(11) DEFAULT ‘0‘ COMMENT ‘小时订单数‘,
`total_order` int(11) DEFAULT ‘0‘ COMMENT ‘总的订单数‘,
`prediction` int(11) DEFAULT ‘0‘ COMMENT ‘预测订单数‘,
PRIMARY KEY (`id`),
UNIQUE KEY `dt_hour` (`dt`,`hour...
前言:在mysql中有一个默认的数据表information_schema,information_schema这张数据表保存了MySQL服务器所有数据库的信息。如数据库名,数据库的表,表栏的数据类型与访问权限等。再简单点,这台MySQL服务器上,到底有哪些数据库、各个数据库有哪些表,每张表的字段类型是什么,各个数据库要什么权限才能访问,等等信息都保存在information_schema表里面,所以请勿删改此表。
代码:
1,切换数据库
use information_schema;
2,查...
查看表是否被锁:直接在mysql命令行执行:show engine innodb status\G。查看造成死锁的sql语句,分析索引情况,然后优化sql.然后show processlist,查看造成死锁占用时间长的sql语句。show status like ‘%lock%。查看表被锁状态和结束死锁步骤:1.查看表被锁状态show OPEN TABLES where In_use > 0; 这个语句记录当前锁表状态 2.查询进程show processlist 查询表被锁进程查询到相应进程kill id3.分析锁表的SQL分析相应SQL,给表加索...
mysql查看表使用的引擎 show table status from 数据库名 where name=表名; 对其进行更改: alter table 表名 engine=innodb; alter table 表名 engine=myisam;mysql查看表使用的引擎show table status from 数据库名 where name=表名;对其进行更改:alter table 表名 engine=innodb; alter table 表名 engine=myisam;
以下的文章主要是对MySQL查看表结构的实际操作命令的实际操作步骤的描述,下面就是其具体方案的详细解析,希望在你今后的MySQL查看表结构的实际操作命令学习中会在所帮助。以下就是正文的主要内容描述。 如下: desc表名; showcolumnsfrom表名; describe表名;以下的文章主要是对MySQL查看表结构的实际操作命令的实际操作步骤的描述,下面就是其具体方案的详细解析,希望在你今后的MySQL查看表结构的实际操作命令学习中会在所帮助。以...
mysql mysql中如何查看表中每列的属性,比如是varchar(),还是int的?