Created
October 2, 2019 09:33
-
-
Save wickywills/cdfc35aee006dbe83dcc34e042ef35d3 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Differences between MySQL and MongoDB | |
Selecting records from the customer table: | |
``` | |
MySQL: SELECT * FROM customer | |
MongoDB: db.customer.find() | |
``` | |
Inserting records into the customer table: | |
``` | |
MySQL: INSERT INTO customer (cust_id, branch, status) VALUES ('appl01', 'main', 'A') | |
MongoDB: db.customer.insert({ cust_id: 'appl01', branch: 'main', status: 'A' }) | |
``` | |
Updating records in the customer table: | |
``` | |
MySQL: UPDATE customer SET branch = 'main' WHERE custage > 2 | |
MongoDB: db.customer.update( { custage: { $gt: 2 } }, { $set: { branch: 'main' } }, { multi: true } ) | |
``` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment