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
MySQL - LEAST and GREATEST Comparison Operators

MySQL – LEAST and GREATEST Comparison Operators

April 19, 2016
Pinal Dave
SQL Tips and Tricks
MySQL, SQL Function, SQL Operator, SQL Scripts

Comparing values across many columns is a common chore. Here is how the MySQL LEAST and GREATEST comparison operators find the smallest and largest value.

Read More
Gouache painting: a wooden seesaw balanced on a log at the edge of a meadow, one end resting low and the other raised, with a small vermilion flag on the raised end

SQL SERVER – How to Flip Value of Bit Field in SQL Server? – Part 2

October 26, 2014
Pinal Dave
SQL Tips and Tricks
SQL Operator, SQL Scripts, SQL Server

Five expressions flip a bit value in SQL Server without a CASE statement. This post runs Vinod Kumar’s four methods and the readers’ answers on SQL Server 2025, shows what each one returns for 0, 1 and NULL, and explains how to flip value of bit field data stored in an integer column.

Read More
Gate latch with one toggle seated and the other lifted

AND Before OR: Operator Precedence in WHERE Clauses

July 20, 2014
Pinal Dave
SQL Tips and Tricks
SQL Coding Standards, SQL NULL, SQL Operator

A report showed closed orders even though the filter said open. The reason is how SQL Server groups AND and OR.

Read More
Two strips of matching leaf wallpaper side by side on a floor, one with a single red leaf that differs.

Finding Rows That Differ Between Two Tables With EXCEPT

June 23, 2014
Pinal Dave
SQL Tips and Tricks
SQL Distinct, SQL NULL, SQL Operator, SQL Server

Use EXCEPT to find differing rows in both directions, compare selected columns, handle NULLs, and distinguish changed keys from additions.

Read More
Eight ducks in a row on a pond, some upright and some tail-up, one flipping over with red feet showing

SELECT 7 & 7 or 7 ^ 7: Bitwise XOR, AND and OR on Integers

May 28, 2014
Pinal Dave
SQL Tips and Tricks
SQL Function, SQL Operator, SQL Server

Understand bitwise XOR, AND and OR in T-SQL, test and change integer flags, explain two sevens, and compare the newer bit functions.

Read More
Veneer packets beside one aligned marquetry band and an unused duplicate strip

Set Operator Rules: Column Names, Types and ORDER BY With UNION

September 18, 2013
Pinal Dave
SQL Tips and Tricks
SQL Operator, SQL Server, SQL Union clause

Why did my UNION change its headers, fail on a word, or sort wrong? Small examples show each rule and the error it produces.

Read More
Two rows of lettuces, a red marker stick standing in the one empty gap.

IS DISTINCT FROM in SQL Server 2022: NULL-Safe Comparisons

August 3, 2013
Pinal Dave
SQL Tips and Tricks
SQL NULL, SQL Operator, SQL Server, SQL Server 2022

Use IS DISTINCT FROM for NULL-safe comparisons in SQL Server 2022, understand older workarounds, and inspect index seeks before changing code.

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

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