Hi Eli, The short answer is .. you create relationships between tables by creating foreign keys and primary keys. However, you might not even need them ;-) - I explain below.
Foreign keys and primary keys are used to create relations between tables. Using them will bind you to some rules which you can use to your advantage (or not), thats entirely up to you. If you define a primary key than any foreign key can link to the primary key. However , a foreign ke can only contain a value which is already defined in a primary key. This can be used to restrict that only valid values are insert for foreign keys or f.e no primary key is deleted where still existing foreign keys are pointing to the primary key record. Currently only the InnoDB table format supports Foreign keys. In order to use a join you dont need to create any keys. You can free define the columns to be used for the join condition. Please see the JOIN Syntax for more information. http://www.mysql.com/doc/en/JOIN.html Best regards Nils Valentin Tokyo/Japan 2003年 7月 25日 金曜日 03:36、eli さんは書きました: > Hi, > > Can anyone explain me how to create relationships between tables in Mysql? > > For making some kind of functions like joins, it is indispensable to have > relationships defined? > > > Thanks in advanced. > > > eli -- --- Valentin Nils Internet Technology E-Mail: [EMAIL PROTECTED] URL: http://www.knowd.co.jp Personal URL: http://www.knowd.co.jp/staff/nils -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]