In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article mainly explains "what is the mysql right outer connection query". Interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Next let the editor to take you to learn "what is the mysql right outer connection query"!
1. Take the right table of join as the main table, display all the data of the right table, and query the data of the left table of join according to the conditions. If satisfied, display. If you are not satisfied, show it in null.
2. It can be understood to ensure that all the data in the right table is displayed on the basis of internal connections.
Grammar
Select field from a right [outer] join b on condition
Example
# left link # query all department information and staff information of the department SELECT did,dname,eid,ename FROM t_department d LEFT JOIN t_employee eON d.didroome.deptSecretid; SELECT did,dname,eid,ename FROM t_employee e LEFT JOIN t_department dON d.didroome.deptSecretid; SELECT did,dname,eid,ename FROM t_department d RIGHT JOIN t_employee eON d.didroome.deptSecretid; UPDATE t_employee SET dept_id=NULL where eid=5 SELECT did,dname,eid,ename FROM t_department d LEFT JOIN t_employee eON d.didroome.deptSecretidscape where e.dept_id IS NULL;# queries department information, and retains department information that has no employees, SELECT did,dname,eid,ename FROM t_department d RIGHT JOIN t_employee eON d.didroome.deptSecretiditusWere e.dept_id IS NULL; SELECT did,dname,eid,ename FROM t_employee e LEFT JOIN t_department dON d.didroome.deptSecretidWTWere e.dept_id IS NULL # query all employee information, as well as employee department information SELECT eid,ename,did,dname FROM t_employee e LEFT JOIN t_department dON e.deptSecretidSecretd.did; SELECT eid,ename,did,dname FROM t_department d LEFT JOIN t_employee eON e.deptSecretidSecretd.did; # query employee information and keep only employees who have no assigned department SELECT eid,ename,did,dname FROM t_employee e LEFT JOIN t_department dON e.dept_id=d.didWHERE e.dept_id IS NULL # query employee information and do not retain SELECT eid,ename,did,dname FROM t_employee e LEFT JOIN t_department dON e.dept_id=d.didWHERE e.dept_id IS NOT NULL; SELECT id,ename,tid,dname FROM student_info s LEFT JOIN student_test tON s.id_id=t.tidWHERE t.tid IS NOT NULL; SELECT * FROM student;SELECT * FROM souce of employees without assigned departments # analyze the left and right outer connection # display the test information of all students SELECT st.s_id,name,C,Java FROM student st LEFT JOIN souce sON st.s_id=s.s_id; # display the test information of the students taking the test SELECT st.s_id,name,C,Java FROM student st RIGHT JOIN souce sON st.s_id=s.s_id At this point, I believe you have a deeper understanding of "what is the mysql right outer connection query". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.