In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)05/31 Report--
This article mainly explains the "mysql right outer join query how to use", the article explains the content is simple and clear, easy to learn and understand, the following please follow the editor's ideas slowly in depth, together to study and learn "mysql right outer join query how to use" it!
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 Thank you for your reading, the above is the "mysql right outer join query how to use" the content, after the study of this article, I believe you on the mysql right outer join query how to use this problem has a deeper understanding, the specific use of the need for you to practice and verify. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!
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.