Skip to content

Commit c0f7de9

Browse files
committed
Mongo and some corrections
1 parent 1f6d00e commit c0f7de9

File tree

5 files changed

+110
-62
lines changed

5 files changed

+110
-62
lines changed

clojure.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Clojure online compiler
2-
Write, Run & Share Clojure code online using OneCompiler's Clojure online compiler for free. It's one of the robust, feature-rich online compilers for Clojure language, Getting started with the OneCompiler's Clojure editor is easy and fast. The editor shows sample boilerplate code when you choose language as Clojure and you can also choose hundreds of reference programs to get started. For example, if you want to write a program on Clojure collections choose the collections tag from reference and see hundreds of pre-written programs on collections. You can pick one of them to start your coding.
2+
Write, Run & Share Clojure code online using OneCompiler's Clojure online compiler for free. It's one of the robust, feature-rich online compilers for Clojure language, Getting started with the OneCompiler's Clojure editor is easy and fast. The editor shows sample boilerplate code when you choose language as Clojure and start coding. Happy learning!
33

44
# Read inputs from stdin
55
OneCompiler's Clojure online editor supports stdin and users can give inputs to programs using the STDIN textbox under the I/O tab. Following is a sample Clojure program which takes name as input and prints hello message with your name.

fortran.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ end if
8888

8989
### 4. If-Else:
9090

91-
If is used to execute a set of statements based on a condition and execute another set of statements present in else block if condition specified in If block fails.
91+
If is used to execute a set of statements based on a condition and execute another set of statements present in else block, if condition specified in If block fails.
9292

