-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hello again --
...and then David T-G said... % % I would like to create a couple of related tables (just for starters) but % I can't figure out how to do it; there are lots of CREATE TABLE examples % in the mysql manual but nothing that shows related columns. Aha! I get it! I *have* to have the InnoDB add-on in order to support foreign keys and fully relational tables, right? Boy, that took a lot of digging. So now I know that I can CREATE TABLE parent(id INT NOT NULL, PRIMARY KEY (id)) TYPE=INNODB; CREATE TABLE child(id INT, parent_id INT, INDEX par_ind (parent_id), FOREIGN KEY (parent_id) REFERENCES parent(id) ON DELETE SET NULL) TYPE=INNODB; to create relational tables, just like the manual says. Now I need to have innodb included, then. The manual says that it's included in 4.0.x, so if I have 4.0 then I should have innodb. Not only does the SQL above not give me any errors, but I also successfully ran TRUNCATE child ; TRUNCATE parent ; and since the manual says that TRUNCATE is new with 4.0 I must have a 4.x rather than 3.x mysqld. Good so far. If that's the case, then why do I get mysql> show create table child ; +-------+-----------------------------------------------------+ | Table | Create Table | +-------+-----------------------------------------------------+ | child | CREATE TABLE `child` ( `id` int(11) default NULL, `parent_id` int(11) default NULL, KEY `par_ind` (`parent_id`) ) TYPE=MyISAM | +-------+-----------------------------------------------------+ mysql> show create table parent ; +--------+----------------------------------------------------+ | Table | Create Table | +--------+----------------------------------------------------+ | parent | CREATE TABLE `parent` ( `id` int(11) NOT NULL default '0', PRIMARY KEY (`id`) ) TYPE=MyISAM | +--------+----------------------------------------------------+ on my tables? TYPE=MyISAM doesn't look very innodb-like... TIA & HAND mysql query, :-D - -- David T-G * There is too much animal courage in (play) [EMAIL PROTECTED] * society and not sufficient moral courage. (work) [EMAIL PROTECTED] -- Mary Baker Eddy, "Science and Health" http://www.justpickone.org/davidtg/ Shpx gur Pbzzhavpngvbaf Qrprapl Npg! -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.7 (FreeBSD) iD8DBQE96h2CGb7uCXufRwARAgtQAKCaQ9s/Yw6f/KP8U8kKHgbZjysb7gCfSMoW 2PJU8VEIpkNknj5Ii1ZiC2I= =xrei -----END PGP SIGNATURE----- --------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php