1.SQL语句异常
com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘bname like ‘%圣墟%’’ at line 1
“select * from t_mvc_book where trueand bname like ‘%圣墟%’ “
在拼接sql语句要注意空格
2.java异常
Unhandled exception type……
这里我截不出这样的图,因此借了一张网图,类似于
*解决:**只需把有这种异常的语句放在 try…catch… 语句中就行了,如图红色标识处
通用分页需要学习的mysql
– 1.根据条件模糊查询
select * from t_mvc_book where bname like ‘%斗破%’;
– 2.符合条件的记录数
select count(1) from (select * from t_mvc_book where bname like ‘%斗破%’) t;
–3.分页的查询语句
select * from t_mvc_book where bname like ‘%斗破%’ limit start,offset–
star