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 query with expected results.

SQL SERVER – Relating Unrelated Tables – A Question from Reader

December 10, 2018
Pinal Dave
SQL Puzzle
SQL Scripts, SQL Server

A reader asked how to relate two unrelated tables, Table_A and Table_B, and show them in one output. Here is my answer to this unusual question.

Read More
Result column flipping between 1 and 0.

Puzzle – Datatime to DateTime2 Conversation in SQL Server 2017

November 16, 2018
Pinal Dave
SQL Puzzle
SQL DateTime, SQL Scripts, SQL Server, SQL Server 2017

At PASS, SQL Server expert Christopher Savage showed me a puzzle on DateTime to DateTime2 conversion in SQL Server 2017. I still have no answer, so can you solve it?

Read More
Execution plan of a query with a single row and single table.

SQL SERVER – Puzzle – Why Such a Complicated Execution Plan for a Single Row, Single Table Query?

July 13, 2018
Pinal Dave
SQL Puzzle
Execution Plan, SQL Scripts, SQL Server

A simple puzzle: why does SQL Server show such a complicated execution plan for a single row, single table query on WideWorldImporters? Try to solve it.

Read More
Year 1904 Answer.

SQL SERVER – Puzzle – How Does YEAR Function Work?

March 13, 2018
Pinal Dave
SQL Puzzle
SQL DateTime, SQL Function, SQL Scripts, SQL Server

SELECT YEAR(35000/20) returns 1904, which looks strange. This puzzle shows how the YEAR function treats a plain integer. Can you explain the result?

Read More
unexpected results

SQL SERVER – Puzzle – SQL Server Stored Procedure and Unexpected Results

March 6, 2018
Pinal Dave
SQL Puzzle
SQL Scripts, SQL Server, SQL Stored Procedure

The matter of the fact when I discovered this puzzle related to the stored procedure and unexpected results, I was very much surprised as well. 

Read More
Incorrect alias in INSERT statement.

SQL SERVER – Puzzle – How Does Table Qualifier Work in INSERT Statement?

March 2, 2018
Pinal Dave
SQL Puzzle
SQL Scripts, SQL Server, SQL Table Operation

You can use a table alias in SELECT just fine, but how does a Table Qualifier work in the column list of an INSERT statement? Try this short puzzle.

Read More
Four bead strands show distinct leading beads in widened receiving recesses.

SQL SERVER – Puzzle – Get the First Name From Full Name Without CHARINDEX

February 21, 2018
Pinal Dave
SQL Puzzle
SQL Function, SQL Scripts, SQL Server, SQL String

This First Name From Full Name puzzle excludes CHARINDEX and SUBSTRING. It came from a customer query during a performance health check.

Read More
Previous 1 2 3 4 5 6 … 21 Next
  • Books
  • Testimonials
  • Privacy Policy

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