This month's discount Comprehensive Database Performance Health Check · Testimonials
SQLAuthority with Pinal Dave
Home
  • Consulting
    • Health Check
  • Free Videos
  • All Articles
    • AI
    • SQL Performance
    • SQL Tips and Tricks
    • Interview Questions and Answers
    • SQL Puzzle
    • SQL Video
    • SQLAuthority News
    • Personal
  • Books
  • Consulting
SQL SERVER - INNER JOIN Returning More Records than Exists in Table

SQL SERVER – INNER JOIN Returning More Records than Exists in Table

February 9, 2012
Pinal Dave
SQL Puzzle
SQL Joins, SQL Scripts

Can an INNER JOIN returning more records than exist in a table be right? Jeff thought it was a bug. Our chat shows why it is possible and natural.

Read More
A winding garden path with two small houses along it, the nearer older house with a red front door.

Slowly Changing Dimension Quiz: Type 1 or Type 2?

February 1, 2012
Pinal Dave
SQL Puzzle
Business Intelligence, Data Warehousing, ETL

This Slowly Changing Dimension Quiz asks which type to use when a customer moves from Denver to Austin and sales before the move must stay under Denver. The answer is Type 2. A tested script runs Type 1 and Type 2 side by side, checks the move date and shows both reports.

Read More
A long glass greenhouse divided into sections, with only its red-framed middle door lit from inside.

Table Partitioning Quiz: When Does It Make a Query Faster?

January 31, 2012
Pinal Dave
SQL Puzzle
Execution Plan, SQL Index, SQL Performance, Table Partitioning

This Table Partitioning Quiz asks whether a query for last month runs faster once a sales table is partitioned by month. The answer is only when the filter lets SQL Server skip partitions. A tested script shows the partition count, the reads, and a partition SWITCH.

Read More
A row of closed cloth-bound journals on a shelf, one pale journal leaning forward with a red ribbon bookmark.

Query Store Quiz: Where Is Last Week’s Slow Query?

January 30, 2012
Pinal Dave
SQL Puzzle
Execution Plan, Query Store, SQL Performance, SQL Server 2022

This Query Store Quiz starts with a slow query from last week and a plan cache that restarted empty. The answer is Query Store, which keeps plans and run times inside the database. A tested T-SQL script finds the query, its plan and its duration.

Read More
A large open moving box on a wooden floor, only partly filled with folded linens, a red roll of tape beside it.

Reclaiming Space Quiz: Does Deleting Rows Shrink the File?

January 29, 2012
Pinal Dave
SQL Puzzle
Shrinking Database, SQL Data Storage, SQL Index, SQL Performance

This Reclaiming Space Quiz asks what happens to the data file after you delete half the rows of a big table. The file keeps its size, and the space stays free inside it. A tested script shows the numbers, then what a shrink costs.

Read More
A long wooden fence across a meadow with one red post marking the boundary between two fields.

Date Functions Quiz: What Does DATEDIFF Count?

January 28, 2012
Pinal Dave
SQL Puzzle
SQL Datatype, SQL DateTime, SQL Function

This Date Functions Quiz asks what DATEDIFF returns for two dates one day apart, when the unit is year. The answer is 1, because DATEDIFF counts boundaries crossed. A tested script shows an age calculation that works, plus DATETRUNC and EOMONTH.

Read More
A soap bubble floating above a small red bubble wand on a table by a window.

Common Table Expressions Quiz: Why Did My Second Query Fail?

January 27, 2012
Pinal Dave
SQL Puzzle
CTE, SQL Coding Standards, SQL Error Messages

This Common Table Expressions Quiz defines one CTE, reads it once, and then reads it again. The answer is error 208, because a CTE lives for one statement only. A tested script shows the error, the missing semicolon trap and the recursion limit.

Read More
Previous 1 … 9 10 11 12 13 14 15 … 22 Next
  • Books
  • Testimonials
  • Privacy Policy

© 2006 – 2026 All rights reserved. pinal @ SQLAuthority.com