9393
```fortran
9494
if (logical-expression) then

java.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Java online compiler
2-
Write, Run & Share Java code online using OneCompiler's Java online compiler for free. It's one of the robust, feature-rich online compilers for Java language, running the Java LTS version 11. Getting started with the OneCompiler's Java editor is easy and fast. The editor shows sample boilerplate code when you choose language as Java and start coding.
2+
Write, Run & Share Java code online using OneCompiler's Java online compiler for free. It's one of the robust, feature-rich online compilers for Java language, running the Java LTS version 11. Getting started with the OneCompiler's Java editor is easy and fast. The editor shows sample boilerplate code when you choose language as Java and start coding. Happy learning!
33

44
# Taking inputs (stdin)
55
OneCompiler's Java online editor supports stdin and users can give inputs to the programs using the STDIN textbox under the I/O tab. Using Scanner class in Java program, you can read the inputs. Following is a sample program that shows reading STDIN ( A string in this case ).

mongodb.md

+78
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
# MongoDB online editor
2+
Write, Run & Share MongoDB queries online using OneCompiler's MongoDB online editor and compiler for free. It's one of the robust, feature-rich online editor and compiler for MongoDB. Getting started with the OneCompiler's MongoDB editor is really simple and pretty fast. The editor shows sample boilerplate code when you choose language as 'MongoDB' and start writing queries to learn and test online without worrying about tedious process of installation.
3+
4+
# About MongoDB
5+
6+
MongoDB is a cross platform document oriented NoSQL database.
7+
8+
### Key Features:
9+
10+
* Designed to overcome the the limitations of relational databases approach and other NoSQL solutions
11+
* Horizontal scaling
12+
* Load balancing capabilities
13+
* Better data availability and stability
14+
15+
# Syntax help
16+
17+
## Commands
18+
19+
### Inserting documents
20+
21+
1. `db.collection.insert()`: Using `insert` you can either insert one document or array of documents
22+
```json
23+
db.cars.insert({ "name" : "Volvo xc 60", "type" : "SUV" });
24+
```
25+
26+
2. `db.collection.insertOne()`: Inserts one document
27+
```json
28+
db.cars.insertOne({ "name" : "Volvo xc 60", "type" : "SUV" });
29+
```
30+
31+
3. `db.collection.insertMany`: Inserts multiple documents
32+
```json
33+
db.cars.insertMany(
34+
[
35+
{ "name" : "Volvo xc 60", "type" : "SUV" },
36+
{ "name" : "Volvo xc 90", "type" : "SUV" },
37+
{ "name" : "Volvo S90", "type" : "SUV" }
38+
]
39+
);
40+
```
41+
42+
### Updating documents
43+
44+
1. `db.collection.update()` : Updates one or more than one document(s) in collection based on matching document and based on `multi` option
45+
46+
```json
47+
db.cars.update(
48+
{ type: "SUV" },
49+
{ $set: { size : 5} },
50+
{ multi: true}
51+
)
52+
```
53+
2. `db.collection.updateOne()` : Updates a single document in collection based on matching document
54+
```json
55+
db.cars.updateOne(
56+
{ type: "SUV" },
57+
{ $set: { size : 5} }
58+
)
59+
```
60+
3. `db.collection.updateMany()` : Updates multiple documents in collection based on the condition.
61+
```json
62+
db.cars.updateMany(
63+
{ type: "hatchback" },
64+
{ $set: { size : 5} }
65+
)
66+
```
67+
68+
### Deleting documents
69+
70+
1. `db.collection.deleteOne(<filter>, <options>)`: Deletes a Single document from collection
71+
```json
72+
db.employees.deleteOne({_id: 1})
73+
```
74+
75+
2. `db.collection.deleteMany(<filter>, <options>)`: Deletes all documents with matching filter
76+
```json
77+
db.employees.deleteMany({type: "hatchback"})
78+
```

mysql.md

+29-59
Original file line numberDiff line numberDiff line change
@@ -20,33 +20,6 @@ MySQL is a open-source, free and very popular relational database management sys
2020

2121
## Commands
2222

23-
### Creating a database
24-
25-
```sql
26-
CREATE DATABASE [IF NOT EXISTS] db_name;
27-
```
28-
### Use a database
29-
30-
```sql
31-
USE db_name;
32-
```
33-
### Drop a database
34-
35-
```sql
36-
DROP DATABASE [IF EXISTS] db_name;
37-
```
38-
### Show available databases in the working database server
39-
40-
```sql
41-
SHOW DATABASE;
42-
```
43-
### Display all the tables present in the database
44-
45-
```sql
46-
SHOW TABLES;
47-
```
48-
## DDL Commands
49-
5023
### 1. CREATE
5124

5225
```sql
@@ -55,10 +28,24 @@ CREATE TABLE table_name (
5528
column2 datatype,
5629
....);
5730
```
31+
32+
### Example
33+
```sql
34+
CREATE TABLE EMPLOYEE (
35+
empId INTEGER PRIMARY KEY,
36+
name TEXT NOT NULL,
37+
dept TEXT NOT NULL
38+
);
39+
```
5840
### 2. ALTER
5941
```sql
6042
ALTER TABLE Table_name ADD column_name datatype;
6143
```
44+
45+
### Example
46+
```sql
47+
INSERT INTO EMPLOYEE VALUES (0001, 'Dave', 'Sales');
48+
```
6249
### 3. TRUNCATE
6350
```sql
6451
TRUNCATE table table_name;
@@ -91,58 +78,41 @@ INSERT INTO table_name (column1, column2, column3, ...) VALUES (value1, value2,
9178
```
9279
Note: Column names are optional.
9380

81+
### Example
82+
```sql
83+
INSERT INTO EMPLOYEE VALUES (0001, 'Ava', 'Sales');
84+
```
9485
### 2. SELECT
9586

9687
```sql
9788
SELECT column1, column2, ...
9889
FROM table_name
9990
[where condition];
10091
```
92+
93+
### Example
94+
```sql
95+
SELECT * FROM EMPLOYEE where dept ='sales';
96+
```
10197
### 3. UPDATE
10298

10399
```sql
104100
UPDATE table_name
105101
SET column1 = value1, column2 = value2, ...
106102
WHERE condition;
107103
```
104+
### Example
105+
```sql
106+
UPDATE EMPLOYEE SET dept = 'Sales' WHERE empId='0001';
107+
```
108108
### 4. DELETE
109109

110110
```sql
111111
DELETE FROM table_name where condition;
112112
```
113-
114-
## DCL Commands
115-
116-
### 1. GRANT
117-
118-
```sql
119-
GRANT privileges ON object TO user;
120-
```
121-
### 2. REVOKE
122-
123-
```sql
124-
REVOKE privileges ON object FROM user;
125-
```
126-
## TCL commands
127-
128-
### 1. COMMIT
129-
130-
```sql
131-
COMMIT;
132-
```
133-
### 2. ROLLBACK
134-
135-
```sql
136-
ROLLBACK;
137-
```
138-
## 3. SAVEPOINT
139-
```sql
140-
SAVEPOINT savepoint_name;
141-
ROLLBACK TO savepoint_name;
142-
```
143-
How to delete a savepoint:
113+
### Example
144114
```sql
145-
RELEASE SAVEPOINT savepoint_name;
115+
DELETE from EMPLOYEE where empId='0001';
146116
```
147117

148118
## Indexes

0 commit comments

Comments
 (0)