Skip to content

bhavyabgada/sql

Repository files navigation

SQL Learning Path

This repository contains a structured set of SQL examples and practice problems organized by topic, designed to help you learn SQL from basic to advanced concepts. Each folder focuses on a specific topic and includes examples and relevant practice problems.

Repository Structure

  1. 1_basic_sql_commands

    • Fundamental SQL commands: SELECT, INSERT, UPDATE, DELETE
    • Basic clauses: WHERE, GROUP BY, HAVING, ORDER BY, LIMIT
    • 5 practice problems focused on basic queries
  2. 2_advanced_query_techniques

    • Joins (INNER, LEFT, RIGHT, FULL OUTER, CROSS)
    • Subqueries (EXISTS, IN, NOT IN, SCALAR SUBQUERY)
    • Common Table Expressions (CTE)
    • Window Functions
    • Hierarchical Queries
    • 16 practice problems covering joins and advanced select techniques
  3. 3_transactions_and_concurrency

    • Transaction control (BEGIN, COMMIT, ROLLBACK)
    • Row locking (FOR UPDATE)
    • Concurrency control and isolation levels
  4. 4_data_types_json_xml_arrays

    • JSON Functions
    • XML Handling
    • ARRAY Functions
    • String Functions and Regular Expressions
    • 7 practice problems on string manipulation and special data types
  5. 5_procedural_sql

    • Stored Procedures
    • Triggers
    • Dynamic SQL
  6. 6_analytical_and_performance_features

    • Query Optimization
    • Materialized Views
    • Partitioning
    • 7 practice problems focused on subqueries and analytical functions
  7. 7_reporting_and_pivoting

    • PIVOT and UNPIVOT operations
    • String Aggregation
    • 15 practice problems on aggregation, sorting, and grouping
  8. 8_unique_sql_features

    • Recursive Queries
    • Geospatial Data Queries
    • Graph Queries

Master Query

All examples are derived from a comprehensive master query (master_query.sql) that demonstrates many SQL features in a single file. This master query serves as a reference for how different SQL features can be combined in complex queries.

🚀 Interview Preparation

SQL Interview Cheatsheet — A comprehensive 2-hour final day revision guide covering:

  • Window Functions (ROW_NUMBER, RANK, DENSE_RANK, LAG, LEAD)
  • PARTITION BY patterns
  • Common Table Expressions (CTEs)
  • All types of JOINs with solutions
  • Subqueries (IN, EXISTS, correlated)
  • Aggregations & Grouping
  • Theoretical interview questions with answers
  • Quick reference patterns for common problems

How to Use This Repository

  1. Start with folder 1 and work your way through in numerical order
  2. Each folder contains:
    • A README.md file explaining the topic and listing relevant problems
    • An SQL file with examples of the topic's features
    • (In some folders) Problem descriptions and solutions
  3. Study the example file in each folder to understand the concepts
  4. Work through the practice problems to reinforce your learning
  5. Refer back to the master query to see how different features can be combined

Database Compatibility

The examples include syntax variations for different database systems where appropriate:

  • MySQL/MariaDB
  • PostgreSQL
  • Oracle
  • SQL Server

Note that not all features are available in all database systems, and syntax may vary.

Learning Path

This repository is designed to take you from basic SQL queries to advanced database concepts. By working through the folders in order, you'll build a solid foundation in SQL and gradually tackle more complex topics.

Happy learning! # sql

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published