Bug #61069 Key Join
| Submitted: | 5 May 2011 11:01 | Modified: | 10 May 2011 9:19 |
|---|---|---|---|
| Reporter: | Marcus Hambraeus | Email Updates: | |
| Status: | Open | Impact on me: | |
| Category: | MySQL Server: InnoDB storage engine | Severity: | S4 (Feature request) |
| Version: | OS: | Any | |
| Assigned to: | CPU Architecture: | Any | |
| Tags: | key join | ||
[5 May 2011 11:01]
Marcus Hambraeus
[5 May 2011 11:06]
Marcus Hambraeus
Small fix to How to repeat: The INNER-statement in INNER KEY JOIN could be omitted, since the FK-relation would be enough to figure out the relation type.
[10 May 2011 9:01]
Valeriy Kravchuk
Why not to give the same names to related columns and use (SQL standard) NATURAL JOIN instead? See http://dev.mysql.com/doc/refman/5.5/en/join.html.
[10 May 2011 9:19]
Marcus Hambraeus
Lots of databases that I've seen (including my own, obviously :P ) use the field name "id" for their auto-incremented primary key-field, and then [table name]_id when referencing it from another field. Natural joins wouldn't work in those scenarios, since it requires the fields to be named the same. Sure, it could be solved if people used [table name]_id instead of id in the main table too, but a key join would greatly simplify database query writing, without forcing people to work in a specific way. Also, natural joins can behave in "strange" ways since it tries to invent a relation based on field names, while a key join would use an already specified relation. Also, since we've gone though the trouble of specifying relations between tables, why not use that to its fullest?
Portions of this website are copyright © 2001, 2002 The PHP Group
Page generated in 0.040 sec. using MySQL 8.4.7-u6-cloud
Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the
respective copyright holders.
It is not reviewed in advance
by Oracle and does not necessarily represent the opinion of
Oracle or any other party.