Please explain to me that MySQL connects in a simple language?

Please explain to me if you are joining in plain language? please don’t post the web link as I need how the developer gets it different from the author .. pls understand :)

+5
source share
3 answers

The best I can tell you is a visual explanation of SQL joins .

The diagrams helped me a lot.


Adding basic charts from a related post here.

Inner join

inner join diagram

The inner join only creates a set of records that correspond to both table A and table B.

Full external connection

full outer join diagram

A B , . , .

left outer join diagram

A ( ) B. , .

+15

SELECT *
FROM Person INNER JOIN
Information ON Person.ID = Information.ID

, . , Person, Information, .

SELECT *
FROM Person LEFT JOIN
Information ON Person.ID = Information.ID

Person, , , , NULL

SELECT *
FROM Person LEFT JOIN
Information ON Person.ID = Information.ID
WHERE Information.ID IS NULL

, . , Informaton.

+3

, , , , :

, , . , :

Books   (ID, Title, AuthorID)
Authors (ID, Name)

, :

  Book                    |   Author
'The Sirens of Titan'     | 'Kurt Vonnegut'
'The Old Man and the Sea' | 'Earnest Hemingway'

:

select Books.Title as Book, Authors.Name as Author
from Books
inner join Authors on Authors.ID = Books.AuthorID

An inner join is the simplest type of join; it may be difficult to understand the point of external associations without having a strong understanding of internal connections and their use.

+2
source

All Articles