数据库有张表T_User id | RegName | regDate | regCount | 1 | lily | 2012-12-12 | 200 | 2 | lisa | 2012-7-8 | 300 | 3 | tom | 2012-7-8 | 200 | 4 | jerry | 2012-12-21 | 400 |
在regCount字段建了索引
以下请优化以下SQL语句,并说明优化点:
1)select RegName,regDate,RegCount from T_User where regCount<>300
2 ) select RegName,regDate,RegCount from T_User where regDate<'2012-12-12'
3)select RegName,regDate,RegCount from T_User where day(regDate)<20 and month(regDate) between 5 and 12
4)select RegName,regDate,RegCount from T_User where regCount+100<400
这是昨天实习招聘的笔试题,求教~~ |