HAVING Filters After GROUP BY?!

HAVING filters GROUPS, WHERE filters ROWS! HAVING runs after aggregation, WHERE runs before. This order matters and will break your logic!

#sql #sqltricks #having #where #groupby #sqlweird #sqlquiz #codingchallenge #sqlshorts #sqlwtf #aggregation #advancedsql

https://www.youtube.com/watch?v=OMjcmF4mw08

HAVING Filters After GROUP BY?! #codingchallenge

YouTube

Window ORDER BY NULLS FIRST - LAST?!

NULLS FIRST and NULLS LAST change window function results! The order of NULLs matters in window functions. This subtle difference will cause bugs!

#sql #sqltricks #windowfunctions #nullsfirst #nullslast #sqlweird #sqlquiz #codingchallenge #sqlshorts #sqlwtf #nullhandling #advancedsql

https://www.youtube.com/watch?v=TbQfBej6dis

Window ORDER BY NULLS FIRSTLAST?! #sqlshorts

YouTube

Decimal Precision Rounds Numbers?!

DECIMAL precision ROUNDS values! Cast 1.999 to DECIMAL(5,2) and it becomes 2.00. This silent rounding will cause calculation errors!

#sql #sqltricks #decimal #precision #rounding #sqlweird #sqlquiz #codingchallenge #sqlshorts #sqlwtf #datatypes #advancedsql

https://www.youtube.com/watch?v=wNyhCqAhlb8

Decimal Precision Rounds Numbers?! #codingchallenge

YouTube

TRIM with Different Characters?!

TRIM can remove ANY character! Not just spaces. LEADING, TRAILING, or BOTH. This flexible trimming will clean your data in unexpected ways!

#sql #sqltricks #trim #leading #trailing #sqlweird #sqlquiz #codingchallenge #sqlshorts #sqlwtf #stringfunctions #advancedsql

https://www.youtube.com/watch?v=MRgaM0p-Obg

TRIM with Different Characters?! #sqlquiz

YouTube

CHAR vs VARCHAR Padding?!

CHAR PADS with spaces! VARCHAR doesn't. LENGTH() returns different values for same string in CHAR vs VARCHAR. This padding will break comparisons!

#sql #sqltricks #char #varchar #padding #sqlweird #sqlquiz #codingchallenge #sqlshorts #sqlwtf #stringtypes #advancedsql

https://www.youtube.com/watch?v=0DNOIV-lXyo

CHAR vs VARCHAR Padding?! #padding

YouTube

Conditional Aggregation with CASE?!

CASE inside SUM creates conditional aggregation! You can sum only certain rows based on conditions. This conditional math will transform your data!

#sql #sqltricks #case #sum #conditionalaggregation #sqlweird #sqlquiz #codingchallenge #sqlshorts #sqlwtf #aggregation #advancedsql

https://www.youtube.com/watch?v=ncgl7_S0NvQ

Conditional Aggregation with CASE?! #sqlwtf

YouTube

Date Arithmetic with Leap Year?!

Leap years BREAK date math! February 28 + 1 day = February 29 in leap years, March 1 in non-leap years. This edge case will cause bugs!

#sql #sqltricks #datearithmetic #leapyear #dateadd #sqlweird #sqlquiz #codingchallenge #sqlshorts #sqlwtf #datefunctions #advancedsql

https://www.youtube.com/watch?v=LndKlugNMrE

Date Arithmetic with Leap Year?! #DATEADD

YouTube

LAG - LEAD Default Value Trap?!

LAG and LEAD have DEFAULT values! When there's no previous/next row, they return the default. This hidden parameter will surprise you!

#sql #sqltricks #lag #lead #defaultvalue #sqlweird #sqlquiz #codingchallenge #sqlshorts #sqlwtf #windowfunctions #advancedsql

https://www.youtube.com/watch?v=zGKaBIgNThU

LAGLEAD Default Value Trap?! #SQL

YouTube

NULLIF and COALESCE Chain?!

NULLIF and COALESCE can be CHAINED! NULLIF converts to NULL, COALESCE converts from NULL. This transformation chain will surprise you!

#sql #sqltricks #nullif #coalesce #functionchaining #sqlweird #sqlquiz #codingchallenge #sqlshorts #sqlwtf #nullhandling #advancedsql

https://www.youtube.com/watch?v=36UQvnnAo5s

NULLIF and COALESCE Chain?! #SQL

YouTube

Window PARTITION BY Changes Results?!

PARTITION BY creates separate windows! Each partition has its own running sum. This partitioning will change your aggregation results!

#sql #sqltricks #partitionby #windowfunctions #runningsum #sqlweird #sqlquiz #codingchallenge #sqlshorts #sqlwtf #advancedsql

https://www.youtube.com/watch?v=OdUmjf_ZbSU

Window PARTITION BY Changes Results?! #windowfunctions

YouTube