hello

来源:互联网 发布:小葫芦数据检测作假 编辑:程序博客网 时间:2024/04/16 18:29
3.查询
3.1查询表的所有记录
在oracle中使用
select xuehao,name,tel from table2;
在mongodb里使用
db.table2.find()


3.2查询指定的列的所有数据
在oracle中使用
select name from table2;
在mongodb里使用
db.table2.find({},{"name":1})


3.3查询过滤单一条件
在oracle中使用
select xuehao,name,tel from table2 where xuehao="5";
在mongodb里使用
db.table2.find({"xuehao":"5"},{"xuehao":1,"name":1,"tel":1})


3.4查询过滤多个组合and条件
在oracle中使用
select xuehao,name,tel from table2 where xuehao="5" and name="lxd3";
在mongodb里使用
db.table2.find({"xuehao":"5","name":"lxd3"},{"xuehao":1,"name":1,"tel":1})


3.5查询过滤多个组合or条件
在oracle中使用
select xuehao,name,tel from table2 where xuehao="5" or name="lxd%";
在mongodb里使用
db.table2.find({$or:[{"xuehao":"5","name":"/^lxd/"}]},{"xuehao":1,"name":1,"tel":1})
0 0
原创粉丝点击