Foreign keys across databases?
I would like to use separate databases to group certain related tables to keep things clean, but I would also like to use foreign keys to enforce referential integrity between tables in different databases. I don't think this is possible. Am I right? And if so, am I reduced to using carefully chosen table names to keep things organized? What have others done in this situation? Thanks, Jake Krohn -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: Foreign keys across databases?
Hello Jake, I would like to use separate databases to group certain related tables to keep things clean, but I would also like to use foreign keys to enforce referential integrity between tables in different databases. I don't think this is possible. Am I right? And if so, am I reduced to using carefully chosen table names to keep things organized? What have others done in this situation? Ehm... According to me, all tables related to eachother or a certain domain should go in 1 database. That is, each database should be able to exist by itself. So, in your case, dump everything into 1 database. With regards, Martijn Tonies Database Workbench - tool for InterBase, Firebird, MySQL, Oracle MS SQL Server Upscene Productions http://www.upscene.com Database development questions? Check the forum! http://www.databasedevelopmentforum.com -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
foreign keys across databases?
This might be a stupid question, but is it possible to have a foreign key reference to a table.column in another database? E.g.: FOREIGN KEY (parent_id) REFERENCES databasename.parent(id) Probably not, but are there any other ways to enforce such relations? Best regards Tor Rune Skoglund [EMAIL PROTECTED] sql,query,queries,smallint - 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
Re: foreign keys across databases?
You can do this. E.g.: FOREIGN KEY (parent_id) REFERENCES databasename.parent(id) and I'm already using this kind of foreign key. Try yourself ! - Original Message - From: Tor R. Skoglund (NextG) [EMAIL PROTECTED] To: mysql users [EMAIL PROTECTED] Sent: Monday, February 24, 2003 4:59 AM Subject: foreign keys across databases? This might be a stupid question, but is it possible to have a foreign key reference to a table.column in another database? E.g.: FOREIGN KEY (parent_id) REFERENCES databasename.parent(id) Probably not, but are there any other ways to enforce such relations? Best regards Tor Rune Skoglund [EMAIL PROTECTED] sql,query,queries,smallint - 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 - 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