diff --git a/README.md b/README.md index 178512f..c30ae44 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,10 +58,15 @@ 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"; + String username = "root"; + String password = "your_password"; 🚀 How to Run the Project @@ -76,25 +85,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 +117,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