This repository contains my journey through SQL challenges on HackerRank, where I earned a 5-star rating in SQL programming. Each solution demonstrates different aspects of SQL querying, from basic SELECT statements to advanced window functions, aggregations, and complex joins. These solutions are compatible with MySQL, PostgreSQL, and SQL Server.
5 Star SQL Badge on HackerRank
Weather Observation Stations (String Functions)
Advanced Weather Stations (Mathematical Functions)
String Manipulation & Pattern Matching
🛠️ Key SQL Concepts Demonstrated
- SELECT, FROM, WHERE clauses
- Filtering with conditions (=, >, <, >=, <=, <>)
- Logical operators (AND, OR, NOT)
- DISTINCT for unique values
- LIKE patterns with wildcards (%, _)
- SUBSTR() / SUBSTRING() for character extraction
- LEFT() and RIGHT() functions
- CONCAT() for string concatenation
- REPLACE() for character substitution
- LENGTH() for string length
- COUNT(), SUM(), AVG(), MAX(), MIN()
- GROUP BY for data grouping
- HAVING clause for filtered aggregations
- ROUND(), TRUNCATE(), CEIL(), FLOOR()
- SQRT(), POWER() for calculations
- Mathematical operators (+, -, *, /, %)
- Subqueries and correlated subqueries
- Window functions (ROW_NUMBER(), OVER())
- CASE statements for conditional logic
- PIVOT operations for data transformation
- JOIN operations (LEFT JOIN)
- MySQL syntax and functions
- PostgreSQL compatibility
- SQL Server T-SQL features
- Standard SQL compliance
-
Clone the repository:
git clone https://github.com/yourusername/SQL-with-Problem-Solving.git
cd SQL-with-Problem-Solving
-
Execute any solution:
-- Copy the SQL code from any .sql file
-- Run it in your preferred SQL environment (MySQL, PostgreSQL, SQL Server)
-
Example execution:
-- From SelectAll.sql
SELECT * FROM CITY;
| Category |
Problems Solved |
Difficulty |
Key Concepts |
| Basic Select |
6 |
🟢 Easy |
SELECT, WHERE, filtering |
| Advanced Select |
5 |
🟡 Medium |
String functions, patterns |
| Aggregation |
6 |
🟡 Medium |
COUNT, SUM, AVG, GROUP BY |
| Weather Stations |
20 |
🟡 Medium |
String manipulation, math functions |
| Join Operations |
1 |
🔴 Hard |
LEFT JOIN, GROUP BY |
| Advanced Topics |
7 |
🔴 Hard |
CASE, subqueries, window functions |
- ✅ Proficiency in SQL query writing and optimization
- ✅ String manipulation and pattern matching expertise
- ✅ Advanced aggregation and mathematical functions
- ✅ Subquery design and correlated queries
- ✅ Window functions and analytical queries
- ✅ Database schema understanding and relationships
- ✅ Performance optimization techniques
- ✅ Cross-platform SQL compatibility
🎯 Problem Categories Mastered
- Basic and advanced SELECT statements
- Multi-table queries with JOINs
- Filtering and sorting large datasets
- Statistical calculations (averages, medians, ranges)
- Distance calculations (Manhattan, Euclidean)
- Pattern recognition and classification
- Text pattern matching and extraction
- Character-based filtering and sorting
- String formatting and manipulation
- Employee hierarchy analysis
- Geographic data processing
- Educational grading systems
This project is licensed under the MIT License - see the LICENSE file for details.
Feel free to fork this repository and submit pull requests for any improvements or additional solutions! Contributions for SQL optimization or alternative approaches are welcome.
⭐ If you found this repository helpful, please star it! ⭐
Made with ❤️ by Ak-Rajak