mysql 如何看一个表的索引 我现在的工具有时候展现实在太慢所以我不得不开始用命令 比如1 看一个表所有索引2 看1个表的dll语句 或者建立表语句 , 也就是字段详细信息3 看的触发器 外键 等 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 SHOW INDEX FROM tbl_nameSHOW CREATE TABLE tbl_name 1 看一个表所有索引show index from tableName;2 看1个表的dll语句 或者建立表语句 , 也就是字段详细信息show create table tablename3 看的触发器 外键 等 SHOW TRIGGERS like 'xxxx'; 终于选用命令行工具了 个人觉得,学习数据库就应该用命令行才能学到东西。mysql> show index from t1;+-------+------------+----------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+| Table | Non_unique | Key_name | Seq_in_index | Column_name | Collation | Cardinality | Sub_part | Packed | Null | Index_type | Comment |+-------+------------+----------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+| t1 | 0 | PRIMARY | 1 | id | A | NULL | NULL | NULL | | BTREE | |+-------+------------+----------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+1 row in set (0.00 sec)mysql>mysql> show create table t1;+-------+-----------------------------------------------------------------------| Table | Create Table+-------+-----------------------------------------------------------------------| t1 | CREATE TABLE `t1` ( `id` int(11) NOT NULL, `col` int(11) DEFAULT NULL, PRIMARY KEY (`id`)) ENGINE=MyISAM DEFAULT CHARSET=latin1 |+-------+-----------------------------------------------------------------------1 row in set (0.00 sec)mysql> desc t1;+-------+---------+------+-----+---------+-------+| Field | Type | Null | Key | Default | Extra |+-------+---------+------+-----+---------+-------+| id | int(11) | NO | PRI | NULL | || col | int(11) | YES | | NULL | |+-------+---------+------+-----+---------+-------+2 rows in set (0.00 sec)mysql> show columns from t1;+-------+---------+------+-----+---------+-------+| Field | Type | Null | Key | Default | Extra |+-------+---------+------+-----+---------+-------+| id | int(11) | NO | PRI | NULL | || col | int(11) | YES | | NULL | |+-------+---------+------+-----+---------+-------+2 rows in set (0.00 sec)mysql> show full columns from t1;+-------+---------+-----------+------+-----+---------+-------+---------------------------------+---------+| Field | Type | Collation | Null | Key | Default | Extra | Privileges | Comment |+-------+---------+-----------+------+-----+---------+-------+---------------------------------+---------+| id | int(11) | NULL | NO | PRI | NULL | | select,insert,update,references | || col | int(11) | NULL | YES | | NULL | | select,insert,update,references | |+-------+---------+-----------+------+-----+---------+-------+---------------------------------+---------+2 rows in set (0.00 sec)mysql>mysql> show triggers like 'test1';+---------+--------+-------+---------------------------------------------------------------------------------------------------------------------------------------------------+--------+---------+----------------------------------------------------------------+----------------+----------------------+----------------------+--------------------+| Trigger | Event | Table | Statement | Timing | Created | sql_mode | Definer | character_set_client | collation_connection | Database Collation |+---------+--------+-------+---------------------------------------------------------------------------------------------------------------------------------------------------+--------+---------+----------------------------------------------------------------+----------------+----------------------+----------------------+--------------------+| testref | INSERT | test1 | BEGIN INSERT INTO test2 SET a2 = NEW.a1; DELETE FROM test3 WHERE a3 = NEW.a1; UPDATE test4 SET b4 = b4 + 1 WHERE a4 = NEW.a1; END | BEFORE | NULL | STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION | root@localhost | latin1 | latin1_swedish_ci | latin1_swedish_ci |+---------+--------+-------+---------------------------------------------------------------------------------------------------------------------------------------------------+--------+---------+----------------------------------------------------------------+----------------+----------------------+----------------------+--------------------+1 row in set (0.00 sec) 求navicat premium 10.1.5.0注册码 LEFT Join 操作 速度 很慢 用MySql怎么根据时间查询前一天的数据,在线等,急、、、、 调用MySQL存储过程错误 MySql中怎样实现动态SQL,大家帮帮忙啊! 请问多表查询的问题 如何是mysql支持多字节? 一句话SQL,希望大家喜欢。 hql 查询问题,问题如下 mysql求助 搞不明白的查询! 不能建表 怎么回事
SHOW CREATE TABLE tbl_name
show index from tableName;2 看1个表的dll语句 或者建立表语句 , 也就是字段详细信息
show create table tablename3 看的触发器 外键 等
SHOW TRIGGERS like 'xxxx';
mysql> show index from t1;
+-------+------------+----------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+
| Table | Non_unique | Key_name | Seq_in_index | Column_name | Collation | Cardinality | Sub_part | Packed | Null | Index_type | Comment |
+-------+------------+----------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+
| t1 | 0 | PRIMARY | 1 | id | A | NULL | NULL | NULL | | BTREE | |
+-------+------------+----------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+
1 row in set (0.00 sec)mysql>
mysql> show create table t1;
+-------+-----------------------------------------------------------------------
| Table | Create Table
+-------+-----------------------------------------------------------------------
| t1 | CREATE TABLE `t1` (
`id` int(11) NOT NULL,
`col` int(11) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 |
+-------+-----------------------------------------------------------------------
1 row in set (0.00 sec)mysql> desc t1;
+-------+---------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-------+---------+------+-----+---------+-------+
| id | int(11) | NO | PRI | NULL | |
| col | int(11) | YES | | NULL | |
+-------+---------+------+-----+---------+-------+
2 rows in set (0.00 sec)mysql> show columns from t1;
+-------+---------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-------+---------+------+-----+---------+-------+
| id | int(11) | NO | PRI | NULL | |
| col | int(11) | YES | | NULL | |
+-------+---------+------+-----+---------+-------+
2 rows in set (0.00 sec)mysql> show full columns from t1;
+-------+---------+-----------+------+-----+---------+-------+---------------------------------+---------+
| Field | Type | Collation | Null | Key | Default | Extra | Privileges | Comment |
+-------+---------+-----------+------+-----+---------+-------+---------------------------------+---------+
| id | int(11) | NULL | NO | PRI | NULL | | select,insert,update,references | |
| col | int(11) | NULL | YES | | NULL | | select,insert,update,references | |
+-------+---------+-----------+------+-----+---------+-------+---------------------------------+---------+
2 rows in set (0.00 sec)mysql>mysql> show triggers like 'test1';
+---------+--------+-------+----------------------------------------------------
--------------------------------------------------------------------------------
---------------+--------+---------+---------------------------------------------
-------------------+----------------+----------------------+--------------------
--+--------------------+
| Trigger | Event | Table | Statement | Timing | Created | sql_mode
| Definer | character_set_client | collation_connectio
n | Database Collation |
+---------+--------+-------+----------------------------------------------------
--------------------------------------------------------------------------------
---------------+--------+---------+---------------------------------------------
-------------------+----------------+----------------------+--------------------
--+--------------------+
| testref | INSERT | test1 | BEGIN
INSERT INTO test2 SET a2 = NEW.a1;
DELETE FROM test3 WHERE a3 = NEW.a1;
UPDATE test4 SET b4 = b4 + 1 WHERE a4 = NEW.a1;
END | BEFORE | NULL | STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUB
STITUTION | root@localhost | latin1 | latin1_swedish_ci | latin
1_swedish_ci |
+---------+--------+-------+----------------------------------------------------
--------------------------------------------------------------------------------
---------------+--------+---------+---------------------------------------------
-------------------+----------------+----------------------+--------------------
--+--------------------+
1 row in set (0.00 sec)