|
1 | | -# SQL, JDBC & MongoDB Tasks |
| 1 | +# SQL + JDBC + MongoDB Tasks |
2 | 2 |
|
3 | | -A clean, structured collection of database tasks involving **MySQL SQL queries**, **Java JDBC operations**, and **MongoDB queries**. |
4 | | -This repository also includes screenshots demonstrating query outputs and program execution. |
| 3 | + |
| 4 | + |
| 5 | + |
| 6 | + |
| 7 | + |
| 8 | +A clean, structured repository containing SQL queries, JDBC database operations, and MongoDB query tasks. |
| 9 | +This project demonstrates backend fundamentals using **MySQL**, **Java JDBC**, and **MongoDB**. |
5 | 10 |
|
6 | 11 | --- |
7 | 12 |
|
8 | 13 | ## 📁 Project Structure |
9 | 14 |
|
10 | 15 | ``` |
11 | | -. |
12 | | -├── 1.sql |
13 | | -├── MyDatabaseConnection.java |
14 | | -├── QuestionTwo.java |
15 | | -├── screenshots/ |
16 | | -│ ├── 1.1.png |
17 | | -│ ├── 1.2.png |
18 | | -│ ├── 1.3.png |
19 | | -│ ├── 1.4.png |
20 | | -│ ├── 1.5.png |
21 | | -│ ├── 1.6.png |
22 | | -│ ├── 1.7.png |
23 | | -│ ├── 1.8.png |
24 | | -│ ├── 2.5.png |
25 | | -│ ├── 2.6.png |
26 | | -└── README.md |
| 16 | +sql-jdbc-mongodb-tasks/ |
| 17 | +│── .github/workflows/ # CI workflows (Java build, linting, formatting) |
| 18 | +│── screenshots/ # Visual outputs of SQL & Java executions |
| 19 | +│── 1.sql # SQL queries for Employee table |
| 20 | +│── MyDatabaseConnection.java |
| 21 | +│── QuestionTwo.java |
| 22 | +│── MONGODB TASK.docx |
| 23 | +│── README.md |
| 24 | +│── LICENSE |
27 | 25 | ``` |
28 | 26 |
|
29 | 27 | --- |
30 | 28 |
|
31 | | -## 📝 Task 1 — SQL Queries on Employee Table |
32 | | - |
33 | | -The `Empl` table contains employee information such as: |
34 | | - |
35 | | -- `EName` — Employee Name |
36 | | -- `Sal` — Salary |
37 | | -- `Comm` — Commission |
38 | | -- `Job` — Job Title |
39 | | -- `Mgr` — Manager ID |
40 | | - |
41 | | -### ✔ Screenshots |
42 | | - |
43 | | -#### 🔹 Full Table View |
44 | | - |
45 | | - |
46 | | - |
47 | | -#### 🔹 Employees with salary ≥ 2200 |
48 | | - |
49 | | - |
| 29 | +## 🧩 Task 1 — SQL Queries (MySQL) |
50 | 30 |
|
51 | | -#### 🔹 Employees with NULL commission |
| 31 | +These SQL queries run on the `Empl` table to explore filtering, pattern matching, and NULL checks. |
52 | 32 |
|
53 | | - |
| 33 | +### 📸 Screenshots |
| 34 | +#### Full Table Output |
| 35 | + |
54 | 36 |
|
55 | | -#### 🔹 Salary NOT between 2500 and 4000 |
| 37 | +#### Salary ≥ 2200 |
| 38 | + |
56 | 39 |
|
57 | | - |
| 40 | +#### Employees With NULL Commission |
| 41 | + |
58 | 42 |
|
59 | | -#### 🔹 Employees without a manager |
| 43 | +#### Salary NOT Between 2500 and 4000 |
| 44 | + |
60 | 45 |
|
61 | | - |
| 46 | +#### No Manager (mgr IS NULL) |
| 47 | + |
62 | 48 |
|
63 | | -#### 🔹 Employees whose 3rd letter is 'A' |
| 49 | +#### Name with 'A' as 3rd Letter |
| 50 | + |
64 | 51 |
|
65 | | - |
| 52 | +#### Name Ending with 'T' |
| 53 | + |
66 | 54 |
|
67 | | -#### 🔹 Employees whose name ends with 'T' |
68 | | - |
69 | | - |
70 | | - |
71 | | -#### 🔹 SQL Script Summary |
72 | | - |
73 | | - |
| 55 | +#### Final SQL Script |
| 56 | + |
74 | 57 |
|
75 | 58 | --- |
76 | 59 |
|
77 | | -## 🧪 Task 2 — JDBC Employee Insert Program |
78 | | - |
79 | | -Java program using JDBC to: |
| 60 | +## 🧩 Task 2 — JDBC Program (Java) |
80 | 61 |
|
81 | | -- Connect to MySQL |
82 | | -- Create `employee` table |
83 | | -- Insert 5 employee records |
| 62 | +`MyDatabaseConnection.java` |
| 63 | +Establishes connection to MySQL using JDBC. |
| 64 | + |
84 | 65 |
|
85 | | -### ✔ Successful Connection Screenshot |
| 66 | +**Output:** |
| 67 | + |
86 | 68 |
|
87 | | - |
88 | | - |
89 | | -### ✔ Inserted Records Verification |
90 | | - |
91 | | - |
| 69 | +`QuestionTwo.java` |
| 70 | +Creates a table and inserts employee records. |
| 71 | + |
92 | 72 |
|
93 | 73 | --- |
94 | 74 |
|
95 | | -## 🍃 Task 3 — MongoDB Queries (Product Dataset) |
| 75 | +## 🧩 Task 3 — MongoDB Queries |
96 | 76 |
|
97 | | -Queries performed: |
| 77 | +Queries performed on `product.json` dataset (Day 1). |
98 | 78 |
|
99 | | -1. Retrieve all products |
100 | | -2. Find products priced between 400 and 800 |
101 | | -3. Find products NOT priced between 400 and 600 |
102 | | -4. First 4 products with price > 500 |
103 | | -5. Retrieve product_name & product_material |
104 | | -6. Find product with `row_id = 10` |
105 | | -7. Delete products priced at 28 |
106 | | -8. And more… |
| 79 | +Includes filters, ranges, projections, and delete operations. |
| 80 | +File: `MONGODB TASK.docx` |
107 | 81 |
|
108 | 82 | --- |
109 | 83 |
|
110 | | -## ▶ How to Run |
| 84 | +## ▶️ How to Run |
111 | 85 |
|
112 | 86 | ### **SQL** |
113 | | - |
114 | | -```bash |
| 87 | +```sql |
115 | 88 | mysql -u root -p |
| 89 | +use tasks; |
116 | 90 | source 1.sql; |
117 | 91 | ``` |
118 | 92 |
|
119 | | -### **JDBC** |
120 | | - |
| 93 | +### **Java** |
121 | 94 | ```bash |
122 | | -javac MyDatabaseConnection.java |
123 | | -javac QuestionTwo.java |
| 95 | +javac MyDatabaseConnection.java QuestionTwo.java |
| 96 | +java MyDatabaseConnection |
124 | 97 | java QuestionTwo |
125 | 98 | ``` |
126 | 99 |
|
127 | 100 | ### **MongoDB** |
128 | | - |
129 | 101 | ```bash |
130 | 102 | mongoimport --db mydatabase --collection products --file product.json --jsonArray |
131 | 103 | ``` |
132 | 104 |
|
133 | 105 | --- |
134 | 106 |
|
135 | | -## ✔ Requirements |
136 | | - |
137 | | -- MySQL 5.7+ / MariaDB |
138 | | -- Java 8+ |
139 | | -- MySQL Connector/J |
140 | | -- MongoDB 4.0+ |
141 | | - |
142 | | ---- |
143 | | - |
144 | | -## 📸 Screenshots Folder |
145 | | - |
146 | | -All images included are sanitized and safe for public usage. |
147 | | -Sensitive screenshots (`2.1`–`2.4`) were removed. |
148 | | - |
149 | | ---- |
150 | | - |
151 | | -## 📌 Author |
152 | | - |
153 | | -**TheComputationalCore** |
154 | | - |
155 | | ---- |
| 107 | +## 📜 License |
| 108 | +This project is licensed under the **MIT License**. |
0 commit comments