Posts

Showing posts from September, 2025

Phases of sql query

  FROM & JOIN Phase The DBMS starts by looking at the FROM users u table. It then performs a LEFT JOIN with borrows b : For each row in users , it tries to find matching rows in borrows where u.id = b.user_id . If a user has no borrows, that user still appears, but with NULL in b.* . 👉 At this stage, we have a wide table with u.id, u.name, b.id, b.issued_date, b.status . WHERE Filtering  If you had a WHERE clause, it would be applied here, filtering individual rows before grouping. Since we’re not using WHERE , all rows pass through. GROUP BY Phase Rows are grouped by u.id, u.name . Each group corresponds to one user . Example: If user #5 has 3 borrow rows, those rows are grouped into a single "bucket." Aggregate Functions (COUNT) For each group (each user), COUNT(b.id) is calculated. Important: COUNT(b.id) counts only non-NULL values . If a user has no borrows, b.id is NULL → count becomes 0 . ...

Running a Maven Web Application in IntelliJ with Tomcat

Image
Running a Maven Web Application in IntelliJ with Tomcat Running a Maven Web Application in IntelliJ with Tomcat Step 1: Configure Tomcat in IntelliJ Go to File → Settings → Build, Execution, Deployment → Application Servers . Click + → Select Tomcat Server (Local) . Point IntelliJ to your Tomcat installation folder. Step 2: Create a Run/Debug Configuration Go to Run → Edit Configurations . Click + → Select Tomcat Server → Local . Under Deployment , click + → select Artifact . Choose your WAR file ( dbsample:war exploded ) → OK. Name the configuration (e.g., Tomcat-dbsample ). Step 3: Run the Application Click the green Run ▶️ (or Debug 🐞) button. IntelliJ will start Tomcat and deploy your dbsample app automatically. Open your browser and go to: http://localhost:8080/dbsample ✅ That’s it! You now have your Maven Webap...

How to Remove a File or Folder from Git Without Losing It Locally

How to Remove a File or Folder from Git Without Losing It Locally How to Remove a File or Folder from Git Without Losing It Locally Safely untrack sensitive or noisy files (like .env ) from your repository while keeping them on your machine. When working on projects, you often have files that shouldn’t be tracked by Git , such as .env files containing sensitive credentials or configuration data. Committing these files can expose secrets and clutter your repository. But what if they are already tracked? You can safely remove them from Git while keeping them on your local machine . Here’s how. Remove the file from Git index Use the --cached option to untrack the file: Copy git rm --cached .env --cached tells Git to remove the file from version co...