Go4Expert

Go4Expert (http://www.go4expert.com/)
-   MySQL (http://www.go4expert.com/forums/mysql-forum/)
-   -   select constraint name (http://www.go4expert.com/forums/select-constraint-name-t5377/)

kalaid 21Jul2007 16:46

select constraint name
 
Hi
I have set constraint for my table with user constraint name. I want to view all the constraints created by me , is there is any option for this.

Windhan 10Jan2008 13:36

Re: select constraint name
 
Y not...

Try this.

Code:

mysql> CREATE TABLE test_mast(id INTEGER NOT NULL PRIMARY KEY,v_name VARCHAR(100));
Query OK, 0 rows affected (0.01 sec)

Code:

mysql> CREATE TABLE test_child(id INTEGER NOT NULL PRIMARY KEY,mast_id INTEGER NOT NULL,det                    VARCHAR(100));
Query OK, 0 rows affected (0.02 sec)

Code:

mysql> ALTER TABLE test_child ADD CONSTRAINT fk_test_mast_id FOREIGN KEY(mast_id) REFERENCES                    test_mast(id);
Query OK, 0 rows affected (0.02 sec)
Records: 0  Duplicates: 0  Warnings: 0

Code:

mysql> SHOW CREATE TABLE test_child;
+------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Table      | Create Table                                                                                                                                                                                                            |
+------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| test_child | CREATE TABLE `test_child` (
  `id` int(11) NOT NULL,
  `mast_id` int(11) NOT NULL,
  `det` varchar(100) default NULL,
  PRIMARY KEY  (`id`),
  KEY `fk_test_mast_id` (`mast_id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 |
+------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)

Hope it is clear now !!!!


All times are GMT +5.5. The time now is 13:23.