+ 2

SQL - diference about when to use UPPER and LOWER

what is the difference between lower and upper if this pattern is case insensitive

25th Feb 2024, 3:50 AM
Bruna Yukimy Hada
Bruna Yukimy Hada - avatar
7 Respuestas
+ 2
There is no difference for insensitive pattern. You can convert text to lower or to upper.
25th Feb 2024, 4:01 AM
JaScript
JaScript - avatar
+ 2
, SQL is not a case-sensitive language, so it doesn't matter if you use upper case or lower case for SQL commands. However, it's recommended to use a consistent capitalization style for better code readability and maintainability
26th Feb 2024, 5:12 AM
Ajit Kumar
Ajit Kumar - avatar
+ 2
SELECT UPPER(column_name) FROM table_name; SQL. SELECT UPPER(Name) AS UpperCaseName FROM Employees; SQL. SELECT LOWER(column_name) FROM table_name; SQL. SELECT LOWER(Name) AS LowerCaseName FROM Employees; SQL.
26th Feb 2024, 5:13 AM
Ajit Kumar
Ajit Kumar - avatar
+ 1
That's what I thought, but when I was doing this part of the course it seemed like there was a logic in when to use UPPER or LOWER, so much so that it marked it wrong twice, but if it was insensitive, couldn't I use any of the commands?
25th Feb 2024, 4:15 AM
Bruna Yukimy Hada
Bruna Yukimy Hada - avatar
+ 1
There is no difference between lower and upper it is an insensitive pattern to convert text.
25th Feb 2024, 4:29 AM
Sumit Jain
+ 1
Let's consider this scenario. Suppose you are searching a book from a library, and you already know the book name, such as "The Hunt for Red October", and the library does have this book. How would you make a search? 1. the hunt for red october 2. The Hunt for Red October 3. THE HUNT FOR RED OCTOBER 4. The Hunt For Red October I think most of the people will type 1 because we are lazy to type the entire name with the "correct capitalization." Because the library record the book name in the correct capitalization, if you type in option 1, there will be no result return to you and telling you the book does not exist, which is incorrect. By turning both the recorded book name in the system and your search text into the same capitalization, it will find a match, no matter how you search in the above 4 options.
25th Feb 2024, 4:44 AM
Wong Hei Ming
Wong Hei Ming - avatar
+ 1
I think you need to convert both sides which will be compared with each other. So you make it case insensitive. Which course or task you mean, from where?
25th Feb 2024, 7:52 AM
JaScript
JaScript - avatar