From 8b301756a4c5f6bacd62d54d3032d03fa8e5ba66 Mon Sep 17 00:00:00 2001 From: Rachit Sharma Date: Sun, 11 Jan 2026 18:12:40 +0530 Subject: [PATCH 1/2] Update README with project structure and JDBC learnings --- README.md | 47 +++++++++++++++++++++++++++-------------------- 1 file changed, 27 insertions(+), 20 deletions(-) diff --git a/README.md b/README.md index 178512f..6a77acd 100644 --- a/README.md +++ b/README.md @@ -43,8 +43,12 @@ CREATE TABLE students ( age INT, marks INT DEFAULT 0 ); +``` + ## Project Structure + +``` ├── Task1.java # MySQL Connection Test ├── Task2.java # Read (SELECT) Operation ├── Task3.java # Insert (INSERT) Operation @@ -54,6 +58,9 @@ CREATE TABLE students ( ├── Main.java # Menu Driven Program ├── Methods.java # CRUD Methods └── README.md +``` + +--- ## 🔑 MySQL Connection Configuration String mysqlUrl = "jdbc:mysql://localhost:3306/Student_db"; @@ -76,25 +83,30 @@ javac *.java java Main 📋 CRUD Operations Explained -➕ Insert Data +➕ + +```sql +-- Insert Data INSERT INTO students VALUES (?, ?, ?); -📖 Read Data +-- 📖 Read Data SELECT * FROM students; -✏ Update Data +-- Update Data UPDATE students SET marks = ? WHERE id = ?; -❌ Delete Data +-- Delete Data DELETE FROM students WHERE id = ?; -🧠 Key JDBC Learnings -## ? is used only for values, not table/column names -## Always use PreparedStatement instead of Statement -## executeQuery() → SELECT -## executeUpdate() → INSERT / UPDATE / DELETE -## \t is for printing, not column names -## Table names should never be in quotes +``` + +# 🧠 Key JDBC Learnings +- ? is used only for values, not table/column names +- Always use PreparedStatement instead of Statement +- executeQuery() → SELECT +- executeUpdate() → INSERT / UPDATE / DELETE +- `\t` is for printing, not column names +- Table names should never be in quotes ⚠ Common Errors Solved >SQLSyntaxErrorException @@ -103,19 +115,14 @@ DELETE FROM students WHERE id = ?; >Incorrect column name usage in ResultSet >Forgetting to set values for ? -🎯 Ideal For +## Ideal For JDBC beginners College practicals Viva preparation Interview fundamentals Mini Java projects -👨‍💻 Author -Mayur Ughade -Learning Java | JDBC | MySQL - - - - - +## Author +`Mayur Ughade` +Learning Java | JDBC | MySQL From d27ceb8b56dfaa474c9d2ed8ba8adde71d48ae5c Mon Sep 17 00:00:00 2001 From: Rachit Sharma Date: Sun, 11 Jan 2026 18:23:53 +0530 Subject: [PATCH 2/2] Fix formatting issues in README.md --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 6a77acd..c30ae44 100644 --- a/README.md +++ b/README.md @@ -64,7 +64,9 @@ CREATE TABLE students ( ## 🔑 MySQL Connection Configuration String mysqlUrl = "jdbc:mysql://localhost:3306/Student_db"; + String username = "root"; + String password = "your_password"; 🚀 How to Run the Project