Indexed Views in SQL Server: Requirements, NOEXPAND and Real Costs

Indexed views in SQL Server: NOEXPAND hint logical reads compared with base tables

Indexed views in SQL Server cut my sales-by-state query from 1,059 logical reads to 2. But only after I named the view and added a hint. Without it, SQL Server 2025 Standard Developer ignored the index. Quick answer (indexed views in SQL Server): create the view WITH SCHEMABINDING, use two-part table names, add COUNT_BIG(*) next … Read more >>

SQL Server Move Database Files (MDF and LDF) to Another Drive

SQL Server move database files with ALTER DATABASE MODIFY FILE and verify the new location

My 16 MB test database was offline for about 2 seconds. The SQL Server move database files routine Microsoft recommends: ALTER DATABASE … MODIFY FILE, SET OFFLINE, copy the MDF and LDF, SET ONLINE. Here’s the end state: Before You Start: Test Setup and Sample Database Test setup: SQL Server 2025 (17.0.1000.7) Standard Developer, default … Read more >>

How to Get Trigger Definition in SQL Server (OBJECT_DEFINITION, sp_helptext, sys.sql_modules)

Get trigger definition in SQL Server with OBJECT_DEFINITION, sp_helptext and sys.sql_modules

To get trigger definition in SQL Server, pass the trigger name to OBJECT_ID and wrap it in OBJECT_DEFINITION. You get the full CREATE TRIGGER text back as one value: sqlcmd printed: Two cases return NULL instead: DDL triggers and encrypted triggers. Sample Triggers for Every Example Tested on SQL Server 2025 (17.0.1000.7) Developer, sqlcmd in … Read more >>

PostgreSQL Multiple Joins: Join 3+ Tables Without Wrong Totals

PostgreSQL multiple joins query with order_items and payments run in PostgreSQL 18

If you’ve chained one more table onto a report and watched the totals double, the joins did exactly what you wrote. PostgreSQL multiple joins are JOIN … ON clauses stacked in one FROM, each joining the next table to the rows built so far: On PostgreSQL 18.6 (x86_64-windows, run from psql), that returns all five … Read more >>

SQL Server LEFT OUTER JOIN with WHERE clause

Sql server left outer join with where clause example

In this SQL Server tutorial, we will learn and understand how to use the SQL Server LEFT OUTER JOIN with the WHERE clause on tables by the query. Recently, I got a requirement to join multiple tables and even filter records based on the condition for the resultset in the SQL Server. So, I came … Read more >>

How to Change Column in MariaDB

Change Column in MariaDB

In this MariaDB tutorial, we will learn about the “MariaDB change column” and cover the following topics. How to change column data type in MariaDB MariaDB change column name How to change column order in MariaDB MariaDB change column size How to change column to not null in MariaDB How to change column to primary … Read more >>