Optimizing SQL Queries for Efficient Database Management