Using relations in MySQL comes in handy, when an ID is updated, or someone tries to delete a category. But is there an easy way to do a SELECT query, without using a JOIN?
JOIN is easy to use, but can’t I use the relations when doing a SELECT? I can do a JOIN without relations!
Are relations only used so I can control actions on the ID field?
Constraints in database (foreign keys specifically) are created for maintaining referential integrity, to prevent of accidental deletions of rows that are refered to by another rows.
Constraints doesn’t provide any way to perform
SELECTwith automatically joined tables. So –NO, you need to specify allJOINs explicitly. AndYES,JOINdoesn’t depend on existing constraints: you can use it for any tables, any fields and write any conditions, regardless their references to each other through foreign key relations.