[prev in list] [next in list] [prev in thread] [next in thread] 

List:       mysql
Subject:    Re: alter table for foreign key
From:       thufir <hawat.thufir () gmail ! com>
Date:       2014-11-17 11:25:09
Message-ID: m4clul$3i1$1 () ger ! gmane ! org
[Download RAW message or body]

On Mon, 17 Nov 2014 10:59:15 +0100, Martijn Tonies (Upscene Productions)
wrote:


> In general, an "index" is used for performance, while a "constraint" is
> used for logical concepts, like uniqueness. Most often, the DBMS uses an
> index to implement these logical concepts, but it's better to understand
> the difference.

The GUI resulted in:

| links | CREATE TABLE `links` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `created` datetime NOT NULL,
  `feed_id` int(11) NOT NULL DEFAULT '0',
  `link` varchar(767) NOT NULL,
  `status` int(11) NOT NULL DEFAULT '0',
  PRIMARY KEY (`id`),
  UNIQUE KEY `UNQ_links_0` (`link`),
  KEY `fk_links_1_idx` (`feed_id`),
  CONSTRAINT `fk_links_1` FOREIGN KEY (`feed_id`) REFERENCES `feeds` 
(`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=270 DEFAULT CHARSET=latin1 |

I'll be reading a bit more about this.


thanks,

Thufir


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/mysql

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic