How can I see the constraints which are applied to a table stored in another database then I am currently using?

MySQLMySQLi Database

MySQL SHOW CREATE TABLE statement will provide us the constraints applied to a particular table along with some other details about that table stored in another database then I am currently using. Its syntax would be as follows −

Syntax

SHOW CREATE TABLE db_name.table_name;

Here table_name is the name of the table on which we want to see the constraints.

Db_name is the name of the database name in which table is stored.

Example

In this example we are getting the detail of the table named ‘arena’ stored in MySQL database −

mysql> Show Create table mysql.arena\G
*************************** 1. row ***************************
Table: arena
Create Table: CREATE TABLE `arena` (
   `id` int(10) unsigned zerofill NOT NULL AUTO_INCREMENT,
   `Photo` blob, PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1
1 row in set (0.00 sec)

The above result set shows that there is a PRIMARY KEY constraint on column ’id’ in table ‘arena’ stored in ‘mysql’.

raja
Published on 19-Feb-2018 06:11:21
Advertisements