申明:生平第一次写博客,相关条款了解不全,如有雷同之处请及时联系解决。本篇博客主要目的将自己的总结记载,如果有幸有大佬看到望指正不足。
一.分页语句
mysql: limit关键字的用法:limit(pageno-1)*pagesize,pagesize (当前页码-1)*页容量,页容量
sqlServer:
单表:
select * from (select *, ROW_NUMBER() OVER(Order by 排序的字段名) AS RowId from 表名) as b where RowId between pageNum(当前页码) and pageSize(页容量)
多表联查:
select * from(select *, ROW_NUMBER() OVER(order by t1.排序字段) as Row from (多表联查语句)as t1) as t2 where t2.Row between pageNum and pageSize
二.主键自增(通常设ID自增)
mysql:
1.创表语句AUTO_INCREMENT实现
create table if not exists userInfo (
id int PRIMARY KEY **AUTO_INCREMENT,**
name varchar(50) NOT NULL,
password