四、SQL SERVER分页查询方法
  sql server 2005及以上版本,可用 rownum() over()方式实现
  不可用rownum() over()方式版本用top关键字方式实现
  select top num * from tablename where ..........
  五、MONGODB分页查询方法
  mongoDB的分页查询是通过limit(),skip(),sort()这三个函数组合进行分页查询的
  用skip方法查询大量数据的时候速度慢
  page1 = db.things.find().limit(20)
  page2 = db.things.find().skip(20).limit(20)
  page3 = db.things.find().skip(40).limit(20)
  find(查询条件),skip(跳过多少条数据),limit(查询多少条数据),sort(排序依据):sort({"age":1})1--正序,-1--反序
  MySQL对应mongodb:
  查询:
  MySQL:SELECT * FROM user
  Mongo: db.user.find()
  MySQL:SELECT * FROM user WHERE name = 'starlee'
  Mongo: db.user.find({'name' : 'starlee'})
  插入:
  MySQL:INSERT INOT user (`name`, `age`) values ('starlee',25)
  Mongo:db.user.insert({'name' : 'starlee', 'age' : 25})
  删除:
  MySQL:DELETE * FROM user
  Mongo:db.user.remove({})
  MySQL:DELETE FROM user WHERE age < 30
  Mongo:db.user.remove({'age' : {$lt : 30}})
  更新:
MySQL:UPDATE user SET `age` = 36 WHERE `name` = 'starlee'
Mongo:db.user.update({'name' : 'starlee'}, {$set : {'age' : 36}})
MySQL:UPDATE user SET `age` = `age` + 3 WHERE `name` = 'starlee'
Mongo:db.user.update({'name' : 'starlee'}, {$inc : {'age' : 3}})
==============others=======================
MySQL:SELECT COUNT(*) FROM user WHERE `name` = 'starlee'
Mongo:db.user.find({'name' : 'starlee'}).count()
MySQL:SELECT * FROM user limit 10,20
Mongo:db.user.find().skip(10).limit(20)
MySQL:SELECT * FROM user WHERE `age` IN (25, 35,45)
Mongo:db.user.find({'age' : {$in : [25, 35, 45]}})
MySQL:SELECT * FROM user ORDER BY age DESC
Mongo:db.user.find().sort({'age' : -1})
MySQL:SELECT DISTINCT(name) FROM user WHERE age > 20
Mongo:db.user.distinct('name', {'age': {$lt : 20}})
MySQL:SELECT name, sum(marks) FROM user GROUP BY name
Mongo:
db.user.group({
key : {'name' : true},
cond: {'name' : 'foo'},
reduce: function(obj,prev) { prev.msum += obj.marks; },
initial: {msum : 0}
});
MySQL:
SELECT name FROM user WHERE age < 20
Mongo:db.user.find('this.age < 20', {name : 1})