A practical collection of T-SQL demonstrating schema design, stored procedures, indexing, window functions, and a scheduled SQL Agent job — the bread and butter of database work.
| File | Demonstrates |
|---|---|
01_schema.sql |
Normalized schema (Customers, Orders, OrderItems) with keys, constraints, indexes |
02_seed.sql |
Sample data for testing |
03_stored_procedures.sql |
Parameterized procs (CRUD, reporting) with TRY/CATCH + transactions |
04_views_and_window_functions.sql |
Reporting views, ROW_NUMBER, SUM() OVER, ranking |
05_indexing.sql |
Covering & filtered indexes with rationale |
06_agent_job.sql |
A SQL Server Agent job that archives old orders nightly |
Open in SSMS or Azure Data Studio against any SQL Server / LocalDB instance and run the scripts in numeric order.
Relational modelling, set-based thinking, safe transactional procedures, reporting with window functions, deliberate indexing, and operational automation via Agent jobs.