我是靠谱客的博主 魁梧麦片,最近开发中收集的这篇文章主要介绍mysql 索引触发,MySQL 查看表构造、索引、触发器 的SQL语句,觉得挺不错的,现在分享给大家,希望可以做个参考。

概述

当前位置:我的异常网» MySQL » MySQL 查看表构造、索引、触发器 的SQL语句

MySQL 查看表构造、索引、触发器 的SQL语句

www.myexceptions.net  网友分享于:2013-07-09  浏览:8次

MySQL 查看表结构、索引、触发器 的SQL语句

ysql> 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)

文章评论

最后

以上就是魁梧麦片为你收集整理的mysql 索引触发,MySQL 查看表构造、索引、触发器 的SQL语句的全部内容,希望文章能够帮你解决mysql 索引触发,MySQL 查看表构造、索引、触发器 的SQL语句所遇到的程序开发问题。

如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(49)

评论列表共有 0 条评论

立即
投稿
返回
顶部