Welcome to the official repository for my SQL tasks completed during the Celebal Technologies Summer Internship 2025. This repository is structured week-wise as per the course modules provided on the Celebal Internship Portal.
- 🏢 Company: Celebal Technologies
- 👨💻 Role: SQL Intern
- 📆 Duration: June 2, 2025 – August 3, 2025
Tasks focused on foundational SQL concepts like:
- Creating, Altering, Dropping Databases and Tables
- SQL Constraints (Primary, Foreign, Default, Check, etc.)
- Data Types in SQL Server
- SQL Commands:
INSERT,UPDATE,DELETE SELECTStatements- Joins and Advanced Joins
- Aggregation and Set Operations
- Relationship Modeling and Referential Integrity
📁 Folder: Week-1-DDL/
📄 Assignment: Level A Task Solutions
This week focuses on advanced SQL concepts using the AdventureWorks2022 database, including built-in functions, user-defined functions, stored procedures, views, and triggers.
- Built-in String, DateTime, Math, Cast/Convert Functions
- User Defined Functions (UDFs)
- Views (Standard, Updatable, Indexed, with Limitations)
- Stored Procedures for Insert, Update, Delete, Fetch Operations
- Triggers for Referential Integrity and Inventory Management
📁 Folder: Week-2-BuiltIn-Functions/
📄 Assignment: Level B Task Solutions
This week dives into performance optimization and modular SQL programming through indexes, stored procedures, and subqueries.
- Temporary Tables
- Indexes (Part 1 & 2)
- Unique vs Non-Unique Indexes
- Pros and Cons of Indexes
- Stored Procedures
- Stored Procedures with Output Parameters (Part 1 & 2)
- Advantages of Stored Procedures
- Subqueries & Correlated Subqueries
- Performance Comparison: Subquery vs Join
📁 Folder: Week-3-Indexes/
📄 Assignment: Level C Task Solutions
This week focuses on DML triggers and their practical use cases, including conditional logic during INSERT, UPDATE, and DELETE operations. The week concludes with a subject allotment assignment based on GPA and preference order.
- DML Triggers
- AFTER UPDATE Trigger
- INSTEAD OF INSERT Trigger
- INSTEAD OF UPDATE Trigger
- INSTEAD OF DELETE Trigger
📁 Folder: Week-4-Triggers/
📄 Assignment: Student Allotment SQL Problem
This week covers Common Table Expressions (CTE) and their use in modular query writing. Topics include recursive CTEs, updatable CTEs, and using them in practical scenarios. The assignment implements a subject change request tracker using stored procedures.
- Common Table Expressions (CTE) – Part 1 & 2
- Updatable CTEs
- Recursive CTE
📁 Folder: Week-5-CTE/
📄 Assignment: Subject Change Request Problem
This week introduces data reshaping, robust error handling, and transaction management in SQL Server. It also includes LeetCode-style SQL problems that help apply concepts in real-world scenarios.
PIVOT– Transform rows into columnsUNPIVOT– Transform columns back into rows- Error Handling using
TRY...CATCHblocks- Error Handling – Part 1: Handling syntax/logical errors
- Error Handling – Part 2: Custom error messages, nested try-catch
- Transactions & ACID Properties
MERGEStatement – ConditionalINSERT,UPDATE, orDELETE- Window Functions:
ROW_NUMBER()RANK()DENSE_RANK()NTILE()
- LeetCode SQL Problems (Performance-focused)
📁 Folder: Week-6-Pivot/
📄 Assignment: Perform Leetcode Questions
This week dives deep into Slowly Changing Dimensions (SCD) — a critical concept in Data Warehousing and ETL processes. Each SCD type handles historical changes in dimension tables differently. The assignment includes implementation of stored procedures for each SCD type using SQL Server.
- SCD Type 0: Fixed dimensions (no changes allowed)
- SCD Type 1: Overwrite old data (no history maintained)
- SCD Type 2: Historical tracking via versioning or effective dates
- SCD Type 3: Limited history with previous and current column versions
- SCD Type 4: History stored in a separate historical table
- SCD Type 6: Hybrid approach (Types 1 + 2 + 3)
Each SCD type is implemented through a dedicated stored procedure to handle INSERT and UPDATE operations based on the logic of that dimension type.
📁 Folder: Week-7-Star and Snowflake Schema/
📄 Assignment: Create Stored Procedures for SCD Types
This week focuses on Change Tracking, historical dimension handling, dynamic SQL generation, and OLAP-style aggregations in SQL Server. These concepts are widely used in real-world ETL pipelines, reporting systems, and data marts.
-
CDC (Change Data Capture):
Track and log changes (INSERTs, UPDATEs, DELETEs) to source tables for incremental ETL processing. -
SCD Type 2:
Maintain a full history of changes by inserting new rows on update, usingstart_date,end_date, andis_currentflags or versioning columns. -
Dynamic SQL:
Learn how to generate flexible queries at runtime usingEXECorsp_executesql. -
OLAP Features in SQL Server:
Use advanced SQL grouping techniques for data summarization:GROUPING SETSROLLUPCUBE
These operations allow multi-level aggregations without multiple GROUP BY statements, optimizing performance for analytics.
📁 Folder: Week-8-CDC/
📄 Assignment: PopulateTimeDimension.sql – Write a stored procedure to populate a Time Dimension table for all dates of a year based on one input date, using a single INSERT and recursive CTE.
- Clone this repository or download it as a ZIP.
- Open
.sqlfiles using SQL Server Management Studio (SSMS) or Mysql WorkBench 8.0 - Execute the queries on the Adventure works2022 database.
- Files are named and commented for clarity.
Krishna Shelar
💼 SQL Intern @ Celebal Technologies
🔗 LinkedIn
📌 This repository will be updated weekly with new assignments and tasks.