当前位置:网站首页>Multi table operation - Auto Association query
Multi table operation - Auto Association query
2022-07-05 11:47:00 【Soup key TJ】
Catalog
Basic concepts
- In the same table, the data is related , We can query this table as multiple tables
- This is achieved by taking different aliases for the table
Data preparation

- CREATE TABLE employee(
id INT PRIMARY KEY auto_increment, -- Employee number
NAME VARCHAR(20), -- Employee name
mgr INT, -- Superior number
salary DOUBLE -- Wages
); - -- Add data
- INSERT INTO employee VALUES (1001,' The Monkey King ',1005,9000.00),
- (1002,' Pig eight quit ',1005,8000.00),
- (1003,' The sand monk ',1005,8500.00),
- (1004,' Small white dragon ',1005,7900.00),
- (1005,' Tang's monk ',NULL,15000.00),
- (1006,' Wusong ',1009,7600.00),
- (1007,' Li Kui ',1009,7400.00),
- (1008,' Lin Chong ',1009,8100.00),
- (1009,' Song Jiang ',NULL,16000.00);
Example operation
- Check the names of all employees and their immediate superiors , Employees without superiors also need to inquire
- adopt mgr Can find the superior
- Then employees without superiors also need to query , This requires external connection query

-- Check the names of all employees and their immediate superiors , Employees without superiors also need to inquire -- Conditions :employee.mgr=employee.id SELECT e1.id, e1.name, e1.mgr, e2.id, e2.name FROM employee e1 LEFT OUTER JOIN employee e2 ON e1.mgr=e2.id;
边栏推荐
- 【上采样方式-OpenCV插值】
- C # implements WinForm DataGridView control to support overlay data binding
- 查看多台机器所有进程
- 【TFLite, ONNX, CoreML, TensorRT Export】
- yolov5目标检测神经网络——损失函数计算原理
- 谜语1
- Risc-v-qemu-virt in FreeRTOS_ Scheduling opportunity of GCC
- Redirection of redis cluster
- COMSOL -- establishment of 3D graphics
- ZCMU--1390: 队列问题(1)
猜你喜欢
![[calculation of loss in yolov3]](/img/8c/1ad99b8fc1c5490f70dc81e1e5c27e.png)
[calculation of loss in yolov3]
![[yolov3 loss function]](/img/79/87bcc408758403cf3993acc015381a.png)
[yolov3 loss function]

COMSOL -- establishment of 3D graphics

yolov5目標檢測神經網絡——損失函數計算原理

Reading notes of growth hacker

【上采样方式-OpenCV插值】

11. (map data section) how to download and use OSM data

Sentinel sentinel mechanism of master automatic election in redis master-slave

【云原生 | Kubernetes篇】Ingress案例实战(十三)

XML解析
随机推荐
Redirection of redis cluster
Principle of redis cluster mode
An error is reported in the process of using gbase 8C database: 80000305, host IPS long to different cluster. How to solve it?
13.(地图数据篇)百度坐标(BD09)、国测局坐标(火星坐标,GCJ02)、和WGS84坐标系之间的转换
Project summary notes series wstax kt session2 code analysis
Redis集群的重定向
What does cross-border e-commerce mean? What do you mainly do? What are the business models?
【TFLite, ONNX, CoreML, TensorRT Export】
[calculation of loss in yolov3]
C operation XML file
Implementation of array hash function in PHP
Halcon 模板匹配实战代码(一)
Pytorch linear regression
pytorch-权重衰退(weight decay)和丢弃法(dropout)
无线WIFI学习型8路发射遥控模块
MySQL giant pit: update updates should be judged with caution by affecting the number of rows!!!
Yolov 5 Target Detection Neural Network - Loss Function Calculation Principle
Use and install RkNN toolkit Lite2 on itop-3568 development board NPU
【yolov3损失函数】
1.php的laravel创建项目

