..


Sponsored Links

How to create a relationship between two tables without a match between the fields of JOIN?

For this purpose you can use (instead of an INNER JOIN) a LEFT JOIN or a RIGHT JOIN.
In this way the data are extracted even if there is no exact match between the fields used to define the relationship.

For example:






 SELECT * FROM books







 LEFT JOIN authors







 ON = libri.autore_id autori.id







 WHERE libri.id> 0



In this case, the LEFT JOIN will show all records in the table "books" regardless of whether or not there is a correspondence with the table "authors".

To put it simple: if a book was "no author" ie "autore_id = 0" would also shown although there are no material correspondence with the table "authors" (because it has no id = 0).

In the same category ...
E-Learning
MS Access (Advanced) MS Access (Advanced)
Learn how to create and manage databases quickly and easily. Starting from 29 €.
MySQL (Course) MySQL (Course)
Management of open-source database. From 39 €.
SQL and Database (Course) SQL and Database (Course)
Create and manage relational databases. From 39 €.
Sponsored Links