首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 数据库 > 其他数据库 >

MongoDB与MySql常用命令对照

2012-07-20 
MongoDB与MySql常用命令对比最近给朋友推荐哈mongodb也很久没有去回顾这些数据库了,下面对mysql和mongodb

MongoDB与MySql常用命令对比

最近给朋友推荐哈mongodb

也很久没有去回顾这些数据库了,下面对mysql和mongodb常用命令做哈对比

123456789101112131415161718192021222324252627282930313233343536373839404142434445一、连接数据库?mysql -uroot -p123456????????? #mysql?mongo.exe????????????????????? #mongodb?#都是默认的端口?二、查询所有的数据库?show databases??????????????? #mysql?show? dbs???????????????????? #mongodb?三、选择指定数据库?use test??????????????????????? #mysql、mongodb一样?四、列出该数据库的所有表?show tables???????????????????? #mysql、mongodb一样?五、查询?select * from tb_table? where id=1???????????????? #mysql?db.tb_table.find({id:1})?????????????????????????? #mongodb?六、添加数据?insert into tb_table(id,name) values(3,'lyc')????? #mysql?db.tb_table.save({"id":3,"name":"lyc"})??????????? #mongodb?七、删除数据?delete from tb_table where id=3???????????????????? #mysql?db.tb_table.remove({"id":3})??????????????????????? #mongodb?八、更新数据?update tb_table set? name="lyca" where id=3??????????????? #mysql?

热点排行