EXPLAIN SELECT
te.*, tl.*
FROM
t_employee te
LEFT JOIN t_employee_log tl ON te.EMPLOYEE_ID = tl.EMPLOYEE_ID;
alter table t_employee_log add foreign key (EMPLOYEE_ID) references t_employee(EMPLOYEE_ID);
生成的默认索引:t_employee_log_ibfk_1
select COUNT(1) from t_employee;
select COUNT(1) from t_employee_log ;
show INDEX from t_employee;
show INDEX from t_employee_log;
SELECT
tel.EMPLOYEE_ID
FROM
t_employee_log tel
where tel.EMPLOYEE_ID not in(
select te.EMPLOYEE_ID
from t_employee te);
DELETE from t_employee_log
WHERE
EMPLOYEE_ID IN (
"3db901474f844d84be54802cec20a9e3",
"f8e042c8678148a796d69bde1e6ec133"
);