CHAR vs VARCHAR Comparison Returns ZERO Rows?!

STRING COMPARISON IS BROKEN! CHAR pads with spaces, VARCHAR doesn't! 'test' does NOT equal 'test '! Your WHERE clause returns ZERO rows! This breaks string matching! Watch!

#sql #sqlbug #char #varchar #trailingspaces #comparisonfails #sqlfails #productionbug #sqlshorts #sqlwtf #stringcomparison #padding

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

CHAR vs VARCHAR Comparison Returns ZERO Rows?! #trailingspaces

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

Technical people of the Interwebs, I have a question

If I were to create a table in a MySQL database with a field called emoji of type VarChar, what size would it need to hold a single emoji from all available (and future) emoji characters? I’m using utf8mb4 encoding.

#emoji #MySQL #utf8mb4 #VarChar

🌘 資料庫架構師:CHAR的有趣之處
➤ CHAR(n)數據類型的問題和替代方案
http://databasearchitects.blogspot.com/2015/01/fun-with-char.html
本文探討了SQL中CHAR(n)數據類型的特點和問題,並提出了使用VARCHAR(n)或TEXT代替CHAR(n)的建議。
+ 這篇文章很有趣,我從中學到了很多關於CHAR(n)的問題。
+ 我完全同意作者的觀點,CHAR(n)確實存在很多問題,使用VARCHAR(n)或TEXT更加合適。
#資料庫 #CHAR #VARCHAR #TEXT
Fun with CHAR

A blog by and for database architects.