What is the difference between learning PHP-27th days-connection in the left or right corner with Yan 18?
Source: Internet
Author: User
Difference between learning PHP-27th days-connection in the left or right corner with Yan 18/** & nbsp; Yan 18 public welfare PHP Training & nbsp; classroom address: YY channel 88354001 & nbsp; learning community: www. zixue. it & nbsp; **/mysql & gt; createtableboy (& nbsp; learn the difference between PHP-27th days-connections between the left and right sides
/**
Yan 18 public welfare PHP Training
Classroom address: YY channel 88354001
Learning Community: www. zixue. it
**/
Mysql>
Mysql> insert into girl
-> Values
-> ('Stewardess ',' B '),
-> ('Big s', 'C '),
-> ('Abaclo', 'D '),
-> ('Cecilia Cheung ', 'D '),
-> ('Lin Daiyu ', 'E '),
-> ('Babywa', 'F ');
Query OK, 6 rows affected (0.03 sec)
Records: 6 Duplicates: 0 Warnings: 0
Mysql> select * from boy;
+ -------- + ------- +
| Bname | other |
+ -------- + ------- +
| Diaosi | A |
| Li Si | B |
| Wang Wu | C |
| Gao fushuai | D |
| Zheng Qi | E |
+ -------- + ------- +
5 rows in set (0.00 sec)
Mysql> select * from girl;
+ -------- + ------- +
| Gname | other |
+ -------- + ------- +
| Flight attendant | B |
| Big s | C |
| Gillian | D |
| Cecilia Cheung | D |
| Lin Daiyu | E |
| Baochai | F |
+ -------- + ------- +
6 rows in set (0.00 sec)
Mysql> select boy. *, girl. * from
-> Boy left join girl on boy. other = girl. other;
+ -------- + ------- +
| Bname | other | gname | other |
+ -------- + ------- +
| Diaosi | A | NULL |
| Li Si | B | flight attendant | B |
| Wang Wu | C | big s | C |
| Gao fushuai | D | a jiao | D |
| Gao fushuai | D | Cecilia Cheung | D |
| Zheng Qi | E | Lin Daiyu | E |
+ -------- + ------- +
6 rows in set (0.00 sec)
Mysql> # When a girl comes on stage, the other half is taken, and the other half is left blank.
Mysql> select boy. *, girl. * from
-> Girl left join boy on boy. other = girl. other;
+ -------- + ------- +
| Bname | other | gname | other |
+ -------- + ------- +
| Li Si | B | flight attendant | B |
| Wang Wu | C | big s | C |
| Gao fushuai | D | a jiao | D |
| Gao fushuai | D | Cecilia Cheung | D |
| Zheng Qi | E | Lin Daiyu | E |
| NULL | Baochai | F |
+ -------- + ------- +
6 rows in set (0.00 sec)
Mysql> # Note: a left join B does not mean that table a must be on the left, but that table a prevails when querying data.
Mysql> select * from boy;
+ -------- + ------- +
| Bname | other |
+ -------- + ------- +
| Diaosi | A |
| Li Si | B |
| Wang Wu | C |
| Gao fushuai | D |
| Zheng Qi | E |
+ -------- + ------- +
5 rows in set (0.00 sec)
Mysql> select other, bname from boy;
+ ------- + -------- +
| Other | bname |
+ ------- + -------- +
| A | diaosi |
| B | Li Si |
| C | Wang Wu |
| D | Gao fushuai |
| E | Zheng Qi |
+ ------- + -------- +
5 rows in set (0.00 sec)
Mysql> # When a girl comes on stage, the other half is taken, and the other half is left blank.
Mysql> # Do not use left join
Mysql> # Use Right join. it was just a girl left join male.
Mysql> # connect with the right, just right join male
Mysql> select boy. *, girl .*
-> From
-> Boy right join girl
-> On boy. other = girl. other;
+ -------- + ------- +
| Bname | other | gname | other |
+ -------- + ------- +
| Li Si | B | flight attendant | B |
| Wang Wu | C | big s | C |
| Gao fushuai | D | a jiao | D |
| Gao fushuai | D | Cecilia Cheung | D |
| Zheng Qi | E | Lin Daiyu | E |
| NULL | Baochai | F |
+ -------- + ------- +
6 rows in set (0.01 sec)
Mysql> select boy. *, girl .*
-> From
-> Boy inner join girl
-> On boy. other = girl. other;
+ -------- + ------- +
| Bname | other | gname | other |
+ -------- + ------- +
| Li Si | B | flight attendant | B |
| Wang Wu | C | big s | C |
| Gao fushuai | D | a jiao | D |
| Gao fushuai | D | Cecilia Cheung | D |
| Zheng Qi | E | Lin Daiyu | E |
+ -------- + ------- +
5 rows in set (0.00 sec)
Mysql> exit
Instructor Yan Shiba is too humorous. yesterday's video is as follows:
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.