外观
京东零售平台营销中心后端开发实习(一面)
约 267 字小于 1 分钟
2025-3-25
1. 联合索引是什么?
2. 索引失效场景是什么?
3. SQL 场景题:
Where 字符串转成数字作比较,索引失效后怎么优化
t表有3个字段,A,B,C建了联合索引(A,B,C)
Select * from t where a = 3 and b > 5;
Select * from t where b > 5 and a = 3;
Select * from t where a = 3 and b > 5 and c > 7;
Select * from t where a < 3;
Select * from t where a <= 3;
上面那些语句会用到索引
4. Join 语句场景题
T1表
Id name
1 A
2 B
3 C
T2表
name score
A 1
A 2
B 1
Select * from t1 left join t2 on t1.name = t2.name; 返回几行
Select * from t1 left join t2 on t1.name = t2.name and t2.name is not null;返回几行
Select * from t1 left join t2 on t1.name = t2.name where t2.name is not null;返回几行