StackPractices

Tag: sql

Browse 36 practical software engineering resources tagged with "sql". Discover code recipes, design patterns, documentation templates, and in-depth guides to help you build, deploy, and maintain production-ready solutions involving sql. Each resource is written for engineers who ship real systems, with copy-paste examples and practical trade-offs.

SQL and Relational Data Access

SQL remains the universal language for structured data. Writing production SQL means going beyond basic queries: indexes, transactions, window functions, CTEs, and query plans determine whether an application scales.

The resources below cover query optimization, schema design, migrations, common table expressions, full-text search, and safe access patterns. Each recipe translates database theory into performant, maintainable queries.

Every resource includes clear explanations, copy-paste code, and practical warnings. Use them to make informed decisions, avoid production pitfalls, and speed up your delivery. If you are just getting started, read the beginner-friendly articles first; if you are experienced, jump straight to the advanced patterns and architecture guides. New resources are added regularly, so bookmark this page and check back for the latest patterns.

Transform Data in the Warehouse with dbt

How to use dbt for SQL-based data transformations with models, tests, materializations, macros, and...

Recursive CTEs for Hierarchical Data Queries

How to query hierarchical data with recursive Common Table Expressions in SQL, covering tree...

Caching with Redis

How to implement application caching using Redis for performance and scalability.

Handle Database Deadlocks and Retries

Detect, prevent, and recover from database deadlocks with automatic retry logic, consistent lock...

Manage Database Migrations Safely

How to version, apply, and rollback database schema changes using migration tools like Flyway,...

Database Migrations Safely

How to run database schema migrations without downtime or data loss.

Set Up Database Read Replicas for Scaling

Scale read-heavy workloads with database read replicas, replication lag monitoring, and read/write...

Database Replication

Set up and manage database replication for high availability, read scaling, and disaster recovery...

Database Transactions

How to use ACID transactions to ensure data integrity across Python, JavaScript, and Java with SQL...

Create and Use Database Views and Materialized Views

How to create and use database views and materialized views to simplify queries and improve read...

Prevent and Resolve Deadlocks in SQL Transactions

Identify deadlock patterns in SQL databases, apply consistent lock ordering, use appropriate...

Implement Event Sourcing in a Relational Database

Build event sourcing in a relational database. Store immutable events, project read models, and use...

Execute Raw SQL

How to execute raw SQL queries safely with parameterized statements.

Full-Text Search

How to implement full-text search with Elasticsearch, Meilisearch, and PostgreSQL.

CRUD Operations with MongoDB and Mongoose

How to perform Create, Read, Update, and Delete operations in MongoDB using Mongoose ODM with...

Optimistic Locking in Databases

Implement optimistic locking with versioning to prevent lost updates. Examples in SQL, Node.js,...

PostgreSQL Query Optimization and Indexing Strategies

Analyze and optimize slow PostgreSQL queries using EXPLAIN, proper indexing, partial indexes, and...

Database Schema Evolution

Evolve database schemas safely with backward-compatible changes, versioned migrations, and online...

Implement Soft Deletes in Databases with Python, JS and Java

Learn to implement soft deletes in databases. Practical examples in Python, JavaScript, and Java...

Find and Remove Duplicate Rows in SQL

Detect duplicate records in SQL tables using GROUP BY and HAVING, then remove them safely while...