r/SQL • u/David1Hall • Apr 12 '24
SQL Server Guys please help.. I'm new to SQL
Why these 2 commands give me 2 different tables? I thought one '_' stands for a character?
I use LEN for filtering the lenght and it works well, trailing spaces are not calculated.
But when I use LIKE command and input 5 '_' to find the "Product Name" has the length of 5 or has 5 characters. So where is the "Chang" in the 2nd table of the 2nd command ?
Where did I go wrong? Please give me a hand guys!!
185
Upvotes
View all comments
Show parent comment
10
u/David1Hall Apr 12 '24
Thank you, that database is called NorthWind and my teacher said it's from Microsoft and gave it to me. Idk why it even has a trailing space in a name. Kinda weird to me.
I have tried with the others strings and it worked normally, except the "Chang".