-
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})
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/29146891/viewspace-1850458/
,如需转载,请注明出处,否则将追究法律责任。