Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Database left connection, right connection, full connection, left outer, right outer, full outer

2025-02-22 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

Inline

SELECT

*

FROM

Temployee employees0

INNER JOIN tcustomer customer1 ON (customer1.id = employees0.id)

Left couplet

SELECT

*

FROM

Temployee employees0

LEFT OUTER JOIN tcustomer customer1 ON (customer1.id = employees0.id)

Right couplet

SELECT

*

FROM

Temployee employees0

RIGHT OUTER JOIN tcustomer customer1 ON (customer1.id = employees0.id)

Quanlian = left + right (not supported by MySql)

SELECT * FROM t_employee te FULL JOIN t_customer tc ON (te.id = tc.id)

Left outside

SELECT

*

FROM

Temployee employees0

LEFT OUTER JOIN tcustomer customer1 ON (customer1.id = employees0.id)

WHERE

Customer1_.id IS NULL

Right outside

SELECT *

FROM

Temployee employees0

RIGHT OUTER JOIN tcustomer customer1 ON (customer1.id = employees0.id)

WHERE

Employees0_.id IS NULL

Full outside = left outside + right outside (not supported by MySql)

SELECT *

FROM

T_employee te

FULL JOIN t_customer tc ON (te.id = tc.id)

WHERE

Te.id IS NULL

OR tc.id IS NULL

Database

Employee

Customer

-Table structure for tweak employeeWhile-DROP TABLE IF EXISTS `t _ employee` CREATE TABLE `t _ employee` (`id` bigint (20) NOT NULL AUTO_INCREMENT, `employee_ name` varchar (255i) DEFAULT NULL, `employee_ part` varchar (255i) DEFAULT NULL, PRIMARY KEY (`id`) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -Records of tweak employee VALUES-- INSERT INTO `t _ employee` VALUES (1, 'Lao Pan', 'Chief Adjudication Department'); INSERT INTO `t _ employee` VALUES (2, 'Lao Wang', 'Secretary Department') INSERT INTO `t _ employee`VALUES (3, 'Lao Zhang', 'Design Department'); INSERT INTO `t _ employee` VALUES (4, 'Lao Li', 'Operation Department');-Table structure for tasking customerCustom-- DROP TABLE IF EXISTS `tcustomer` CREATE TABLE `tcustomer` (`id` bigint (20) NOT NULL AUTO_INCREMENT, `customer_ name` varchar (255i) DEFAULT NULL, `customer_ part` varchar (255DEFAULT NULL), PRIMARY KEY (`id`) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -Records of tasking customerCustom-INSERT INTO `tcustomer` VALUES (2, 'Lao Wang', 'Secretary Department'); INSERT INTO `tcustomer` VALUES (3, 'Lao Zhang', 'Design Department') INSERT INTO `tcustomer` VALUES (4, 'Lao Liu', 'personnel Department'); INSERT INTO `tcustomer` VALUES (5, 'Lao Huang', 'production Department')

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.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report